test.sh
4.13 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
function checksum_test001() {
for i in 000 001 002 003 010 011 015 027 029 033 200; do
mysql -B -e "CHECKSUM TABLE test${i}" test001 | grep -v -i checksum
done
}
function checksum_test002() {
for i in 201; do
mysql --default-character-set=utf8mb4 -B -e "CHECKSUM TABLE test${i}" test002 | grep -v -i checksum
done
}
function checksum_test005() {
for i in 000; do
mysql -B -e "CHECKSUM TABLE test${i}" test001 | grep -v -i checksum
done
}
for i in $(seq 0 20) ; do
ret[$i]=0
done
index=0
mysql -e "CREATE USER 'travis'@'localhost' IDENTIFIED BY '';" 2> /dev/null
mysql -e "CREATE DATABASE test001;" 2> /dev/null
mysql -e "CREATE DATABASE test002;" 2> /dev/null
mysql -e "CREATE DATABASE test005;" 2> /dev/null
mysql -e "CREATE DATABASE test006a;" 2> /dev/null
mysql -e "CREATE DATABASE test006b;" 2> /dev/null
mysql -e "GRANT ALL PRIVILEGES ON test001.* TO 'travis'@'localhost';" 2> /dev/null
mysql -e "GRANT SELECT ON mysql.proc to 'travis'@'localhost';" 2> /dev/null
mysql -e "GRANT ALL PRIVILEGES ON test002.* TO 'travis'@'localhost';" 2> /dev/null
mysql -e "GRANT ALL PRIVILEGES ON test005.* TO 'travis'@'localhost';" 2> /dev/null
mysql -e "GRANT ALL PRIVILEGES ON test006a.* TO 'travis'@'localhost';" 2> /dev/null
mysql -e "GRANT ALL PRIVILEGES ON test00ba.* TO 'travis'@'localhost';" 2> /dev/null
mysql -e "FLUSH PRIVILEGES;" 2> /dev/null
mysql -uroot < test001.src.sql; ret[((index++))]=$?
mysql -uroot --default-character-set=utf8mb4 < test002.src.sql; ret[((index++))]=$?
mysql -uroot < test005.src.sql; ret[((index++))]=$?
mysql -uroot < test006.src.sql; ret[((index++))]=$?
checksum_test001 > test001.src.checksum
checksum_test002 > test002.src.checksum
checksum_test005 > test005.src.checksum
mysqldump -uroot test001 \
--no-autocommit \
--extended-insert=false \
--hex-blob=true \
--routines=true \
> mysqldump_test001.sql
ret[((index++))]=$?
mysqldump -uroot test002 \
--no-autocommit \
--extended-insert=false \
--hex-blob=true \
--default-character-set=utf8mb4 \
> mysqldump_test002.sql
ret[((index++))]=$?
mysqldump -uroot test005 \
--no-autocommit \
--extended-insert=false \
--hex-blob=true \
> mysqldump_test005.sql
ret[((index++))]=$?
php test.php
ret[((index++))]=$?
mysql -uroot test001 < mysqldump-php_test001.sql
ret[((index++))]=$?
mysql -uroot test002 < mysqldump-php_test002.sql
ret[((index++))]=$?
mysql -uroot test005 < mysqldump-php_test005.sql
ret[((index++))]=$?
mysql -uroot test006b < mysqldump-php_test006.sql
ret[((index++))]=$?
checksum_test001 > mysqldump-php_test001.checksum
checksum_test002 > mysqldump-php_test002.checksum
checksum_test005 > mysqldump-php_test005.checksum
cat test001.src.sql | grep ^INSERT > test001.filtered.sql
cat test002.src.sql | grep ^INSERT > test002.filtered.sql
cat test005.src.sql | grep ^INSERT > test005.filtered.sql
cat mysqldump_test001.sql | grep ^INSERT > mysqldump_test001.filtered.sql
cat mysqldump_test002.sql | grep ^INSERT > mysqldump_test002.filtered.sql
cat mysqldump_test005.sql | grep ^INSERT > mysqldump_test005.filtered.sql
cat mysqldump-php_test001.sql | grep ^INSERT > mysqldump-php_test001.filtered.sql
cat mysqldump-php_test002.sql | grep ^INSERT > mysqldump-php_test002.filtered.sql
cat mysqldump-php_test005.sql | grep ^INSERT > mysqldump-php_test005.filtered.sql
diff test001.filtered.sql mysqldump_test001.filtered.sql
ret[((index++))]=$?
diff test002.filtered.sql mysqldump_test002.filtered.sql
ret[((index++))]=$?
diff test001.filtered.sql mysqldump-php_test001.filtered.sql
ret[((index++))]=$?
diff test002.filtered.sql mysqldump-php_test002.filtered.sql
ret[((index++))]=$?
diff test001.src.checksum mysqldump-php_test001.checksum
ret[((index++))]=$?
diff test002.src.checksum mysqldump-php_test002.checksum
ret[((index++))]=$?
diff test005.src.checksum mysqldump-php_test005.checksum
ret[((index++))]=$?
diff mysqldump_test005.filtered.sql mysqldump-php_test005.filtered.sql
ret[((index++))]=$?
rm *.checksum 2> /dev/null
rm *.filtered.sql 2> /dev/null
rm mysqldump* 2> /dev/null
echo "Done $index tests"
total=0
for i in $(seq 0 20) ; do
total=$((${ret[$i]} + $total))
done
echo "Exiting with code $total"
exit $total