The bug766033.sh test is not portable

Reported by Alexey Kopytov on 2012-05-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona XtraBackup
Low
Alexey Kopytov
2.0
Low
Alexey Kopytov
2.1
Low
Alexey Kopytov

Bug Description

The bug766039.sh test introduced with https://code.launchpad.net/~sergei.glushchenko/percona-xtrabackup/bug766033-filename-error/+merge/96043 has a number of portability issues:

- the values for 'count' and 'seek' are in 512-byte units. So we actually write 8 MB of zeroes starting with the 512 KB offset. Is that intentional?

- On *BSD and OSX "wc" has a different output format (the number is prepended with a tab character). But the next check compares "$COUNT" and "1" as strings rather than numbers. So that expression is always false. Besides, we don't really need the count of matched lines, all we need is the grep exit code (i.e. if there was at least one matching line).

So this:

> set +e
> COUNT=`xtrabackup --backup --datadir=$mysql_datadir --target-dir=$topdir/backup 2>&1 \
> | grep "File ./sakila/rental.ibd seems to be corrupted" | wc -l `
> set -e
>
> if [ "$COUNT" != "1" ] ; then
> vlog "test failed"
> exit 1
> fi

is equivalent to the following 2 lines that are also more portable:

> run_cmd_expect_failure $XB_BIN $XB_ARGS --backup --datadir=$mysql_datadir \
> --target-dir=$topdir/backup
> grep -q "File ./sakila/rental.ibd seems to be corrupted" $OUTFILE

summary: - The bug766039.sh test is not portable
+ The bug766033.sh test is not portable
Alexey Kopytov (akopytov) wrote :

Reassigning to myself as this bug blocks my testing of replication support in the test suite.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers