File: t460

package info (click to toggle)
rcs 5.10.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,348 kB
  • sloc: ansic: 47,019; sh: 4,939; makefile: 169
file content (129 lines) | stat: -rw-r--r-- 2,918 bytes parent folder | download | duplicates (3)
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# t460 --- co -p -d
#
# Copyright (C) 2010-2022 Thien-Thi Nguyen
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

. $srcdir/common
. $srcdir/common-kn
split_std_out_err no
$hey echo '                                    -*- org -*-'
$hey type co

now=`date -u '+%Y/%m/%d'`

##
# Do "co -p -dDATE" for various valid values of DATE,
# on various branches.  Check output.
##

prep_b_comparison

coerr=$wd/co.err
doubt=$wd/diff.out

tip1=1.9       ; dtip1='2010/04/18 09:39:02'
tip111=1.1.1.7 ; dtip111='2010/03/28 16:04:26'
tip161=1.6.1.2 ; dtip161='2010/10/21 22:48:48'

xfail ()
{
    # $1 -- date
    # $2 -- source (valid branch or revision number)
    # $3+ -- expected diagnostic
    date=$1
    source=$2
    shift ; shift
    badmsg="$@"
    $hey echo "* xfail: $date $source"

    cmd="co -p$source -d$date"
    $cmd $v 1> $actual 2> $coerr \
        && problem "unexpected exit value (success): $cmd"
    noiselessness_rules $actual "$cmd"
    grep -F "$badmsg" $coerr \
        || problem "unexpected diagnostic output: $cmd"
}

xfail_brnum ()
{
    # $1 -- date
    # $2 -- branch number
    date=$1
    brnum=$2
    xfail $date $brnum \
        "No revision on branch $brnum has a date before $date 00:00:00."
}

xfail_revno ()
{
    # $1 -- date
    # $2 -- revision number
    date=$1
    revno=$2
    tip_varname=`echo tip$revno | sed 's/[.]//g'`
    eval tip='$'$tip_varname
    eval tipdate='$d'$tip_varname
    xfail $date $revno "Revision $tip has date $tipdate."
}

xpass ()
{
    # $1 -- STEM in fake/b.d/STEM.cou
    # $2 -- date
    expected=`bundled_commav b.d/$1.cou`
    date=$2
    source=`echo $1 | sed 's/./&./g;s/...$//'`
    cmd="co -p$source -d$date"
    $hey echo "* xpass: $date $source"

    must '$cmd $v 1> $actual 2> $coerr'
    normalize_b_and_diff "$cmd"
}

##
# * First, try a date that is not in the RCS file.
##

early='2010/01/01'
xfail_brnum $early 1
xfail_revno $early 1.
xfail_brnum $early 1.1.1
xfail_revno $early 1.1.1.
xfail_brnum $early 1.6.1
xfail_revno $early 1.6.1.

##
# * Next, try some dates on the trunk.
##

xpass 11 '2010/03/30'
xpass 15 '2010/03/31'
xpass 19 $now

##
# * Last, try some dates on various branches.
##

xpass 1113 '2010/03/18'
xpass 1116 '2010/03/28'
xpass 1117 $now

xpass 1611 '2010/10/20'
xpass 1612 '2010/10/30'
xpass 1612 $now

exit 0

# t460 ends here