This repository has been archived by the owner on Dec 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·67 lines (54 loc) · 1.57 KB
/
test.sh
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
rm -rf tmp
mkdir tmp
dd if=/dev/urandom of=tmp/file.orig bs=1M count=4
sum=`shasum tmp/file.orig | cut -d\ -f 1`
function test_result()
{
if [ "$sum" != "$res" ];
then
echo "Failed Test. $sum != $res"
exit
else
echo "Passed."
fi
}
echo -n "Test loopback ... "
res=$sum
test_result
res="bad"
for pver in python2 python3
do
echo -n "Test $pver standard ... "
export s3cret=quickbrownfox
$pver easycrypt.py tmp/file.orig tmp/file.$pver.enc
$pver easycrypt.py -d tmp/file.$pver.enc tmp/file.$pver
res=`shasum tmp/file.$pver | cut -d\ -f 1`
test_result
res=None
echo -n "Test $pver embed... "
$pver easycrypt.py -s tmp/file.orig tmp/file.$pver.enc
tmp/file.$pver.enc tmp/file.$pver.orig
res=`shasum tmp/file.$pver.orig | cut -d\ -f 1`
test_result
res=None
echo -n "Test $pver pipe... "
cat tmp/file.orig | $pver ./easycrypt.py | cat > tmp/file.$pver.pipe.enc
cat tmp/file.$pver.pipe.enc | $pver ./easycrypt.py -d | cat > tmp/file.$pver.pipe
res=`shasum tmp/file.$pver.pipe | cut -d\ -f 1`
test_result
res=None
echo -n "Test $pver embed 2... "
cat tmp/file.orig | $pver ./easycrypt.py -s > tmp/file.$pver.pemb.enc
chmod a+x tmp/file.$pver.pemb.enc
tmp/file.$pver.pemb.enc > tmp/file.$pver.pemb
res=`shasum tmp/file.$pver.pemb | cut -d\ -f 1`
test_result
res=None
echo -n "Test $pver overwrite... "
cp tmp/file.orig tmp/file.inplace.$pver
$pver ./easycrypt.py tmp/file.inplace.$pver
$pver ./easycrypt.py -d tmp/file.inplace.$pver
res=`shasum tmp/file.inplace.$pver | cut -d\ -f 1`
test_result
res=None
done