]> Cypherpunks.ru repositories - goredo.git/blob - t/redo-sh.tests/ood_2/test
Add redo-ood related redo.sh-tests/ood_* unittests
[goredo.git] / t / redo-sh.tests / ood_2 / 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
5 >all.do printf 'redo-ifchange a
6 '
7
8 >a.do cat <<EOF
9 redo-ifchange b
10 printf '0
11 '
12 EOF
13
14 >b.do cat <<EOF
15 redo-ifchange c
16 printf '1
17 '
18 EOF
19
20 >c printf '2
21 '
22
23 redo
24 <a read -r a1
25 <b read -r b1
26 <c read -r c1
27
28 ood1=$(redo-ood)
29
30 >c printf '3
31 '
32 <c read -r c2
33
34 ood2=$(redo-ood)
35
36 test 0 -eq "${a1}"
37 test 1 -eq "${b1}"
38 test 2 -eq "${c1}"
39 test 3 -eq "${c2}"
40
41 test -z "${ood1}"
42 test -n "${ood2}"
43
44 . ../stat_inode.rc
45
46 inode_a=$(stat_inode a)
47 inode_b=$(stat_inode b)
48 inodes_ood=$(stat_inode ${ood2})
49
50 case "${inodes_ood}" in
51  *"${inode_a}"*)
52  ;;
53  *)
54   exit 1
55  ;;
56 esac
57
58 case "${inodes_ood}" in
59  *"${inode_b}"*)
60  ;;
61  *)
62   exit 1
63  ;;
64 esac