Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2DE00200CB4 for ; Tue, 27 Jun 2017 13:50:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2A665160BDC; Tue, 27 Jun 2017 11:50:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3B481160BF6 for ; Tue, 27 Jun 2017 13:50:04 +0200 (CEST) Received: (qmail 43672 invoked by uid 500); 27 Jun 2017 11:50:03 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 43657 invoked by uid 99); 27 Jun 2017 11:50:03 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Jun 2017 11:50:03 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 0B11B3A019D for ; Tue, 27 Jun 2017 11:50:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1800053 - in /httpd/test/framework/trunk: Misc.pm t/modules/proxy.t Date: Tue, 27 Jun 2017 11:49:59 -0000 To: cvs@httpd.apache.org From: jim@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170627115002.0B11B3A019D@svn01-us-west.apache.org> archived-at: Tue, 27 Jun 2017 11:50:05 -0000 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"); }