From: Dr. David von Oheimb Date: Tue, 14 Jul 2020 08:38:06 +0000 (+0200) Subject: 81-test_cmp_cli.t: Avoid using 'tail', 'awk', and the '-s' option of 'lsof' X-Git-Tag: openssl-3.0.0-alpha6~85 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4f8fbf372efedb34e5f8172fa4673a19549cf025;p=thirdparty%2Fopenssl.git 81-test_cmp_cli.t: Avoid using 'tail', 'awk', and the '-s' option of 'lsof' Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/12422) --- diff --git a/test/recipes/81-test_cmp_cli.t b/test/recipes/81-test_cmp_cli.t index fe837d63dc9..009cdcc4d8d 100644 --- a/test/recipes/81-test_cmp_cli.t +++ b/test/recipes/81-test_cmp_cli.t @@ -219,7 +219,7 @@ indir data_dir() => sub { if ($server_name eq "Mock") { indir "Mock" => sub { $pid = start_mock_server(""); - die "Cannot start CMP mock server" unless $pid; + die "Cannot start or find the started CMP mock server" unless $pid; } } foreach my $aspect (@all_aspects) { @@ -294,7 +294,7 @@ sub load_tests { } sub mock_server_pid { - return `lsof -iTCP:$server_port -sTCP:LISTEN | tail -n 1 | awk '{ print \$2 }'`; + return `lsof -iTCP:$server_port` =~ m/\n\S+\s+(\d+)\s+[^\n]+LISTEN/s ? $1 : 0; } sub start_mock_server {