--- /dev/null
+#!/bin/sh -eu
+# When invoked, redo-ood must output targets for which a dependency
+# changed and targets for which a dependency of a dependency changed.
+
+>all.do printf 'redo-ifchange a
+'
+
+>a.do cat <<EOF
+redo-ifchange b
+printf '0
+'
+EOF
+
+>b.do cat <<EOF
+redo-ifchange c
+printf '1
+'
+EOF
+
+>c printf '2
+'
+
+redo
+<a read -r a1
+<b read -r b1
+<c read -r c1
+
+ood1=$(redo-ood)
+
+>c printf '3
+'
+<c read -r c2
+
+ood2=$(redo-ood)
+
+test 0 -eq "${a1}"
+test 1 -eq "${b1}"
+test 2 -eq "${c1}"
+test 3 -eq "${c2}"
+
+test -z "${ood1}"
+test -n "${ood2}"
+
+. ../stat_inode.rc
+
+inode_a=$(stat_inode a)
+inode_b=$(stat_inode b)
+inodes_ood=$(stat_inode ${ood2})
+
+case "${inodes_ood}" in
+ *"${inode_a}"*)
+ ;;
+ *)
+ exit 1
+ ;;
+esac
+
+case "${inodes_ood}" in
+ *"${inode_b}"*)
+ ;;
+ *)
+ exit 1
+ ;;
+esac