Skip to content

chore: minor cleanup to compile script #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)