From cdc80cd341875c11313873a0c7b0b581a63f3fc3 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Wed, 3 Jul 2019 10:32:24 -0700 Subject: [PATCH] auto-t: add copy_to_hotspot Initially the solution to copying files to .hotspot was to use the existing copy_to_storage, but allow full directory copying. Doing it this way does not allow us to copy single files into .hotspot which makes it difficult to test single configurations in several consecutive tests. This adds a new API, copy_to_hotspot, where a single hotspot config can be provided. clear_storage was also modified to clear out the .hotspot directory in addition to the regular storage directory. --- autotests/util/iwd.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py index 67825215..3b5abf57 100755 --- a/autotests/util/iwd.py +++ b/autotests/util/iwd.py @@ -947,6 +947,7 @@ class IWD(AsyncOpAbstract): @staticmethod def clear_storage(): os.system('rm -rf ' + IWD_STORAGE_DIR + '/*') + os.system('rm -rf ' + IWD_STORAGE_DIR + '/.hotspot/*') @staticmethod def create_in_storage(file_name, file_content): @@ -961,10 +962,18 @@ class IWD(AsyncOpAbstract): assert not os.path.isabs(source) - if os.path.isdir(source): - shutil.copytree(source, IWD_STORAGE_DIR + "/%s" % source) - else: - shutil.copy(source, IWD_STORAGE_DIR) + shutil.copy(source, IWD_STORAGE_DIR) + + @staticmethod + def copy_to_hotspot(source): + import shutil + + assert not os.path.isabs(source) + + if not os.path.exists(IWD_STORAGE_DIR + "/.hotspot"): + os.mkdir(IWD_STORAGE_DIR + "/.hotspot") + + shutil.copy(source, IWD_STORAGE_DIR + "/.hotspot") @staticmethod def remove_from_storage(file_name):