[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[committed] Remove leading whitespace in gnu-debugaltlink-name.sh output



Hi,

Currently, gnu-debugaltlink-name.sh prints leading whitespace:
...
$ echo \""$(./testsuite/scripts/gnu-debugaltlink-name.sh 1)"\"
"  3"
...

Fix this by using sed to extract the name from the readelf output.

With that fixed, we add quotes to gnu-debugaltlink-name.sh calls to prevent
"unary operator expected" errors.

Thanks,
- Tom

Remove leading whitespace in gnu-debugaltlink-name.sh output

2019-03-13  Tom de Vries  <tdevries@suse.de>

	* testsuite/scripts/gnu-debugaltlink-name.sh: Remove leading whitespace.
	* testsuite/dwz.tests/eu-strip-unstrip-multifile.sh: Guard
	gnu-debugaltlink-name.sh call with quotes.
	* testsuite/dwz.tests/multifile-name.sh: Same.
	* testsuite/dwz.tests/multifile-relative.sh: Same.
	* testsuite/dwz.tests/multifile.sh: Same.

---
 testsuite/dwz.tests/eu-strip-unstrip-multifile.sh | 4 ++--
 testsuite/dwz.tests/multifile-name.sh             | 4 ++--
 testsuite/dwz.tests/multifile-relative.sh         | 4 ++--
 testsuite/dwz.tests/multifile.sh                  | 4 ++--
 testsuite/scripts/gnu-debugaltlink-name.sh        | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/testsuite/dwz.tests/eu-strip-unstrip-multifile.sh b/testsuite/dwz.tests/eu-strip-unstrip-multifile.sh
index a49666f..ea76dcb 100755
--- a/testsuite/dwz.tests/eu-strip-unstrip-multifile.sh
+++ b/testsuite/dwz.tests/eu-strip-unstrip-multifile.sh
@@ -16,8 +16,8 @@ eu-unstrip 2.stripped 2.debug -o 2.unstripped
 smaller-than.sh 1.unstripped 1
 smaller-than.sh 2.unstripped 2
 
-[ $(gnu-debugaltlink-name.sh 1.unstripped) = "3" ]
-[ $(gnu-debugaltlink-name.sh 2.unstripped) = "3" ]
+[ "$(gnu-debugaltlink-name.sh 1.unstripped)" = "3" ]
+[ "$(gnu-debugaltlink-name.sh 2.unstripped)" = "3" ]
 
 ls=$(ls)
 ls=$(echo $ls)
diff --git a/testsuite/dwz.tests/multifile-name.sh b/testsuite/dwz.tests/multifile-name.sh
index 26d2ed3..ea4dcec 100755
--- a/testsuite/dwz.tests/multifile-name.sh
+++ b/testsuite/dwz.tests/multifile-name.sh
@@ -14,7 +14,7 @@ ls=$(ls)
 ls=$(echo $ls)
 [ "$ls" = "1 2 3" ]
 
-[ $(gnu-debugaltlink-name.sh 1) = "/xxx/yyy/3" ]
-[ $(gnu-debugaltlink-name.sh 2) = "/xxx/yyy/3" ]
+[ "$(gnu-debugaltlink-name.sh 1)" = "/xxx/yyy/3" ]
+[ "$(gnu-debugaltlink-name.sh 2)" = "/xxx/yyy/3" ]
 
 rm -f 1 2 3
diff --git a/testsuite/dwz.tests/multifile-relative.sh b/testsuite/dwz.tests/multifile-relative.sh
index 9b13d43..2fea507 100755
--- a/testsuite/dwz.tests/multifile-relative.sh
+++ b/testsuite/dwz.tests/multifile-relative.sh
@@ -14,7 +14,7 @@ ls=$(ls)
 ls=$(echo $ls)
 [ "$ls" = "1 2 3" ]
 
-[ $(gnu-debugaltlink-name.sh 1) = "3" ]
-[ $(gnu-debugaltlink-name.sh 2) = "3" ]
+[ "$(gnu-debugaltlink-name.sh 1)" = "3" ]
+[ "$(gnu-debugaltlink-name.sh 2)" = "3" ]
 
 rm -f 1 2 3
diff --git a/testsuite/dwz.tests/multifile.sh b/testsuite/dwz.tests/multifile.sh
index 5c54d0f..dde2a94 100755
--- a/testsuite/dwz.tests/multifile.sh
+++ b/testsuite/dwz.tests/multifile.sh
@@ -14,7 +14,7 @@ ls=$(ls)
 ls=$(echo $ls)
 [ "$ls" = "1 2 3" ]
 
-[ $(gnu-debugaltlink-name.sh 1) = "3" ]
-[ $(gnu-debugaltlink-name.sh 2) = "3" ]
+[ "$(gnu-debugaltlink-name.sh 1)" = "3" ]
+[ "$(gnu-debugaltlink-name.sh 2)" = "3" ]
 
 rm -f 1 2 3
diff --git a/testsuite/scripts/gnu-debugaltlink-name.sh b/testsuite/scripts/gnu-debugaltlink-name.sh
index d99a970..667c5fd 100755
--- a/testsuite/scripts/gnu-debugaltlink-name.sh
+++ b/testsuite/scripts/gnu-debugaltlink-name.sh
@@ -8,4 +8,4 @@ readelf \
     --string-dump=.gnu_debugaltlink \
     $1 \
     | grep -a '\[[ 	]*0\]' \
-    | awk '{$1="";$2=""; print;}'
+    | sed 's/.*0\]  //'