Skip to content
Open
5 changes: 4 additions & 1 deletion interception/faros.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import subprocess
import sys
import os
import pathlib
from colors import *

sys.path.append('../../..')
FILE_PATH = str(pathlib.Path(__file__).parent.absolute())
#sys.path.append('../../..')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment

sys.path.append(FILE_PATH+'/../')
from libs.faros import faroslib as faros

INTERCEPT_LIB = os.path.dirname(os.path.abspath(__file__))+"/intercept.so"
Expand Down
2 changes: 1 addition & 1 deletion interception/tests/test_cmake/test_cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_1():
if file.endswith(".yaml"):
count +=1

assert count==3
assert count==5

if __name__ == '__main__':
test_1()
2 changes: 1 addition & 1 deletion interception/tests/test_compile_single_file/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ all:
$(CC) -o main $(OP) main.c

clean:
rm -rf *.o main *.yaml
rm -rf *.o main *.yaml report
2 changes: 1 addition & 1 deletion interception/tests/test_mpi_openmp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ all:
$(CC) $(LINK) -o main main.o

clean:
rm -rf *.o main *.yaml
rm -rf *.o main *.yaml report
11 changes: 11 additions & 0 deletions interception/tests/test_report_generated/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

CC = clang
OP = -g -O3 -fopenmp
LINK = -fopenmp

all:
$(CC) -c $(OP) main.c
$(CC) $(LINK) -o main main.o

clean:
rm -rf *.o main *.yaml ./report
23 changes: 23 additions & 0 deletions interception/tests/test_report_generated/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

#include <stdio.h>

#if defined(_OPENMP)
#include <omp.h>
#endif

int main() {

#if defined(_OPENMP)
omp_set_num_threads(4);
#endif

#pragma omp parallel
{
#if defined(_OPENMP)
printf("Thread ID: %d\n", omp_get_thread_num());
#endif
}

printf("Done!\n");
return 0;
}
32 changes: 32 additions & 0 deletions interception/tests/test_report_generated/test_report_generated.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python

import subprocess
import os
import sys

def setup_module(module):
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
os.chdir(THIS_DIR)

def teardown_module(module):
cmd = ["make clean"]
cmdOutput = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)

def run_command(cmd):
try:
cmdOutput = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
except subprocess.CalledProcessError as e:
print(e.output)
exit()

def test_1():
# --- compile code ---
cmd = ["../../faros make"]
run_command(cmd)

# --- run code ---
cmd = ["./main"]
run_command(cmd)

assert os.path.isfile('./main.opt.yaml')
assert os.path.isfile('./report/html-output/index.html')
2 changes: 1 addition & 1 deletion interception/tests/test_simple_openmp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ all:
$(CC) $(LINK) -o main main.o

clean:
rm -rf *.o main *.yaml
rm -rf *.o main *.yaml ./report