]> Cypherpunks.ru repositories - goredo.git/blob - t/redo-sh.tests/dependency_ne_dofile_1/test
Import tests from apenwarr/redo and redo.sh
[goredo.git] / t / redo-sh.tests / dependency_ne_dofile_1 / test
1 #!/bin/sh -eu
2 # A target built with a default dofile in the same directory must be rebuilt if a more specific dofile appears.
3
4 test -e a.b.c && \
5  rm -- a.b.c
6
7 >all.do cat <<EOF
8 redo-ifchange a.b.c
9 EOF
10
11 dofiles="default.do default.c.do default.b.c.do a.b.c.do"
12
13 for dofile in ${dofiles}; do
14  [ -e "${dofile}" ] && \
15   rm -- "${dofile}" || :
16 done
17
18 for dofile in ${dofiles}; do
19  >"${dofile}" cat <<EOF
20 printf '${dofile}\n'
21 EOF
22
23  redo
24  <a.b.c read -r text
25  if ! [ "${text}" = "${dofile}" ]; then
26   >&2 printf 'a.b.c was built with %s, should have been built with %s\n' \
27    "${text}" "${dofile}"
28   exit 1
29  fi
30 done