Honour errors when processing more than one file When using dwz -L0 on a hello world a.out, it fails: ... $ dwz -L0 a.out $ echo $? 1 ... But when we do the same for a.out and a copy b.out, it passes: ... $ cp a.out b.out $ dwz -L0 a.out b.out $ echo $? 0 ... Fix this by honouring dwz return codes when processing more than one file. 2019-05-10 Tom de Vries PR dwz/24301 * dwz.c (main): Handle dwz returning 1 if processing more than one file. * testsuite/dwz.tests/pr24171.sh: Update expected return status. * testsuite/dwz.tests/two-files-too-many-dies.sh: Same. --- dwz.c | 2 ++ testsuite/dwz.tests/pr24171.sh | 2 +- testsuite/dwz.tests/two-files-too-many-dies.sh | 6 +----- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/dwz.c b/dwz.c index 51300d3..6f34a0c 100644 --- a/dwz.c +++ b/dwz.c @@ -12291,6 +12291,8 @@ main (int argc, char *argv[]) } else if (resa[i - optind].res == 0) successcount++; + else if (thisret == 1) + ret = 1; if (hardlink && resa[i - optind].res >= 0 && resa[i - optind].nlink > 1) diff --git a/testsuite/dwz.tests/pr24171.sh b/testsuite/dwz.tests/pr24171.sh index 0705489..31b2439 100644 --- a/testsuite/dwz.tests/pr24171.sh +++ b/testsuite/dwz.tests/pr24171.sh @@ -10,6 +10,6 @@ if ! grep -q "DW_AT_stmt_list not DW_FORM_sec_offset or DW_FORM_data4" dwz.err; exit 1 fi -[ $status -eq 0 ] +[ $status -eq 1 ] rm -f 1 2 dwz.err diff --git a/testsuite/dwz.tests/two-files-too-many-dies.sh b/testsuite/dwz.tests/two-files-too-many-dies.sh index fb7d496..13950ba 100644 --- a/testsuite/dwz.tests/two-files-too-many-dies.sh +++ b/testsuite/dwz.tests/two-files-too-many-dies.sh @@ -9,11 +9,7 @@ if ! grep -q "Too many DIEs, not optimizing" dwz.err; then exit 1 fi -if [ $status -eq 0 ]; then - echo "PR24301 workaround used" > dwz.info -else - [ $status -eq 1 ] -fi +[ $status -eq 1 ] cmp 1 $execs/hello cmp 2 $execs/hello