check.am 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Variables to be defined:
  2. #
  3. # TEST_VERBOSE - set to 0 (default) or 1 to control test suite verbosity
  4. # TEST_PARALLEL - set to 1 (default) or N to control the parallel jobs
  5. # TEST_ENV_VARS - environment variables to be set for the test suite
  6. # TEST_COVERAGE - set to the perl module in charge of getting test coverage
  7. # test_tmpdir - test suite temporary directory
  8. # test_scripts - list of test case scripts
  9. # test_programs - list of test case programs
  10. # test_data - list of test data files
  11. TEST_VERBOSE ?= 0
  12. TEST_PARALLEL ?= 1
  13. TEST_RUNNER = '\
  14. my $$harness = TAP::Harness->new({ \
  15. exec => sub { my (undef, $$test) = @_; \
  16. return [ $$test ] if $$test !~ "\.t\$$" and -x $$test; \
  17. return }, \
  18. lib => [ "$(top_srcdir)/scripts", "$(top_srcdir)/dselect/methods" ], \
  19. color => 1, \
  20. verbosity => $(TEST_VERBOSE), \
  21. jobs => $(TEST_PARALLEL), \
  22. failures => 1, \
  23. }); \
  24. my $$aggregate = $$harness->runtests(@ARGV); \
  25. die "FAIL: test suite has errors\n" if $$aggregate->has_errors;'
  26. check-clean:
  27. [ -z "$(test_tmpdir)" ] || rm -fr $(test_tmpdir)
  28. check-local: $(test_data) $(test_programs) $(test_scripts)
  29. [ -z "$(test_tmpdir)" ] || $(MKDIR_P) $(test_tmpdir)
  30. PATH="$(abs_top_builddir)/src:$(abs_top_builddir)/scripts:$(abs_top_builddir)/utils:$(PATH)" \
  31. LC_ALL=C \
  32. DPKG_COLORS=never \
  33. $(TEST_ENV_VARS) \
  34. srcdir=$(srcdir) builddir=$(builddir) \
  35. CC=$(CC) \
  36. PERL=$(PERL) \
  37. PERL_DL_NONLAZY=1 \
  38. PERL5LIB=$(abs_top_srcdir)/scripts:$(abs_top_srcdir)/dselect/methods \
  39. PERL5OPT=$(TEST_COVERAGE) \
  40. $(PERL) -MTAP::Harness -e $(TEST_RUNNER) \
  41. $(addprefix $(builddir)/,$(test_programs)) \
  42. $(addprefix $(srcdir)/,$(test_scripts))