forked from xtreemfs/xtreemfs-docker-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-distribution.sh
executable file
·55 lines (39 loc) · 1.09 KB
/
test-distribution.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/distributions
CONTAINER_NAME="test-container"
DISTRIBUTION_DIR=$1
if [ "${DISTRIBUTION_DIR:0:6}" = "debian" ] ; then
docker pull debian
fi
if [ "${DISTRIBUTION_DIR:0:6}" = "ubuntu" ] ; then
docker pull ubuntu
fi
if [ "${DISTRIBUTION_DIR:0:6}" = "fedora" ] ; then
docker pull fedora
fi
if [ "${DISTRIBUTION_DIR:0:6}" = "centos" ] ; then
docker pull centos
fi
if [ "${DISTRIBUTION_DIR:0:8}" = "opensuse" ] ; then
docker pull opensuse
fi
ret=0
failed=""
# copy test.sh
cp test.sh $DIR/$DISTRIBUTION_DIR
# build docker image
docker build -t scalaris/$DISTRIBUTION_DIR $DIR/$DISTRIBUTION_DIR
# run docker container
docker run --name=$CONTAINER_NAME --privileged scalaris/$DISTRIBUTION_DIR ./test.sh
if [ $? -ne 0 ]; then
ret=`expr $ret + 1`
echo "$DISTRIBUTION_DIR test failed!"
failed=$(printf "%s\n%s" "$failed" "$DISTRIBUTION_DIR")
fi
#remove container and image
docker rm $CONTAINER_NAME
docker rmi scalaris/$DISTRIBUTION_DIR
if [ $ret -ne 0 ]; then
echo "The following tests failed: $failed"
fi
exit $ret