diff mbox series

[net,1/4] selftests/tc-testing: Fix Error: Specified qdisc kind is unknown.

Message ID 20230612075712.2861848-2-vladbu@nvidia.com (mailing list archive)
State Accepted
Commit aef6e908b54200d04f2d77dab31509fcff2e60ae
Headers show
Series Fix small bugs and annoyances in tc-testing | expand

Commit Message

Vlad Buslov June 12, 2023, 7:57 a.m. UTC
All TEQL tests assume that sch_teql module is loaded. Load module in tdc.sh
before running qdisc tests.

Fixes following example error when running tests via tdc.sh for all TEQL
tests:

 # $ sudo ./tdc.py -d eth2 -e 84a0
 #  -- ns/SubPlugin.__init__
 # Test 84a0: Create TEQL with default setting
 # exit: 2
 # exit: 0
 # Error: Specified qdisc kind is unknown.
 #
 # -----> teardown stage *** Could not execute: "$TC qdisc del dev $DUMMY handle 1: root"
 #
 # -----> teardown stage *** Error message: "Error: Invalid handle.
 # "
 # returncode 2; expected [0]
 #
 # -----> teardown stage *** Aborting test run.
 #
 # <_io.BufferedReader name=3> *** stdout ***
 #
 # <_io.BufferedReader name=5> *** stderr ***
 # "-----> teardown stage" did not complete successfully
 # Exception <class '__main__.PluginMgrTestFail'> ('teardown', 'Error: Specified qdisc kind is unknown.\n', '"-----> teardown stage" did not complete successfully') (caught in test_runner, running test 2 84a0 Create TEQL with default setting stage teardown)
 # ---------------
 # traceback
 #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 495, in test_runner
 #     res = run_one_test(pm, args, index, tidx)
 #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 434, in run_one_test
 #     prepare_env(args, pm, 'teardown', '-----> teardown stage', tidx['teardown'], procout)
 #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 245, in prepare_env
 #     raise PluginMgrTestFail(
 # ---------------
 # accumulated output for this test:
 # Error: Specified qdisc kind is unknown.
 #
 # ---------------
 #
 # All test results:
 #
 # 1..1
 # ok 1 84a0 - Create TEQL with default setting # skipped - "-----> teardown stage" did not complete successfully

Fixes: cc62fbe114c9 ("selftests/tc-testing: add selftests for teql qdisc")
Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
---
 tools/testing/selftests/tc-testing/tdc.sh | 1 +
 1 file changed, 1 insertion(+)

Comments

shaozhengchao June 12, 2023, 10:35 a.m. UTC | #1
On 2023/6/12 15:57, Vlad Buslov wrote:
> All TEQL tests assume that sch_teql module is loaded. Load module in tdc.sh
> before running qdisc tests.
> 
> Fixes following example error when running tests via tdc.sh for all TEQL
> tests:
> 
>   # $ sudo ./tdc.py -d eth2 -e 84a0
>   #  -- ns/SubPlugin.__init__
>   # Test 84a0: Create TEQL with default setting
>   # exit: 2
>   # exit: 0
>   # Error: Specified qdisc kind is unknown.
>   #
>   # -----> teardown stage *** Could not execute: "$TC qdisc del dev $DUMMY handle 1: root"
>   #
>   # -----> teardown stage *** Error message: "Error: Invalid handle.
>   # "
>   # returncode 2; expected [0]
>   #
>   # -----> teardown stage *** Aborting test run.
>   #
>   # <_io.BufferedReader name=3> *** stdout ***
>   #
>   # <_io.BufferedReader name=5> *** stderr ***
>   # "-----> teardown stage" did not complete successfully
>   # Exception <class '__main__.PluginMgrTestFail'> ('teardown', 'Error: Specified qdisc kind is unknown.\n', '"-----> teardown stage" did not complete successfully') (caught in test_runner, running test 2 84a0 Create TEQL with default setting stage teardown)
>   # ---------------
>   # traceback
>   #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 495, in test_runner
>   #     res = run_one_test(pm, args, index, tidx)
>   #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 434, in run_one_test
>   #     prepare_env(args, pm, 'teardown', '-----> teardown stage', tidx['teardown'], procout)
>   #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 245, in prepare_env
>   #     raise PluginMgrTestFail(
>   # ---------------
>   # accumulated output for this test:
>   # Error: Specified qdisc kind is unknown.
>   #
>   # ---------------
>   #
>   # All test results:
>   #
>   # 1..1
>   # ok 1 84a0 - Create TEQL with default setting # skipped - "-----> teardown stage" did not complete successfully
> 
> Fixes: cc62fbe114c9 ("selftests/tc-testing: add selftests for teql qdisc")
> Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
> ---
>   tools/testing/selftests/tc-testing/tdc.sh | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/tc-testing/tdc.sh b/tools/testing/selftests/tc-testing/tdc.sh
> index afb0cd86fa3d..eb357bd7923c 100755
> --- a/tools/testing/selftests/tc-testing/tdc.sh
> +++ b/tools/testing/selftests/tc-testing/tdc.sh
> @@ -2,5 +2,6 @@
>   # SPDX-License-Identifier: GPL-2.0
>   
>   modprobe netdevsim
> +modprobe sch_teql
I think not only the sch_teql module needs to be imported, but all test
modules need to be imported before testing. Modifying the config file
looks more appropriate.
>   ./tdc.py -c actions --nobuildebpf
>   ./tdc.py -c qdisc
Vlad Buslov June 12, 2023, 10:37 a.m. UTC | #2
On Mon 12 Jun 2023 at 18:35, shaozhengchao <shaozhengchao@huawei.com> wrote:
> On 2023/6/12 15:57, Vlad Buslov wrote:
>> All TEQL tests assume that sch_teql module is loaded. Load module in tdc.sh
>> before running qdisc tests.
>> Fixes following example error when running tests via tdc.sh for all TEQL
>> tests:
>>   # $ sudo ./tdc.py -d eth2 -e 84a0
>>   #  -- ns/SubPlugin.__init__
>>   # Test 84a0: Create TEQL with default setting
>>   # exit: 2
>>   # exit: 0
>>   # Error: Specified qdisc kind is unknown.
>>   #
>>   # -----> teardown stage *** Could not execute: "$TC qdisc del dev $DUMMY handle 1: root"
>>   #
>>   # -----> teardown stage *** Error message: "Error: Invalid handle.
>>   # "
>>   # returncode 2; expected [0]
>>   #
>>   # -----> teardown stage *** Aborting test run.
>>   #
>>   # <_io.BufferedReader name=3> *** stdout ***
>>   #
>>   # <_io.BufferedReader name=5> *** stderr ***
>>   # "-----> teardown stage" did not complete successfully
>>   # Exception <class '__main__.PluginMgrTestFail'> ('teardown', 'Error: Specified qdisc kind is unknown.\n', '"-----> teardown stage" did not complete successfully') (caught in test_runner, running test 2 84a0 Create TEQL with default setting stage teardown)
>>   # ---------------
>>   # traceback
>>   #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 495, in test_runner
>>   #     res = run_one_test(pm, args, index, tidx)
>>   #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 434, in run_one_test
>>   #     prepare_env(args, pm, 'teardown', '-----> teardown stage', tidx['teardown'], procout)
>>   #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 245, in prepare_env
>>   #     raise PluginMgrTestFail(
>>   # ---------------
>>   # accumulated output for this test:
>>   # Error: Specified qdisc kind is unknown.
>>   #
>>   # ---------------
>>   #
>>   # All test results:
>>   #
>>   # 1..1
>>   # ok 1 84a0 - Create TEQL with default setting # skipped - "-----> teardown stage" did not complete successfully
>> Fixes: cc62fbe114c9 ("selftests/tc-testing: add selftests for teql qdisc")
>> Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
>> ---
>>   tools/testing/selftests/tc-testing/tdc.sh | 1 +
>>   1 file changed, 1 insertion(+)
>> diff --git a/tools/testing/selftests/tc-testing/tdc.sh
>> b/tools/testing/selftests/tc-testing/tdc.sh
>> index afb0cd86fa3d..eb357bd7923c 100755
>> --- a/tools/testing/selftests/tc-testing/tdc.sh
>> +++ b/tools/testing/selftests/tc-testing/tdc.sh
>> @@ -2,5 +2,6 @@
>>   # SPDX-License-Identifier: GPL-2.0
>>     modprobe netdevsim
>> +modprobe sch_teql
> I think not only the sch_teql module needs to be imported, but all test
> modules need to be imported before testing. Modifying the config file
> looks more appropriate.

All other modules are automatically loaded when first
qdisc/action/classifier is instantiated via their respective APIs. The
problem with two modules that are manually inserted here is that
netdevsim-related tests expect /sys/bus/netdevsim/new_device to exist
(which only exists if netdevsim module has been manually loaded) and
specific command format "$TC qdisc add dev $DUMMY handle 1: root teql0"
failing since 'telq0', again, only exists when sch_telq is loaded.

Overall, I added modprobe here not for theoretical correctness sake but
because running tdc.sh on cold system causes error included in the
commit message for me. I don't get any other errors related to necessary
kernel modules not being loaded for any other kinds of tc tests.

>>   ./tdc.py -c actions --nobuildebpf
>>   ./tdc.py -c qdisc
shaozhengchao June 12, 2023, 10:51 a.m. UTC | #3
On 2023/6/12 18:37, Vlad Buslov wrote:
> On Mon 12 Jun 2023 at 18:35, shaozhengchao <shaozhengchao@huawei.com> wrote:
>> On 2023/6/12 15:57, Vlad Buslov wrote:
>>> All TEQL tests assume that sch_teql module is loaded. Load module in tdc.sh
>>> before running qdisc tests.
>>> Fixes following example error when running tests via tdc.sh for all TEQL
>>> tests:
>>>    # $ sudo ./tdc.py -d eth2 -e 84a0
>>>    #  -- ns/SubPlugin.__init__
>>>    # Test 84a0: Create TEQL with default setting
>>>    # exit: 2
>>>    # exit: 0
>>>    # Error: Specified qdisc kind is unknown.
>>>    #
>>>    # -----> teardown stage *** Could not execute: "$TC qdisc del dev $DUMMY handle 1: root"
>>>    #
>>>    # -----> teardown stage *** Error message: "Error: Invalid handle.
>>>    # "
>>>    # returncode 2; expected [0]
>>>    #
>>>    # -----> teardown stage *** Aborting test run.
>>>    #
>>>    # <_io.BufferedReader name=3> *** stdout ***
>>>    #
>>>    # <_io.BufferedReader name=5> *** stderr ***
>>>    # "-----> teardown stage" did not complete successfully
>>>    # Exception <class '__main__.PluginMgrTestFail'> ('teardown', 'Error: Specified qdisc kind is unknown.\n', '"-----> teardown stage" did not complete successfully') (caught in test_runner, running test 2 84a0 Create TEQL with default setting stage teardown)
>>>    # ---------------
>>>    # traceback
>>>    #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 495, in test_runner
>>>    #     res = run_one_test(pm, args, index, tidx)
>>>    #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 434, in run_one_test
>>>    #     prepare_env(args, pm, 'teardown', '-----> teardown stage', tidx['teardown'], procout)
>>>    #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 245, in prepare_env
>>>    #     raise PluginMgrTestFail(
>>>    # ---------------
>>>    # accumulated output for this test:
>>>    # Error: Specified qdisc kind is unknown.
>>>    #
>>>    # ---------------
>>>    #
>>>    # All test results:
>>>    #
>>>    # 1..1
>>>    # ok 1 84a0 - Create TEQL with default setting # skipped - "-----> teardown stage" did not complete successfully
>>> Fixes: cc62fbe114c9 ("selftests/tc-testing: add selftests for teql qdisc")
>>> Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
>>> ---
>>>    tools/testing/selftests/tc-testing/tdc.sh | 1 +
>>>    1 file changed, 1 insertion(+)
>>> diff --git a/tools/testing/selftests/tc-testing/tdc.sh
>>> b/tools/testing/selftests/tc-testing/tdc.sh
>>> index afb0cd86fa3d..eb357bd7923c 100755
>>> --- a/tools/testing/selftests/tc-testing/tdc.sh
>>> +++ b/tools/testing/selftests/tc-testing/tdc.sh
>>> @@ -2,5 +2,6 @@
>>>    # SPDX-License-Identifier: GPL-2.0
>>>      modprobe netdevsim
>>> +modprobe sch_teql
>> I think not only the sch_teql module needs to be imported, but all test
>> modules need to be imported before testing. Modifying the config file
>> looks more appropriate.
> 
> All other modules are automatically loaded when first
> qdisc/action/classifier is instantiated via their respective APIs. The
> problem with two modules that are manually inserted here is that
> netdevsim-related tests expect /sys/bus/netdevsim/new_device to exist
> (which only exists if netdevsim module has been manually loaded) and
> specific command format "$TC qdisc add dev $DUMMY handle 1: root teql0"
> failing since 'telq0', again, only exists when sch_telq is loaded.
> 
> Overall, I added modprobe here not for theoretical correctness sake but
> because running tdc.sh on cold system causes error included in the
> commit message for me. I don't get any other errors related to necessary
> kernel modules not being loaded for any other kinds of tc tests.
> 
Fine, it looks good to me. Thank you.

Zhengchao Shao

>>>    ./tdc.py -c actions --nobuildebpf
>>>    ./tdc.py -c qdisc
>
Victor Nogueira June 12, 2023, 1:22 p.m. UTC | #4
> On Jun 12, 2023, at 04:57, Vlad Buslov <vladbu@nvidia.com> wrote:
> 
> All TEQL tests assume that sch_teql module is loaded. Load module in tdc.sh
> before running qdisc tests.
> 
> Fixes following example error when running tests via tdc.sh for all TEQL
> tests:
> 
> # $ sudo ./tdc.py -d eth2 -e 84a0
> #  -- ns/SubPlugin.__init__
> # Test 84a0: Create TEQL with default setting
> # exit: 2
> # exit: 0
> # Error: Specified qdisc kind is unknown.
> #
> # -----> teardown stage *** Could not execute: "$TC qdisc del dev $DUMMY handle 1: root"
> #
> # -----> teardown stage *** Error message: "Error: Invalid handle.
> # "
> # returncode 2; expected [0]
> #
> # -----> teardown stage *** Aborting test run.
> #
> # <_io.BufferedReader name=3> *** stdout ***
> #
> # <_io.BufferedReader name=5> *** stderr ***
> # "-----> teardown stage" did not complete successfully
> # Exception <class '__main__.PluginMgrTestFail'> ('teardown', 'Error: Specified qdisc kind is unknown.\n', '"-----> teardown stage" did not complete successfully') (caught in test_runner, running test 2 84a0 Create TEQL with default setting stage teardown)
> # ---------------
> # traceback
> #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 495, in test_runner
> #     res = run_one_test(pm, args, index, tidx)
> #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 434, in run_one_test
> #     prepare_env(args, pm, 'teardown', '-----> teardown stage', tidx['teardown'], procout)
> #   File "/images/src/linux/tools/testing/selftests/tc-testing/./tdc.py", line 245, in prepare_env
> #     raise PluginMgrTestFail(
> # ---------------
> # accumulated output for this test:
> # Error: Specified qdisc kind is unknown.
> #
> # ---------------
> #
> # All test results:
> #
> # 1..1
> # ok 1 84a0 - Create TEQL with default setting # skipped - "-----> teardown stage" did not complete successfully
> 
> Fixes: cc62fbe114c9 ("selftests/tc-testing: add selftests for teql qdisc")
> Signed-off-by: Vlad Buslov <vladbu@nvidia.com>

Reviewed-by: Victor Nogueira <victor@mojatatu.com>
diff mbox series

Patch

diff --git a/tools/testing/selftests/tc-testing/tdc.sh b/tools/testing/selftests/tc-testing/tdc.sh
index afb0cd86fa3d..eb357bd7923c 100755
--- a/tools/testing/selftests/tc-testing/tdc.sh
+++ b/tools/testing/selftests/tc-testing/tdc.sh
@@ -2,5 +2,6 @@ 
 # SPDX-License-Identifier: GPL-2.0
 
 modprobe netdevsim
+modprobe sch_teql
 ./tdc.py -c actions --nobuildebpf
 ./tdc.py -c qdisc