1
by brian
clean slate |
1 |
#! /bin/sh
|
2 |
||
3 |
# This script is a hack for lazy developers who want to get a quick
|
|
4 |
# start on the result file. The code here is rather dirty, but it works
|
|
5 |
# If you have a spare moment feel free to improve it - the right way is
|
|
6 |
# to start mysqld yourself and run mysqltest -r
|
|
7 |
||
8 |
RESULT_DIR=r |
|
9 |
if [ -z "$EDITOR" ] ; then |
|
10 |
EDITOR=vi |
|
11 |
fi
|
|
12 |
||
13 |
function die() |
|
14 |
{
|
|
15 |
echo $1 |
|
16 |
exit 1 |
|
17 |
}
|
|
18 |
||
19 |
function usage() |
|
20 |
{
|
|
21 |
echo "Usage: $0 test_name" |
|
22 |
exit 1 |
|
23 |
}
|
|
24 |
||
25 |
test_name=$1 |
|
26 |
||
27 |
[ -z "$test_name" ] && usage |
|
28 |
||
29 |
result_file=$RESULT_DIR/$test_name.result |
|
30 |
reject_file=$RESULT_DIR/$test_name.reject |
|
31 |
||
32 |
[ -f $result_file ] && die "result file $result_file has already been created" |
|
33 |
||
34 |
touch $result_file
|
|
35 |
echo "Running the test case against empty file, will fail, but don't worry" |
|
36 |
./mysql-test-run --local $test_name
|
|
37 |
||
38 |
if [ -f $reject_file ] ; then |
|
39 |
echo "Below are the contents of the reject file:" |
|
40 |
echo "-----start---------------------" |
|
41 |
cat $reject_file
|
|
42 |
echo "-----end-----------------------" |
|
43 |
echo "Is this the output you expected from your test case?(y/n)[n]" |
|
44 |
read yes_no
|
|
45 |
if [ x$yes_no = xy ] ; then |
|
46 |
echo "Press any key to edit it in $EDITOR, or Ctrl-C to abort" |
|
47 |
read junk
|
|
48 |
$EDITOR $reject_file |
|
49 |
edited="edited" |
|
50 |
fi
|
|
51 |
echo "Save $edited file as master result? (y/n)[y]" |
|
52 |
read yes_no
|
|
53 |
if [ x$yes_no != xn ]; then |
|
54 |
mv $reject_file $result_file |
|
55 |
fi
|
|
56 |
else
|
|
57 |
echo "Your test failed so bad, it did not even produce a reject file" |
|
58 |
echo "You need to fix your bugs in the test case, the code, or both" |
|
59 |
exit 1 |
|
60 |
fi
|
|
61 |
||
62 |
||
63 |
||
64 |
||
65 |