File: valbasic.sh

package info (click to toggle)
cssc 1.2.0-2
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 3,564 kB
  • ctags: 1,387
  • sloc: cpp: 13,240; sh: 4,771; ansic: 2,992; perl: 342; makefile: 338; awk: 11
file content (92 lines) | stat: -rw-r--r-- 2,129 bytes parent folder | download | duplicates (4)
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
#! /bin/sh

# valbasic.sh:  Basic tests for the "val" command.

# Import common functions & definitions.
. ../common/test-common

files="f s.f"

remove $files

docommand v1 "${admin} -n s.f" 0 IGNORE IGNORE
docommand v2 "${val} s.f" 0 IGNORE IGNORE

docommand v3 "${val} -r1.1 s.f" 0 IGNORE IGNORE
docommand v4 "${val} -s s.f" 0 IGNORE IGNORE

# Having no args is an error.
docommand v5 "${val}" 128 IGNORE IGNORE


# Module flag mismatch
docommand v6 "${val} -mZ s.f" 1 IGNORE IGNORE

# Change the module flag
docommand v7 "${admin} -fmZ s.f" 0 IGNORE IGNORE

# Module flag match
docommand v8 "${val} -mZ s.f" 0 IGNORE IGNORE


# Type flag mismatch
docommand v9 "${val} -yA s.f" 2 IGNORE IGNORE

# Change the type flag
docommand v10 "${admin} -ftA s.f" 0 IGNORE IGNORE

# Module flag match
docommand v11 "${val} -yA s.f" 0 IGNORE IGNORE

# SID not found
docommand v12 "${val} -r1.2 s.f" 4 IGNORE IGNORE

# SID not valid
docommand v13 "${val} -r1.2xyzzy s.f" 8 IGNORE IGNORE

chmod 0 s.f || miscarry "Cannot change permissions for file s.f"
# Cannot read file
docommand v14 "${val} s.f" 16 IGNORE IGNORE
chmod +r s.f || miscarry "Cannot reset permissions for file s.f"

# Missing file
docommand v15 "${val} -r1.1" 128 IGNORE IGNORE

# Too many -r options
docommand v16 "${val} -r1.1 -r1.2 s.f" 64 IGNORE IGNORE


# A corrupt file
remove s.corrupt
cat valbasic.sh s.f > s.corrupt || miscarry "cannot create file s.corrupt"
docommand v17 "${val} -r1.1 s.corrupt" 32 IGNORE IGNORE
remove s.corrupt


# Too many -r options (a different way)
docommand v18 "${val} -r1.1 -s -r1.1 s.f" 64 IGNORE IGNORE

# Too many -m options
docommand v19 "${val} -mX -mX s.f" 64 IGNORE IGNORE

# Too many -y options
docommand v20 "${val} -yX -yX s.f" 64 IGNORE IGNORE

# Unknown option
docommand v21 "${val} -X s.f" 64 IGNORE IGNORE




# done rc   0 (success)
# done rc   1 (Val_MismatchedM)
# done rc   2 (Val_MismatchedY)
# done rc   4 (Val_NoSuchSID)
# done rc   8 (Val_InvalidSID)
# done rc  16 (Val_CannotOpenOrWrongFormat)
# done rc  32 (Val_CorruptFile)
# done rc  64 (Val_InvalidOption)
# done rc 128 (Val_MissingFile)

remove $files
success