-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest08.sh
95 lines (75 loc) · 2.95 KB
/
test08.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
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
#!/bin/sh
# This test has NEGATIVE testcase related to passwords and flags and all following
# testcases should fail. This run user program (xcpenc_nocheck) with No checks at all
echo dummy test > infile
echo "" >> results
echo "" >> log
echo test08.sh: Negative testcases of password, options >> results
echo test08.sh: Negative testcase of password, options >> log
# Multiple options specified -e, -d, -c all at once. It should fail
echo Multiple options >> results
echo ./xcpenc_nocheck -e -d -c -p password infile encryptfile >> results
echo ./xcpenc_nocheck -e -d -c -p password infile encryptfile>> log
./xcpenc_nocheck -e -d -c -p "password" infile encryptfile >> log
retval=$?
if test $retval != 0 ; then
echo xcpenc_nocheck failed with error: $retval >> results
else
echo xcpenc_nocheck program succeeded >> results
fi
echo "" >> results
echo "" >> log
# -p is specified with copy command -c. It should fail.
echo -p specified with -c >> results
echo ./xcpenc_nocheck -c -p password infile outfile >> results
echo ./xcpenc_nocheck -c -p password infile outfile >> log
./xcpenc_nocheck -c -p "password" infile outfile >> log
retval=$?
if test $retval != 0 ; then
echo xcpenc_nocheck failed with error: $retval >> results
else
echo xcpenc_nocheck program succeeded >> results
fi
echo "" >> results
echo "" >> log
# password length should be >= 6 characters. This should fail
echo password length is less than 6 characters >> results
echo ./xcpenc_nocheck -p pass infile encryptfile >> results
echo ./xcpenc_nocheck -p pass infile encryptfile >> log
./xcpenc_nocheck -p pass infile encryptfile >> log
retval=$?
if test $retval != 0 ; then
echo xcpenc_nocheck failed with error: $retval >> results
else
echo xcpenc_nocheck program succeeded >> results
fi
echo "" >> results
echo "" >> log
# When with encryption/decryption, no password is specified.
# It should fail
echo No password >> results
echo ./xcpenc_nocheck -d infile decryptfile >> results
echo ./xcpenc_nocheck -d infile decryptfile >> log
./xcpenc_nocheck -d infile decryptfile >> log
retval=$?
if test $retval != 0 ; then
echo xcpenc_nocheck failed with error: $retval >> results
else
echo xcpenc_nocheck program succeeded >> results
fi
echo "" >> results
echo "" >> log
# When password is specified but no option to encrypt/decrypt
# is specified. This testcase should fail
echo No option spciefied with password >> results
echo ./xcpenc_nocheck -p password infile decryptfile >> results
echo ./xcpenc_nocheck -p password infile decryptfile >> log
./xcpenc_nocheck -p password infile decryptfile >> log
retval=$?
if test $retval != 0 ; then
echo xcpenc_nocheck failed with error: $retval >> results
else
echo xcpenc_nocheck program succeeded >> results
fi
echo "------------------------------------------------------------------------------" >> results
echo "------------------------------------------------------------------------------" >> log