[KERNEL][TEST] Wait for debug.log more reliable

git-svn-id: svn://kolibrios.org@9254 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Magomed Kostoev (mkostoevr) 2021-11-05 09:17:31 +00:00
parent e44770ac18
commit c582c8b648

View File

@ -19,7 +19,9 @@ class TestFailureException(Exception):
class Qemu: class Qemu:
def __init__(self, popen): def __init__(self, popen):
self.popen = popen self.popen = popen
self.wait() # qemu needs time to create debug.log file # Qemu needs time to create debug.log file
while not os.path.exists("debug.log"):
self.wait()
def wait_for_debug_log(self, needle, timeout = 1): def wait_for_debug_log(self, needle, timeout = 1):
needle = bytes(needle, "utf-8") needle = bytes(needle, "utf-8")
@ -61,6 +63,7 @@ class Qemu:
time.sleep(seconds) time.sleep(seconds)
def run(): def run():
os.remove("debug.log")
s = f"qemu-system-i386 -nographic -L . -m 128 -drive format=raw,file=../../kolibri_test.img,index=0,if=floppy -boot a -vga vmware -net nic,model=rtl8139 -net user -soundhw ac97 -debugcon file:debug.log" s = f"qemu-system-i386 -nographic -L . -m 128 -drive format=raw,file=../../kolibri_test.img,index=0,if=floppy -boot a -vga vmware -net nic,model=rtl8139 -net user -soundhw ac97 -debugcon file:debug.log"
a = shlex.split(s) a = shlex.split(s)
popen = subprocess.Popen(a, bufsize = 0, stdout = subprocess.DEVNULL, stderr = subprocess.DEVNULL, stdin = subprocess.DEVNULL, start_new_session = True) popen = subprocess.Popen(a, bufsize = 0, stdout = subprocess.DEVNULL, stderr = subprocess.DEVNULL, stdin = subprocess.DEVNULL, start_new_session = True)