add norne and norne_parallel as ExtraTests

to execute these you have to use ctest -C ExtraTests
or 'make extra_test'
This commit is contained in:
Arne Morten Kvarving 2020-04-03 10:15:49 +02:00
parent d72db978d6
commit e5b32dd82d
3 changed files with 65 additions and 0 deletions

View File

@ -352,6 +352,8 @@ if (OPM_ENABLE_PYTHON)
add_subdirectory(python)
endif()
add_custom_target(extra_test ${CMAKE_CTEST_COMMAND} -C ExtraTests)
# must link libraries after target 'flow' has been defined
if(CUDA_FOUND)
target_link_libraries( opmsimulators PUBLIC ${CUDA_cusparse_LIBRARY} )

View File

@ -11,6 +11,35 @@
# Define some paths
set(BASE_RESULT_PATH ${PROJECT_BINARY_DIR}/tests/results)
###########################################################################
# TEST: runSim
###########################################################################
# Input:
# - casename: basename (no extension)
#
# Details:
# - This test class simply runs a simulation.
function(add_test_runSimulator)
set(oneValueArgs CASENAME FILENAME SIMULATOR DIR DIR_PREFIX PROCS)
set(multiValueArgs TEST_ARGS)
cmake_parse_arguments(PARAM "$" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if(NOT PARAM_DIR)
set(PARAM_DIR ${PARAM_CASENAME})
endif()
set(RESULT_PATH ${BASE_RESULT_PATH}${PARAM_DIR_PREFIX}/${PARAM_SIMULATOR}+${PARAM_CASENAME})
set(TEST_ARGS ${OPM_TESTS_ROOT}/${PARAM_DIR}/${PARAM_FILENAME} ${PARAM_TEST_ARGS})
opm_add_test(runSimulator/${PARAM_CASENAME} NO_COMPILE
EXE_NAME ${PARAM_SIMULATOR}
DRIVER_ARGS ${OPM_TESTS_ROOT}/${PARAM_DIR}
${RESULT_PATH}
${PROJECT_BINARY_DIR}/bin
${PARAM_FILENAME}
${PARAM_PROCS}
TEST_ARGS ${TEST_ARGS}
CONFIGURATION extra)
endfunction()
###########################################################################
# TEST: compareECLFiles
###########################################################################
@ -142,6 +171,19 @@ if(NOT TARGET test-suite)
add_custom_target(test-suite)
endif()
# Simple execution tests
opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-test.sh "")
add_test_runSimulator(CASENAME norne
FILENAME NORNE_ATW2013
SIMULATOR flow
PROCS 1)
add_test_runSimulator(CASENAME norne_parallel
FILENAME NORNE_ATW2013
SIMULATOR flow
DIR norne
PROCS 4)
# Regression tests
opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-regressionTest.sh "")

21
tests/run-test.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
# This simply runs a simulator.
INPUT_DATA_PATH="$1"
RESULT_PATH="$2"
BINPATH="$3"
EXE_NAME="$4"
FILENAME="$5"
MPI_PROCS="$6"
shift 7
TEST_ARGS="$@"
mkdir -p ${RESULT_PATH}
if (( ${MPI_PROCS} > 1))
then
mpirun -np ${MPI_PROCS} ${BINPATH}/${EXE_NAME} ${TEST_ARGS} --output-dir=${RESULT_PATH}
else
${BINPATH}/${EXE_NAME} ${TEST_ARGS} --output-dir=${RESULT_PATH}
fi
test $? -eq 0 || exit 1