From 12cb52a647e71e522d507d2ce3618424760cf898 Mon Sep 17 00:00:00 2001 From: drunkendog Date: Mon, 11 Sep 2023 20:51:15 +0100 Subject: [PATCH] Placeholder --- run-tests.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 run-tests.py diff --git a/run-tests.py b/run-tests.py new file mode 100644 index 0000000..d1426c4 --- /dev/null +++ b/run-tests.py @@ -0,0 +1,21 @@ +#!/bin/python3 + +import glob +import subprocess +import os + +# will break if there are namespace collisions + +file_list = [x.rstrip(".case") for x in glob.glob(f"{os.path.dirname(__file__)}/**/*.case", recursive=True)] +file_only_list = [os.path.basename(x) for x in file_list] + +for file_name in glob.glob("*.c", recursive=False): + if file_name.rstrip(".c") in file_only_list: + should_continue = input(f"{file_name}; run (y/N)?").lower() + if should_continue is not "y": + continue + subprocess.run(["gcc", "-std=c11", "-Wall", "-g", file_name], check=True) + with open(next(x for x in file_list if file_name in x)) as f: + to_run = f.read().split("\n\n") + for x in to_run: + subprocess.run(["./a.out"], input="", capture_output=True)