summaryrefslogtreecommitdiff
path: root/storage/tokudb/scripts/test.mysql.bash
blob: 5c389e05f3fcc1d66fdda3546dc3c4149eb81cf1 (plain)
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
#!/usr/bin/env bash

function usage() {
    echo "run the mysql tests"
    echo "--mysqlbuild=$mysqlbuild --tests=$tests"
}

function expand() {
    echo $* | tr ,: " "
}

mysqlbuild=
mysqlsocket=/tmp/mysql.sock
gearmandir=/usr/local/gearmand-1.1.6
gearmandhost=localhost
system=$(uname -s | tr [:upper:] [:lower:])
arch=$(uname -m | tr [:upper:] [:lower:])
tests=run.mysql.tests.bash

while [ $# -gt 0 ] ; do
    arg=$1; shift
    if [[ $arg =~ --(.*)=(.*) ]] ; then
	eval ${BASH_REMATCH[1]}=${BASH_REMATCH[2]}
    else
	usage; exit 1;
    fi
done

if [ -z $mysqlbuild ] ; then exit 1; fi

for testname in $(expand $tests) ; do
    if [ $testname = "run.mysql.tests.bash" ] ; then
	run_mysqld=0
    else
	run_mysqld=1
    fi
    if [ $run_mysqld = 0 ] ; then
	setupextra="--shutdown=1 --install=1 --startup=0"
    else
	setupextra="--shutdown=1 --install=1 --startup=1"
    fi
    echo "echo \$(date) $mysqlbuild >>/tmp/$(whoami).$testname.trace 2>&1; \
          \$HOME/bin/setup.mysql.bash --mysqlbuild=$mysqlbuild $setupextra >>/tmp/$(whoami).$testname.trace 2>&1; \
          testexitcode=\$?; \
          echo \$(date) $mysqlbuild \$testexitcode >>/tmp/$(whoami).$testname.trace 2>&1; \
          if [ \$testexitcode -ne 0 ] ; then exit 1; fi; \
          \$HOME/bin/$testname --mysqlbuild=$mysqlbuild --commit=1 >>/tmp/$(whoami).$testname.trace 2>&1; \
	  if [ $run_mysqld != 0 ] ; then mysqladmin -S$mysqlsocket shutdown; fi" | $gearmandir/bin/gearman -b -f mysql-test-$system-$arch -h $gearmandhost -p 4730
done

exit 0