1#!/bin/bash
2
3#
4# Note that this test expact that there are tables test1 and test2 in
5# the current directory where test2 has also a .frm file
6#
7
8TMPDIR=tmpdir
9LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/
10
11my_cmp()
12{
13    if ! cmp $1 $TMPDIR/$1
14    then
15        echo "aborting"
16        exit 1;
17    fi
18}
19
20run_test()
21{
22    OPT=$1;
23    echo "******* Running test with options '$OPT' **********"
24    rm -rf $TMPDIR
25    mkdir $TMPDIR
26    cp test?.* $TMPDIR
27    if ! ./aria_s3_copy --op=to --force $OPT test1 test2
28    then
29        echo Got error $?
30        exit 1;
31    fi
32    rm test?.*
33    if ! ./aria_s3_copy --op=from $OPT test1 test2
34    then
35        echo Got error $?
36        exit 1;
37    fi
38    if ! ./aria_s3_copy --op=delete $OPT test1 test2
39    then
40        echo Got error $?
41        exit 1;
42    fi
43    my_cmp test1.MAI
44    my_cmp test1.MAD
45    my_cmp test2.MAI
46    my_cmp test2.MAD
47    my_cmp test2.frm
48    rm test?.*
49    cp $TMPDIR/* .
50    rm -r $TMPDIR
51}
52
53run_test ""
54run_test "--s3_block_size=64K --compress"
55run_test "--s3_block_size=4M"
56echo "ok"
57