summaryrefslogtreecommitdiff
path: root/t/distcheck-pr18286.sh
blob: 549ec22b7c9d9bbbd957259b1bd811683bbef467 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /bin/sh
# Copyright (C) 2014-2017 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Ensure "make distcheck" detects all missing files, without getting
# confused by the fact that they exists in the "original" source tree
# from which "make distcheck" is run. See automake bug#18286.

. test-init.sh

echo AC_OUTPUT >> configure.ac

cat > Makefile.am <<'END'
$(srcdir)/test_data.am: $(srcdir)/test_data.txt $(srcdir)/gen-testdata.sh
	cd $(srcdir) && $(SHELL) gen-testdata.sh <test_data.txt >test_data.am

include $(srcdir)/test_data.am

check-local:
	is $(testdata) == foo bar
END

cat > test_data.txt <<'END'
foo
bar
END


cat > gen-testdata.sh <<'END'
#!/bin/sh
printf 'testdata = \\\n'
sed 's/$/ \\/'
echo '$(empty_string)'
END
chmod a+x gen-testdata.sh

$sleep
./gen-testdata.sh <test_data.txt >test_data.am

$ACLOCAL
$AUTOCONF
$AUTOMAKE -a

./configure

$MAKE check

# Oops, we failed to distribute some required files!
run_make -e FAIL -M distcheck
$FGREP '../../test_data.txt' output

# But if we distribute them, everything will be OK.
echo 'EXTRA_DIST = test_data.txt gen-testdata.sh' >> Makefile.am

using_gmake || $MAKE Makefile
$MAKE distcheck

: