Skip to content

Commit e6bbf8f

Browse files
committed
Use pkg-config to find thapi include and ldflags
1 parent df095a7 commit e6bbf8f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

integration_tests/toggle.bats

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/usr/bin/env bats
22

3+
setup_file() {
4+
export THAPI_INCFLAGS="-I$(pkg-config --variable=includedir thapi)"
5+
export THAPI_LDFLAGS="-Wl,-rpath,$(pkg-config --variable=libdir thapi) $(pkg-config --libs thapi)"
6+
}
7+
38
teardown_file() {
49
rm -rf $THAPI_HOME/thapi-traces
510
}
@@ -11,8 +16,7 @@ get_unique_jobid() {
1116
@test "toggle_api" {
1217
rm -rf toggle_traces 2>/dev/null
1318

14-
cc -I${THAPI_INC_DIR} ./integration_tests/toggle.c -o toggle \
15-
-Wl,-rpath,${THAPI_LIB_DIR} -L${THAPI_LIB_DIR} -lThapi
19+
cc ${THAPI_INCFLAGS} ./integration_tests/toggle.c -o toggle ${THAPI_LDFLAGS}
1620

1721
$IPROF --trace-output toggle_traces --no-analysis -- ./toggle
1822
dir=$(ls -d -1 ./toggle_traces/*/)
@@ -41,8 +45,7 @@ toggle_count_traces() {
4145
}
4246

4347
@test "toggle_plugin_mpi_np_1" {
44-
mpicc -I${THAPI_INC_DIR} ./integration_tests/toggle_mpi.c -o toggle_mpi \
45-
-Wl,-rpath,${THAPI_LIB_DIR} -L${THAPI_LIB_DIR} -lThapi
48+
mpicc ${THAPI_INCFLAGS} ./integration_tests/toggle_mpi.c -o toggle_mpi ${THAPI_LDFLAGS}
4649

4750
count_0=$(toggle_count_traces 1 0)
4851
count_1=$(toggle_count_traces 1 1)
@@ -58,8 +61,7 @@ toggle_count_vpids() {
5861
}
5962

6063
@test "toggle_plugin_mpi_np_2" {
61-
mpicc -I${THAPI_INC_DIR} ./integration_tests/toggle_mpi.c -o toggle_mpi \
62-
-Wl,-rpath,${THAPI_LIB_DIR} -L${THAPI_LIB_DIR} -lThapi
64+
mpicc ${THAPI_INCFLAGS} ./integration_tests/toggle_mpi.c -o toggle_mpi ${THAPI_LDFLAGS}
6365

6466
count_0=$(toggle_count_vpids 2 0)
6567
count_1=$(toggle_count_vpids 2 1)

0 commit comments

Comments
 (0)