Meson: Update cross compilation doc
[glib.git] / glib-tap.mk
blobe73438db8ce37d054f82ac5b45dba7fa0b666ec3
1 # GLIB - Library of useful C routines
3 AM_TESTS_ENVIRONMENT= \
4 G_TEST_SRCDIR="$(abs_srcdir)" \
5 G_TEST_BUILDDIR="$(abs_builddir)" \
6 G_DEBUG=gc-friendly \
7 MALLOC_CHECK_=2 \
8 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
9 LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh
10 LOG_COMPILER = $(top_srcdir)/tap-test
12 NULL =
14 # initialize variables for unconditional += appending
15 BUILT_SOURCES =
16 BUILT_EXTRA_DIST =
17 CLEANFILES = *.log *.trs
18 DISTCLEANFILES =
19 MAINTAINERCLEANFILES =
20 EXTRA_DIST =
21 TESTS =
23 installed_test_LTLIBRARIES =
24 installed_test_PROGRAMS =
25 installed_test_SCRIPTS =
26 nobase_installed_test_DATA =
28 noinst_LTLIBRARIES =
29 noinst_PROGRAMS =
30 noinst_SCRIPTS =
31 noinst_DATA =
33 check_LTLIBRARIES =
34 check_PROGRAMS =
35 check_SCRIPTS =
36 check_DATA =
38 # We support a fairly large range of possible variables. It is expected that all types of files in a test suite
39 # will belong in exactly one of the following variables.
41 # First, we support the usual automake suffixes, but in lowercase, with the customary meaning:
43 # test_programs, test_scripts, test_data, test_ltlibraries
45 # The above are used to list files that are involved in both uninstalled and installed testing. The
46 # test_programs and test_scripts are taken to be actual testcases and will be run as part of the test suite.
47 # Note that _data is always used with the nobase_ automake variable name to ensure that installed test data is
48 # installed in the same way as it appears in the package layout.
50 # In order to mark a particular file as being only for one type of testing, use 'installed' or 'uninstalled',
51 # like so:
53 # installed_test_programs, uninstalled_test_programs
54 # installed_test_scripts, uninstalled_test_scripts
55 # installed_test_data, uninstalled_test_data
56 # installed_test_ltlibraries, uninstalled_test_ltlibraries
58 # Additionally, we support 'extra' infixes for programs and scripts. This is used for support programs/scripts
59 # that should not themselves be run as testcases (but exist to be used from other testcases):
61 # test_extra_programs, installed_test_extra_programs, uninstalled_test_extra_programs
62 # test_extra_scripts, installed_test_extra_scripts, uninstalled_test_extra_scripts
64 # Additionally, for _scripts and _data, we support the customary dist_ prefix so that the named script or data
65 # file automatically end up in the tarball.
67 # dist_test_scripts, dist_test_data, dist_test_extra_scripts
68 # dist_installed_test_scripts, dist_installed_test_data, dist_installed_test_extra_scripts
69 # dist_uninstalled_test_scripts, dist_uninstalled_test_data, dist_uninstalled_test_extra_scripts
71 # Note that no file is automatically disted unless it appears in one of the dist_ variables. This follows the
72 # standard automake convention of not disting programs scripts or data by default.
74 # test_programs, test_scripts, uninstalled_test_programs and uninstalled_test_scripts (as well as their disted
75 # variants) will be run as part of the in-tree 'make check'. These are all assumed to be runnable under
76 # gtester. That's a bit strange for scripts, but it's possible.
78 TESTS += $(test_programs) $(test_scripts) $(uninstalled_test_programs) $(uninstalled_test_scripts) \
79 $(dist_test_scripts) $(dist_uninstalled_test_scripts)
81 # Note: build even the installed-only targets during 'make check' to ensure that they still work.
82 # We need to do a bit of trickery here and manage disting via EXTRA_DIST instead of using dist_ prefixes to
83 # prevent automake from mistreating gmake functions like $(wildcard ...) and $(addprefix ...) as if they were
84 # filenames, including removing duplicate instances of the opening part before the space, eg. '$(addprefix'.
85 all_test_programs = $(test_programs) $(uninstalled_test_programs) $(installed_test_programs) \
86 $(test_extra_programs) $(uninstalled_test_extra_programs) $(installed_test_extra_programs)
87 all_test_scripts = $(test_scripts) $(uninstalled_test_scripts) $(installed_test_scripts) \
88 $(test_extra_scripts) $(uninstalled_test_extra_scripts) $(installed_test_extra_scripts)
89 all_dist_test_scripts = $(dist_test_scripts) $(dist_uninstalled_test_scripts) $(dist_installed_test_scripts) \
90 $(dist_test_extra_scripts) $(dist_uninstalled_test_extra_scripts) $(dist_installed_test_extra_scripts)
91 all_test_scripts += $(all_dist_test_scripts)
92 EXTRA_DIST += $(all_dist_test_scripts)
93 all_test_data = $(test_data) $(uninstalled_test_data) $(installed_test_data)
94 all_dist_test_data = $(dist_test_data) $(dist_uninstalled_test_data) $(dist_installed_test_data)
95 all_test_data += $(all_dist_test_data)
96 EXTRA_DIST += $(all_dist_test_data)
97 all_test_ltlibs = $(test_ltlibraries) $(uninstalled_test_ltlibraries) $(installed_test_ltlibraries)
99 if ENABLE_ALWAYS_BUILD_TESTS
100 noinst_LTLIBRARIES += $(all_test_ltlibs)
101 noinst_PROGRAMS += $(all_test_programs)
102 noinst_SCRIPTS += $(all_test_scripts)
103 noinst_DATA += $(all_test_data)
104 else
105 check_LTLIBRARIES += $(all_test_ltlibs)
106 check_PROGRAMS += $(all_test_programs)
107 check_SCRIPTS += $(all_test_scripts)
108 check_DATA += $(all_test_data)
109 endif
111 if ENABLE_INSTALLED_TESTS
112 installed_test_PROGRAMS += $(test_programs) $(installed_test_programs) \
113 $(test_extra_programs) $(installed_test_extra_programs)
114 installed_test_SCRIPTS += $(test_scripts) $(installed_test_scripts) \
115 $(test_extra_scripts) $(installed_test_extra_scripts)
116 installed_test_SCRIPTS += $(dist_test_scripts) $(dist_test_extra_scripts) \
117 $(dist_installed_test_scripts) $(dist_installed_test_extra_scripts)
118 nobase_installed_test_DATA += $(test_data) $(installed_test_data)
119 nobase_installed_test_DATA += $(dist_test_data) $(dist_installed_test_data)
120 installed_test_LTLIBRARIES += $(test_ltlibraries) $(installed_test_ltlibraries)
121 installed_testcases = $(test_programs) $(installed_test_programs) \
122 $(test_scripts) $(installed_test_scripts) \
123 $(dist_test_scripts) $(dist_installed_test_scripts)
125 installed_test_meta_DATA = $(installed_testcases:=.test)
127 %.test: %$(EXEEXT) Makefile
128 $(AM_V_GEN) ($(MKDIR_P) $(@D); \
129 echo '[Test]' > $@.tmp; \
130 echo 'Type=session' >> $@.tmp; \
131 echo 'Exec=$(installed_testdir)/$(notdir $<) --tap' >> $@.tmp; \
132 echo 'Output=TAP' >> $@.tmp; \
133 mv $@.tmp $@)
135 CLEANFILES += $(installed_test_meta_DATA)
136 endif