Docker local testing of 4 distributions.

master
Julian M. Kunkel 2018-07-07 00:10:58 +01:00
parent 2148f68d36
commit de1d3ff266
13 changed files with 272 additions and 3 deletions

View File

@ -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/

View File

@ -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))
}

10
testing/docker/README.md Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
testing/docker/prepare.sh Executable file
View File

@ -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
testing/docker/run-all-tests.sh Executable file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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