Changeset cc9b520 for tests/test.py


Ignore:
Timestamp:
Mar 9, 2022, 7:59:46 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
b053083
Parents:
5baa33c
Message:

Clean-up error handling in test scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/test.py

    r5baa33c rcc9b520  
    195195        # build, skipping to next test on error
    196196        with Timed() as comp_dur:
    197                 make_ret, _ = make( test.target(), output_file=subprocess.DEVNULL, error=out_file, error_file = err_file )
     197                make_ret, _, _ = make( test.target(), output_file=subprocess.DEVNULL, error=out_file, error_file = err_file )
    198198
    199199        # ----------
     
    208208                                if settings.dry_run or is_exe(exe_file):
    209209                                        # run test
    210                                         retcode, _ = sh(exe_file, output_file=out_file, input_file=in_file, timeout=True)
     210                                        retcode, _, _ = sh(exe_file, output_file=out_file, input_file=in_file, timeout=True)
    211211                                else :
    212212                                        # simply cat the result into the output
     
    226226                        else :
    227227                                # fetch return code and error from the diff command
    228                                 retcode, error = diff(cmp_file, out_file)
     228                                retcode, error, _ = diff(cmp_file, out_file)
    229229
    230230                else:
     
    235235                                error = "Output log can't be read, file is bigger than 1MB, see {} for actual error\n".format(out_file)
    236236
    237                         ret, info = core_info(exe_file)
    238                         error = error + info if error else info
     237                        ret, info, gdberr = core_info(exe_file)
     238                        if ret == 0:
     239                                error = error + info if error else info
     240                        else :
     241                                error = error + gdberr if error else gdberr
    239242
    240243                        if settings.archive:
     
    366369                        print(os.path.relpath(t.expect(), settings.SRCDIR), end=' ')
    367370                        print(os.path.relpath(t.input() , settings.SRCDIR), end=' ')
    368                         code, out = make_recon(t.target())
     371                        code, out, err = make_recon(t.target())
    369372
    370373                        if code != 0:
    371                                 print('ERROR: recond failed for test {}'.format(t.target()), file=sys.stderr)
     374                                print('ERROR: recond failed for test {}: {} \'{}\''.format(t.target(), code, err), file=sys.stderr)
    372375                                sys.exit(1)
    373376
Note: See TracChangeset for help on using the changeset viewer.