mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-25 10:40:21 -06:00
Merge pull request #2520 from akva2/extra_tests
add norne and norne_parallel as ExtraTests
This commit is contained in:
commit
2696160f56
@ -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} )
|
||||
|
@ -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
21
tests/run-test.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user