chiark / gitweb /
Legal: Add copyright, licence and warranty notice to many files
[subdirmk.git] / tests / example / check
1 #!/bin/sh
2 # subdirmk - part of the test suite
3 #  Copyright 2019 Mark Wooding
4 #  Copyright 2019 Ian Jackson
5 # SPDX-License-Identifier: LGPL-2.0-or-later
6 # There is NO WARRANTY.
7
8 set -ex
9
10 . tests/build-common
11
12 make_copy example
13
14 cd tests/example/example
15
16 : ----- out of tree build -----
17
18 mkdir build
19 cd build
20 >>../src/for-test.sd.mk
21 >>../lib/for-test.mk.in
22 >>../for-test-final.sd.mk
23 .././autogen.sh && ../configure
24 make -j4 all check
25
26 : ----- testing rebuild on input change -----
27
28 reset_times () {
29         cd ..
30
31         find ! -path './build/*' -type f -print0 \
32         | xargs -0 \
33         touch -hmd 'now -2000 seconds' --
34
35         cd build
36
37         find -type f -print0 \
38         | xargs -0 \
39         touch -hmd 'now -1000 seconds' --
40 }
41
42 : ----- for-check-1 -----
43 reset_times
44 echo 'for-check-1:' >>../src/for-test.sd.mk
45 make -j4 for-check-1
46 grep '^for-check-1:' src/Dir.mk || false
47
48 : ----- for-check-2 -----
49 reset_times
50 echo 'for-check-2:' >>../lib/for-test.mk.in
51 make -j4 for-check-2
52 grep '^for-check-2:' lib/for-test.mk || false
53
54 : ----- for-check-3 -----
55 reset_times
56 echo 'for-check-3:' >>../for-test-final.sd.mk
57 make -j4 for-check-3
58 grep '^for-check-3:' Final.mk
59
60 echo ok.