Skip to content

Commit

Permalink
Merge pull request #2520 from akva2/extra_tests
Browse files Browse the repository at this point in the history
add norne and norne_parallel as ExtraTests
  • Loading branch information
joakim-hove authored Apr 22, 2020
2 parents 0d78d7e + e5b32dd commit 2696160
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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} )
Expand Down
42 changes: 42 additions & 0 deletions compareECLFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
###########################################################################
Expand Down Expand Up @@ -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 "")

Expand Down
21 changes: 21 additions & 0 deletions tests/run-test.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2696160

Please sign in to comment.