2009-04-25 03:36:22 +08:00
|
|
|
# Most of this is probably too coreutils-centric to be useful to other packages.
|
|
|
|
|
|
|
|
bin=bin-$$$$
|
|
|
|
|
|
|
|
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
|
|
|
|
|
2009-12-06 05:16:32 +08:00
|
|
|
tmpdir = $(abs_top_builddir)/tests/torture
|
|
|
|
|
|
|
|
t=$(tmpdir)/$(PACKAGE)/test
|
2009-04-25 03:36:22 +08:00
|
|
|
pfx=$(t)/i
|
|
|
|
|
2012-09-01 18:15:59 +08:00
|
|
|
built_programs := $(sort $(patsubst src/%$(EXEEXT),%,$(bin_PROGRAMS)))
|
2009-12-13 17:35:49 +08:00
|
|
|
|
2009-04-25 03:36:22 +08:00
|
|
|
# More than once, tainted build and source directory names would
|
|
|
|
# have caused at least one "make check" test to apply "chmod 700"
|
|
|
|
# to all directories under $HOME. Make sure it doesn't happen again.
|
2009-12-06 05:16:32 +08:00
|
|
|
tp = $(tmpdir)/taint
|
2009-04-25 03:36:22 +08:00
|
|
|
t_prefix = $(tp)/a
|
|
|
|
t_taint = '$(t_prefix) b'
|
|
|
|
fake_home = $(tp)/home
|
|
|
|
|
2009-12-14 00:55:13 +08:00
|
|
|
# When extracting from a distribution tarball, extract using the fastest
|
|
|
|
# method possible. With dist-xz, that means using the *.xz file.
|
|
|
|
ifneq ('', $(filter *.xz, $(DIST_ARCHIVES)))
|
|
|
|
tar_decompress_opt_ = J
|
|
|
|
suffix_ = xz
|
|
|
|
else
|
|
|
|
ifneq ('', $(filter *.gz, $(DIST_ARCHIVES)))
|
|
|
|
tar_decompress_opt_ = z
|
|
|
|
suffix_ = gz
|
|
|
|
else
|
|
|
|
tar_decompress_opt_ = j
|
|
|
|
suffix_ = bz2
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
amtar_extract_ = $(AMTAR) -$(tar_decompress_opt_)xf
|
|
|
|
preferred_tarball_ = $(distdir).tar.$(suffix_)
|
|
|
|
|
2009-04-25 03:36:22 +08:00
|
|
|
# Ensure that tests run from tainted build and src dir names work,
|
|
|
|
# and don't affect anything in $HOME. Create witness files in $HOME,
|
|
|
|
# record their attributes, and build/test. Then ensure that the
|
|
|
|
# witnesses were not affected.
|
2009-12-09 17:26:21 +08:00
|
|
|
# Skip this test when using libtool, since libtool-generated scripts
|
|
|
|
# cannot deal with a space-tainted srcdir.
|
2009-04-25 03:36:22 +08:00
|
|
|
ALL_RECURSIVE_TARGETS += taint-distcheck
|
|
|
|
taint-distcheck: $(DIST_ARCHIVES)
|
2009-12-20 17:50:29 +08:00
|
|
|
grep '^[ ]*LT_INIT' configure.ac >/dev/null && exit 0 || :
|
2009-04-25 03:36:22 +08:00
|
|
|
test -d $(t_taint) && chmod -R 700 $(t_taint) || :
|
|
|
|
-rm -rf $(t_taint) $(fake_home)
|
|
|
|
mkdir -p $(t_prefix) $(t_taint) $(fake_home)
|
2009-12-14 00:55:13 +08:00
|
|
|
$(amtar_extract_) $(preferred_tarball_) -C $(t_taint)
|
2009-04-25 03:36:22 +08:00
|
|
|
mkfifo $(fake_home)/fifo
|
|
|
|
touch $(fake_home)/f
|
|
|
|
mkdir -p $(fake_home)/d/e
|
|
|
|
ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before
|
2009-12-06 05:16:32 +08:00
|
|
|
HOME=$(fake_home); export HOME; \
|
2009-04-25 03:36:22 +08:00
|
|
|
cd $(t_taint)/$(distdir) \
|
|
|
|
&& ./configure \
|
|
|
|
&& $(MAKE) \
|
2009-12-06 05:16:32 +08:00
|
|
|
&& $(MAKE) check \
|
2009-04-25 03:36:22 +08:00
|
|
|
&& ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \
|
|
|
|
&& diff $(tp)/.ls-before $(tp)/.ls-after \
|
|
|
|
&& test -d $(t_prefix)
|
|
|
|
rm -rf $(tp)
|
|
|
|
|
|
|
|
# Verify that a twisted use of --program-transform-name=PROGRAM works.
|
|
|
|
define install-transform-check
|
|
|
|
echo running install-transform-check \
|
|
|
|
&& rm -rf $(pfx) \
|
|
|
|
&& $(MAKE) program_transform_name='s/.*/zyx/' \
|
|
|
|
prefix=$(pfx) install \
|
|
|
|
&& test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \
|
|
|
|
&& test "$$(find $(pfx)/share/man -type f|sed 's,.*/,,;s,\..*,,')" = "zyx"
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Install, then verify that all binaries and man pages are in place.
|
2009-12-14 00:55:13 +08:00
|
|
|
# Note that neither the binary, ginstall, nor the [.1 man page is installed.
|
2009-04-25 03:36:22 +08:00
|
|
|
define my-instcheck
|
2009-12-06 05:16:32 +08:00
|
|
|
echo running my-instcheck; \
|
2009-04-25 03:36:22 +08:00
|
|
|
$(MAKE) prefix=$(pfx) install \
|
|
|
|
&& test ! -f $(pfx)/bin/ginstall \
|
|
|
|
&& { fail=0; \
|
|
|
|
for i in $(built_programs); do \
|
|
|
|
test "$$i" = ginstall && i=install; \
|
|
|
|
for j in "$(pfx)/bin/$$i" \
|
|
|
|
"$(pfx)/share/man/man1/$$i.1"; do \
|
|
|
|
case $$j in *'[.1') continue;; esac; \
|
|
|
|
test -f "$$j" && : \
|
|
|
|
|| { echo "$$j not installed"; fail=1; }; \
|
|
|
|
done; \
|
|
|
|
done; \
|
|
|
|
test $$fail = 1 && exit 1 || :; \
|
|
|
|
}
|
|
|
|
endef
|
|
|
|
|
2009-12-13 17:35:49 +08:00
|
|
|
# Use this to make sure we don't run these programs when building
|
2009-12-14 00:55:13 +08:00
|
|
|
# from a virgin compressed tarball file, below.
|
2009-12-13 17:35:49 +08:00
|
|
|
null_AM_MAKEFLAGS ?= \
|
|
|
|
ACLOCAL=false \
|
|
|
|
AUTOCONF=false \
|
|
|
|
AUTOMAKE=false \
|
|
|
|
AUTOHEADER=false \
|
|
|
|
GPERF=false \
|
|
|
|
MAKEINFO=false
|
|
|
|
|
2009-04-25 03:36:22 +08:00
|
|
|
ALL_RECURSIVE_TARGETS += my-distcheck
|
|
|
|
my-distcheck: $(DIST_ARCHIVES) $(local-check)
|
|
|
|
$(MAKE) syntax-check
|
|
|
|
$(MAKE) check
|
|
|
|
-rm -rf $(t)
|
|
|
|
mkdir -p $(t)
|
2009-12-14 00:55:13 +08:00
|
|
|
$(amtar_extract_) $(preferred_tarball_) -C $(t)
|
2009-12-14 18:33:03 +08:00
|
|
|
(set -e; cd $(t)/$(distdir); \
|
|
|
|
./configure --quiet --enable-gcc-warnings --disable-nls; \
|
|
|
|
$(MAKE) AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)'; \
|
|
|
|
$(MAKE) dvi; \
|
|
|
|
$(install-transform-check); \
|
|
|
|
$(my-instcheck); \
|
|
|
|
$(MAKE) distclean \
|
|
|
|
)
|
2009-04-25 03:36:22 +08:00
|
|
|
(cd $(t) && mv $(distdir) $(distdir).old \
|
2009-12-14 00:55:13 +08:00
|
|
|
&& $(amtar_extract_) - ) < $(preferred_tarball_)
|
2016-09-15 05:16:40 +08:00
|
|
|
# With post-v1.15 automake, "distclean" would fail to remove .deps
|
|
|
|
# directories, leading to a spurious failure of the following recursive diff.
|
|
|
|
# FIXME: remove this, once automake is fixed.
|
2016-11-30 22:47:08 +08:00
|
|
|
find $(t)/$(distdir).old $(t)/$(distdir) -name .deps | xargs -r rmdir
|
2009-04-25 03:36:22 +08:00
|
|
|
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
|
|
|
|
-rm -rf $(t)
|
2009-12-06 05:16:32 +08:00
|
|
|
rmdir $(tmpdir)/$(PACKAGE) $(tmpdir)
|
2009-04-25 03:36:22 +08:00
|
|
|
@echo "========================"; \
|
2009-12-13 23:58:10 +08:00
|
|
|
echo "ready for distribution:"; \
|
|
|
|
for i in $(DIST_ARCHIVES); do echo " $$i"; done; \
|
2009-04-25 03:36:22 +08:00
|
|
|
echo "========================"
|