[autotest][PATCH] UBUNTU: SAUCE: fix missing setup on second run

Krzysztof Kozlowski krzysztof.kozlowski at canonical.com
Thu Jun 3 13:21:18 UTC 2021


The autotest had nice idea that test setup can be executed only once on
a machine, till test version does not change.  If version stays the
same, autotest will not run test setup on next executions.

However this requirement/feature was not defined clear enough and some
tests:
1. Perform cleanup() which reverts the setup() (e.g. ubuntu_boot).
2. Set runtime configuration (e.g. initialize object's field in Python
   __init__()) during setup() and read it on each test (e.g.
   ubuntu_sysdig_smoke_test).

All of these cases fail.  Fix this by calling the test setup() every
time.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at canonical.com>
---
 client/shared/utils.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/client/shared/utils.py b/client/shared/utils.py
index 3e8c9448d23e..367edcd04a03 100644
--- a/client/shared/utils.py
+++ b/client/shared/utils.py
@@ -862,7 +862,11 @@ def update_version(srcdir, preserve_srcdir, new_version, install,
                                      os.path.basename(patch_src))
             shutil.copyfile(patch_src, patch_dst)
 
-        install(*args, **dargs)
+    # The test-specific setup is always needed because:
+    #  - it could have been reverted with cleanup()
+    #  - few broken tests might depend on setup() run always
+    install(*args, **dargs)
+    if install_needed:
         pickle.dump(new_version, open(versionfile, 'w'))
 
 
-- 
2.27.0




More information about the kernel-team mailing list