[KERNEL][TEST] Use python library instead of custom function

git-svn-id: svn://kolibrios.org@9369 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Magomed Kostoev (mkostoevr) 2021-12-03 15:52:30 +00:00
parent bf87c5937f
commit 904c78d4e4

View File

@ -77,16 +77,6 @@ class Qemu:
def wait(self, seconds = 0.25):
time.sleep(seconds)
def get_file_directory(path):
path = path.replace("\\", "/")
if "/" in path:
folder = "/".join(path.split("/")[:-1])
if folder == "":
return "/" # It was a file in the root folder
return folder
else:
return "." # Just a filename, let's return current folder
def run_qemu(root_dir, test_dir, debug_log):
# Make local copy of IMG, so we will be able to run the test in parallel
if os.path.exists(f"{test_dir}/kolibri_test.img"): # If previous test run interrupted the file may be busy
@ -104,7 +94,7 @@ def run_qemu(root_dir, test_dir, debug_log):
flags += "-soundhw ac97 "
if is_win32():
qemu_full_path = shutil.which(qemu_command)
qemu_directory = get_file_directory(qemu_full_path)
qemu_directory = os.path.dirname(qemu_full_path)
flags += f"-L {qemu_directory} "
s = f"{qemu_command} {flags}"
qemu_stdout = open(f"{test_dir}/qemu_stdout.log", "w")