1#! /bin/sh 2# a-option.sh: Testing for the -a option. 3 4# Import common functions & definitions. 5. ../../common/test-common 6 7 8# Get a test file... 9g=testfile 10s=s.$g 11x=x.$g 12p=p.$g 13z=z.$g 14remove $s $g $p $z 15 16 17get_expect () { 18label="$1" ; shift 19r_option=$1 ; shift 20a_option=$1 ; shift 21sid_expected=$1 ; shift 22docommand "$label" "${vg_get} ${toption} -g ${r_option} ${a_option} ${t_option} \ 23$s" 0 "$sid_expected\n" IGNORE 24} 25 26## Create the file (empty). 27docommand prep1 "${admin} -n $s" 0 "" "" 28 29## make some deltas. 30docommand prep2 "${get} -e $s" 0 "1.1\nnew delta 1.2\n0 lines\n" "" 31docommand prep3 "${delta} -y $s" \ 32 0 "1.2\n0 inserted\n0 deleted\n0 unchanged\n" IGNORE 33docommand prep4 "${get} -e -r2 $s" 0 "1.2\nnew delta 2.1\n0 lines\n" "" 34docommand prep5 "${delta} -y $s" \ 35 0 "2.1\n0 inserted\n0 deleted\n0 unchanged\n" IGNORE 36 37docommand prep6 "${admin} -fb $s" 0 "" "" 38docommand prep7 "${get} -e -b $s" 0 "2.1\nnew delta 2.1.1.1\n0 lines\n" IGNORE 39docommand prep8 "${delta} -y $s" 0 \ 40 "2.1.1.1\n0 inserted\n0 deleted\n0 unchanged\n" IGNORE 41docommand prep9 "${get} -e -r2.1.1 $s" 0 \ 42 "2.1.1.1\nnew delta 2.1.1.2\n0 lines\n" IGNORE 43docommand prep10 "${delta} -y $s" 0 \ 44 "2.1.1.2\n0 inserted\n0 deleted\n0 unchanged\n" IGNORE 45 46## Also make a branch on release 1. 47docommand prep11 "${get} -e -r1.2 $s" 0 \ 48 "1.2\nnew delta 1.2.1.1\n0 lines\n" IGNORE 49docommand prep12 "${delta} -y $s" 0 \ 50 "1.2.1.1\n0 inserted\n0 deleted\n0 unchanged\n" IGNORE 51 52 53all_seqs() { 54 ${prs} -d:DS: -l -r1.1 "$@" | sort -n 55} 56 57all_sids() { 58 ${prs} -d:I: -l -r1.1 "$@" 59} 60 61sid_for_seq() { 62 seq=$1 63 shift 64 ${prs} -d":DS: :I:" -l -r1.1 "$@" | grep "^${seq} " | while read seq sid 65 do 66 echo "$sid" 67 done 68} 69 70seq_for_sid() { 71 ${prs} -d":DS:" -r$1 "$2" 72} 73 74 75# Do various forms of get on the file and make sure we get the right SID. 76seqlist=`all_seqs $s` 77sidlist=`all_sids $s` 78 79for sid in $sidlist 80do 81 for gotsid in $sidlist 82 do 83 gotseq=`seq_for_sid $gotsid $s` || \ 84 miscarry "Cannot find sequence number for SID $gotsid" 85 for t_option in " " "-t" 86 do 87 get_expect "ar${gotseq}-${sid}${t_option}" -r${sid} -a${gotseq} "${gotsid}" 88 done 89 done 90done 91 92for gotsid in $sidlist 93do 94 gotseq=`seq_for_sid $gotsid $s` || \ 95 miscarry "Cannot find sequence number for SID $gotsid" 96 for t_option in " " "-t" 97 do 98 get_expect "a${gotseq}${t_option}" "" -a${gotseq} "${gotsid}" 99 done 100done 101 102# None of the above commands should have left a g-file lying around. 103docommand g1 "test -f $g" 1 "" IGNORE 104 105remove $s $g 106 107success 108