You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2017/06/27 22:37:23 UTC

svn commit: r1800100 - in /httpd/test/framework/trunk: Misc.pm t/modules/proxy_fcgi.t

Author: jim
Date: Tue Jun 27 22:37:23 2017
New Revision: 1800100

URL: http://svn.apache.org/viewvc?rev=1800100&view=rev
Log:
Not really required to pull this out

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

Modified: httpd/test/framework/trunk/Misc.pm
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/Misc.pm?rev=1800100&r1=1800099&r2=1800100&view=diff
==============================================================================
--- httpd/test/framework/trunk/Misc.pm (original)
+++ httpd/test/framework/trunk/Misc.pm Tue Jun 27 22:37:23 2017
@@ -27,7 +27,7 @@ BEGIN {
     # Just a bunch of useful subs
 }
 
-sub forker
+sub runner
 {
     my $msg = shift;
     my $func = shift;

Modified: httpd/test/framework/trunk/t/modules/proxy_fcgi.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/proxy_fcgi.t?rev=1800100&r1=1800099&r2=1800100&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/modules/proxy_fcgi.t (original)
+++ httpd/test/framework/trunk/t/modules/proxy_fcgi.t Tue Jun 27 22:37:23 2017
@@ -5,8 +5,6 @@ use Apache::Test;
 use Apache::TestRequest;
 use Apache::TestUtil;
 
-use Misc;
-
 my $have_fcgisetenvif    = have_min_apache_version('2.4.26');
 my $have_fcgibackendtype = have_min_apache_version('2.4.26');
 my $have_php_fpm = `php-fpm -v` =~ /fpm-fcgi/;
@@ -235,15 +233,24 @@ ok t_cmp($envs->{'SCRIPT_NAME'}, '/modul
 # Testing using php-fpm directly
 if ($have_php_fpm) {
     my $pid_file = "/tmp/php-fpm-" . $$ . "-" . time . ".pid";
-    my $pid = Misc::forker("php-fpm", sub { system "php-fpm -F -g $pid_file -p $servroot/php-fpm"; });
-    if ($pid > 0) {
-        while (! -e $pid_file) {}
-        $envs = run_fcgi_envvar_request(-1, "/fpm/sub1/sub2/test.php?query", "PHP-FPM");
-        ok t_cmp($envs->{'SCRIPT_NAME'}, '/fpm/sub1/sub2/test.php', "Server sets correct SCRIPT_NAME by default");
-
-        # TODO: Add more here
-        kill 'TERM', $pid;
-        kill 'TERM', `cat $pid_file`;
-        waitpid($pid, 0);
+    my $pid = fork();
+    unless (defined $pid) {
+        t_debug "couldn't start PHP-FPM";
+        ok 0;
+        exit;
+    }
+    if ($pid == 0) {
+        system "php-fpm -g $pid_file -p $servroot/php-fpm";
     }
+    # Wait for php-fpm to start-up
+    while (!-e $pid_file) {}
+    $envs = run_fcgi_envvar_request(-1, "/fpm/sub1/sub2/test.php?query", "PHP-FPM");
+    ok t_cmp($envs->{'SCRIPT_NAME'}, '/fpm/sub1/sub2/test.php', "Server sets correct SCRIPT_NAME by default");
+
+    # TODO: Add more tests here
+
+    # Clean up php-fpm process(es)
+    kill 'TERM', $pid;
+    kill 'TERM', `cat $pid_file`;
+    waitpid($pid, 0);
 }