diff mbox series

[net] tc-testing: don't access non-existent variable on exception

Message ID 20240815-tdc-test-ordinal-v1-1-0255c122a427@kernel.org (mailing list archive)
State Accepted
Commit a0c9fe5eecc97680323ee83780ea3eaf440ba1b7
Delegated to: Netdev Maintainers
Headers show
Series [net] tc-testing: don't access non-existent variable on exception | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 7 this patch: 7
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 7 this patch: 7
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 7 this patch: 7
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-16--21-00 (tests: 710)

Commit Message

Simon Horman Aug. 15, 2024, 3:37 p.m. UTC
Since commit 255c1c7279ab ("tc-testing: Allow test cases to be skipped")
the variable test_ordinal doesn't exist in call_pre_case().
So it should not be accessed when an exception occurs.

This resolves the following splat:

  ...
  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File ".../tdc.py", line 1028, in <module>
      main()
    File ".../tdc.py", line 1022, in main
      set_operation_mode(pm, parser, args, remaining)
    File ".../tdc.py", line 966, in set_operation_mode
      catresults = test_runner_serial(pm, args, alltests)
    File ".../tdc.py", line 642, in test_runner_serial
      (index, tsr) = test_runner(pm, args, alltests)
    File ".../tdc.py", line 536, in test_runner
      res = run_one_test(pm, args, index, tidx)
    File ".../tdc.py", line 419, in run_one_test
      pm.call_pre_case(tidx)
    File ".../tdc.py", line 146, in call_pre_case
      print('test_ordinal is {}'.format(test_ordinal))
  NameError: name 'test_ordinal' is not defined

Fixes: 255c1c7279ab ("tc-testing: Allow test cases to be skipped")
Signed-off-by: Simon Horman <horms@kernel.org>
---
 tools/testing/selftests/tc-testing/tdc.py | 1 -
 1 file changed, 1 deletion(-)

Comments

Jamal Hadi Salim Aug. 16, 2024, 4:51 a.m. UTC | #1
On Thu, Aug 15, 2024 at 11:37 AM Simon Horman <horms@kernel.org> wrote:
>
> Since commit 255c1c7279ab ("tc-testing: Allow test cases to be skipped")
> the variable test_ordinal doesn't exist in call_pre_case().
> So it should not be accessed when an exception occurs.
>

LGTM.
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal
> This resolves the following splat:
>
>   ...
>   During handling of the above exception, another exception occurred:
>
>   Traceback (most recent call last):
>     File ".../tdc.py", line 1028, in <module>
>       main()
>     File ".../tdc.py", line 1022, in main
>       set_operation_mode(pm, parser, args, remaining)
>     File ".../tdc.py", line 966, in set_operation_mode
>       catresults = test_runner_serial(pm, args, alltests)
>     File ".../tdc.py", line 642, in test_runner_serial
>       (index, tsr) = test_runner(pm, args, alltests)
>     File ".../tdc.py", line 536, in test_runner
>       res = run_one_test(pm, args, index, tidx)
>     File ".../tdc.py", line 419, in run_one_test
>       pm.call_pre_case(tidx)
>     File ".../tdc.py", line 146, in call_pre_case
>       print('test_ordinal is {}'.format(test_ordinal))
>   NameError: name 'test_ordinal' is not defined
>
> Fixes: 255c1c7279ab ("tc-testing: Allow test cases to be skipped")
> Signed-off-by: Simon Horman <horms@kernel.org>
> ---
>  tools/testing/selftests/tc-testing/tdc.py | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py
> index ee349187636f..4f255cec0c22 100755
> --- a/tools/testing/selftests/tc-testing/tdc.py
> +++ b/tools/testing/selftests/tc-testing/tdc.py
> @@ -143,7 +143,6 @@ class PluginMgr:
>              except Exception as ee:
>                  print('exception {} in call to pre_case for {} plugin'.
>                        format(ee, pgn_inst.__class__))
> -                print('test_ordinal is {}'.format(test_ordinal))
>                  print('testid is {}'.format(caseinfo['id']))
>                  raise
>
>
patchwork-bot+netdevbpf@kernel.org Aug. 17, 2024, 2:30 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 15 Aug 2024 16:37:13 +0100 you wrote:
> Since commit 255c1c7279ab ("tc-testing: Allow test cases to be skipped")
> the variable test_ordinal doesn't exist in call_pre_case().
> So it should not be accessed when an exception occurs.
> 
> This resolves the following splat:
> 
>   ...
>   During handling of the above exception, another exception occurred:
> 
> [...]

Here is the summary with links:
  - [net] tc-testing: don't access non-existent variable on exception
    https://git.kernel.org/netdev/net/c/a0c9fe5eecc9

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py
index ee349187636f..4f255cec0c22 100755
--- a/tools/testing/selftests/tc-testing/tdc.py
+++ b/tools/testing/selftests/tc-testing/tdc.py
@@ -143,7 +143,6 @@  class PluginMgr:
             except Exception as ee:
                 print('exception {} in call to pre_case for {} plugin'.
                       format(ee, pgn_inst.__class__))
-                print('test_ordinal is {}'.format(test_ordinal))
                 print('testid is {}'.format(caseinfo['id']))
                 raise