Igor Gnatenko 082d5d
From 8cd45c82a968404929e00dce65644f81e906591b Mon Sep 17 00:00:00 2001
Igor Gnatenko 082d5d
From: Mark Wielaard <mark@klomp.org>
Igor Gnatenko 082d5d
Date: Fri, 3 Mar 2017 23:51:13 +0100
Igor Gnatenko 3992a6
Subject: [PATCH 23/54] tests/tpmbuild.at: Make file sed regexp more strict to
Igor Gnatenko 082d5d
 extract BuildID.
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
In some testcases we extract the BuildID with the file command.
Igor Gnatenko 082d5d
Unfortunately the file command output changed slightly between versions.
Igor Gnatenko 082d5d
Make the sed regexp more strict by only matching a hex-string.
Igor Gnatenko 082d5d
Also properly "escape" [ and ] which inside an AT_CHECK should be [[ and ]].
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
Tested against file versions 5.11, 5.29 and 5.30.
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
Signed-off-by: Mark Wielaard <mark@klomp.org>
Igor Gnatenko 082d5d
(cherry picked from commit f0a581925ad4c948dc58cc8f9a55399ad8de351e)
Igor Gnatenko 082d5d
---
Igor Gnatenko 082d5d
 tests/rpmbuild.at | 20 ++++++++++----------
Igor Gnatenko 082d5d
 1 file changed, 10 insertions(+), 10 deletions(-)
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
Igor Gnatenko 082d5d
index a46822f52..dcbdd2cad 100644
Igor Gnatenko 082d5d
--- a/tests/rpmbuild.at
Igor Gnatenko 082d5d
+++ b/tests/rpmbuild.at
Igor Gnatenko 082d5d
@@ -423,11 +423,11 @@ hello2_file=./usr/local/bin/hello2
Igor Gnatenko 082d5d
 test -f $hello_file || echo "no hello file: $hello_file"
Igor Gnatenko 082d5d
 test -f $hello2_file || echo "no hello2 file: $hello2_file"
Igor Gnatenko 082d5d
 
Igor Gnatenko 082d5d
-id1=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Igor Gnatenko 082d5d
-id2=$(file $hello2_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Igor Gnatenko 082d5d
-id1debug=$(file $hello_file_debug | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Igor Gnatenko 082d5d
-id2debug=$(file $hello2_file_debug | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Igor Gnatenko 082d5d
-idmulti=$(file $hello_multi_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Igor Gnatenko 082d5d
+id1=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Igor Gnatenko 082d5d
+id2=$(file $hello2_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Igor Gnatenko 082d5d
+id1debug=$(file $hello_file_debug | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Igor Gnatenko 082d5d
+id2debug=$(file $hello2_file_debug | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Igor Gnatenko 082d5d
+idmulti=$(file $hello_multi_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Igor Gnatenko 082d5d
 
Igor Gnatenko 082d5d
 test "$id1" = "$id1debug" || echo "id1: $id1 != id1debug: $id1debug"
Igor Gnatenko 082d5d
 test "$id2" = "$id2debug" || echo "id2: $id2 != id2debug: $id2debug"
Igor Gnatenko 082d5d
@@ -516,11 +516,11 @@ hello2_file=./usr/local/bin/hello2
Igor Gnatenko 082d5d
 test -f $hello_file || echo "no hello file: $hello_file"
Igor Gnatenko 082d5d
 test -f $hello2_file || echo "no hello2 file: $hello2_file"
Igor Gnatenko 082d5d
 
Igor Gnatenko 082d5d
-id1=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Igor Gnatenko 082d5d
-id2=$(file $hello2_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Igor Gnatenko 082d5d
-id1debug=$(file $hello_file_debug | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Igor Gnatenko 082d5d
-id2debug=$(file $hello2_file_debug | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Igor Gnatenko 082d5d
-idmulti=$(file $hello_multi_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Igor Gnatenko 082d5d
+id1=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Igor Gnatenko 082d5d
+id2=$(file $hello2_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Igor Gnatenko 082d5d
+id1debug=$(file $hello_file_debug | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Igor Gnatenko 082d5d
+id2debug=$(file $hello2_file_debug | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Igor Gnatenko 082d5d
+idmulti=$(file $hello_multi_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Igor Gnatenko 082d5d
 
Igor Gnatenko 082d5d
 test "$id1" = "$id1debug" || echo "id1: $id1 != id1debug: $id1debug"
Igor Gnatenko 082d5d
 test "$id2" = "$id2debug" || echo "id2: $id2 != id2debug: $id2debug"
Igor Gnatenko 082d5d
-- 
Igor Gnatenko 082d5d
2.13.2
Igor Gnatenko 082d5d