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

Bug#809440: lintian: runtime-test-file-is-not-a-regular-file complains about a symlink to a regular test file



Hi Jakub,

On 02/14/2016 05:34 PM, Jakub Wilk wrote:
> * Christian Seiler <christian@iwakd.de>, 2016-02-14, 17:30:
>>>> Relative symbolic links to autopkgtest tests should be allowed as long as they point to regular files. This adds the following tags for identifying problematic types of symlinks:
>>>>
>>>> - runtime-test-file-is-absolute-symlink
>>>> - runtime-test-file-is-self-recursive-symlink
>>>> - runtime-test-file-is-broken-symlink
>>>> - runtime-test-file-is-symlink-to-non-regular-file
>>>
>>> I don't think we need separate tags for every kind of brokenness. One tag should be enough.
>>
>> Ok, I can provide a patch that just emits runtime-test-file-is-not-a-regular-file if is_open_ok fails and updates the description of that tag that symbolic links are also allowed, as long as they point to a regular file, if that is OK with you?
> 
> Sounds good to me! :)

Patch is attached.

I've test-built lintian with my patch in a clean sid pbuilder chroot
and.

Regards,
Christian
From 6b949549caed8e277a5893209c95031513878d9e Mon Sep 17 00:00:00 2001
From: Christian Seiler <christian@iwakd.de>
Date: Sun, 14 Feb 2016 17:46:21 +0100
Subject: [PATCH] Allow relative symlinks for autopkgtest tests

Relative symbolic links to autopkgtest tests should be allowed as long
as they point to regular files.

Closes: #809440
---
 checks/testsuite.desc                                 |  3 ++-
 checks/testsuite.pm                                   |  2 +-
 t/tests/testsuite-general/debian/debian/tests/control |  3 +++
 t/tests/testsuite-general/pre_build                   | 11 ++++++++++-
 t/tests/testsuite-general/tags                        |  6 ++++++
 5 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/checks/testsuite.desc b/checks/testsuite.desc
index 1fad72d..f68fc74 100644
--- a/checks/testsuite.desc
+++ b/checks/testsuite.desc
@@ -68,7 +68,8 @@ Tag: runtime-test-file-is-not-a-regular-file
 Severity: wishlist
 Certainty: certain
 Info: A runtime test listed by debian/tests/control is not a regular
- file.
+ file or a relative symbolic link to a regular file in the source
+ package.
 Ref: http://anonscm.debian.org/gitweb/?p=autopkgtest/autopkgtest.git;a=blob_plain;f=doc/README.package-tests.rst;hb=HEAD
 
 Tag: syntax-error-in-debian-tests-control
diff --git a/checks/testsuite.pm b/checks/testsuite.pm
index a9de939..aa57023 100644
--- a/checks/testsuite.pm
+++ b/checks/testsuite.pm
@@ -184,7 +184,7 @@ sub check_test_file {
     if (not defined($index)) {
         tag 'missing-runtime-test-file', $path,
           'paragraph starting at line', $line;
-    } elsif (not $index->is_regular_file) {
+    } elsif (not $index->is_open_ok) {
         tag 'runtime-test-file-is-not-a-regular-file', $path;
     }
     # Test files are allowed not to be executable.
diff --git a/t/tests/testsuite-general/debian/debian/tests/control b/t/tests/testsuite-general/debian/debian/tests/control
index 6348583..0fef676 100644
--- a/t/tests/testsuite-general/debian/debian/tests/control
+++ b/t/tests/testsuite-general/debian/debian/tests/control
@@ -30,3 +30,6 @@ Depends: @
 
 Tests: test-1, test-2
 Depends: @
+
+Tests: asym, asym1, self, self1, broken, lfifo, working
+Depends: @
diff --git a/t/tests/testsuite-general/pre_build b/t/tests/testsuite-general/pre_build
index 9302e88..1043be5 100755
--- a/t/tests/testsuite-general/pre_build
+++ b/t/tests/testsuite-general/pre_build
@@ -3,4 +3,13 @@
 set -e
 
 DIR="$1"
-mkfifo "$DIR/debian/tests/fifo"
+mkfifo            "$DIR/debian/tests/fifo"
+ln -s /dev/null   "$DIR/debian/tests/asym"
+ln -s /dev/null   "$DIR/debian/tests/asym2"
+ln -s asym2       "$DIR/debian/tests/asym1"
+ln -s self        "$DIR/debian/tests/self"
+ln -s self2       "$DIR/debian/tests/self2"
+ln -s self2       "$DIR/debian/tests/self1"
+ln -s nonexistent "$DIR/debian/tests/broken"
+ln -s fifo        "$DIR/debian/tests/lfifo"
+ln -s test-1      "$DIR/debian/tests/working"
diff --git a/t/tests/testsuite-general/tags b/t/tests/testsuite-general/tags
index c537b70..95dcb9a 100644
--- a/t/tests/testsuite-general/tags
+++ b/t/tests/testsuite-general/tags
@@ -1,4 +1,10 @@
+I: testsuite-general source: runtime-test-file-is-not-a-regular-file debian/tests/asym
+I: testsuite-general source: runtime-test-file-is-not-a-regular-file debian/tests/asym1
+I: testsuite-general source: runtime-test-file-is-not-a-regular-file debian/tests/broken
 I: testsuite-general source: runtime-test-file-is-not-a-regular-file debian/tests/fifo
+I: testsuite-general source: runtime-test-file-is-not-a-regular-file debian/tests/lfifo
+I: testsuite-general source: runtime-test-file-is-not-a-regular-file debian/tests/self
+I: testsuite-general source: runtime-test-file-is-not-a-regular-file debian/tests/self1
 P: testsuite-general source: unknown-runtime-tests-feature unknownfeature paragraph starting at line 24
 P: testsuite-general source: unknown-runtime-tests-field comment paragraph starting at line 1
 P: testsuite-general source: unknown-runtime-tests-restriction unknownrestriction paragraph starting at line 24
-- 
2.1.4

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: