From 5b1b9f78247e122804490b17112e94df32851464 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Fri, 1 Jan 2021 13:44:00 -0500 Subject: [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 --- tests/mod-scgi.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/mod-scgi.t') 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} = ( <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} = ( <