summaryrefslogtreecommitdiff
path: root/tests/mod-scgi.t
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2021-01-01 13:44:00 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2021-01-05 12:52:11 -0500
commit5b1b9f78247e122804490b17112e94df32851464 (patch)
treee8b7580206627e5cd84e9fa4c01dcd0296344da6 /tests/mod-scgi.t
parent048af4c5063485b65d9919f6a7a5d28c1db02d66 (diff)
downloadlighttpd-git-5b1b9f78247e122804490b17112e94df32851464.tar.gz
[tests] use ephemeral ports in tests
avoid spurious test failures due to conflicts with ports in use by other processes, which might occur when tests use hard-coded ports
Diffstat (limited to 'tests/mod-scgi.t')
-rwxr-xr-xtests/mod-scgi.t6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/mod-scgi.t b/tests/mod-scgi.t
index 3b30249c..2cf3e605 100755
--- a/tests/mod-scgi.t
+++ b/tests/mod-scgi.t
@@ -16,8 +16,12 @@ my $t;
SKIP: {
skip "no scgi-responder found", 10 unless -x $tf->{BASEDIR}."/tests/scgi-responder" || -x $tf->{BASEDIR}."/tests/scgi-responder.exe";
+ my $ephemeral_port = LightyTest->get_ephemeral_tcp_port();
+ $ENV{EPHEMERAL_PORT} = $ephemeral_port;
+
$tf->{CONFIGFILE} = 'scgi-responder.conf';
ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or die();
+
$t->{REQUEST} = ( <<EOF
GET /index.scgi?lf HTTP/1.0
Host: www.example.org
@@ -77,7 +81,7 @@ EOF
# (might take lighttpd 1 sec to detect backend exit)
select(undef, undef, undef, .5);
- for (my $c = 2*20; $c && 0 == $tf->listening_on(10000); --$c) {
+ for (my $c = 2*20; $c && 0 == $tf->listening_on($ephemeral_port); --$c) {
select(undef, undef, undef, 0.05);
}
$t->{REQUEST} = ( <<EOF