[lintian] 02/09: t/runtests: Re-sort after running post_test script
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch stretch
in repository lintian.
commit 3c32c331e98a39ced650d7a30519cce89d2cfaf0
Author: Niels Thykier <niels@thykier.net>
Date: Tue Jan 17 07:24:02 2017 +0000
t/runtests: Re-sort after running post_test script
This should fix a FTBFS on arm* and many other architectures without
having to disable the test "files-old-config-scripts".
Some outputs are architecture sensitive. Most of the time, a simple
"sed s///" is sufficient to solve the problem. However, in the
"files-old-config-scripts" test, the output for arm is sorted
differently than the output for amd64/i386 (relative to other output)
prior to the sed script is run.
To solve this, we could either run the sed script before sorting
(which would be "cheaper" resource-wise) or just re-sort post running
the script. I have opt'ed for the latter on account of it being
easier to implement.
Signed-off-by: Niels Thykier <niels@thykier.net>
---
debian/changelog | 7 +++++++
t/runtests | 15 +++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index f7ef4fc..4dfe759 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,13 @@ lintian (2.5.50.1) UNRELEASED; urgency=medium
XXX: generate tag summary
+ * t/runtests:
+ + [NT] Re-sort test output after running the "post_test" sed script
+ on the output. This prevent test failures caused by the order
+ changing on different architectures prior to the sed script is run
+ (assuming the sed script otherwise normalises the differences
+ correctly).
+
* vendors/ubuntu/main/data/changes-file/known-dists:
+ [CW] Add zesty.
diff --git a/t/runtests b/t/runtests
index 4b650c1..020f3f8 100755
--- a/t/runtests
+++ b/t/runtests
@@ -426,8 +426,19 @@ sub test_package {
# Run a sed-script if it exists, for tests that have slightly variable
# output
- runsystem_ok('sed', '-ri', '-f', "$origdir/post_test", "$rundir/tags.$pkg")
- if -e "$origdir/post_test";
+ if (-f "$origdir/post_test") {
+ runsystem_ok('sed', '-ri', '-f', "$origdir/post_test",
+ "$rundir/tags.$pkg");
+ if ($testdata->{'sort'}) {
+ # Re-sort as the sed may have changed the order lines
+ open(my $rfd, '<', "$rundir/tags.$pkg");
+ my @lines = sort(<$rfd>);
+ close($rfd);
+ open(my $wfd, '>', "$rundir/tags.$pkg");
+ print {$wfd} $_ for @lines;
+ close($wfd);
+ }
+ }
if (-x "$origdir/test_calibration") {
my $calibrated = "$rundir/expected.$pkg.calibrated";
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: