Skip to content

Commit 2e585b4

Browse files
author
Damian Rouson
committed
Add installation script tests to ctest
1 parent a930cdf commit 2e585b4

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

AddInstallationScriptTest.cmake

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
macro(add_installation_script_test name path)
2+
3+
# Copy the source to the binary tree
4+
configure_file(
5+
${CMAKE_CURRENT_SOURCE_DIR}/${path}/${name}
6+
${CMAKE_CURRENT_BINARY_DIR}/${path}/${name}
7+
COPYONLY
8+
)
9+
configure_file(
10+
${CMAKE_CURRENT_SOURCE_DIR}/${path}/${name}-usage
11+
${CMAKE_CURRENT_BINARY_DIR}/${path}/${name}-usage
12+
COPYONLY
13+
)
14+
set(harness "${CMAKE_BINARY_DIR}/staging/test-${name}.sh")
15+
install(
16+
FILES "${harness}"
17+
PERMISSIONS WORLD_EXECUTE WORLD_READ WORLD_WRITE OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ GROUP_WRITE
18+
DESTINATION ${CMAKE_BINARY_DIR}/${path}
19+
)
20+
file(WRITE "${harness}" "#!/bin/bash\n")
21+
file(APPEND "${harness}" "cd ${CMAKE_BINARY_DIR}/${path}\n")
22+
file(APPEND "${harness}" "OPENCOARRAYS_SRC_DIR=${CMAKE_SOURCE_DIR} ./${name}\n")
23+
add_test(NAME ${name} COMMAND "${CMAKE_CURRENT_BINARY_DIR}/${path}/test-${name}.sh")
24+
#set_property(TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
25+
endmacro(add_installation_script_test)

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,3 +412,6 @@ else()
412412
add_test(co_reduce_extension ${tests_root}/unit/extensions/test-co_reduce-extension.sh)
413413
set_property(TEST co_reduce_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
414414
endif()
415+
416+
include(AddInstallationScriptTest.cmake )
417+
add_installation_script_test(installation-scripts.sh src/tests/installation/)

src/tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ endif()
1717

1818
add_subdirectory(integration)
1919
add_subdirectory(unit)
20-
#add_subdirectory(performance)
20+
add_subdirectory(installation)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/installation-scripts.sh ${CMAKE_CURRENT_BINARY_DIR}/installation-scripts.sh COPYONLY)

src/tests/installation/installation-scripts.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@
8282
### Start of boilerplate -- do not edit this block #######################
8383
export OPENCOARRAYS_SRC_DIR="${OPENCOARRAYS_SRC_DIR:-${PWD%/}/../../..}"
8484
if [[ ! -f "${OPENCOARRAYS_SRC_DIR}/src/libcaf.h" ]]; then
85-
echo "Please run this script inside the top-level OpenCoarrays source directory or "
86-
echo "set OPENCOARRAYS_SRC_DIR to the OpenCoarrays source directory path."
85+
echo "Please run this script inside the OpenCoarrays source sudirectory src/tests/instsallation"
86+
echo "or set OPENCOARRAYS_SRC_DIR to the OpenCoarrays source directory path."
8787
exit 1
8888
fi
8989
export B3B_USE_CASE="${B3B_USE_CASE:-${OPENCOARRAYS_SRC_DIR}/prerequisites/use-case}"

0 commit comments

Comments
 (0)