From 5353f19c8110ded6608b2450d359dab26d63dbf3 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Tue, 21 Jan 2020 16:57:15 +0200 Subject: locus testsuite: fix synclines comparison The fix introduced in 928cd662 didn't work quite well on mswin, because Cwd::abs_path in many places inserts literal '/', instead of os-specific directory separators (see e.g. Cwd.pm:652, for version 3.40). This commit replaces os-specific separators with '/' when formatting synclines. * t/TestPreproc.pm (new): Revert 928cd662. (dump_reformat_synclines_worker): When formatting synclines, replace each occurrence of directory separator with /. * t/06locus00.t: Revert 928cd662. * t/06locus01.t: Likewise. * t/06locus02.t: Likewise. * t/06locus03.t: Likewise. * t/06locus04.t: Likewise. * t/06locus05.t: Likewise. * t/06locus06.t: Likewise. --- t/06locus00.t | 8 ++++---- t/06locus01.t | 16 ++++++++-------- t/06locus02.t | 34 +++++++++++++++++----------------- t/06locus03.t | 20 ++++++++++---------- t/06locus04.t | 8 ++++---- t/06locus05.t | 10 +++++----- t/06locus06.t | 22 +++++++++++----------- t/TestPreproc.pm | 5 +++-- 8 files changed, 62 insertions(+), 61 deletions(-) diff --git a/t/06locus00.t b/t/06locus00.t index d311e96..543760d 100644 --- a/t/06locus00.t +++ b/t/06locus00.t @@ -19,17 +19,17 @@ __DATA__ # End of file != -# {{$server_root/httpd.conf}}:1 +# $server_root/httpd.conf:1 # Start of file # $server_root/httpd.conf:2 -# {{$server_root/httpd.conf}}:3-5 +# $server_root/httpd.conf:3-5 # Comment 1 # Comment 2 # Comment 3 -# {{$server_root/httpd.conf}}:6-7 +# $server_root/httpd.conf:6-7 -# {{$server_root/httpd.conf}}:8 +# $server_root/httpd.conf:8 # End of file !$ diff --git a/t/06locus01.t b/t/06locus01.t index f1010b2..407e2a6 100644 --- a/t/06locus01.t +++ b/t/06locus01.t @@ -21,20 +21,20 @@ __DATA__ # End of file != -# {{$server_root/httpd.conf}}:1 +# $server_root/httpd.conf:1 # Start of file -# {{$server_root/httpd.conf}}:2 +# $server_root/httpd.conf:2 -# {{$server_root/httpd.conf}}:3 +# $server_root/httpd.conf:3 # Comment 1 -# {{$server_root/httpd.conf}}:4 +# $server_root/httpd.conf:4 # Comment 2 -# {{$server_root/httpd.conf}}:5 +# $server_root/httpd.conf:5 # Comment 3 -# {{$server_root/httpd.conf}}:6 +# $server_root/httpd.conf:6 -# {{$server_root/httpd.conf}}:7 +# $server_root/httpd.conf:7 -# {{$server_root/httpd.conf}}:8 +# $server_root/httpd.conf:8 # End of file !$ diff --git a/t/06locus02.t b/t/06locus02.t index f4c749d..8a09987 100644 --- a/t/06locus02.t +++ b/t/06locus02.t @@ -31,41 +31,41 @@ ServerAdmin foo@example.net # End of file != -# {{$server_root/httpd.conf}}:1 +# $server_root/httpd.conf:1 # Start of file -# {{$server_root/httpd.conf}}:2 +# $server_root/httpd.conf:2 ServerName localhost -# {{$server_root/httpd.conf}}:3 +# $server_root/httpd.conf:3 -# {{$server_root/httpd.conf}}:4 +# $server_root/httpd.conf:4 ServerAdmin foo@example.net -# {{$server_root/httpd.conf}}:5 +# $server_root/httpd.conf:5 -# {{$server_root/httpd.conf}}:6-13 +# $server_root/httpd.conf:6-13 -# {{$server_root/httpd.conf}}:7 +# $server_root/httpd.conf:7 ServerName foo -# {{$server_root/httpd.conf}}:8 +# $server_root/httpd.conf:8 DocumentRoot a -# {{$server_root/httpd.conf}}:9-12 +# $server_root/httpd.conf:9-12 -# {{$server_root/httpd.conf}}:10 +# $server_root/httpd.conf:10 AllowOverride none -# {{$server_root/httpd.conf}}:11 +# $server_root/httpd.conf:11 Require all granted -# {{$server_root/httpd.conf}}:14 +# $server_root/httpd.conf:14 -# {{$server_root/httpd.conf}}:15-18 +# $server_root/httpd.conf:15-18 -# {{$server_root/httpd.conf}}:16 +# $server_root/httpd.conf:16 ServerName bar -# {{$server_root/httpd.conf}}:17 +# $server_root/httpd.conf:17 DocumentRoot b -# {{$server_root/httpd.conf}}:19 +# $server_root/httpd.conf:19 -# {{$server_root/httpd.conf}}:20 +# $server_root/httpd.conf:20 # End of file !$ diff --git a/t/06locus03.t b/t/06locus03.t index bedf3a3..37b4c1f 100644 --- a/t/06locus03.t +++ b/t/06locus03.t @@ -27,26 +27,26 @@ PidFile logs/httpd.pid DocumentRoot b != -# {{$server_root/httpd.conf}}:1 +# $server_root/httpd.conf:1 # Start of file -# {{$server_root/httpd.conf}}:2 +# $server_root/httpd.conf:2 ServerRoot "$server_root" -# {{$server_root/httpd.conf}}:3 +# $server_root/httpd.conf:3 ServerAdmin foo@example.net -# {{$server_root/vhost1.conf}}:1-4 +# $server_root/vhost1.conf:1-4 -# {{$server_root/vhost1.conf}}:2 +# $server_root/vhost1.conf:2 ServerName foo -# {{$server_root/vhost1.conf}}:3 +# $server_root/vhost1.conf:3 DocumentRoot a -# {{$server_root/vhost2.conf}}:1-4 +# $server_root/vhost2.conf:1-4 -# {{$server_root/vhost2.conf}}:2 +# $server_root/vhost2.conf:2 ServerName bar -# {{$server_root/vhost2.conf}}:3 +# $server_root/vhost2.conf:3 DocumentRoot b -# {{$server_root/httpd.conf}}:6 +# $server_root/httpd.conf:6 PidFile logs/httpd.pid !$ diff --git a/t/06locus04.t b/t/06locus04.t index 6e1ced4..3d173c9 100644 --- a/t/06locus04.t +++ b/t/06locus04.t @@ -18,13 +18,13 @@ ServerRoot "$server_root" EndStatement true Use X bar != -# {{$server_root/httpd.conf}}:1 +# $server_root/httpd.conf:1 # Start of file -# {{$server_root/httpd.conf}}:2 +# $server_root/httpd.conf:2 ServerRoot "$server_root" -# {{$server_root/httpd.conf}}:6 +# $server_root/httpd.conf:6 EndStatement true -# {{$server_root/httpd.conf}}:4 +# $server_root/httpd.conf:4 Foo bar !$ diff --git a/t/06locus05.t b/t/06locus05.t index ea82674..9d04aee 100644 --- a/t/06locus05.t +++ b/t/06locus05.t @@ -22,7 +22,7 @@ ServerAdmin foo ServerName localhost != -# {{$server_root/httpd.conf}}:1 +# $server_root/httpd.conf:1 ServerAdmin foo !$ __END__ @@ -32,9 +32,9 @@ ServerAdmin foo ServerName localhost != -# {{$server_root/httpd.conf}}:1 +# $server_root/httpd.conf:1 ServerAdmin foo -# {{$server_root/httpd.conf}}:3 +# $server_root/httpd.conf:3 ServerName localhost !$ __END__ @@ -44,8 +44,8 @@ ServerAdmin foo ServerName localhost != -# {{$server_root/httpd.conf}}:1 +# $server_root/httpd.conf:1 ServerAdmin foo -# {{$server_root/httpd.conf}}:3 +# $server_root/httpd.conf:3 ServerName localhost !$ diff --git a/t/06locus06.t b/t/06locus06.t index bf58bb5..fa55839 100644 --- a/t/06locus06.t +++ b/t/06locus06.t @@ -61,26 +61,26 @@ LoadModule unixd_module lib/httpd/modules/mod_unixd.so MaxRequestsPerChild 0 != -# {{$server_root/httpd.conf}}:1 +# $server_root/httpd.conf:1 LoadModule mpm_prefork_module lib/httpd/modules/mod_mpm_prefork.so -# {{$server_root/httpd.conf}}:2 +# $server_root/httpd.conf:2 LoadModule unixd_module lib/httpd/modules/mod_unixd.so -# {{$server_root/httpd.conf}}:3 +# $server_root/httpd.conf:3 -# {{$server_root/httpd.conf}}:5 +# $server_root/httpd.conf:5 PidFile "/var/run/httpd.pid" -# {{$server_root/httpd.conf}}:8 +# $server_root/httpd.conf:8 StartServers 1 -# {{$server_root/httpd.conf}}:9 +# $server_root/httpd.conf:9 MinSpareServers 1 -# {{$server_root/httpd.conf}}:10 +# $server_root/httpd.conf:10 MaxSpareServers 1 -# {{$server_root/httpd.conf}}:11 +# $server_root/httpd.conf:11 MaxClients 10 -# {{$server_root/httpd.conf}}:12 +# $server_root/httpd.conf:12 MaxRequestsPerChild 0 -# {{$server_root/httpd.conf}}:43 +# $server_root/httpd.conf:43 User apache -# {{$server_root/httpd.conf}}:44 +# $server_root/httpd.conf:44 Group apache !$ diff --git a/t/TestPreproc.pm b/t/TestPreproc.pm index d4d8a58..d8e518c 100644 --- a/t/TestPreproc.pm +++ b/t/TestPreproc.pm @@ -48,8 +48,6 @@ sub new { $fd = undef; } elsif ($fd) { s/\$server_root/$dir/; - s/{{(.+)}} - /File::Spec->catfile(split m{\/}, $1)/gex; print $fd $_; } } @@ -79,8 +77,11 @@ sub dump_reformat_synclines { sub dump_reformat_synclines_worker { my ($tree, $dir) = @_; + my $sep = qr(File::Spec->catfile('','')); + join('', map { (my $l = $_->locus->format) =~ s{$dir/}{}g; + $l =~ s{$sep}{/}g; "# $l\n" . do { if ($_->type eq 'section') { -- cgit v1.2.1