eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit a55f8864d2a65d9032e4d205da62fa2eeb27ace2
parent 6fdae0c4ebc9c2d0b2a92cf333e855524f633554
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date:   Mon, 25 Jan 2021 18:56:14 +0100

testrunner: Fix /tmp files cleanup on error

Since the list of files copied to /tmp was part of the return value from
pre_test(), if an exception occurred inside pre_test(), "copied" would
be undefined and the post_test(ctx, copied) call in the finally clause
cause another exception:

raceback (most recent call last):
  File "/home/balrog/repos/iwd/tools/test-runner", line 1508, in <module>
    run_tests()
  File "/home/balrog/repos/iwd/tools/test-runner", line 1242, in run_tests
    run_auto_tests(config.ctx, args)
  File "/home/balrog/repos/iwd/tools/test-runner", line 1166, in run_auto_tests
    post_test(ctx, copied)
UnboundLocalError: local variable 'copied' referenced before assignment

(apart from not being able to clean up the files).  Pass "copied" as a
paremeter to pre_test instead.

Diffstat:
Mtools/test-runner | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/test-runner b/tools/test-runner @@ -973,7 +973,7 @@ def start_test(ctx, subtests, rqueue): # This may not be required since we are manually popping sys.modules importlib.invalidate_caches() -def pre_test(ctx, test): +def pre_test(ctx, test, copied): ''' Copy test files, start processes, and any other pre test work. ''' @@ -1005,6 +1005,7 @@ def pre_test(ctx, test): shutil.copytree(f, '/tmp/' + f) else: shutil.copy(f, '/tmp') + copied.append(f) # Prune down any subtests if needed if ctx.args.sub_tests: @@ -1044,7 +1045,7 @@ def pre_test(ctx, test): sys.path.insert(1, test) - return (to_copy, sorted(subtests)) + return sorted(subtests) def post_test(ctx, to_copy): ''' @@ -1119,8 +1120,9 @@ def run_auto_tests(ctx, args): shutil.copy(args.testhome + '/autotests/misc/phonesim/phonesim.conf', '/tmp') for test in tests: + copied = [] try: - copied, subtests = pre_test(ctx, test) + subtests = pre_test(ctx, test, copied) if args.shell: #