Skip to content

Commit

Permalink
tools: fix broken failure-detection when using individual dmesg logs
Browse files Browse the repository at this point in the history
This patch fixes the issue where the exit code of the test was not
properly used or reported after creating the dmesg log. By capturing
the exit code of the test and then using it as the exit status of
the entire command sequence, the script ensures that any failure in
the test is correctly propagated and reported.

Error report:

    Testcase                                           Result     Exit Value
    --------                                           ------     ----------
    cn_pec_sh__with_dmesg_entry                        PASS       0
    kmsg01__with_dmesg_entry                           PASS       0
    rtc02__with_dmesg_entry                            PASS       0
    umip_basic_test__with_dmesg_entry                  PASS       0
    abs01__with_dmesg_entry                            PASS       0
    atof01__with_dmesg_entry                           PASS       0
    float_bessel__with_dmesg_entry                     PASS       0
    float_exp_log__with_dmesg_entry                    PASS       0
    ...
    proc_sched_rt01__with_dmesg_entry                  PASS       0
    ...

    -----------------------------------------------
    Total Tests: 1590
    Total Skipped Tests: 0
    Total Failures: 0
    Kernel Version: 5.14.0-427.el9.x86_64
    Machine Architecture: x86_64

But proc_sched_rt01 indeed get failed in the test:

     <<<test_start>>>
     tag=proc_sched_rt01__with_dmesg_entry stime=1709667487
     cmdline="dmesg -c 1>/dev/null 2>&1; proc_sched_rt01; dmesg >
     	/mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-51310-02:08:39PM/proc_sched_rt01.dmesg.log"
     contacts=""
     analysis=exit
     <<<test_output>>>
     tst_kconfig.c:87: TINFO: Parsing kernel config '/lib/modules/5.14.0-427.el9.x86_64/config'
     tst_test.c:1709: TINFO: LTP version: 20240129
     tst_test.c:1593: TINFO: Timeout per run is 0h 01m 00s
     proc_sched_rt01.c:45: TFAIL: Expect: timeslice_ms > 0 after reset to default
     proc_sched_rt01.c:51: TPASS: echo 0 > /proc/sys/kernel/sched_rt_period_us : EINVAL (22)
     proc_sched_rt01.c:53: TFAIL: echo -1 > /proc/sys/kernel/sched_rt_period_us invalid retval 2: SUCCESS (0)
     proc_sched_rt01.c:59: TPASS: echo -2 > /proc/sys/kernel/sched_rt_runtime_us : EINVAL (22)
     proc_sched_rt01.c:72: TFAIL: echo rt_period_us+1 > /proc/sys/kernel/sched_rt_runtime_us invalid retval 1: SUCCESS (0)

     HINT: You _MAY_ be missing kernel fixes:

     https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c1fc6484e1fb
     https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=079be8fc6309

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

Signed-off-by: Bruno Goncalves <[email protected]>
CC: Shizhao Chen <[email protected]>
Cc: Ping Fang <[email protected]>
Reviewed-by: Li Wang <[email protected]>
Reviewed-by: Petr Vorel <[email protected]>
  • Loading branch information
wangli5665 committed Mar 15, 2024
1 parent 02109a3 commit 71f75ca
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/create_dmesg_entries_for_each_test.awk
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ NF && ! /^#/ {
s = s " " $i
}
sub(/[;]+$/, "", s)
s = s "; EXIT_CODE=$?"
s = s "; dmesg > " DMESG_DIR "/" $1 ".dmesg.log"
s = s "; exit $EXIT_CODE"
print s
}

0 comments on commit 71f75ca

Please sign in to comment.