Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 872c882

Browse files
author
Stephanie Labasan
committed
Parameterizing CMake build of executables in test directory to make it easier
to add new tests. Signed-off-by: Stephanie Labasan <[email protected]>
1 parent 96c66dd commit 872c882

File tree

2 files changed

+24
-39
lines changed

2 files changed

+24
-39
lines changed

.gitignore

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ install_manifest.txt
1818
lib/
1919
libmsr-config.cmake
2020
msrmod/msrmod
21-
test/dump-data
22-
test/libmsr-test
21+
test/libmsr_dump_data
2322
test/libmsr_test
24-
test/pstate-test
25-
test/rapl-data
26-
test/translate
27-
test/turbo-test
28-
test/unit-test
23+
test/power_cap_test
24+
test/power_unit_test
25+
test/pstate_test
26+
test/read_rapl_data
27+
test/translate_pkg_rapl_limit
28+
test/turbo_test

test/CMakeLists.txt

+17-32
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
11
cmake_minimum_required(VERSION 2.8)
22

3-
include_directories(${PROJECT_SOURCE_DIR}/include)
4-
5-
add_executable (power-unit-test power_unit_test.c)
6-
set_target_properties(${execname} PROPERTIES COMPILE_FLAGS "-g -Wall -D_GNU_SOURCE")
7-
target_link_libraries (power-unit-test msr)
8-
9-
add_executable (libmsr-test libmsr_test.c)
10-
set_target_properties(${execname} PROPERTIES COMPILE_FLAGS "-g -Wall -D_GNU_SOURCE")
11-
target_link_libraries (libmsr-test msr)
12-
13-
add_executable (pstate-test pstate_test.c)
14-
set_target_properties(${execname} PROPERTIES COMPILE_FLAGS "-g -Wall -D_GNU_SOURCE")
15-
target_link_libraries (pstate-test msr)
16-
17-
add_executable (rapl-data read_rapl_data.c)
18-
set_target_properties(${execname} PROPERTIES COMPILE_FLAGS "-g -Wall -D_GNU_SOURCE")
19-
target_link_libraries (rapl-data msr)
3+
set(LIBMSR_TESTS
4+
power_unit_test
5+
libmsr_test
6+
pstate_test
7+
read_rapl_data
8+
translate_pkg_rapl_limit
9+
turbo_test
10+
libmsr_dump_data
11+
power_cap_test
12+
)
13+
14+
foreach(TEST ${LIBMSR_TESTS})
15+
add_executable(${TEST} ${TEST}.c)
16+
set_target_properties(${TEST} PROPERTIES COMPILE_FLAGS "-g -Wall -D_GNU_SOURCE")
17+
target_link_libraries(${TEST} msr)
18+
endforeach()
2019

21-
add_executable (translate translate_pkg_rapl_limit.c)
22-
set_target_properties(${execname} PROPERTIES COMPILE_FLAGS "-g -Wall -D_GNU_SOURCE")
23-
target_link_libraries (translate msr)
24-
25-
add_executable (turbo-test turbo_test.c)
26-
set_target_properties(${execname} PROPERTIES COMPILE_FLAGS "-g -Wall -D_GNU_SOURCE")
27-
target_link_libraries (turbo-test msr)
28-
29-
add_executable (dump-data libmsr_dump_data.c)
30-
set_target_properties(${execname} PROPERTIES COMPILE_FLAGS "-g -Wall -D_GNU_SOURCE")
31-
target_link_libraries (dump-data msr)
32-
33-
add_executable (power-cap-test power_cap_test.c)
34-
set_target_properties(${execname} PROPERTIES COMPILE_FLAGS "-g -Wall -D_GNU_SOURCE")
35-
target_link_libraries (power-cap-test msr)
20+
include_directories(${PROJECT_SOURCE_DIR}/include)

0 commit comments

Comments
 (0)