mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-02 05:26:56 +03:00
[KERNEL][TEST] Make UMKa tests position independent
git-svn-id: svn://kolibrios.org@9333 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
809317b91f
commit
f80242ef66
@ -142,7 +142,7 @@ def collect_umka_tests():
|
|||||||
continue
|
continue
|
||||||
if not os.path.isfile(test_file_path):
|
if not os.path.isfile(test_file_path):
|
||||||
continue
|
continue
|
||||||
tests.append(test_file)
|
tests.append(test_file_path)
|
||||||
return tests
|
return tests
|
||||||
|
|
||||||
def run_tests_serially_thread(test, root_dir):
|
def run_tests_serially_thread(test, root_dir):
|
||||||
@ -213,10 +213,21 @@ def build_umka():
|
|||||||
objects = " ".join(objects)
|
objects = " ".join(objects)
|
||||||
os.system(f"gcc -m32 -no-pie -o umka_shell -static -T umka/umka.ld {objects}")
|
os.system(f"gcc -m32 -no-pie -o umka_shell -static -T umka/umka.ld {objects}")
|
||||||
|
|
||||||
def run_umka_test(test_file_path):
|
def create_relocated(root_dir, fname):
|
||||||
ref_log = f"{test_file_path[:-2]}.ref.log"
|
with open(fname, "rb") as f:
|
||||||
out_log = f"{test_file_path[:-2]}.out.log"
|
contents = f.read()
|
||||||
os.system(f"../../umka_shell < {test_file_path} > {out_log}")
|
new_contents = contents.replace(b"../img", bytes(f"{root_dir}/umka/img", "ascii"))
|
||||||
|
new_contents = new_contents.replace(b"chess_image.rgb", bytes(f"{root_dir}/umka/test/chess_image.rgb", "ascii"))
|
||||||
|
outname = f"{fname}.o" # .o extension just to avoid indexing of the file
|
||||||
|
with open(outname, "wb") as f:
|
||||||
|
f.write(new_contents)
|
||||||
|
return outname
|
||||||
|
|
||||||
|
def run_umka_test(root_dir, test_file_path):
|
||||||
|
test = create_relocated(root_dir, test_file_path)
|
||||||
|
ref_log = create_relocated(root_dir, f"{test_file_path[:-2]}.ref.log")
|
||||||
|
out_log = create_relocated(root_dir, f"{test_file_path[:-2]}.out.log")
|
||||||
|
os.system(f"./umka_shell < {test} > {out_log}")
|
||||||
if os.system(f"cmp {ref_log} {out_log}") != 0:
|
if os.system(f"cmp {ref_log} {out_log}") != 0:
|
||||||
print(f"FAILURE: {test_file_path}\n", end = "")
|
print(f"FAILURE: {test_file_path}\n", end = "")
|
||||||
else:
|
else:
|
||||||
@ -237,7 +248,6 @@ if __name__ == "__main__":
|
|||||||
serial_executor_thread = run_tests_serially(tests, root_dir)
|
serial_executor_thread = run_tests_serially(tests, root_dir)
|
||||||
serial_executor_thread.join()
|
serial_executor_thread.join()
|
||||||
if enable_umka:
|
if enable_umka:
|
||||||
os.chdir(f"{root_dir}/umka/test")
|
|
||||||
for umka_test in umka_tests:
|
for umka_test in umka_tests:
|
||||||
run_umka_test(umka_test)
|
run_umka_test(root_dir, umka_test)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user