-
Notifications
You must be signed in to change notification settings - Fork 2
/
test-distributions.sh
executable file
·49 lines (37 loc) · 1.16 KB
/
test-distributions.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
#!/bin/bash
# usage: ./test-distributions.sh [ all| [distribution]* ]
# default: ./test.distibutions.sh all
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/distributions
CONTAINER_NAME="test-container"
# prepare distribution dirs
if [[ "$1" == "all" || "$1" == "" ]]; then
DISTRIBUTION_DIRS=$(ls $DIR | grep "xtreemfs-")
else
for i in $*; do DISTRIBUTION_DIRS="$DISTRIBUTION_DIRS $(ls $DIR | grep "xtreemfs-$i")"; done
fi
docker pull ubuntu
docker pull opensuse
docker pull centos
docker pull fedora
docker pull debian
ret=0
failed=""
#run containers
for DISTRIBUTION_DIR in $DISTRIBUTION_DIRS; do
# build docker image
docker build -t xtreemfs/$DISTRIBUTION_DIR $DIR/$DISTRIBUTION_DIR
# run docker container
docker run --name=$CONTAINER_NAME --privileged xtreemfs/$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 xtreemfs/$DISTRIBUTION_DIR
done
if [ $ret -ne 0 ]; then
echo "The following tests failed: $failed"
fi
exit $ret