[KERNEL][TEST] Refactor runtests.py

git-svn-id: svn://kolibrios.org@9321 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Magomed Kostoev (mkostoevr) 2021-11-26 21:30:41 +00:00
parent 00df866213
commit 9ad8889fd4

View File

@ -14,9 +14,6 @@ import subprocess
sys.path.append('test') sys.path.append('test')
import common import common
root_dir = os.getcwd()
tests = []
def log(s, end = "\n"): def log(s, end = "\n"):
print(s, end = end, flush = True) print(s, end = end, flush = True)
@ -81,12 +78,8 @@ def check_tools(tools):
draw_line() draw_line()
exit() exit()
if __name__ == "__main__": def prepare_test_img():
# Check available tools # TODO: Always recompile the kernel (after build system is done?)
tools = (("qemu-system-i386", "qemu-system-x86"),
("fasm", "fasm"))
check_tools(tools)
# Get IMG # Get IMG
if not os.path.exists("kolibri_test.img"): if not os.path.exists("kolibri_test.img"):
if len(sys.argv) == 1: if len(sys.argv) == 1:
@ -122,6 +115,9 @@ if __name__ == "__main__":
img.add_file_path("KERNEL.MNT", kernel_mnt_pretest_data) img.add_file_path("KERNEL.MNT", kernel_mnt_pretest_data)
img.save("kolibri_test.img") img.save("kolibri_test.img")
def collect_tests():
tests = []
# Collect tests from test folder (not recursively yet) # Collect tests from test folder (not recursively yet)
for test_folder in os.listdir("test"): for test_folder in os.listdir("test"):
test_folder_path = f"test/{test_folder}" test_folder_path = f"test/{test_folder}"
@ -132,6 +128,18 @@ if __name__ == "__main__":
if os.path.exists(test_file): if os.path.exists(test_file):
tests.append(test_folder_path) tests.append(test_folder_path)
return tests
if __name__ == "__main__":
root_dir = os.getcwd()
# Check available tools
tools = (("qemu-system-i386", "qemu-system-x86"),
("fasm", "fasm"))
check_tools(tools)
prepare_test_img()
tests = collect_tests()
# Execute each test # Execute each test
test_number = 1 test_number = 1