forked from Percona-QA/percona-qa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pquery-clean-known.sh
executable file
·67 lines (57 loc) · 2.28 KB
/
pquery-clean-known.sh
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
#!/bin/bash
# Created by Roel Van de Paar, Percona LLC
# This script deletes all known found bugs from a pquery work directory. Execute from within the pquery workdir.
# Internal variables
SCRIPT_PWD=$(cd `dirname $0` && pwd)
# Check if this an automated (pquery-reach.sh) run
if [ "$1" == "reach" ]; then
REACH=1 # Minimal output, and no 2x enter required
else
REACH=0 # Normal output
fi
# Check if this is a pxc run
if [ "$(grep 'PXC Mode:' ./pquery-run.log 2> /dev/null | sed 's|^.*PXC Mode[: \t]*||' )" == "TRUE" ]; then
PXC=1
else
PXC=0
fi
# Check if this is a group replication run
if [ "$(grep 'Group Replication Mode:' ./pquery-run.log 2> /dev/null | sed 's|^.*Group Replication Mode[: \t]*||')" == "TRUE" ]; then
GRP_RPL=1
else
GRP_RPL=0
fi
# Current location checks
if [ `ls ./*/*.sql 2>/dev/null | wc -l` -eq 0 ]; then
echo "Assert: no pquery trials (with logging - i.e. ./*/*.sql) were found in this directory"
exit 1
fi
if [[ ${PXC} -eq 1 || ${GRP_RPL} -eq 1 ]]; then
cat ${SCRIPT_PWD}/known_bugs.strings > /tmp/pquery_known_bugs
cat ${SCRIPT_PWD}/known_bugs_pxc.strings >> /tmp/pquery_known_bugs
STRINGS_FILE=/tmp/pquery_known_bugs
else
STRINGS_FILE=${SCRIPT_PWD}/known_bugs.strings
fi
while read line; do
STRING="`echo "$line" | sed 's|[ \t]*##.*$||'`"
if [ "`echo "$STRING" | sed 's|^[ \t]*$||' | grep -v '^[ \t]*#'`" != "" ]; then
if [ `ls reducer[0-9]* 2>/dev/null | wc -l` -gt 0 ]; then
if [[ ${PXC} -eq 1 || ${GRP_RPL} -eq 1 ]]; then
grep -li "${STRING}" reducer[0-9]* | sed 's/[^0-9.]*\([0-9.]*\).*/\1/' | xargs -I_ $SCRIPT_PWD/pquery-del-trial.sh _
else
grep -li "${STRING}" reducer[0-9]* | sed 's/[^0-9]//g' | xargs -I_ $SCRIPT_PWD/pquery-del-trial.sh _
fi
fi
fi
#sync; sleep 0.02 # Making sure that next line in file does not trigger same deletions
done < ${STRINGS_FILE}
# Other cleanups
grep "CT NAME_CONST('a', -(1 [ANDOR]\+ 2)) [ANDOR]\+ 1" */log/master.err 2>/dev/null | sed 's|/.*||' | xargs -I{} ~/percona-qa/pquery-del-trial.sh {} #http://bugs.mysql.com/bug.php?id=81407
if [ ${REACH} -eq 0 ]; then # Avoid normal output if this is an automated run (REACH=1)
if [ -d ./bundles ]; then
echo "Done! Any trials in ./bundles were not touched. Any Valgrind trials were not touched."
else
echo "Done!"
fi
fi