diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2014-08-18 22:58:20 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2014-08-18 22:58:20 +0000 |
commit | f52647cf72e7c4c63b13c301a0d73b74a114f8b2 (patch) | |
tree | 16aded1b29434c16a75b096ef6b3c8a188a108e1 /regress/sys/kern | |
parent | 3e7efed81f8f874970bc32590fda2d79a040ae6b (diff) |
Make the perl modules consistent for the multiple regression tests.
This includes coding style, better error messages and variable
naming.
Diffstat (limited to 'regress/sys/kern')
-rw-r--r-- | regress/sys/kern/sosplice/LICENSE | 2 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/Proc.pm | 12 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/Remote.pm | 12 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/error/error.pl | 13 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/error/remote.pl | 12 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/tcp/direct.pl | 13 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/tcp/relay.pl | 12 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/tcp/remote.pl | 14 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/udp/direct.pl | 13 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/udp/relay.pl | 12 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/udp/remote.pl | 14 |
11 files changed, 63 insertions, 66 deletions
diff --git a/regress/sys/kern/sosplice/LICENSE b/regress/sys/kern/sosplice/LICENSE index 9d91f4737f8..a6e1dd38fcf 100644 --- a/regress/sys/kern/sosplice/LICENSE +++ b/regress/sys/kern/sosplice/LICENSE @@ -1,4 +1,4 @@ -# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org> +# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above diff --git a/regress/sys/kern/sosplice/Proc.pm b/regress/sys/kern/sosplice/Proc.pm index 12b95daf477..5ec5315f8c9 100644 --- a/regress/sys/kern/sosplice/Proc.pm +++ b/regress/sys/kern/sosplice/Proc.pm @@ -1,6 +1,6 @@ -# $OpenBSD: Proc.pm,v 1.2 2013/01/08 21:20:00 bluhm Exp $ +# $OpenBSD: Proc.pm,v 1.3 2014/08/18 22:58:19 bluhm Exp $ -# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org> +# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -59,7 +59,7 @@ sub run { my $self = shift; defined(my $pid = fork()) - or die ref($self), " fork child failed"; + or die ref($self), " fork child failed: $!"; if ($pid) { $CHILDREN{$pid} = 1; $self->{pid} = $pid; @@ -81,9 +81,9 @@ sub run { alarm($self->{alarm}) if $self->{alarm}; $self->{func}->($self); print STDERR "Shutdown", "\n"; + IO::Handle::flush(\*STDOUT); IO::Handle::flush(\*STDERR); - POSIX::_exit(0); } @@ -143,7 +143,7 @@ sub up { my $self = shift; my $timeout = shift || 10; $self->loggrep(qr/$self->{up}/, $timeout) - or croak ref($self), " no $self->{up} in $self->{logfile} ". + or croak ref($self), " no '$self->{up}' in $self->{logfile} ". "after $timeout seconds"; return $self; } @@ -152,7 +152,7 @@ sub down { my $self = shift; my $timeout = shift || 30; $self->loggrep(qr/$self->{down}/, $timeout) - or croak ref($self), " no $self->{down} in $self->{logfile} ". + or croak ref($self), " no '$self->{down}' in $self->{logfile} ". "after $timeout seconds"; return $self; } diff --git a/regress/sys/kern/sosplice/Remote.pm b/regress/sys/kern/sosplice/Remote.pm index faa361b7ab3..70b494ea4b9 100644 --- a/regress/sys/kern/sosplice/Remote.pm +++ b/regress/sys/kern/sosplice/Remote.pm @@ -1,6 +1,6 @@ -# $OpenBSD: Remote.pm,v 1.1 2013/01/03 17:36:38 bluhm Exp $ +# $OpenBSD: Remote.pm,v 1.2 2014/08/18 22:58:19 bluhm Exp $ -# Copyright (c) 2010 Alexander Bluhm <bluhm@openbsd.org> +# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -62,15 +62,15 @@ sub child { print STDERR $self->{up}, "\n"; my @opts = split(' ', $ENV{SSH_OPTIONS}) if $ENV{SSH_OPTIONS}; my $dir = dirname($0); - $dir = getcwd() if ! $dir || $dir eq '.'; - my @cmd = ('ssh', '-n', @opts, $self->{remotessh}, 'perl', - '-I', "$dir/..", "$dir/".basename($0), $self->{forward}, + $dir = getcwd() if ! $dir || $dir eq "."; + my @cmd = ("ssh", "-n", @opts, $self->{remotessh}, "perl", + "-I", "$dir/..", "$dir/".basename($0), $self->{forward}, $self->{listenaddr}, $self->{connectaddr}, $self->{connectport}, ($self->{testfile} ? "$dir/".basename($self->{testfile}) : ())); print STDERR "execute: @cmd\n"; exec @cmd; - die "Exec @cmd failed: $!"; + die ref($self), " exec '@cmd' failed: $!"; } 1; diff --git a/regress/sys/kern/sosplice/error/error.pl b/regress/sys/kern/sosplice/error/error.pl index 4205c402579..c1c4dc59b79 100644 --- a/regress/sys/kern/sosplice/error/error.pl +++ b/regress/sys/kern/sosplice/error/error.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -# $OpenBSD: error.pl,v 1.1 2013/01/03 17:36:39 bluhm Exp $ +# $OpenBSD: error.pl,v 1.2 2014/08/18 22:58:19 bluhm Exp $ -# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org> +# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -25,14 +25,13 @@ sub usage { @ARGV == 1 or usage(); -my $test; +my $testfile; our %args; if (@ARGV and -f $ARGV[-1]) { - $test = pop; - do $test - or die "Do test file $test failed: ", $@ || $!; + $testfile = pop; + do $testfile + or die "Do test file $testfile failed: ", $@ || $!; } - @ARGV == 0 or usage(); $args{func}->(); diff --git a/regress/sys/kern/sosplice/error/remote.pl b/regress/sys/kern/sosplice/error/remote.pl index ad4c7f86d37..ae7e50bf1c2 100644 --- a/regress/sys/kern/sosplice/error/remote.pl +++ b/regress/sys/kern/sosplice/error/remote.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -# $OpenBSD: remote.pl,v 1.1 2013/01/03 17:36:39 bluhm Exp $ +# $OpenBSD: remote.pl,v 1.2 2014/08/18 22:58:19 bluhm Exp $ -# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org> +# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -30,9 +30,9 @@ my($remotessh, $testfile) = @ARGV; my @opts = split(' ', $ENV{SSH_OPTIONS}) if $ENV{SSH_OPTIONS}; my $dir = dirname($0); -$dir = getcwd() if ! $dir || $dir eq '.'; -my @cmd = ('ssh', '-n', @opts, $remotessh, 'perl', - '-I', "$dir/..", "$dir/error.pl", "$dir/".basename($testfile)); +$dir = getcwd() if ! $dir || $dir eq "."; +my @cmd = ("ssh", "-n", @opts, $remotessh, "perl", + "-I", "$dir/..", "$dir/error.pl", "$dir/".basename($testfile)); #print STDERR "execute: @cmd\n"; exec @cmd; -die "Exec @cmd failed: $!"; +die "Exec '@cmd' failed: $!"; diff --git a/regress/sys/kern/sosplice/tcp/direct.pl b/regress/sys/kern/sosplice/tcp/direct.pl index dcd5f233ae7..d57b7a15c09 100644 --- a/regress/sys/kern/sosplice/tcp/direct.pl +++ b/regress/sys/kern/sosplice/tcp/direct.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -# $OpenBSD: direct.pl,v 1.1 2013/01/03 17:36:39 bluhm Exp $ +# $OpenBSD: direct.pl,v 1.2 2014/08/18 22:58:19 bluhm Exp $ -# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org> +# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -28,14 +28,13 @@ sub usage { die "usage: direct.pl [test-args.pl]\n"; } -my $test; +my $testfile; our %args; if (@ARGV and -f $ARGV[-1]) { - $test = pop; - do $test - or die "Do test file $test failed: ", $@ || $!; + $testfile = pop; + do $testfile + or die "Do test file $testfile failed: ", $@ || $!; } - @ARGV == 0 or usage(); my $s = Server->new( diff --git a/regress/sys/kern/sosplice/tcp/relay.pl b/regress/sys/kern/sosplice/tcp/relay.pl index b8b6385c4d0..63f4521c946 100644 --- a/regress/sys/kern/sosplice/tcp/relay.pl +++ b/regress/sys/kern/sosplice/tcp/relay.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -# $OpenBSD: relay.pl,v 1.1 2013/01/03 17:36:39 bluhm Exp $ +# $OpenBSD: relay.pl,v 1.2 2014/08/18 22:58:19 bluhm Exp $ -# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org> +# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -29,12 +29,12 @@ sub usage { die "usage: relay.pl copy|splice [test-args.pl]\n"; } -my $test; +my $testfile; our %args; if (@ARGV and -f $ARGV[-1]) { - $test = pop; - do $test - or die "Do test file $test failed: ", $@ || $!; + $testfile = pop; + do $testfile + or die "Do test file $testfile failed: ", $@ || $!; } @ARGV == 1 or usage(); diff --git a/regress/sys/kern/sosplice/tcp/remote.pl b/regress/sys/kern/sosplice/tcp/remote.pl index 60db268dbf0..60a7886d2b6 100644 --- a/regress/sys/kern/sosplice/tcp/remote.pl +++ b/regress/sys/kern/sosplice/tcp/remote.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -# $OpenBSD: remote.pl,v 1.1 2013/01/03 17:36:39 bluhm Exp $ +# $OpenBSD: remote.pl,v 1.2 2014/08/18 22:58:19 bluhm Exp $ -# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org> +# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -43,12 +43,12 @@ usage: EOF } -my $test; +my $testfile; our %args; if (@ARGV and -f $ARGV[-1]) { - $test = pop; - do $test - or die "Do test file $test failed: ", $@ || $!; + $testfile = pop; + do $testfile + or die "Do test file $testfile failed: ", $@ || $!; } my $mode = @ARGV == 3 && $ARGV[0] =~ /^\d+$/ && $ARGV[2] =~ /^\d+$/ ? "manual" : @@ -100,7 +100,7 @@ if ($mode eq "auto") { $r = Remote->new( forward => $ARGV[0], logfile => "relay.log", - testfile => $test, + testfile => $testfile, %{$args{relay}}, remotessh => $ARGV[3], listenaddr => $ARGV[2], diff --git a/regress/sys/kern/sosplice/udp/direct.pl b/regress/sys/kern/sosplice/udp/direct.pl index f8838375638..9720e823f3b 100644 --- a/regress/sys/kern/sosplice/udp/direct.pl +++ b/regress/sys/kern/sosplice/udp/direct.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -# $OpenBSD: direct.pl,v 1.2 2013/01/05 13:53:42 bluhm Exp $ +# $OpenBSD: direct.pl,v 1.3 2014/08/18 22:58:19 bluhm Exp $ -# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org> +# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -28,14 +28,13 @@ sub usage { die "usage: direct.pl [test-args.pl]\n"; } -my $test; +my $testfile; our %args; if (@ARGV and -f $ARGV[-1]) { - $test = pop; - do $test - or die "Do test file $test failed: ", $@ || $!; + $testfile = pop; + do $testfile + or die "Do test file $testfile failed: ", $@ || $!; } - @ARGV == 0 or usage(); my $s = Server->new( diff --git a/regress/sys/kern/sosplice/udp/relay.pl b/regress/sys/kern/sosplice/udp/relay.pl index 0c1a9a1037c..80095a154b0 100644 --- a/regress/sys/kern/sosplice/udp/relay.pl +++ b/regress/sys/kern/sosplice/udp/relay.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -# $OpenBSD: relay.pl,v 1.2 2013/01/05 13:53:42 bluhm Exp $ +# $OpenBSD: relay.pl,v 1.3 2014/08/18 22:58:19 bluhm Exp $ -# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org> +# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -29,12 +29,12 @@ sub usage { die "usage: relay.pl copy|splice [test-args.pl]\n"; } -my $test; +my $testfile; our %args; if (@ARGV and -f $ARGV[-1]) { - $test = pop; - do $test - or die "Do test file $test failed: ", $@ || $!; + $testfile = pop; + do $testfile + or die "Do test file $testfile failed: ", $@ || $!; } @ARGV == 1 or usage(); diff --git a/regress/sys/kern/sosplice/udp/remote.pl b/regress/sys/kern/sosplice/udp/remote.pl index 4168797e9d2..7f2d15a76f6 100644 --- a/regress/sys/kern/sosplice/udp/remote.pl +++ b/regress/sys/kern/sosplice/udp/remote.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -# $OpenBSD: remote.pl,v 1.2 2013/01/05 13:53:42 bluhm Exp $ +# $OpenBSD: remote.pl,v 1.3 2014/08/18 22:58:19 bluhm Exp $ -# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org> +# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -43,12 +43,12 @@ usage: EOF } -my $test; +my $testfile; our %args; if (@ARGV and -f $ARGV[-1]) { - $test = pop; - do $test - or die "Do test file $test failed: ", $@ || $!; + $testfile = pop; + do $testfile + or die "Do test file $testfile failed: ", $@ || $!; } my $mode = @ARGV == 3 && $ARGV[0] =~ /^\d+$/ && $ARGV[2] =~ /^\d+$/ ? "manual" : @@ -103,7 +103,7 @@ if ($mode eq "auto") { $r = Remote->new( forward => $ARGV[0], logfile => "relay.log", - testfile => $test, + testfile => $testfile, %{$args{relay}}, remotessh => $ARGV[3], protocol => "udp", |