1 # Most of this is probably too coreutils-centric to be useful to other packages.
5 write_loser
= printf
'\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
7 tmpdir
= $(abs_top_builddir
)/tests
/torture
9 t
=$(tmpdir
)/$(PACKAGE
)/test
12 built_programs
:= $(sort $(patsubst src
/%$(EXEEXT
),%,$(bin_PROGRAMS
)))
14 # More than once, tainted build and source directory names would
15 # have caused at least one "make check" test to apply "chmod 700"
16 # to all directories under $HOME. Make sure it doesn't happen again.
19 t_taint
= '$(t_prefix) b'
20 fake_home
= $(tp
)/home
22 # When extracting from a distribution tarball, extract using the fastest
23 # method possible. With dist-xz, that means using the *.xz file.
24 ifneq ('', $(filter *.xz
, $(DIST_ARCHIVES
)))
25 tar_decompress_opt_
= J
28 ifneq ('', $(filter *.gz
, $(DIST_ARCHIVES
)))
29 tar_decompress_opt_
= z
32 tar_decompress_opt_
= j
36 amtar_extract_
= $(AMTAR
) -$(tar_decompress_opt_
)xf
37 preferred_tarball_
= $(distdir
).
tar.
$(suffix_
)
39 # Ensure that tests run from tainted build and src dir names work,
40 # and don't affect anything in $HOME. Create witness files in $HOME,
41 # record their attributes, and build/test. Then ensure that the
42 # witnesses were not affected.
43 # Skip this test when using libtool, since libtool-generated scripts
44 # cannot deal with a space-tainted srcdir.
45 ALL_RECURSIVE_TARGETS
+= taint-distcheck
46 taint-distcheck
: $(DIST_ARCHIVES
)
47 grep
'^[ ]*LT_INIT' configure.ac
>/dev
/null
&& exit
0 ||
:
48 test -d
$(t_taint
) && chmod
-R
700 $(t_taint
) ||
:
49 -rm -rf
$(t_taint
) $(fake_home
)
50 mkdir
-p
$(t_prefix
) $(t_taint
) $(fake_home
)
51 $(amtar_extract_
) $(preferred_tarball_
) -C
$(t_taint
)
52 mkfifo
$(fake_home
)/fifo
54 mkdir
-p
$(fake_home
)/d
/e
55 ls
-lR
$(fake_home
) $(t_prefix
) > $(tp
)/.ls-before
56 HOME
=$(fake_home
); export HOME
; \
57 cd
$(t_taint
)/$(distdir
) \
61 && ls
-lR
$(fake_home
) $(t_prefix
) > $(tp
)/.ls-after \
62 && diff
$(tp
)/.ls-before
$(tp
)/.ls-after \
63 && test -d
$(t_prefix
)
66 # Verify that a twisted use of --program-transform-name=PROGRAM works.
67 define install-transform-check
68 echo running install-transform-check \
70 && $(MAKE
) program_transform_name
='s/.*/zyx/' \
71 prefix=$(pfx
) install \
72 && test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \
73 && test "$$(find $(pfx)/share/man -type f|sed 's,.*/,,;s,\..*,,')" = "zyx"
76 # Install, then verify that all binaries and man pages are in place.
77 # Note that neither the binary, ginstall, nor the [.1 man page is installed.
79 echo running my-instcheck
; \
80 $(MAKE
) prefix=$(pfx
) install \
81 && test ! -f
$(pfx
)/bin
/ginstall \
83 for i in
$(built_programs
); do \
84 test "$$i" = ginstall
&& i
=install; \
85 for j in
"$(pfx)/bin/$$i" \
86 "$(pfx)/share/man/man1/$$i.1"; do \
87 case
$$j in
*'[.1') continue
;; esac
; \
89 ||
{ echo
"$$j not installed"; fail
=1; }; \
92 test $$fail = 1 && exit
1 ||
:; \
96 # Use this to make sure we don't run these programs when building
97 # from a virgin compressed tarball file, below.
98 null_AM_MAKEFLAGS ?
= \
106 ALL_RECURSIVE_TARGETS
+= my-distcheck
107 my-distcheck
: $(DIST_ARCHIVES
) $(local-check
)
112 $(amtar_extract_
) $(preferred_tarball_
) -C
$(t
)
113 (set
-e
; cd
$(t
)/$(distdir
); \
114 .
/configure
--quiet
--enable-gcc-warnings
--disable-nls
; \
115 $(MAKE
) AM_MAKEFLAGS
='$(null_AM_MAKEFLAGS)'; \
117 $(install-transform-check
); \
121 (cd
$(t
) && mv
$(distdir
) $(distdir
).old \
122 && $(amtar_extract_
) - ) < $(preferred_tarball_
)
123 # With post-v1.15 automake, "distclean" would fail to remove .deps
124 # directories, leading to a spurious failure of the following recursive diff.
125 # FIXME: remove this, once automake is fixed.
126 find
$(t
)/$(distdir
).old
$(t
)/$(distdir
) -name .deps | xargs
-r rmdir
127 diff
-ur
$(t
)/$(distdir
).old
$(t
)/$(distdir
)
129 rmdir
$(tmpdir
)/$(PACKAGE
) $(tmpdir
)
130 @echo
"========================"; \
131 echo
"ready for distribution:"; \
132 for i in
$(DIST_ARCHIVES
); do echo
" $$i"; done
; \
133 echo
"========================"