Skip to content

Commit

Permalink
Docker local testing of 4 distributions.
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianKunkel committed Jul 6, 2018
1 parent 2148f68 commit de1d3ff
Show file tree
Hide file tree
Showing 13 changed files with 272 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
3 changes: 1 addition & 2 deletions testing/basic-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
}

Expand Down
10 changes: 10 additions & 0 deletions testing/docker/README.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions testing/docker/centos6/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
44 changes: 44 additions & 0 deletions testing/docker/centos6/run-test.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions testing/docker/centos7/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions testing/docker/centos7/run-test.sh
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions testing/docker/prepare.sh
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions testing/docker/run-all-tests.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions testing/docker/ubuntu14.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions testing/docker/ubuntu14.04/run-test.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions testing/docker/ubuntu16.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
44 changes: 44 additions & 0 deletions testing/docker/ubuntu16.04/run-test.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit de1d3ff

Please sign in to comment.