File: syntax-progs.t

package info (click to toggle)
debhelper 13.29
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,464 kB
  • sloc: perl: 15,632; makefile: 131; sh: 9
file content (28 lines) | stat: -rwxr-xr-x 686 bytes parent folder | download | duplicates (7)
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
#!/usr/bin/perl
use strict;
use warnings;
use Test::More;

use File::Basename qw(dirname);
use lib dirname(dirname(__FILE__));
# Need Test::More to set PERL5LIB
use Test::DH;

use Config;
my $binpath = $ENV{AUTOPKGTEST_TMP} ? '/usr/bin' : '.';
my $libpath = $ENV{AUTOPKGTEST_TMP} ? $Config{vendorlib} : 'lib';

my @targets;
if ($0 =~ m{syntax-progs\.t$}) {
	@targets = grep { -x $_ } glob("$binpath/dh_*"), "$binpath/dh";
} else {
	@targets = (glob("$libpath/Debian/Debhelper/*.pm"), glob("$libpath/Debian/Debhelper/*/*.pm"));
}

plan(tests => scalar(@targets));

foreach my $file (@targets) {
	is(system("perl -c $file >/dev/null 2>&1"), 0)
	  or diag("$file failed syntax check");
}