]> Cypherpunks.ru repositories - goredo.git/blob - t/apenwarr/102-empty/touchtest.do
Import tests from apenwarr/redo and redo.sh
[goredo.git] / t / apenwarr / 102-empty / touchtest.do
1 # This may have been leftover from a previous run, when switching
2 # between "real" redo and minimal/do, so clean it up.
3 rm -f touch1
4
5 # simply create touch1
6 echo 'echo hello' >touch1.do
7 redo touch1
8 [ -e touch1 ] || exit 55
9 [ "$(cat touch1)" = "hello" ] || exit 56
10
11 # ensure that 'redo touch1' always re-runs touch1.do even if we have
12 # already built touch1 in this session, and even if touch1 already exists.
13 echo 'echo hello2' >touch1.do
14 redo touch1
15 [ "$(cat touch1)" = "hello2" ] || exit 57
16
17 # ensure that touch1 is rebuilt even if it got deleted after the last redo
18 # inside the same session.  Also ensure that we can produce a zero-byte
19 # output file explicitly.
20 rm -f touch1
21 echo 'touch $3' >touch1.do
22 redo touch1
23 [ -e touch1 ] || exit 66
24 [ -z "$(cat touch1)" ] || exit 67
25
26 # Also test that zero bytes of output does not create the file at all, as
27 # opposed to creating a zero-byte file.
28 rm -f touch1
29 echo 'touch touch1-ran' >touch1.do
30 redo touch1
31 [ -e touch1 ] && exit 75
32 [ -e touch1-ran ] || exit 76
33 rm -f touch1-ran
34
35 # Make sure that redo-ifchange *won't* rebuild touch1 if we have already
36 # built it, even if building it did not produce an output file.
37 redo-ifchange touch1
38 [ -e touch1 ] && exit 77
39 [ -e touch1-ran ] && exit 78
40
41 rm -f touch1.do