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.
This commit is contained in:
James Prestwood 2019-07-03 10:32:24 -07:00 committed by Denis Kenzior
parent 1a2f10dacd
commit cdc80cd341
1 changed files with 13 additions and 4 deletions

View File

@ -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):