]> git.donarmstrong.com Git - debhelper.git/blob - dh_auto_test
dh_auto_test: New program, automates running make test or make check if the Makefile...
[debhelper.git] / dh_auto_test
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_auto_test - automatically runs a package's test suites
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_auto_test> [S<I<debhelper options>>] [S<B<--> I<params>>]
15
16 =head1 DESCRIPTION
17
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
23 anything.
24
25 This is intended to work for about 90% of packages with a test suite. If it
26 doesn't work, you're encoruaged to skip using dh_auto_test at all, and
27 just run the test suite manually.
28
29 =head1 OPTIONS
30
31 =over 4
32
33 =item B<--> I<params>
34
35 Pass "params" to the program that is run. These can be used to suppliment
36 or override the any standard parameters that dh_auto_test passes.
37
38 =back
39
40 =cut
41
42 init();
43
44 if (-e "Makefile" || -e "makefile" || -e "GNUmakefile") {
45         foreach my $target (qw{test check}) {
46                 my $ret=system("make --question $target >/dev/null 2>&1");
47                 if ($ret == 0) {
48                         doit(exists $ENV{MAKE} ? $ENV{MAKE} : "make",
49                                 $target, @{$dh{U_PARAMS}});
50                         last;
51                 }
52         }
53 }
54
55 =head1 SEE ALSO
56
57 L<debhelper(7)>
58
59 This program is a part of debhelper.
60
61 =head1 AUTHOR
62
63 Joey Hess <joeyh@debian.org>
64
65 =cut