File: admin-hz.sh

package info (click to toggle)
cssc 1.0.1-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,612 kB
  • ctags: 1,424
  • sloc: cpp: 13,502; sh: 4,759; ansic: 2,971; perl: 342; makefile: 339; awk: 11
file content (56 lines) | stat: -rw-r--r-- 1,450 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
#! /bin/sh

# admin-hz.sh:  Tests for the -h and -z options of "admin".

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

g=new.txt
s=s.$g
p=p.$g
s2=s.spare
remove foo $s $g $p [zx].$g $s2

# Create SCCS file
echo 'hello from %M%' >foo

docommand c1 "${admin} -ifoo $s" 0 "" ""
remove foo

# Make sure the checksum is checked as correct.
docommand c2 "${admin} -h $s" 0 "" ""

# Now, create a copy with a changed checksum, but no other 
# differences.
docommand c3 " (sed -e '1y/0123456789/9876453210/' <$s >$s2) " 0 "" ""

# Check that we think that the checksum of the file is wrong.
docommand c4 "${admin} -h $s2" 1 "" "IGNORE"

# Make sure that specifying "-h -z" does not cause the checksum 
# to be fixed (this is why we do it twice).
docommand c5 "${admin} -h -z $s2" 1 "" "IGNORE"
docommand c6 "${admin} -h -z $s2" 1 "" "IGNORE"

# Check that we still think it is wrong if we pass both files to 
# admin, no matter what the order.
docommand c7 "${admin} -h $s $s2" 1 "" "IGNORE"
docommand c8 "${admin} -h $s2 $s" 1 "" "IGNORE"


# Fix the checksum.
docommand c9 "${admin} -z $s2" 0 "" ""

# Check that we are happy again.
docommand c10 "${admin}  -h $s2" 0 "" ""
docommand c11 "${admin}  -h $s $s2" 0 "" ""
docommand c12 "${admin} -h $s2 $s" 0 "" ""

# Make sure the files are again identical.
docommand c13 "diff $s $s2" 0 "" "IGNORE"


### Cleanup and exit.
rm -rf test 
remove foo $s $g $p [zx].$g command.log $s2
success