Debian Codegraph @

tests/t450

raw
1 # t450 --- co -p -s
2 #
3 # Copyright (C) 2010-2022 Thien-Thi Nguyen
4 #
5 # This program is free software: you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation, either version 3 of
8 # the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty
12 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 # See the GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 . $srcdir/common
19 . $srcdir/common-kn
20 split_std_out_err no
21 $hey echo ' -*- org -*-'
22 $hey type co
23
24 ##
25 # Do "co -p -sSTATE" for various values of STATE,
26 # on various branches. Check output and diagnostics.
27 ##
28
29 prep_b_comparison
30
31 coerr=$wd/co.err
32 doubt=$wd/diff.out
33
34 tip1=1.9 ; stip1=QQQ
35 tip111=1.1.1.7 ; stip111=Exp
36 tip161=1.6.1.2 ; stip161=Exp
37
38 xfail ()
39 {
40 # $1 -- state
41 # $2 -- source (valid branch or revision number)
42 # $3+ -- expected diagnostic
43 state=$1
44 source=$2
45 shift ; shift
46 badmsg="$@"
47 $hey echo "* xfail: $state $source"
48
49 cmd="co -p$source -s$state"
50 $cmd $v 1> $actual 2> $coerr \
51 && problem "unexpected exit value (success): $cmd"
52 noiselessness_rules $actual "$cmd"
53 grep -F "$badmsg" $coerr \
54 || problem "unexpected diagnostic output: $cmd"
55 }
56
57 xfail_brnum ()
58 {
59 # $1 -- state
60 # $2 -- branch number
61 state=$1
62 brnum=$2
63 xfail $state $brnum "No revision on branch $brnum has state $state."
64 }
65
66 xfail_revno ()
67 {
68 # $1 -- state
69 # $2 -- revision number
70 state=$1
71 revno=$2
72 tip_varname=`echo tip$revno | sed 's/[.]//g'`
73 eval tip='$'$tip_varname
74 eval tipstate='$s'$tip_varname
75 xfail $state $revno "Revision $tip has state $tipstate."
76 }
77
78 xpass ()
79 {
80 # $1 -- STEM in fake/b.d/STEM.cou
81 # $2 -- state
82 # $3 -- source (valid branch or revision number)
83 expected=`bundled_commav b.d/$1.cou`
84 state=$2
85 source=$3
86 cmd="co -p$source -s$state"
87 $hey echo "* xpass: $state $source"
88
89 must '$cmd $v 1> $actual 2> $coerr'
90 normalize_b_and_diff "$cmd"
91 }
92
93 ##
94 # * First, try a state that is not in the RCS file.
95 ##
96
97 xfail_brnum bliss 1
98 xfail_revno bliss 1.
99 xfail_brnum bliss 1.1.1
100 xfail_revno bliss 1.1.1.
101 xfail_brnum bliss 1.6.1
102 xfail_revno bliss 1.6.1.
103
104 ##
105 # * Next, try a state that is only on one branch.
106 ##
107
108 xpass 19 QQQ 1
109 xpass 19 QQQ 1.
110 xpass 19 QQQ 1.9
111 xfail_brnum QQQ 1.1.1
112 xfail_revno QQQ 1.1.1.
113 xfail_brnum QQQ 1.6.1
114 xfail_revno QQQ 1.6.1.
115
116 ##
117 # * Last, try a state that is everywhere.
118 ##
119
120 xpass 18 Exp 1
121 xfail_revno Exp 1.
122 xpass 1117 Exp 1.1.1
123 xpass 1117 Exp 1.1.1.
124 xpass 1612 Exp 1.6.1
125 xpass 1612 Exp 1.6.1.
126
127 exit 0
128
129 # t450 ends here