-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild_and_test.py
34 lines (24 loc) · 921 Bytes
/
build_and_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import subprocess
import os
import argparse
def run_command(command):
subprocess.run(command, shell=True, check=True)
def main():
core_count_default = 8
parser = argparse.ArgumentParser(description="Development cycle automation script.")
parser.add_argument("-j", "--cores", type=int, default=core_count_default, help=f"Number of cores for cmake build, default = {core_count_default} ")
args = parser.parse_args()
# Step 1: Create build files
run_command("cmake -S . -B build -DLLVM_ROOT=usr/local -DCMAKE_BUILD_TYPE=RelWithDebInfo")
# Step 2: Build the project
run_command(f"cmake --build build -j{args.cores}")
# Step 3: Run the main executable
# os.chdir("build")
# run_command("./sammine")
# os.chdir("..")
# Step 4: Run tests
os.chdir("build")
run_command("ctest --output-on-failure")
os.chdir("..")
if __name__ == "__main__":
main()