]> Cypherpunks.ru repositories - goredo.git/blobdiff - t/redo-sh.tests/ood_1/test
Add redo-ood related redo.sh-tests/ood_* unittests
[goredo.git] / t / redo-sh.tests / ood_1 / test
diff --git a/t/redo-sh.tests/ood_1/test b/t/redo-sh.tests/ood_1/test
new file mode 100755 (executable)
index 0000000..15a14dc
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh -eu
+# When invoked, redo-ood must output targets for which a dependency
+# changed.
+
+>all.do printf 'redo-ifchange a
+'
+
+>a.do cat <<EOF
+redo-ifchange b
+printf '0
+'
+EOF
+
+>b printf '1
+'
+
+redo
+<a read -r a1
+<b read -r b1
+
+ood1=$(redo-ood)
+
+>b printf '2
+'
+<b read -r b2
+
+ood2=$(redo-ood)
+
+test 0 -eq "${a1}"
+test 1 -eq "${b1}"
+test 2 -eq "${b2}"
+
+test -z "${ood1}"
+test -n "${ood2}"
+
+. ../stat_inode.rc
+
+inode_a=$(stat_inode a)
+inodes_ood=$(stat_inode "${ood2}")
+
+test "${inode_a}" = "${inodes_ood}"