blob: 1228bd774b1a1149d4acf6378b1d0a5f007f1257 (
plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#!/bin/bash
CWD=`pwd`
CREATE="../tbdiff-create"
DEPLOY="../tbdiff-deploy"
PATCH1="../patch1.tbd"
PATCH2="../patch2.tbd"
EMPTY="empty"
MIDDIR="middir"
FINALDIR="finaldir"
cleanup() {
echo "Cleaning up..."
cd $CWD
rm -rf $EMPTY $MIDDIR $FINALDIR patch1prime.tbd patch2prime.tbd
}
checkmeta() {
cd $CWD
echo "Checking metadata..."
cd $MIDDIR
#1325779232 is the hardcoded creation time of b.txt and blockdev in patch1
if [ `stat -c %Y b.txt` -eq 1325779232 ]; then
echo "b.txt OK"
else
echo "Metadata mismatch"
cleanup
exit 1
fi
if [ `stat -c %Y dirdir/blockdev` -eq 1325779232 ]; then
echo "blockdev OK"
else
echo "Metadata mismatch"
cleanup
exit 1
fi
cd ..
cd $FINALDIR
#1325769455 is the hardcoded creation time of a.txt and fifo in patch2
if [ `stat -c %Y a.txt` -eq 1325769455 ]; then
echo "a.txt OK"
else
echo "Metadata mismatch"
cleanup
exit 1
fi
if [ `stat -c %Y dirdir/fifo` -eq 1325769455 ]; then
echo "fifo OK"
else
echo "Metadata mismatch"
cleanup
exit 1
fi
cd ..
}
echo -e "\n#### Preparing Cross Platform Test"
if [ ! -f run_tests.sh ]
then
echo "Test needs to be run from the tests directory" 1>&2
cleanup
exit 1
fi
mkdir $EMPTY
mkdir $MIDDIR
cd $MIDDIR
../$DEPLOY $PATCH1
cd ..
cp -R $MIDDIR $FINALDIR
cd $FINALDIR
../$DEPLOY $PATCH2
cd ..
$CREATE patch1prime.tbd $EMPTY $MIDDIR
$CREATE patch2prime.tbd $MIDDIR $FINALDIR
echo -e "\n#### Testing ####"
echo "Checking Diffs..."
diff patch1.tbd patch1prime.tbd
if [ $? -eq 0 ]; then
echo -n "Patch 1: "
echo OK
fi
diff patch2.tbd patch2prime.tbd
if [ $? -eq 0 ]; then
echo -n "Patch 2: "
echo OK
fi
checkmeta
cleanup
echo "#####################################################################"
exit 0
|