Debian Codegraph @

tests/t632

raw
1 # t632 --- ‘co -l’ w/ writable workfile
2 #
3 # Copyright (C) 2018-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
21 ##
22 # Check that "co -l" w/ writable workfile
23 # queries and DTRT depending on user response.
24 ##
25
26 must 'cp `bundled_commav one` $v'
27 must 'co -l $w'
28
29 echo y | co -l -I $w \
30 || problem 'checkout failed'
31
32 echo n | co -l -I $w \
33 && problem 'checkout succeeded'
34
35 echo | co -l -I $w \
36 && problem 'checkout succeeded'
37
38 ##
39 # Exercise signal handling by sending a signal during the query.
40 # (This is skipped if GNU coreutils timeout(1) is not available.)
41 ##
42
43 # <https://mail.gnu.org/archive/html/bug-rcs/2020-10/msg00014.html>
44 # The timeout test needs co(1) to block on input.
45 # If stdin is not open and connected to a tty, skip out.
46 if test -t 0 ; then
47 echo STDIN OK
48 else
49 exit 0
50 fi
51
52 # TODO: Don't be lame! Pick one:
53 # (a) Mimic timeout(1) w/ sh commands.
54 # (b) Incorporate heart of timeout(1) into ./btdt and use that.
55 if timeout --version 2>&1 | grep 'GNU coreutils' >/dev/null 2>&1
56 then
57 sout=$wd/signal-handling-out-and-err
58 timeout --foreground 0.42s co -l -I $w 1>$sout 2>&1
59 grep 'RCS: Cleaning up' $sout \
60 || problem 'incorrect signal handling'
61 fi
62
63 exit 0
64
65 # t632 ends here