Skip to content

Commit b75fd32

Browse files
speedup test in docker (#524)
1 parent f9349e8 commit b75fd32

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

Dockerfile-test

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ RUN MAIN_VERSION=$(cat /etc/alpine-release | cut -d '.' -f 0-2) \
1010
} >> /etc/apk/repositories \
1111
&& apk add --update --no-cache make \
1212
&& apk add --update --no-cache gcc \
13-
&& apk add --update --no-cache g++
13+
&& apk add --update --no-cache g++ \
14+
&& apk add --update --no-cache bash
1415

15-
ENTRYPOINT ["make"]
16+
ENTRYPOINT ["/matrixcube/test_loop.sh"]
1617

1718

test.sh

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
11
#!/bin/bash
2-
doTesting(){
3-
base=$1
4-
dir=$2
5-
for i in {1..50000}
6-
do
7-
rm -rf $dir/tmp
8-
docker run -e RACE=1 -e MallocNanoZone=0 -e MEMFS_TEST=1 -i --rm -v $dir/tmp:/tmp -v $base:/matrixcube matrixorigin/matrixcube-test all-tests > $dir/test.log
9-
v=`tail -n 1 $dir/test.log | awk {'print $1'}`
10-
if [ "$v" != "ok" ]
11-
then
12-
mv $dir/test.log $dir/test-$i.log
13-
echo "$i: error" >> $dir/result.log
14-
else
15-
echo "$i: ok" >> $dir/result.log
16-
fi
17-
done
18-
}
19-
202
rm -rf $PWD/tests
213
docker system prune -f
224
for i in `seq 1 $1`
235
do
24-
mkdir -p $PWD/tests/$i
25-
doTesting $PWD $PWD/tests/$i &
6+
mkdir -p $PWD/tests/$i/tmp
7+
docker run -e RACE=1 -e MallocNanoZone=0 -e MEMFS_TEST=1 -i --rm --name=cube-test-$i -v $PWD/tests/$i/tmp:/tmp -v $PWD:/matrixcube matrixorigin/matrixcube-test $i $2 &
268
done

test_loop.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
dir=./tests/$1
3+
for i in `seq 1 $2`
4+
do
5+
rm -rf /tmp/cube/*
6+
make all-tests > $dir/test.log
7+
v=`tail -n 1 $dir/test.log | awk {'print $1'}`
8+
if [ "$v" != "ok" ]
9+
then
10+
mv $dir/test.log $dir/test-$i.log
11+
echo "$i: error" >> $dir/result.log
12+
else
13+
echo "$i: ok" >> $dir/result.log
14+
fi
15+
done

0 commit comments

Comments
 (0)