Skip to content

Commit

Permalink
chore: minor cleanup to compile script (#40)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Nov 7, 2024
1 parent 7a670ee commit 9dc88b5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

/test/*/a/*
/test/*/b/*
2 changes: 2 additions & 0 deletions idd.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import argparse
import sys

Expand Down
29 changes: 15 additions & 14 deletions test/compile_tests.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#!/usr/bin/env python
# coding: utf-8
#!/usr/bin/env python3

import glob
import os
from os import system
root_tests_dir = '.'
import subprocess
from pathlib import Path

for test_dir in os.listdir(root_tests_dir):
if os.path.isdir(os.path.join(root_tests_dir, test_dir)):
root_tests_dir = Path(__file__).parent.resolve()
prog = "g++"

for test_dir in root_tests_dir.iterdir():
if test_dir.is_dir():
print(test_dir)
if not os.path.exists("{test_dir}/a".format(test_dir = test_dir)):
os.makedirs("{test_dir}/a".format(test_dir = test_dir))
a_dir = test_dir / "a"
b_dir = test_dir / "b"

if not os.path.exists("{test_dir}/b".format(test_dir = test_dir)):
os.makedirs("{test_dir}/b".format(test_dir = test_dir))
a_dir.mkdir(exist_ok=True)
b_dir.mkdir(exist_ok=True)

system("g++ -DV1 -o {test_d}/a/program.out -xc++ -g {test_files}".format(test_d = test_dir, test_files = ' '.join(glob.glob(test_dir + '/*.c??'))))
system("g++ -DV2 -o {test_d}/b/program.out -xc++ -g {test_files}".format(test_d = test_dir, test_files = ' '.join(glob.glob(test_dir + '/*.c??'))))
test_files = list(test_dir.glob('*.c??'))
subprocess.run([prog, "-DV1", "-o", a_dir/"program.out", "-g", *test_files], check=True)
subprocess.run([prog, "-DV2", "-o", b_dir/"program.out", "-g", *test_files], check=True)

0 comments on commit 9dc88b5

Please sign in to comment.