]> Cypherpunks.ru repositories - goredo.git/blob - t/goredo-deps.t
Download link for 2.6.2 release
[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
10 cd $tmp
11 mkdir -p sub
12 cat > default.html.do <<EOF
13 redo-ifchange \$2.pre
14 echo HTML
15 cat \$2.pre
16 EOF
17 cat > default.pre.do <<EOF
18 redo-ifchange *.inc \$2.html.in
19 echo PRE
20 cat \$2.html.in
21 EOF
22 echo FOOTER > footer.inc
23 echo "<html>" > sub/index.html.in
24
25 test_expect_success Build "redo sub/index.html"
26 stat1=`stat sub/index.html`
27 test_expect_success Rebuild "redo-ifchange sub/index.html"
28 stat2=`stat sub/index.html`
29 test_expect_success "Was not rebuild" '[ "$stat1" = "$stat2" ]'
30
31 tgts=`sed -n "s/^Target: //p" sub/.redo/index.html.dep | sort`
32 tgts=`echo $tgts`
33 tgts_expected="../default.html.do" # .do itself
34 tgts_expected="$tgts_expected default.do" # ifcreate
35 tgts_expected="$tgts_expected default.html.do" # ifcreate
36 tgts_expected="$tgts_expected index.html" # check for user-modification
37 tgts_expected="$tgts_expected index.html.do" # ifcreate
38 tgts_expected="$tgts_expected index.pre" # source
39 test_expect_success "Correct dependencies" '[ "$tgts" = "$tgts_expected" ]'
40
41 test_done