summaryrefslogtreecommitdiff
path: root/check.am
blob: 4d9b4bfe22584aeccd40436ed629fb4b0e55cca3 (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
# Variables to be defined:
#
#  TEST_PREFIX - set to the path to prefix to each test case for execution
#  TEST_VERBOSE - set to 0 (default) or 1 to control test suite verbosity
#  TEST_ENV_VARS - environment variables to be set for the test suite
#  TEST_COVERAGE - set to the perl module in charge of getting test coverage
#  test_tmpdir - test suite temporary directory
#  test_cases - list of test case files
#  test_data - list of test data files

TEST_VERBOSE ?= 0

TEST_RUNNER = '\
	my $$harness = TAP::Harness->new({ \
	    lib => [ "$(top_srcdir)/scripts" ], \
	    color => 1, \
	    verbosity => $(TEST_VERBOSE), \
	    failures => 1, \
	}); \
	my $$aggregate = $$harness->runtests(@ARGV); \
	die "FAIL: test suite has errors\n" if $$aggregate->has_errors;'

check-clean:
	[ -z "$(test_tmpdir)" ] || rm -fr $(test_tmpdir)

check-local: $(test_data) $(test_cases)
	[ -z "$(test_tmpdir)" ] || $(MKDIR_P) $(test_tmpdir)
	PATH="$(top_builddir)/src:$(top_builddir)/scripts:$(top_builddir)/utils:$(PATH)" \
	  LC_ALL=C \
	  $(TEST_ENV_VARS) \
	  srcdir=$(srcdir) builddir=$(builddir) \
	  PERL_DL_NONLAZY=1 \
	  PERL5OPT=$(TEST_COVERAGE) \
	  $(PERL) -MTAP::Harness -e $(TEST_RUNNER) \
	    $(if $(TEST_PREFIX), \
	         $(addprefix $(TEST_PREFIX)/,$(test_cases)), \
	         $(addprefix $(srcdir)/,$(test_cases)))