Debian Codegraph @

tests/t150

raw
1 # t150 --- availability to shell, --version / --help / -V
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 split_std_out_err no
20 set -e
21
22 programs='
23 ci
24 co
25 ident
26 merge
27 rcs
28 rcsclean
29 rcsdiff
30 rcsmerge
31 rlog
32 '
33
34 ##
35 # Check that each program can be found by the shell
36 # (via the ‘type’ command), and that each program displays
37 # reasonable output when invoked with ‘--version’ and ‘--help’.
38 ##
39
40 for p in $programs ; do
41 must 'type $p'
42
43 vcmd="$p --version"
44 vout=$wd/version-$p
45 must '$vcmd > $vout'
46 grep -F "$p (GNU RCS)" $vout || say_what $vcmd
47
48 hcmd="$p --help"
49 hout=$wd/help-$p
50 must '$hcmd > $hout'
51 grep -F 'Report bugs to' $hout || say_what $hcmd
52 done
53
54 ##
55 # Check that each program fails when given ‘--no-such-option’.
56 ##
57
58 for p in $programs ; do
59 $p --no-such-option \
60 && problem "‘$p --no-such-option’ did not fail"
61 done
62
63 ##
64 # For RCS 5.9.0 and later, check ‘rcs no-such-command’ and
65 # ‘rcs --help COMMAND’ where COMMAND ∉ {ident, merge, rcs}.
66 ##
67
68 . $srcdir/common-v
69 version_at_least 5.9.0 || exit 0
70
71 rcs no-such-command \
72 && problem "‘rcs no-such-command’ did not fail"
73
74 for p in $programs ; do
75 case $p in
76 ident|merge|rcs) continue ;;
77 esac
78 hcmd="rcs --help $p"
79 hout=$wd/help-$p
80 must '$hcmd | diff $hout -'
81 done
82
83 ##
84 # For RCS 5.9.0 and later, check that ‘rcs -V’ produces a warning.
85 ##
86
87 rout=$wd/rout
88 rerr=$wd/rerr
89 cmd='rcs -V'
90 must '$cmd 1>$rout 2>$rerr'
91 silence_means_death $rout "$cmd"
92 silence_means_death $rerr "$cmd"
93 grep obsolete $rerr 1>/dev/null \
94 || problem 'invalid diagnostic'
95
96 ##
97 # For RCS 5.9.0 and later, check that ‘rlog -V2’ and ‘rlog -V5X’
98 # (on a valid RCS file) produce range and type errors, respectively.
99 ##
100
101 cp -f `bundled_commav empty` $v
102 set +e
103
104 flail ()
105 {
106 # $1 -- arg for ‘rlog -V’
107 # $2 -- pattern to grep for
108 cmd="rlog -V$1"
109 pattern="$2"
110
111 $cmd $v 1>$rout 2>$rerr \
112 && problem "‘$cmd’ did not fail"
113 silence_means_death $rerr "$cmd"
114 noiselessness_rules $rout "$cmd"
115 grep "$pattern" $rerr 1>/dev/null \
116 || problem 'invalid diagnostic'
117 }
118
119 flail 2 out.of.range
120 flail 5X isn.t.a.number
121
122 exit 0
123
124 # t150 ends here