From 097cbec3c4f8d6ea143abc76c6c5e4aaa43121a3 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Tue, 22 Jan 2019 16:23:49 -0800 Subject: [PATCH] fix cds test - use $PERL instead of perl - use $DIFF instead of cmp for windows portability; cmp doesn't handle CR characters properly --- bin/tests/system/cds/checktime.pl | 14 +++++++++----- bin/tests/system/cds/setup.sh | 2 +- bin/tests/system/cds/tests.sh | 6 +++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/bin/tests/system/cds/checktime.pl b/bin/tests/system/cds/checktime.pl index d26dbf1269..947f0f4f02 100644 --- a/bin/tests/system/cds/checktime.pl +++ b/bin/tests/system/cds/checktime.pl @@ -9,13 +9,17 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -$target = shift; +use strict; +use warnings; + +my $target = shift; +my $notbefore; +my $inception; while (<>) { - $notbefore = $1 if m{^.* must not be signed before \d+ [(](\d+)[)]$}; - $inception = $1 if m{^.* inception time \d+ [(](\d+)[)]$}; + $notbefore = $1 if m{^.* must not be signed before \d+ [(](\d+)[)]}; + $inception = $1 if m{^.* inception time \d+ [(](\d+)[)]}; } die "missing notbefore time" unless $notbefore; die "missing inception time" unless $inception; my $delta = $inception - $notbefore; -die "bad inception time $delta" - unless abs($delta - $target) < 3; +die "bad inception time $delta" unless abs($delta - $target) < 3; diff --git a/bin/tests/system/cds/setup.sh b/bin/tests/system/cds/setup.sh index 6aafe92ccf..ca13261af5 100644 --- a/bin/tests/system/cds/setup.sh +++ b/bin/tests/system/cds/setup.sh @@ -38,7 +38,7 @@ id2=$id2 EOF tac() { - perl -e 'print reverse <>' "$@" + $PERL -e 'print reverse <>' "$@" } convert() { diff --git a/bin/tests/system/cds/tests.sh b/bin/tests/system/cds/tests.sh index 43368a4c5d..35b864e72b 100644 --- a/bin/tests/system/cds/tests.sh +++ b/bin/tests/system/cds/tests.sh @@ -51,7 +51,7 @@ check_stderr() { } check_stdout() { - cmp out.$n "${out:-empty}" >/dev/null && return + $DIFF out.$n "${out:-empty}" >/dev/null && return echo_d "stdout did not match '$out'" ( echo "wanted" cat "$out" @@ -127,10 +127,10 @@ name='in-place backup correct modification time' testcase 0 $PERL checkmtime.pl 7200 DS.inplace.bak name='in-place correct output' -testcase 0 cmp DS.1 DS.inplace +testcase 0 $DIFF DS.1 DS.inplace name='in-place backup unmodified' -testcase 0 cmp DS.1 DS.inplace.bak +testcase 0 $DIFF DS.1 DS.inplace.bak name='one mangled DS' err='found RRSIG by key'