]> Cypherpunks.ru repositories - goredo.git/blob - t/redo-sh.tests/ood_3/test
Add redo-ood related redo.sh-tests/ood_* unittests
[goredo.git] / t / redo-sh.tests / ood_3 / test
1 #!/bin/sh -eu
2 # When invoked, redo-ood must output targets for which a dependency
3 # changed and targets for which a dependency of a dependency changed
4 # and targets for which a dependency of a dependency of a dependency
5 # changed.
6
7 >all.do printf 'redo-ifchange a
8 '
9
10 >a.do cat <<EOF
11 redo-ifchange b
12 printf '0
13 '
14 EOF
15
16 >b.do cat <<EOF
17 redo-ifchange c
18 printf '1
19 '
20 EOF
21
22 >c.do cat <<EOF
23 redo-ifchange d
24 printf '2
25 '
26 EOF
27
28 >d printf '3
29 '
30
31 redo
32 <a read -r a1
33 <b read -r b1
34 <c read -r c1
35 <d read -r d1
36
37 ood1=$(redo-ood)
38
39 >d printf '4\n'
40 <d read -r d2
41
42 ood2=$(redo-ood)
43
44 test 0 -eq "${a1}"
45 test 1 -eq "${b1}"
46 test 2 -eq "${c1}"
47 test 3 -eq "${d1}"
48 test 4 -eq "${d2}"
49
50 test -z "${ood1}"
51 test -n "${ood2}"
52
53 . ../stat_inode.rc
54
55 inode_a=$(stat_inode a)
56 inode_b=$(stat_inode b)
57 inode_c=$(stat_inode c)
58 inodes_ood=$(stat_inode ${ood2})
59
60 case "${inodes_ood}" in
61  *"${inode_a}"*)
62  ;;
63  *)
64   exit 1
65  ;;
66 esac
67
68 case "${inodes_ood}" in
69  *"${inode_b}"*)
70  ;;
71  *)
72   exit 1
73  ;;
74 esac
75
76 case "${inodes_ood}" in
77  *"${inode_c}"*)
78  ;;
79  *)
80   exit 1
81  ;;
82 esac