[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/02: t/runtests: Support test-specific lintian include dir



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 2bf79bc1c12fb309e3aebddacfa85070aa5c9e94
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Apr 9 11:31:01 2016 +0000

    t/runtests: Support test-specific lintian include dir
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 t/runtests | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/t/runtests b/t/runtests
index 00f85f6..a966770 100755
--- a/t/runtests
+++ b/t/runtests
@@ -310,8 +310,9 @@ sub test_package {
     my ($test_state, $testdata) = @_;
     my $suite = $testdata->{suite};
     my $testname = $testdata->{testname};
+    my $origdir = "$TESTSET/$suite/$testname";
 
-    if (!check_test_is_sane($TESTSET, $testdata)) {
+    if (!check_test_is_sane($TESTSET, $origdir, $testdata)) {
         return $test_state->skip_test('architecture mismatch');
     }
 
@@ -319,7 +320,6 @@ sub test_package {
 
     my $pkg = $testdata->{source};
     my $rundir = "$RUNDIR/$suite/$pkg";
-    my $origdir = "$TESTSET/$suite/$testname";
     my $orig_version = $testdata->{version};
     my $expected = "$origdir/tags";
     my $origexp = $expected;
@@ -462,6 +462,9 @@ sub run_lintian {
     unshift(@options, '--allow-root', '--no-cfg');
     unshift(@options, '--profile', $testdata->{profile});
     unshift(@options, '--no-user-dirs');
+    if (my $incl_dir = $testdata->{'lintian-include-dir'}) {
+        unshift(@options, '--include-dir', $incl_dir);
+    }
     my $pid = open(my $in, '-|');
     if ($pid) {
         my @data = <$in>;
@@ -518,7 +521,7 @@ sub run_lintian {
 sub test_changes {
     my ($test_state, $testdata) = @_;
 
-    if (!check_test_is_sane($TESTSET, $testdata)) {
+    if (!check_test_is_sane($TESTSET, undef, $testdata)) {
         return $test_state->skip_test('architecture mismatch');
     }
 
@@ -572,14 +575,14 @@ sub generic_test_runner {
     my ($test_state, $testdata, $ext) = @_;
     my $suite = $testdata->{suite};
     my $testname = $testdata->{testname};
+    my $testdir = "$TESTSET/$suite/$testname";
 
-    if (!check_test_is_sane($TESTSET, $testdata)) {
+    if (!check_test_is_sane($TESTSET, $testdir, $testdata)) {
         return $test_state->skip_test('architecture mismatch');
     }
 
     $test_state->progress('setup');
 
-    my $testdir = "$TESTSET/$suite/$testname";
     my $targetdir = "$RUNDIR/$suite/$testname";
     my $stampfile = "$RUNDIR/$suite/$testname-build-stamp";
 
@@ -1013,7 +1016,7 @@ sub handle_dump_log{
 }
 
 sub check_test_is_sane {
-    my ($dir, $data) = @_;
+    my ($dir, $testdir, $data) = @_;
 
     unless ($data->{testname} && exists $data->{version}) {
         fail('Name or Version missing');
@@ -1056,6 +1059,10 @@ sub check_test_is_sane {
         return 0;
     }
 
+    if ($testdir and -d "${testdir}/lintian-include-dir") {
+        $data->{'lintian-include-dir'} = "${testdir}/lintian-include-dir";
+    }
+
     return 1;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: