5 dh_auto_test - automatically runs a package's test suites
10 use Debian::Debhelper::Dh_Lib;
14 B<dh_auto_test> [S<I<debhelper options>>] [S<B<--> I<params>>]
18 dh_auto_test is a debhelper program that tries to automatically run a
19 package's test suite. If there's a Makefile and it contains a "test"
20 or "check" target, then this is done by running make (or MAKE, if the
21 environment variable is set). If the test suite fails, the command will
22 exit nonzero. If there's no test suite, it will exit zero without doing
25 This is intended to work for about 90% of packages with a test suite. If it
26 doesn't work, you're encouraged to skip using dh_auto_test at all, and
27 just run the test suite manually.
35 Pass "params" to the program that is run. These can be used to supplement
36 or override the any standard parameters that dh_auto_test passes.
42 If the DEB_BUILD_OPTIONS environment variable contains "nocheck", no
43 tests will be performed.
49 if (defined $ENV{DEB_BUILD_OPTIONS} && $ENV{DEB_BUILD_OPTIONS} =~ /nocheck/) {
53 if (-e "Makefile" || -e "makefile" || -e "GNUmakefile") {
54 $ENV{MAKE}="make" unless exists $ENV{MAKE};
55 foreach my $target (qw{test check}) {
56 # Use make -n to check to see if the target would do
57 # anything. There's no good way to test if a target exists.
58 my $ret=`$ENV{MAKE} -s -n $target 2>/dev/null`;
61 doit($ENV{MAKE}, $target, @{$dh{U_PARAMS}});
66 elsif (-e "Build.PL" && -e "Build") {
67 $ENV{MODULEBUILDRC} = "/dev/null";
68 doit(qw/perl Build test/, @{$dh{U_PARAMS}});
75 This program is a part of debhelper.
79 Joey Hess <joeyh@debian.org>