httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1800053 - in /httpd/test/framework/trunk: Misc.pm t/modules/proxy.t
Date Tue, 27 Jun 2017 11:49:59 GMT
Author: jim
Date: Tue Jun 27 11:49:59 2017
New Revision: 1800053

URL: http://svn.apache.org/viewvc?rev=1800053&view=rev
Log:
Spin out to a Misc.pm support lib

Added:
    httpd/test/framework/trunk/Misc.pm
Modified:
    httpd/test/framework/trunk/t/modules/proxy.t

Added: httpd/test/framework/trunk/Misc.pm
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/Misc.pm?rev=1800053&view=auto
==============================================================================
--- httpd/test/framework/trunk/Misc.pm (added)
+++ httpd/test/framework/trunk/Misc.pm Tue Jun 27 11:49:59 2017
@@ -0,0 +1,60 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+package Misc;
+
+use Apache::Test;
+use Apache::TestRequest;
+use Apache::TestUtil;
+use Apache::TestConfig ();
+
+use strict;
+use warnings FATAL => 'all';
+require IO::Select;
+
+BEGIN {
+    # Just a bunch of useful subs
+}
+
+sub do_do_run_run ($$)
+{
+    my $msg = shift;
+    my $func = shift;
+
+    pipe(READ_END, WRITE_END);
+    my $pid = fork();
+    unless (defined $pid) {
+        t_debug "couldn't fork $msg";
+        ok 0;
+        exit;
+    }
+    if ($pid == 0) {
+        print WRITE_END 'x';
+        close WRITE_END;
+        $func->();
+        exit;
+    }
+    # give time for the system call to take effect
+    unless (IO::Select->new((\*READ_END,))->can_read(2)) {
+        t_debug "timed out waiting for $msg";
+        ok 0;
+        kill 'TERM', $pid;
+        exit;
+    }
+}
+
+
+1;
+__END__

Modified: httpd/test/framework/trunk/t/modules/proxy.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/proxy.t?rev=1800053&r1=1800052&r2=1800053&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/modules/proxy.t (original)
+++ httpd/test/framework/trunk/t/modules/proxy.t Tue Jun 27 11:49:59 2017
@@ -5,8 +5,7 @@ use Apache::Test;
 use Apache::TestRequest;
 use Apache::TestUtil;
 use Apache::TestConfig ();
-require IO::Select;
-
+use Misc;
 my $num_tests = 20;
 if (have_min_apache_version('2.4.7')) {
     $num_tests++;
@@ -127,35 +126,8 @@ sub uds_script
     unlink($socket_path);
 }
 
-sub do_do_run_run ($$)
-{
-    my $msg = shift;
-    my $func = shift;
-
-    pipe(READ_END, WRITE_END);
-    my $pid = fork();
-    unless (defined $pid) {
-        t_debug "couldn't fork $msg";
-        ok 0;
-        exit;
-    }
-    if ($pid == 0) {
-        print WRITE_END 'x';
-        close WRITE_END;
-        $func->();
-        exit;
-    }
-    # give time for the system call to take effect
-    unless (IO::Select->new((\*READ_END,))->can_read(2)) {
-        t_debug "timed out waiting for $msg";
-        ok 0;
-        kill 'TERM', $pid;
-        exit;
-    }
-}
-
 if (have_min_apache_version('2.4.7')) {
-    do_do_run_run("UDS script", \&uds_script);
+    Misc::do_do_run_run("UDS script", \&uds_script);
     $r = GET("/uds/");
     ok t_cmp($r->code, 200, "ProxyPass UDS path");
 }



Mime
View raw message