File: a-option.sh

package info (click to toggle)
cssc 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 11,368 kB
  • sloc: cpp: 39,446; ansic: 17,403; sh: 11,328; python: 3,923; makefile: 1,929; perl: 342; awk: 15; sed: 15
file content (107 lines) | stat: -rw-r--r-- 2,573 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#! /bin/sh
# a-option.sh:  Testing for the -a option.   

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


# Get a test file...
g=testfile
s=s.$g
x=x.$g
p=p.$g
z=z.$g
remove $s $g $p $z


get_expect () {
label="$1"         ; shift
r_option=$1      ; shift
a_option=$1      ; shift
sid_expected=$1  ; shift
docommand "$label" "${vg_get} ${toption} -g ${r_option} ${a_option} ${t_option} \
$s" 0 "$sid_expected\n" IGNORE
}

## Create the file (empty).
docommand prep1 "${admin} -n $s" 0 "" ""

## make some deltas.
docommand prep2 "${get} -e $s"    0  "1.1\nnew delta 1.2\n0 lines\n" ""
docommand prep3 "${delta} -y $s"  \
    0  "1.2\n0 inserted\n0 deleted\n0 unchanged\n" IGNORE
docommand prep4 "${get} -e -r2 $s"   0  "1.2\nnew delta 2.1\n0 lines\n" ""
docommand prep5 "${delta} -y $s"  \
    0  "2.1\n0 inserted\n0 deleted\n0 unchanged\n" IGNORE

docommand prep6 "${admin} -fb $s" 0 "" ""
docommand prep7 "${get} -e -b $s" 0 "2.1\nnew delta 2.1.1.1\n0 lines\n" IGNORE
docommand prep8 "${delta} -y $s" 0 \
	"2.1.1.1\n0 inserted\n0 deleted\n0 unchanged\n" IGNORE
docommand prep9 "${get} -e -r2.1.1 $s" 0 \
	"2.1.1.1\nnew delta 2.1.1.2\n0 lines\n" IGNORE
docommand prep10 "${delta} -y $s" 0 \
	"2.1.1.2\n0 inserted\n0 deleted\n0 unchanged\n" IGNORE

## Also make a branch on release 1.
docommand prep11 "${get} -e -r1.2 $s" 0 \
	"1.2\nnew delta 1.2.1.1\n0 lines\n" IGNORE
docommand prep12 "${delta} -y $s" 0 \
	"1.2.1.1\n0 inserted\n0 deleted\n0 unchanged\n" IGNORE


all_seqs() {
    ${prs} -d:DS: -l -r1.1 "$@" | sort -n
}

all_sids() {
    ${prs} -d:I: -l -r1.1 "$@"
}

sid_for_seq() {
    seq=$1
    shift
    ${prs} -d":DS: :I:" -l -r1.1 "$@" | grep "^${seq} " | while read seq sid
    do
      echo "$sid"
    done
}

seq_for_sid() {
    ${prs} -d":DS:" -r$1 "$2"
}


# Do various forms of get on the file and make sure we get the right SID.
seqlist=`all_seqs $s`
sidlist=`all_sids $s`

for sid in $sidlist
do
  for gotsid in $sidlist
  do
    gotseq=`seq_for_sid $gotsid $s` || \
      miscarry "Cannot find sequence number for SID $gotsid"
    for t_option in "  " "-t"
    do
      get_expect "ar${gotseq}-${sid}${t_option}" -r${sid} -a${gotseq} "${gotsid}"
    done
  done
done

for gotsid in $sidlist
do
  gotseq=`seq_for_sid $gotsid $s` || \
    miscarry "Cannot find sequence number for SID $gotsid"
  for t_option in "  " "-t"
  do
    get_expect  "a${gotseq}${t_option}" "" -a${gotseq} "${gotsid}"
  done
done

# None of the above commands should have left a g-file lying around.
docommand g1 "test -f $g" 1 "" IGNORE

remove $s $g

success