Discussion:
[GOLD] Use "set -e" in test scripts
(too old to reply)
Rahul Chaudhry via binutils
2017-01-10 01:35:29 UTC
Permalink
Some tests in gold/testsuite/ run awk to check for errors.
The awk scripts use "exit 1" to indicate test failure, but
a few of those tests don't use "set -e", so the failures
get ignored. This patch adds "set -e" to those tests.

OK?

* testsuite/icf_safe_so_test.sh: Use "set -e".
* testsuite/icf_safe_test.sh: Likewise.
* testsuite/icf_test.sh: Likewise.


diff --git gold/ChangeLog gold/ChangeLog
index 1159f9c6aa..0e7a139ced 100644
--- gold/ChangeLog
+++ gold/ChangeLog
@@ -1,3 +1,9 @@
+2017-01-09 Rahul Chaudhry <***@google.com>
+
+ * testsuite/icf_safe_so_test.sh: Use "set -e".
+ * testsuite/icf_safe_test.sh: Likewise.
+ * testsuite/icf_test.sh: Likewise.
+
2017-01-09 Alan Modra <***@gmail.com>

* powerpc.cc (Target_powerpc::make_plt_section): Point sh_info of
diff --git gold/testsuite/icf_safe_so_test.sh gold/testsuite/icf_safe_so_test.sh
index 6542c65d56..28600be561 100755
--- gold/testsuite/icf_safe_so_test.sh
+++ gold/testsuite/icf_safe_so_test.sh
@@ -27,6 +27,8 @@
# to verify if identical code folding in safe mode correctly folds
# functions in a shared object.

+set -e
+
error_if_symbol_absent()
{
if ! is_symbol_present $1 $2;
@@ -84,8 +86,7 @@ END {

arch_specific_safe_fold()
{
- grep -e "Intel 80386" -e "ARM" -e "PowerPC" $1 > /dev/null 2>&1
- if [ $? -eq 0 ];
+ if grep -q -e "Intel 80386" -e "ARM" -e "PowerPC" $1;
then
check_fold $2 $4 $5 $3
else
diff --git gold/testsuite/icf_safe_test.sh gold/testsuite/icf_safe_test.sh
index 47650162c4..f048d8617d 100755
--- gold/testsuite/icf_safe_test.sh
+++ gold/testsuite/icf_safe_test.sh
@@ -27,6 +27,8 @@
# ctors and dtors are folded, except for x86 (32 and 64 bit), which
# uses relocation types to detect if function pointers are taken.

+set -e
+
check_nofold()
{
func_addr_1=`grep $2 $1 | awk '{print $1}'`
@@ -57,8 +59,7 @@ END {

arch_specific_safe_fold()
{
- grep_x86=`grep -q -e "Advanced Micro Devices X86-64" -e "Intel
80386" -e "ARM" -e "TILE" -e "PowerPC" -e "AArch64" -e "IBM S/390" $2`
- if [ $? -eq 0 ];
+ if grep -q -e "Advanced Micro Devices X86-64" -e "Intel 80386" -e
"ARM" -e "TILE" -e "PowerPC" -e "AArch64" -e "IBM S/390" $2;
then
check_fold $3 $4 $5
else
diff --git gold/testsuite/icf_test.sh gold/testsuite/icf_test.sh
index 3d11dcb808..2e7fd9d709 100755
--- gold/testsuite/icf_test.sh
+++ gold/testsuite/icf_test.sh
@@ -26,6 +26,8 @@
# File icf_test.cc is in this test. This program checks if the
# identical sections are correctly folded.

+set -e
+
check()
{
awk "
--
Rahul
Cary Coutant
2017-01-10 01:49:08 UTC
Permalink
Post by Rahul Chaudhry via binutils
Some tests in gold/testsuite/ run awk to check for errors.
The awk scripts use "exit 1" to indicate test failure, but
a few of those tests don't use "set -e", so the failures
get ignored. This patch adds "set -e" to those tests.
OK?
* testsuite/icf_safe_so_test.sh: Use "set -e".
* testsuite/icf_safe_test.sh: Likewise.
* testsuite/icf_test.sh: Likewise.
Yes, this is OK. Thanks!

-cary
Rahul Chaudhry via binutils
2017-01-12 21:34:59 UTC
Permalink
Hi Cary,

Thanks for your review.
What would be the next steps to get this patch merged?
I am a new contributor, and do not have write access to the repository.

Rahul
Post by Cary Coutant
Post by Rahul Chaudhry via binutils
Some tests in gold/testsuite/ run awk to check for errors.
The awk scripts use "exit 1" to indicate test failure, but
a few of those tests don't use "set -e", so the failures
get ignored. This patch adds "set -e" to those tests.
OK?
* testsuite/icf_safe_so_test.sh: Use "set -e".
* testsuite/icf_safe_test.sh: Likewise.
* testsuite/icf_test.sh: Likewise.
Yes, this is OK. Thanks!
-cary
Cary Coutant
2017-01-18 18:24:46 UTC
Permalink
Post by Rahul Chaudhry via binutils
Thanks for your review.
What would be the next steps to get this patch merged?
I am a new contributor, and do not have write access to the repository.
I'll apply this patch for you.

Your next step is to write to ***@sourceware.org and ask for
write access to the binutils repo. You can name me as your sponsor.
(Or, since Ian is cc'ed here, maybe he will go ahead and add you.)

-cary
Ian Lance Taylor via binutils
2017-01-20 03:35:37 UTC
Permalink
Post by Cary Coutant
Post by Rahul Chaudhry via binutils
Thanks for your review.
What would be the next steps to get this patch merged?
I am a new contributor, and do not have write access to the repository.
I'll apply this patch for you.
write access to the binutils repo. You can name me as your sponsor.
(Or, since Ian is cc'ed here, maybe he will go ahead and add you.)
As far as I know Rahul doesn't have a sourceware account at all, so
the right step is https://sourceware.org/cgi-bin/pdw/ps_form.cgi .

Ian
Rahul Chaudhry via binutils
2017-01-21 01:15:47 UTC
Permalink
Post by Ian Lance Taylor via binutils
Post by Cary Coutant
Post by Rahul Chaudhry via binutils
Thanks for your review.
What would be the next steps to get this patch merged?
I am a new contributor, and do not have write access to the repository.
I'll apply this patch for you.
write access to the binutils repo. You can name me as your sponsor.
(Or, since Ian is cc'ed here, maybe he will go ahead and add you.)
As far as I know Rahul doesn't have a sourceware account at all, so
the right step is https://sourceware.org/cgi-bin/pdw/ps_form.cgi .
Done.
Cary Coutant
2017-01-24 01:36:43 UTC
Permalink
Post by Cary Coutant
Post by Rahul Chaudhry via binutils
* testsuite/icf_safe_so_test.sh: Use "set -e".
* testsuite/icf_safe_test.sh: Likewise.
* testsuite/icf_test.sh: Likewise.
Yes, this is OK. Thanks!
I've committed this patch on trunk.

-cary

Continue reading on narkive:
Loading...