var scope reduction
[trinity.git] / scripts / test-multi.sh
blobcf6d822cf739e4992bd9a7fa47671c9c538f87d9
1 #!/bin/bash
3 OLDPATH=$(pwd)
4 TRINITY_PATH=${TRINITY_PATH:-$OLDPATH}
6 if [ -d tmp ]; then
7 TRINITY_TMP=$(mktemp -d $(pwd)/tmp/trinity.XXXXXX)
8 else
9 TRINITY_TMP=$(mktemp -d /tmp/trinity.XXXXXX)
12 if [ $(/usr/bin/id -u) -eq 0 ] ; then
13 DROPPRIVS=--dropprivs
14 else
15 DROPPRIVS=""
18 check_tainted()
20 if [ "$(cat /proc/sys/kernel/tainted)" != $TAINT ]; then
21 echo ERROR: Taint flag changed $(cat /proc/sys/kernel/tainted)
22 exit
26 chmod 755 $TRINITY_TMP
27 cd $TRINITY_TMP
29 TAINT=$(cat /proc/sys/kernel/tainted)
31 NR_CPUS=`grep ^processor /proc/cpuinfo | /usr/bin/wc -l`
32 NR_PROCESSES=$(($NR_CPUS * 2))
34 while [ 1 ];
36 rm -f trinity
37 cp $TRINITY_PATH/trinity .
38 chmod -w trinity
40 chmod 755 $TRINITY_TMP
41 if [ -d tmp ]; then
42 chmod 755 tmp
43 rm -rf tmp
45 mkdir -p tmp
46 pushd tmp > /dev/null
48 rm -f trinity.socketcache
50 MALLOC_CHECK_=2 ../trinity -q -l off -C $NR_PROCESSES $DROPPRIVS
52 popd > /dev/null
54 check_tainted
56 done