]> 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 export REDO_TOP_DIR="`pwd`" REDO_NO_PROGRESS=1
7
8 mkdir -p sub
9 cat > default.html.do <<EOF
10 redo-ifchange \$2.pre
11 echo HTML
12 cat \$2.pre
13 EOF
14 cat > default.pre.do <<EOF
15 redo-ifchange *.inc \$2.html.in
16 echo PRE
17 cat \$2.html.in
18 EOF
19 echo FOOTER > footer.inc
20 echo "<html>" > sub/index.html.in
21
22 test_expect_success Build "redo sub/index.html"
23 stat1=`stat sub/index.html`
24 test_expect_success Rebuild "redo-ifchange sub/index.html"
25 stat2=`stat sub/index.html`
26 test_expect_success "Was not rebuild" '[ "$stat1" = "$stat2" ]'
27
28 tgts=`sed -n "s/^Target: //p" sub/.redo/index.html.rec | sort`
29 tgts=`echo $tgts`
30 tgts_expected="../default.html.do" # .do itself
31 tgts_expected="$tgts_expected default.do" # ifcreate
32 tgts_expected="$tgts_expected default.html.do" # ifcreate
33 tgts_expected="$tgts_expected index.html" # check for user-modification
34 tgts_expected="$tgts_expected index.html.do" # ifcreate
35 tgts_expected="$tgts_expected index.pre" # source
36 test_expect_success "Correct dependencies" '[ "$tgts" = "$tgts_expected" ]'
37
38 test_done