Bug 11804 - [ltp测试]commands:logrotate_sh用例执行fail
Summary: [ltp测试]commands:logrotate_sh用例执行fail
Status: RESOLVED WONTFIX
Alias: None
Product: Antest
Classification: Infrastructures
Component: 测试用例 (show other bugs) 测试用例
Version: unspecified
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: yunmeng365524
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-11 17:27 UTC by Banana
Modified: 2024-11-21 16:05 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Banana alibaba_cloud_group 2024-11-11 17:27:14 UTC
[问题描述]:
ltp测试commands:logrotate_sh用例执行fail,在执行largelogfile用例未轮询生成压缩包文件

手动验证情况:
1、手动设置相同测试conf可以生成.1文件,也并非压缩包
2、配置文件增加compress参数,手动验证可正常生成压缩文件

conf:
[root@4f7Lab15 ltp]# cat /root/logrotate.conf
/var/log/tst_largelogfile {
        compress
        rotate 5
        size=2k
}

<<<test_start>>>
tag=logrotate_sh stime=1731310603
cmdline="export TCdat=$LTPROOT/testcases/bin; logrotate_tests.sh"
contacts=""
analysis=exit
<<<test_output>>>
incrementing stop
logrotate_tests 1 TINFO: Running: logrotate_tests.sh
logrotate_tests 1 TINFO: Tested kernel: Linux 4f7Lab15 6.6.25-2.2_rc1.an23.aarch64 #1 SMP PREEMPT_DYNAMIC Thu Oct 31 21:22:28 CST 2024 aarch64 aarch64 aarch64 GNU/Linux
logrotate_tests 1 TINFO: Using /tmp/ltp-rBMn4CobhE/LTP_logrotate_tests.Vflv4LHRqe as tmpdir (tmpfs filesystem)
logrotate_tests 1 TINFO: timeout per run is 0h 5m 0s
logrotate_tests 1 TPASS: grep -q reading config file tst_logrotate.conf tst_logrotate.out passed as expected
logrotate_tests 1 TPASS: grep -q forced from command line (5 rotations) tst_logrotate.out passed as expected
logrotate_tests 1 TPASS: grep -E -q compressing new|log with tst_logrotate.out passed as expected
logrotate_tests 1 TPASS: [ -f /var/log/tst_logfile.1.gz ] passed as expected
logrotate_tests 2 TINFO: sleep 1 min to wait for rotating logs
logrotate_tests 2 TFAIL: [ -f /var/log/tst_largelogfile.1.gz ] failed unexpectedly
logrotate_tests 2 TFAIL: Failed to create a compressed file

Summary:
passed   4
failed   2
broken   0
skipped  0
warnings 0
<<<execution_status>>>
initiation_status="ok"
duration=65 termination_type=exited termination_id=1 corefile=no
cutime=8 cstime=8
<<<test_end>>>

[测试核心源码]
测试conf:
/var/log/tst_largelogfile {
    $PERMISSION
    rotate 5
    size=2k
 }

生成测试log
cat >/var/log/tst_largelogfile <<-EOF
        # This is a psuedo-log file. This file will grow to a 2k size before
        # getting rotated.
        EOF

测试命令
 (crontab -l 2>/dev/null; echo \
      "* * * * * $(command -v logrotate) $(pwd)/tst_largelog.conf") | crontab -


[环境信息]:
物理机

[内核信息]:
6.6.25-2.2_rc1.an23.aarch64

[操作系统信息]:
[root@localhost ~]# cat /etc/os-release
NAME="Anolis OS"
VERSION="23.1"
ID="anolis"
VERSION_ID="23.1"
PLATFORM_ID="platform:an23"
PRETTY_NAME="Anolis OS 23.1"
ANSI_COLOR="0;31"
HOME_URL="https://openanolis.cn/"
BUG_REPORT_URL="https://bugzilla.openanolis.cn/"

[期望结果]:
执行pass

[实际结果]:
fail

[复现步骤]:
1、安装ltp测试套
2、执行./runltp -f commands -s logrotate_sh
Comment 1 anolislw alibaba_cloud_group 2024-11-15 15:15:25 UTC
在同内核 x86的物理机环境下,该case也存在问题
-----------------------
Running tests.......
<<<test_start>>>
tag=logrotate_sh stime=1731654582
cmdline="export TCdat=$LTPROOT/testcases/bin; logrotate_tests.sh"
contacts=""
analysis=exit
<<<test_output>>>
incrementing stop
logrotate_tests 1 TINFO: Running: logrotate_tests.sh
logrotate_tests 1 TINFO: Tested kernel: Linux 5f9Lab15 6.6.25-2.2_rc1.an23.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Oct 31 21:26:10 CST 2024 x86_64 x86_64 x86_64 GNU/Linux
logrotate_tests 1 TINFO: Using /tmp/ltp-Py71A8IgFt/LTP_logrotate_tests.uydw97ngw4 as tmpdir (tmpfs filesystem)
logrotate_tests 1 TINFO: timeout per run is 0h 5m 0s
logrotate_tests 1 TPASS: grep -q reading config file tst_logrotate.conf tst_logrotate.out passed as expected
logrotate_tests 1 TPASS: grep -q forced from command line (5 rotations) tst_logrotate.out passed as expected
logrotate_tests 1 TPASS: grep -E -q compressing new|log with tst_logrotate.out passed as expected
logrotate_tests 1 TPASS: [ -f /var/log/tst_logfile.1.gz ] passed as expected
logrotate_tests 2 TINFO: sleep 1 min to wait for rotating logs
logrotate_tests 2 TFAIL: [ -f /var/log/tst_largelogfile.1.gz ] failed unexpectedly
logrotate_tests 2 TFAIL: Failed to create a compressed file

Summary:
passed   4
failed   2
broken   0
skipped  0
warnings 0
<<<execution_status>>>
initiation_status="ok"
duration=65 termination_type=exited termination_id=1 corefile=no
cutime=5 cstime=14
<<<test_end>>>
INFO: ltp-pan reported some tests FAIL
LTP Version: 20240930-79-gec4161186

       ###############################################################

            Done executing testcases.
            LTP Version:  20240930-79-gec4161186
       ###############################################################

-------------------------------------------
INFO: runltp script is deprecated, try kirk
https://github.com/linux-test-project/kirk
-------------------------------------------
[root@5f9Lab15 ltp]# uname -r
6.6.25-2.2_rc1.an23.x86_64
[root@5f9Lab15 ltp]# ./runltp  -f commands -s logrotate_s
Comment 2 lv0322 alibaba_cloud_group 2024-11-20 11:38:41 UTC
用例在生成largelogfile的压缩文件时使用的是crontab定时任务触发执行操作,这里没有生成文件是因为crontab没有成功触发执行,因此没有压缩包文件。不使用crontab手动执行logrotate是可以成功生成压缩包的,logrotate命令本身没有问题。查看crontab的执行日志发现存在报错FAILED to authorize user with PAM (Critical error - immediate abort),这里存在一些PAM鉴权问题导致crontab任务没有正常执行。综上,logrotate命令是没有问题的。
Comment 3 yunmeng365524 2024-11-21 16:04:55 UTC
OK,用例问题,先记录基线