]> Cypherpunks.ru repositories - goredo.git/blob - t/goredo-deps.t
Fix dependencies relative paths determination
[goredo.git] / t / goredo-deps.t
1 #!/bin/sh
2
3 testname=`basename "$0"`
4 test_description="Check that the following use-case won't rebuild everytime and has correct dependencies"
5 . $SHARNESS_TEST_SRCDIR/sharness.sh
6
7 tmp=`mktemp -d`
8 trap "rm -fr $tmp" HUP PIPE INT QUIT TERM EXIT
9 cd $tmp
10 mkdir -p sub
11 cat > default.html.do <<EOF
12 redo-ifchange \$2.pre
13 echo HTML
14 cat \$2.pre
15 EOF
16 cat > default.pre.do <<EOF
17 redo-ifchange *.inc \$2.html.in
18 echo PRE
19 cat \$2.html.in
20 EOF
21 echo FOOTER > footer.inc
22 echo "<html>" > sub/index.html.in
23
24 test_expect_success Build "redo sub/index.html"
25 stat1=`stat sub/index.html`
26 test_expect_success Rebuild "redo-ifchange sub/index.html"
27 stat2=`stat sub/index.html`
28 test_expect_success "Was not rebuild" '[ "$stat1" = "$stat2" ]'
29
30 tgts=`sed -n "s/^Target: //p" sub/.redo/index.html.dep | sort`
31 tgts=`echo $tgts`
32 tgts_expected="../default.html.do" # .do itself
33 tgts_expected="$tgts_expected default.do" # ifcreate
34 tgts_expected="$tgts_expected default.html.do" # ifcreate
35 tgts_expected="$tgts_expected index.html" # check for user-modification
36 tgts_expected="$tgts_expected index.html.do" # ifcreate
37 tgts_expected="$tgts_expected index.pre" # source
38 test_expect_success "Correct dependencies" '[ "$tgts" = "$tgts_expected" ]'
39
40 test_done