Skip to content

Commit

Permalink
test: Update run outputs on examples
Browse files Browse the repository at this point in the history
  • Loading branch information
keyvank committed Dec 7, 2024
1 parent 0d921e1 commit 7e329dd
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 1,378 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $(STAGE3_BIN): $(STAGE2_BIN) **/*.h **/*.c
rm -rf target2

run: $(BIN)
@./a.out $(program) --asm > out.asm
@./30cc $(program) --asm > out.asm
@nasm -f elf64 out.asm -o out.o
@ld -dynamic-linker /lib64/ld-linux-x86-64.so.2 -lc -o out out.o
@echo "$ ./out \"$(arguments)\""
Expand Down
16 changes: 8 additions & 8 deletions scripts/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def git_add_and_diff(file_path):

def main():
mode = None
if len(sys.argv) > 2:
if len(sys.argv) >= 2:
mode = sys.argv[1]
if mode not in ["update", "revert", "run"]:
print("Invalid mode. Use 'update' or 'revert' or 'run'.")
Expand All @@ -120,20 +120,20 @@ def main():
diff_count = 0
failed = False
for test_file in TEST_FILES.keys():
for mode in ['lex', 'prep', 'tree', 'asm']:
for md in ['lex', 'prep', 'tree', 'asm']:
extension = "txt"
if mode == "asm":
if md == "asm":
extension = "asm"
output_file = os.path.join(
OUTPUT_FOLDER,
f"{os.path.basename(test_file)}_{mode}_output.{extension}",
f"{os.path.basename(test_file)}_{md}_output.{extension}",
)
print(test_file, mode)
output = run(test_file, mode)
print(test_file, md)
output = run(test_file, md)
if output is None:
failed = True

if mode == "revert":
if md == "revert":
revert_snapshot(output_file)
continue

Expand All @@ -147,7 +147,7 @@ def main():
update_output(output_file, output, True)
else:
update_output(output_file, output)

if mode == "run":
for test_file, inputs in TEST_FILES.items():
if len(inputs) == 0:
Expand Down
65 changes: 0 additions & 65 deletions tests/output/inp.c_output.txt

This file was deleted.

Loading

0 comments on commit 7e329dd

Please sign in to comment.