| 1 |
|
| 2 |
|
| 3 |
bin=bin-$$$$ |
| 4 |
|
| 5 |
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)' |
| 6 |
|
| 7 |
tmpdir = $(abs_top_builddir)/tests/torture |
| 8 |
|
| 9 |
t=$(tmpdir)/$(PACKAGE)/test |
| 10 |
pfx=$(t)/i |
| 11 |
|
| 12 |
built_programs = \ |
| 13 |
$$(echo 'spy:;@echo $$(bin_PROGRAMS)' \ |
| 14 |
| MAKEFLAGS= $(MAKE) -s -C src -f Makefile -f - spy \ |
| 15 |
| fmt -1 | sed 's,$(EXEEXT)$$,,' | sort -u) |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
tp = $(tmpdir)/taint |
| 21 |
t_prefix = $(tp)/a |
| 22 |
t_taint = '$(t_prefix) b' |
| 23 |
fake_home = $(tp)/home |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
ifneq ('', $(filter *.xz, $(DIST_ARCHIVES))) |
| 28 |
tar_decompress_opt_ = J |
| 29 |
suffix_ = xz |
| 30 |
else |
| 31 |
ifneq ('', $(filter *.gz, $(DIST_ARCHIVES))) |
| 32 |
tar_decompress_opt_ = z |
| 33 |
suffix_ = gz |
| 34 |
else |
| 35 |
tar_decompress_opt_ = j |
| 36 |
suffix_ = bz2 |
| 37 |
endif |
| 38 |
endif |
| 39 |
amtar_extract_ = $(AMTAR) -$(tar_decompress_opt_)xf |
| 40 |
preferred_tarball_ = $(distdir).tar.$(suffix_) |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
ALL_RECURSIVE_TARGETS += taint-distcheck |
| 49 |
taint-distcheck: $(DIST_ARCHIVES) |
| 50 |
grep '^[ ]*LT_INIT' configure.ac >/dev/null && exit 0 || : |
| 51 |
test -d $(t_taint) && chmod -R 700 $(t_taint) || : |
| 52 |
-rm -rf $(t_taint) $(fake_home) |
| 53 |
mkdir -p $(t_prefix) $(t_taint) $(fake_home) |
| 54 |
$(amtar_extract_) $(preferred_tarball_) -C $(t_taint) |
| 55 |
mkfifo $(fake_home)/fifo |
| 56 |
touch $(fake_home)/f |
| 57 |
mkdir -p $(fake_home)/d/e |
| 58 |
ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before |
| 59 |
HOME=$(fake_home); export HOME; \ |
| 60 |
cd $(t_taint)/$(distdir) \ |
| 61 |
&& ./configure \ |
| 62 |
&& $(MAKE) \ |
| 63 |
&& $(MAKE) check \ |
| 64 |
&& ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \ |
| 65 |
&& diff $(tp)/.ls-before $(tp)/.ls-after \ |
| 66 |
&& test -d $(t_prefix) |
| 67 |
rm -rf $(tp) |
| 68 |
|
| 69 |
|
| 70 |
define install-transform-check |
| 71 |
echo running install-transform-check \ |
| 72 |
&& rm -rf $(pfx) \ |
| 73 |
&& $(MAKE) program_transform_name='s/.*/zyx/' \ |
| 74 |
prefix=$(pfx) install \ |
| 75 |
&& test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \ |
| 76 |
&& test "$$(find $(pfx)/share/man -type f|sed 's,.*/,,;s,\..*,,')" = "zyx" |
| 77 |
endef |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
define my-instcheck |
| 82 |
echo running my-instcheck; \ |
| 83 |
$(MAKE) prefix=$(pfx) install \ |
| 84 |
&& test ! -f $(pfx)/bin/ginstall \ |
| 85 |
&& { fail=0; \ |
| 86 |
for i in $(built_programs); do \ |
| 87 |
test "$$i" = ginstall && i=install; \ |
| 88 |
for j in "$(pfx)/bin/$$i" \ |
| 89 |
"$(pfx)/share/man/man1/$$i.1"; do \ |
| 90 |
case $$j in *'[.1') continue;; esac; \ |
| 91 |
test -f "$$j" && : \ |
| 92 |
|| { echo "$$j not installed"; fail=1; }; \ |
| 93 |
done; \ |
| 94 |
done; \ |
| 95 |
test $$fail = 1 && exit 1 || :; \ |
| 96 |
} |
| 97 |
endef |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
define coreutils-path-check |
| 107 |
{ \ |
| 108 |
echo running coreutils-path-check; \ |
| 109 |
if test -f $(srcdir)/src/true.c; then \ |
| 110 |
fail=1; \ |
| 111 |
mkdir $(bin) \ |
| 112 |
&& ($(write_loser)) > $(bin)/loser \ |
| 113 |
&& chmod a+x $(bin)/loser \ |
| 114 |
&& for i in $(built_programs); do \ |
| 115 |
case $$i in \ |
| 116 |
rm|expr|basename|echo|sort|ls|tr);; \ |
| 117 |
cat|dirname|mv|wc);; \ |
| 118 |
*) ln $(bin)/loser $(bin)/$$i;; \ |
| 119 |
esac; \ |
| 120 |
done \ |
| 121 |
&& ln -sf ../src/true $(bin)/false \ |
| 122 |
&& PATH=`pwd`/$(bin)$(PATH_SEPARATOR)$$PATH \ |
| 123 |
$(MAKE) -C tests check \ |
| 124 |
&& { test -d gnulib-tests \ |
| 125 |
&& $(MAKE) -C gnulib-tests check \ |
| 126 |
|| :; } \ |
| 127 |
&& rm -rf $(bin) \ |
| 128 |
&& fail=0; \ |
| 129 |
else \ |
| 130 |
fail=0; \ |
| 131 |
fi; \ |
| 132 |
test $$fail = 1 && exit 1 || :; \ |
| 133 |
} |
| 134 |
endef |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
null_AM_MAKEFLAGS ?= \ |
| 139 |
ACLOCAL=false \ |
| 140 |
AUTOCONF=false \ |
| 141 |
AUTOMAKE=false \ |
| 142 |
AUTOHEADER=false \ |
| 143 |
GPERF=false \ |
| 144 |
MAKEINFO=false |
| 145 |
|
| 146 |
ALL_RECURSIVE_TARGETS += my-distcheck |
| 147 |
my-distcheck: $(DIST_ARCHIVES) $(local-check) |
| 148 |
$(MAKE) syntax-check |
| 149 |
$(MAKE) check |
| 150 |
-rm -rf $(t) |
| 151 |
mkdir -p $(t) |
| 152 |
$(amtar_extract_) $(preferred_tarball_) -C $(t) |
| 153 |
(set -e; cd $(t)/$(distdir); \ |
| 154 |
./configure --quiet --enable-gcc-warnings --disable-nls; \ |
| 155 |
$(MAKE) AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)'; \ |
| 156 |
$(MAKE) dvi; \ |
| 157 |
$(install-transform-check); \ |
| 158 |
$(my-instcheck); \ |
| 159 |
$(coreutils-path-check); \ |
| 160 |
$(MAKE) distclean \ |
| 161 |
) |
| 162 |
(cd $(t) && mv $(distdir) $(distdir).old \ |
| 163 |
&& $(amtar_extract_) - ) < $(preferred_tarball_) |
| 164 |
diff -ur $(t)/$(distdir).old $(t)/$(distdir) |
| 165 |
-rm -rf $(t) |
| 166 |
rmdir $(tmpdir)/$(PACKAGE) $(tmpdir) |
| 167 |
@echo "========================"; \ |
| 168 |
echo "ready for distribution:"; \ |
| 169 |
for i in $(DIST_ARCHIVES); do echo " $$i"; done; \ |
| 170 |
echo "========================" |