~tsarev/percona-server/5.1-install_tests_fix-790199

« back to all changes in this revision

Viewing changes to install_tests.sh

  • Committer: Oleg Tsarev
  • Date: 2011-05-27 02:27:36 UTC
  • mto: (226.2.5 revert)
  • mto: This revision was merged to the branch mainline in revision 231.
  • Revision ID: oleg.tsarev@percona.com-20110527022736-0ekwi8ykestnrr6s
BEFORE-FIX behaviour: ,/install_tests.sh always install all files from mysql-test/
AFTER-FIX behavior: ./install_tests.sh install tests just for patches listed in "series" file and from mysql-test/.
For every "name.patch" patch we have directory "mysql-test/name.patch/" with tests for this patch.
This script help to maintain patches, merge between different versions, backport patches with tests and so one.
My change fix bug #782391
Also script print statistics of patch applying.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
 
3
 
set -ue
 
3
set -u
4
4
 
5
5
MYSQL_VERSION="$(grep ^MYSQL_VERSION= "Makefile" \
6
6
    | cut -d = -f 2)"
7
7
export PERCONA_SERVER="Percona-Server-$MYSQL_VERSION"
8
8
 
 
9
install_file_type()
 
10
{
 
11
    for file in `ls $1/*.$2 2>/dev/null`; do
 
12
        test -f $file && install -m 644 $file ${PERCONA_SERVER}/mysql-test/$3
 
13
    done;
 
14
}
 
15
do_install_path()
 
16
{
 
17
    install_file_type $1 test t
 
18
    install_file_type $1 opt t
 
19
    install_file_type $1 result r
 
20
    install_file_type $1 require r
 
21
    install_file_type $1 inc include
 
22
}
9
23
install_path()
10
24
{
11
 
    echo "Installing mysql-test files: $2"
12
 
    find $1 -iname '*.test' -exec install -m 644 {} ${PERCONA_SERVER}/mysql-test/t/ ';'
13
 
    find $1 -iname '*.opt' -exec install -m 644 {} ${PERCONA_SERVER}/mysql-test/t/ ';'
14
 
    find $1 -iname '*.result' -exec install -m 644 {} ${PERCONA_SERVER}/mysql-test/r/ ';'
15
 
    find $1 -iname '*.require' -exec install -m 644 {} ${PERCONA_SERVER}/mysql-test/r/ ';'
16
 
    find $1 -iname '*.inc' -exec install -m 644 {} ${PERCONA_SERVER}/mysql-test/include/ ';'
 
25
    echo "[$3/$4] Installing mysql-test files: $2"
 
26
    test -d $1 && do_install_path $1 $2
17
27
}
18
 
 
19
 
install_path mysql-test "global"
 
28
let current=1;
 
29
count=`wc -l series`;
 
30
install_path mysql-test "global" $current $count
20
31
for test_name in `cat series`; do
21
 
    test -d mysql-test/$test_name && install_path mysql-test/$test_name $test_name
 
32
    let current=$current+1;
 
33
    install_path mysql-test/$test_name $test_name $current $count
22
34
done
23
35
echo "Done"