]> git.ipfire.org Git - thirdparty/pdns.git/blob - regression-tests/mysqldiff
Merge pull request #785 from zeha/f/init.d-fixup
[thirdparty/pdns.git] / regression-tests / mysqldiff
1 #!/bin/bash
2
3 [ -z "$GMYSQLDB" ] && GMYSQLDB=pdnstest
4 [ -z "$GMYSQLUSER" ] && GMYSQLUSER=root
5 [ -z "$GMYSQLHOST" ] && GMYSQLHOST=localhost
6 [ -z "$GMYSQLPASSWD" ] && GMYSQLPASSWD=''
7
8 step="step.$1"
9 [ -z "$1" ] && step="start"
10 comment=$2
11 [ -z "$comment" ] && comment="No comment"
12 diffto="step.$3"
13 [ -z "$3" ] && diffto="start"
14
15 if [ "${context: -9}" = "-nodnssec" ]
16 then
17 mysql --user="$GMYSQLUSER" --password="$GMYSQLPASSWD" --host="$GMYSQLHOST" \
18 "$GMYSQLDB" \
19 -e "SELECT r.name, r.type, r.prio, r.content, r.ttl FROM domains d JOIN records r ON d.id=r.domain_id WHERE d.name='test.dyndns' AND(r.type != 'SOA' OR r.type IS NULL) ORDER BY r.name, r.type, r.content, r.ttl, r.prio" > ${testsdir}/${testname}/$step
20 else
21 mysql --user="$GMYSQLUSER" --password="$GMYSQLPASSWD" --host="$GMYSQLHOST" \
22 "$GMYSQLDB" \
23 -e "SELECT r.name, r.type, r.prio, r.content, r.ttl, CONCAT('''', CONCAT(r.ordername, '''')), r.auth FROM domains d JOIN records r ON d.id=r.domain_id WHERE d.name='test.dyndns' AND(r.type != 'SOA' OR r.type IS NULL) ORDER BY r.name, r.type, r.content, r.ttl, r.prio" > ${testsdir}/${testname}/$step
24 fi
25
26 if [ ! "$step" == "start" ]
27 then
28 echo -e "$comment\n--- Start: diff $diffto $step ---"
29 diff ${testsdir}/${testname}/$diffto ${testsdir}/${testname}/$step | sed '/^[0-9a-z,/-]*$/d' | sort -V
30 if [ ${PIPESTATUS[0]} -eq 0 ]
31 then
32 echo "no difference"
33 fi
34 echo -e "--- End: diff $diffto $step ---\n"
35 fi