Skip to content

Commit

Permalink
changed: move helper scripts to a scripts folder in root
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1564 e10b68d5-8a6e-419e-a041-bce267b0401d
  • Loading branch information
akva authored and kmokstad committed Jul 10, 2015
1 parent 6b149d1 commit e4ac10a
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Apps/FiniteDefElasticity/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ ADD_CUSTOM_TARGET(doc doxygen

FILE(GLOB_RECURSE NONLINEL_TESTFILES "${PROJECT_SOURCE_DIR}/Test/*.reg")
FOREACH(TESTFILE ${NONLINEL_TESTFILES})
ADD_TEST(${TESTFILE} ${PROJECT_SOURCE_DIR}/../../test/regtest.sh "${CMAKE_BINARY_DIR}/${EXECUTABLE_OUTPUT_PATH}/NonLinEl" "${TESTFILE}")
ADD_TEST(${TESTFILE} ${PROJECT_SOURCE_DIR}/../../scripts/regtest.sh "${CMAKE_BINARY_DIR}/${EXECUTABLE_OUTPUT_PATH}/NonLinEl" "${TESTFILE}")
ENDFOREACH()

IF(NOT IFEM_INSTALL_PREFIX)
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ ADD_CUSTOM_TARGET(doc doxygen
# Regression tests
FILE(GLOB_RECURSE LINEL_TESTFILES "${PROJECT_SOURCE_DIR}/Apps/LinearElasticity/Test/*.reg")
FOREACH(TESTFILE ${LINEL_TESTFILES})
ADD_TEST(${TESTFILE} ${PROJECT_SOURCE_DIR}/test/regtest.sh "${CMAKE_BINARY_DIR}/${EXECUTABLE_OUTPUT_PATH}/LinEl" "${TESTFILE}")
ADD_TEST(${TESTFILE} ${PROJECT_SOURCE_DIR}/scripts/regtest.sh "${CMAKE_BINARY_DIR}/${EXECUTABLE_OUTPUT_PATH}/LinEl" "${TESTFILE}")
ENDFOREACH()

FILE(GLOB_RECURSE POISSON_TESTFILES "${PROJECT_SOURCE_DIR}/Apps/Poisson/Test/*.reg")
FOREACH(TESTFILE ${POISSON_TESTFILES})
ADD_TEST(${TESTFILE} ${PROJECT_SOURCE_DIR}/test/regtest.sh "${CMAKE_BINARY_DIR}/${EXECUTABLE_OUTPUT_PATH}/Poisson" "${TESTFILE}")
ADD_TEST(${TESTFILE} ${PROJECT_SOURCE_DIR}/scripts/regtest.sh "${CMAKE_BINARY_DIR}/${EXECUTABLE_OUTPUT_PATH}/Poisson" "${TESTFILE}")
ENDFOREACH()

IF(NOT IFEM_INSTALL_PREFIX)
Expand Down
33 changes: 33 additions & 0 deletions scripts/doregtests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# Convenience script that compiles and runs all regression tests

ROOT=`readlink -f $0`
ROOT=`dirname $ROOT`/..
PATHS=". Apps/Stokes Apps/FiniteDefElasticity"

rm -f $ROOT/failed.log

globres=0
for p in $PATHS
do
cd $ROOT/$p
mkdir Release-Testing
cd Release-Testing
cmake $ROOT/$p -DDISABLE_HDF5=1 -DCMAKE_BUILD_TYPE=Release -DIFEM_BUILD_TYPE=Release-Testing
make -j3
if ! make test
then
globres=1
fi
done

if test $globres -eq 1
then
echo "Some tests failed, see failed.log in root of repository for details"
fi

for p in $PATHS
do
rm $ROOT/$p/Release-Testing -rf
done
49 changes: 49 additions & 0 deletions scripts/regtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# This script performs a single regression.
# It is used by the 'make test' target in the buildsystems
# Usually you should use 'make test' rather than calling this script directly
#
# Parameters: $1 = Application binary
# $2 = Regression test file
#
# A regression test file is of the format:
# parameters to application
# blank line
# output from program to compare to

mysim=$1

cd `dirname $2`
readarray < $2
$mysim $MAPFILE 2>&1 > templog
globres=1
IFS=$'\n'
for line in `cat $2`
do
test -z "$line" && continue
echo "$line" | grep -q ".inp" && continue
result=0
if grep -q "$line" templog
then result=1
fi
if test $result -eq 0
then
if test $globres -eq 1
then
echo "-------- $2 --------" >> ../../../failed.log
fi
globres=0
echo Failed to find output: $line >> ../../../failed.log
fi
done

if test $globres -eq 0
then
cat templog >> ../../../failed.log
rm templog
exit 1
fi

rm templog
exit 0
File renamed without changes.

0 comments on commit e4ac10a

Please sign in to comment.