-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: minor cleanup to compile script (#40)
Signed-off-by: Henry Schreiner <[email protected]>
- Loading branch information
Showing
3 changed files
with
20 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
import sys | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |