linux-test-project / ltp

Linux Test Project (mailing list: https://lists.linux.it/listinfo/ltp)
https://linux-test-project.readthedocs.io/
GNU General Public License v2.0
2.28k stars 999 forks source link

cpuset_regression_test 1 TBROK: Test didn't report any results #1033

Closed Sowmya-Indranna closed 1 year ago

Sowmya-Indranna commented 1 year ago

cpuset_regression with cgroup version 1 is resulting in TBROKE: Test didn't report any results

mount | grep '^cgroup' | awk '{print $1}' | uniq cgroup

testcase: ./runltp -f controllers -s cpuset_regression_test ==> when run in cgroup version1 env

Error: cpuset_regression_test 1 TBROK: Test didn't report any results

Summary: passed 0 failed 0 broken 1 skipped 0 warnings 0 <<>> initiation_status="ok" duration=0 termination_type=exited termination_id=2 corefile=no cutime=20 cstime=4 <<>> INFO: ltp-pan reported some tests FAIL LTP Version: 20230127

On further debugging the test script - cpuset_regression_test.sh

cpuset_regression_test.sh - calling tst_run in tst_test.sh

_tst_run_tests() { local _tst_data="$1" local _tst_i

    TST_DO_CLEANUP=1
     for _tst_i in $(seq ${TST_CNT:-1}); do
            **if command -v ${TST_TESTFUNC}1 > /dev/null 2>&1; then**
                    _tst_run_test "$TST_TESTFUNC$_tst_i" $_tst_i "$_tst_data"
            else
                    _tst_run_test "$TST_TESTFUNC" $_tst_i "$_tst_data"
            fi

here TST_TESTFUNC=test declared in cpuset_regression_test.sh. So here, command -v ${TST_TESTFUNC}1 - is checking for command -v test1 where in its looking for test1() function, which is not found in cpuset_regression_test where in the function named as test()

test() { local cpu_exclusive_tmp cpus_value

    ROD_SILENT mkdir ${root_cpuset_dir}/testdir

    # Creat an exclusive cpuset.
    echo 1 > ${root_cpuset_dir}/testdir/${cpu_exclusive}
    [ $? -ne 0 ] && tst_brk TFAIL "'echo 1 > ${root_cpuset_dir}/testdir/${cpu_exclusive}' failed"

changing test() to test1() will result in calling the function and test passes

test1() { local cpu_exclusive_tmp cpus_value

    ROD_SILENT mkdir ${root_cpuset_dir}/testdir

    # Creat an exclusive cpuset.
    echo 1 > ${root_cpuset_dir}/testdir/${cpu_exclusive}
    [ $? -ne 0 ] && tst_brk TFAIL "'echo 1 > ${root_cpuset_dir}/testdir/${cpu_exclusive}' failed"

After making the changes and running the testcase:

cpuset_regression_test 1 TINFO: test starts with cgroup version 1 ./ltp/test-819076/cpuset.cpus ./ltp/drain/cpuset.cpus ./ltp/cpuset.cpus cpuset_regression_test 1 TPASS: Bug is not reproducible

Summary: passed 1 failed 0 broken 0 skipped 0 warnings 0 <<>> initiation_status="ok" duration=0 termination_type=exited termination_id=0 corefile=no cutime=16 cstime=8 <<>> INFO: ltp-pan reported all tests PASS LTP Version: 20230127

Is this fix correct ?

metan-ucw commented 1 year ago

Does not sound right, the condition in tst_test.sh is correct, it checks if it should call the $TST_TESTFUNC N times or if it should call ${TST_TESTFUNC}1 ${TST_TESTFUNC}2 .... My guess is that the function with name test is redefined somewhere, can you try renaming it to do_test instead?

Sowmya-Indranna commented 1 year ago

Not changing anything in tst_test.sh, test() is in cpuset_regression_test.sh

renaming the declared value of

TST_TESTFUNC=do_test

TST_SETUP=setup TST_CLEANUP=cleanup TST_TESTFUNC=do_test TST_NEEDS_ROOT=1 TST_NEEDS_TMPDIR=1 TST_MIN_KVER="3.18"

and running the test - ./runltp -f controllers -s cpuset_regression_test

/opt/ltp/testcases/bin/tst_test.sh: line 841: do_test: command not found cpuset_regression_test 1 TBROK: Test didn't report any results

Summary: passed 0 failed 0 broken 1 skipped 0 warnings 0 <<>> initiation_status="ok" duration=1 termination_type=exited termination_id=2 corefile=no cutime=17 cstime=6 <<>> INFO: ltp-pan reported some tests FAIL LTP Version: 20230127

Now renaming the func also to do_test() changing the test() name also to do_test() in cpuset_regression_test.sh

do_test() { local cpu_exclusive_tmp cpus_value

     ROD_SILENT mkdir ${root_cpuset_dir}/testdir

     # Creat an exclusive cpuset.
     echo 1 > ${root_cpuset_dir}/testdir/${cpu_exclusive}
     [ $? -ne 0 ] && tst_brk TFAIL "'echo 1 > ${root_cpuset_dir}/testdir/${cpu_exclusive}' failed"

     cpu_exclusive_tmp=$(cat ${root_cpuset_dir}/testdir/${cpu_exclusive})
     if [ "${cpu_exclusive_tmp}" != "1" ]; then
            tst_brk TFAIL "${cpu_exclusive} is '${cpu_exclusive_tmp}', expected '1'"
     fi

     # This may trigger the kernel crash
     echo 0 > ${root_cpuset_dir}/testdir/${cpus}
     [ $? -ne 0 ] && tst_brk TFAIL "'echo 0 > ${root_cpuset_dir}/testdir/${cpus}' failed"

     cpus_value=$(cat ${root_cpuset_dir}/testdir/${cpus})
     if [ "${cpus_value}" != "0" ]; then
            tst_brk TFAIL "${cpus} is '${cpus_value}', expected '0'"
     fi

     tst_res TPASS "Bug is not reproducible"

}

./runltp -f controllers -s cpuset_regression_test

result: ./ltp/test-1000644/cpuset.cpus ./ltp/drain/cpuset.cpus ./ltp/cpuset.cpus cpuset_regression_test 1 TPASS: Bug is not reproducible

Summary: passed 1 failed 0 broken 0 skipped 0 warnings 0 <<>> initiation_status="ok" duration=0 termination_type=exited termination_id=0 corefile=no cutime=20 cstime=4 <<>> INFO: ltp-pan reported all tests PASS LTP Version: 20230127

metan-ucw commented 1 year ago

Of course you have to change the function name in both places. So it really looks like the function name has to be changed. Can you send a patch to the mailing list?

Sowmya-Indranna commented 1 year ago

Sure, will send in soon