diff --git a/README.md b/README.md index 6cfa992..dd9ee1e 100755 --- a/README.md +++ b/README.md @@ -22,4 +22,8 @@ See also NOTES.txt 3. Optionally, run "make install". The installation prefix can be changed as an option to the "configure" script. -4. To run basic functionality tests that we use for continuous integration, see ./testing/ +# Testing + + * To run basic functionality tests that we use for continuous integration, see ./testing/ + * There are docker scripts provided to test various distributions at once. + * See ./testing/docker/ diff --git a/testing/basic-tests.sh b/testing/basic-tests.sh index ecc7f68..4575c7e 100755 --- a/testing/basic-tests.sh +++ b/testing/basic-tests.sh @@ -12,7 +12,6 @@ IOR_OUT=${IOR_OUT:-./build/test} IOR_EXTRA=${IOR_EXTRA:-./build/test} # Add global options like verbosity ################################################################################ - mkdir -p ${IOR_OUT} ## Sanity check @@ -38,7 +37,7 @@ function TEST(){ else echo -n "OK " fi - echo " ${IOR_OUT}/${I} ${IOR_MPIRUN} ${@}" + echo " ${IOR_OUT}/${I} ${IOR_MPIRUN} -o /dev/shm/ior ${@}" I=$((${I}+1)) } diff --git a/testing/docker/README.md b/testing/docker/README.md new file mode 100644 index 0000000..5467285 --- /dev/null +++ b/testing/docker/README.md @@ -0,0 +1,10 @@ +# Docker enabled testing + +This directory contains scripts to run the IOR benchmark testing in various Docker images. +This allows for testing several distributions on a developer machine. + +To setup your test systems run: + ./prepare.sh + +To run all tests for all variants use + ./run-all-tests.sh diff --git a/testing/docker/centos6/Dockerfile b/testing/docker/centos6/Dockerfile new file mode 100644 index 0000000..30712ce --- /dev/null +++ b/testing/docker/centos6/Dockerfile @@ -0,0 +1,5 @@ +FROM centos:6 + +WORKDIR /data +RUN yum install -y mpich openmpi git pkg-config nano gcc bzip2 patch gcc-c++ make mpich-devel openmpi-devel +RUN yum install -y sudo diff --git a/testing/docker/centos6/run-test.sh b/testing/docker/centos6/run-test.sh new file mode 100755 index 0000000..387997c --- /dev/null +++ b/testing/docker/centos6/run-test.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +BUILD="$1" +if [[ $UID == 0 ]]; then + groupadd -g $3 testuser + useradd -r -u $2 -g testuser testuser + sudo -u testuser $0 $1 + exit $? +fi + +ERROR=0 + +function runTest(){ + P=$PATH + FLAVOR="$1" + MPI_DIR="$2" + export IOR_MPIRUN="$3" + + echo $FLAVOR in $BUILD/$FLAVOR + export PATH=$MPI_DIR/bin:$PATH + mkdir -p $BUILD/$FLAVOR + + pushd $BUILD/$FLAVOR > /dev/null + /data/configure || exit 1 + make || exit 1 + + cd /data/ + export IOR_EXEC=$BUILD/$FLAVOR/src/ior + export IOR_OUT=$BUILD/$FLAVOR/test + ./testing/basic-tests.sh + + ERROR=$(($ERROR + $?)) + popd > /dev/null + PATH=$P +} + + +runTest openmpi /usr/lib64/openmpi/ "mpiexec -n" +export MPI_ARGS="" +runTest mpich /usr/lib64/mpich "mpiexec -n" + +#kill -9 %1 + +exit $ERROR diff --git a/testing/docker/centos7/Dockerfile b/testing/docker/centos7/Dockerfile new file mode 100644 index 0000000..db70df4 --- /dev/null +++ b/testing/docker/centos7/Dockerfile @@ -0,0 +1,5 @@ +FROM centos:7 + +WORKDIR /data +RUN yum install -y mpich openmpi git pkg-config nano gcc bzip2 patch gcc-c++ make mpich-devel openmpi-devel +RUN yum install -y sudo diff --git a/testing/docker/centos7/run-test.sh b/testing/docker/centos7/run-test.sh new file mode 100755 index 0000000..088fcb0 --- /dev/null +++ b/testing/docker/centos7/run-test.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +BUILD="$1" + +if [[ $UID == 0 ]]; then + groupadd -g $3 testuser + useradd -r -u $2 -g testuser testuser + sudo -u testuser $0 $1 + exit $? +fi + +ERROR=0 + +function runTest(){ + P=$PATH + FLAVOR="$1" + MPI_DIR="$2" + + echo $FLAVOR in $BUILD/$FLAVOR + mkdir -p $BUILD/$FLAVOR + + pushd $BUILD/$FLAVOR > /dev/null + + export PATH=$MPI_DIR/bin:$PATH + /data/configure || exit 1 + make || exit 1 + + cd /data/ + export IOR_EXEC=$BUILD/$FLAVOR/src/ior + export IOR_OUT=$BUILD/$FLAVOR/test + ./testing/basic-tests.sh + + ERROR=$(($ERROR + $?)) + popd > /dev/null + PATH=$P +} + + +runTest openmpi /usr/lib64/openmpi/ +runTest mpich /usr/lib64/mpich + +exit $ERROR diff --git a/testing/docker/prepare.sh b/testing/docker/prepare.sh new file mode 100755 index 0000000..c8ed22b --- /dev/null +++ b/testing/docker/prepare.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +echo "Checking docker" +docker ps +if [ $? != 0 ] ; then + echo "Error, cannot run docker commands" + groups |grep docker || echo "You are not in the docker group !" + exit 1 +fi + +echo "Building docker containers" + +for IMAGE in $(find -type d | cut -b 3- |grep -v "^$") ; do + docker build -t hpc/ior:$IMAGE $IMAGE + if [ $? != 0 ] ; then + echo "Error building image $IMAGE" + exit 1 + fi +done diff --git a/testing/docker/run-all-tests.sh b/testing/docker/run-all-tests.sh new file mode 100755 index 0000000..30d2deb --- /dev/null +++ b/testing/docker/run-all-tests.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# This script runs the testscript for all supported docker images + +TARGET=../../build-docker +mkdir -p $TARGET + +ARGS="$@" +GID=$(id -g $USER) +OPT="-it --rm -v $PWD/../../:/data/" +ERROR=0 +VERBOSE=0 + +set -- `getopt -u -l "clean" -l verbose -o "" -- "$ARGS"` +test $# -lt 1 && exit 1 +while test $# -gt 0 +do + case "$1" in + --clean) echo "Cleaning build dirs!"; rm -rf $TARGET/* ;; + --verbose) VERBOSE=1 ;; + --) ;; + *) echo "Unknown option $1"; exit 1;; + esac + shift +done + +for IMAGE in $(find -type d | cut -b 3- |grep -v "^$") ; do + echo "RUNNING $IMAGE" + mkdir -p $TARGET/$IMAGE + WHAT="docker run $OPT -h $IMAGE hpc/ior:$IMAGE /data/testing/docker/$IMAGE/run-test.sh /data/build-docker/$IMAGE $UID $GID" + if [[ $VERBOSE == 1 ]] ; then + echo $WHAT + fi + $WHAT 2>$TARGET/$IMAGE/LastTest.log 1>&2 + ERR=$? + ERROR=$(($ERROR+$ERR)) + if [[ $ERR != 0 ]]; then + echo $WHAT + echo "Error, see $TARGET/$IMAGE/LastTest.log" + fi +done + +if [[ $ERROR != 0 ]] ; then + echo "Errors occured!" +else + echo "OK: all tests passed!" +fi diff --git a/testing/docker/ubuntu14.04/Dockerfile b/testing/docker/ubuntu14.04/Dockerfile new file mode 100644 index 0000000..735178b --- /dev/null +++ b/testing/docker/ubuntu14.04/Dockerfile @@ -0,0 +1,6 @@ +FROM ubuntu:14.04 + +WORKDIR /data +RUN apt-get update +RUN apt-get install -y libopenmpi-dev openmpi-bin mpich git pkg-config gcc-4.7 nano make +RUN apt-get install -y sudo diff --git a/testing/docker/ubuntu14.04/run-test.sh b/testing/docker/ubuntu14.04/run-test.sh new file mode 100755 index 0000000..b7084c5 --- /dev/null +++ b/testing/docker/ubuntu14.04/run-test.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +BUILD="$1" +if [[ $UID == 0 ]]; then + groupadd -g $3 testuser + useradd -r -u $2 -g testuser testuser + sudo -u testuser $0 $1 + exit $? +fi +ERROR=0 + +function runTest(){ + FLAVOR="$1" + MPI_DIR="$2" + echo $FLAVOR in $BUILD/$FLAVOR + update-alternatives --set mpi $MPI_DIR + mkdir -p $BUILD/$FLAVOR + + pushd $BUILD/$FLAVOR > /dev/null + /data/configure || exit 1 + make || exit 1 + + #define the alias + ln -sf $(which mpiexec.$FLAVOR) /usr/bin/mpiexec + + cd /data/ + export IOR_EXEC=$BUILD/$FLAVOR/src/ior + export IOR_OUT=$BUILD/$FLAVOR/test + ./testing/basic-tests.sh + + ERROR=$(($ERROR + $?)) + popd > /dev/null +} + +runTest openmpi /usr/lib/openmpi/include +runTest mpich /usr/include/mpich + +exit $ERROR diff --git a/testing/docker/ubuntu16.04/Dockerfile b/testing/docker/ubuntu16.04/Dockerfile new file mode 100644 index 0000000..2583a3a --- /dev/null +++ b/testing/docker/ubuntu16.04/Dockerfile @@ -0,0 +1,6 @@ +FROM ubuntu:16.04 + +WORKDIR /data +RUN apt-get update +RUN apt-get install -y libopenmpi-dev openmpi-bin mpich git pkg-config gcc-5 gcc-4.8 nano +RUN apt-get install -y sudo diff --git a/testing/docker/ubuntu16.04/run-test.sh b/testing/docker/ubuntu16.04/run-test.sh new file mode 100755 index 0000000..950bdaa --- /dev/null +++ b/testing/docker/ubuntu16.04/run-test.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +BUILD="$1" +if [[ $UID == 0 ]]; then + groupadd -g $3 testuser + useradd -r -u $2 -g testuser testuser + sudo -u testuser $0 $1 + exit $? +fi +groupadd -g $3 testuser +useradd -r -u $2 -g testuser testuser + +ERROR=0 + +function runTest(){ + FLAVOR="$1" + MPI_DIR="$2" + export IOR_MPIRUN="$3" + echo $FLAVOR in $BUILD/$FLAVOR + update-alternatives --set mpi $MPI_DIR + mkdir -p $BUILD/$FLAVOR + + pushd $BUILD/$FLAVOR > /dev/null + /data/configure || exit 1 + make || exit 1 + + #define the alias + ln -sf $(which mpiexec.$FLAVOR) /usr/bin/mpiexec + + cd /data/ + export IOR_EXEC=$BUILD/$FLAVOR/src/ior + export IOR_OUT=$BUILD/$FLAVOR/test + + ./testing/basic-tests.sh + + ERROR=$(($ERROR + $?)) + popd > /dev/null +} + +export MPI_ARGS="" +runTest openmpi /usr/lib/openmpi/include "mpiexec -n" +runTest mpich /usr/include/mpich "mpiexec -n" + +exit $ERROR