From 4f8fbf372efedb34e5f8172fa4673a19549cf025 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Tue, 14 Jul 2020 10:38:06 +0200 Subject: [PATCH] 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) --- test/recipes/81-test_cmp_cli.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 { -- 2.47.2