Ignore:
Timestamp:
Aug 13, 2019, 4:38:27 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
3221a2b
Parents:
1118b8b
Message:

Test script can now archive errors (copy executables and core dumps to a specified directory)
run --help command for detail

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/pybin/tools.py

    r1118b8b rdcfedca  
    22import argparse
    33import contextlib
     4import datetime
    45import fileinput
    56import multiprocessing
     
    273274################################################################################
    274275
     276def pretty_now():
     277        ts = time.time()
     278        print(ts, file=sys.stderr)
     279        return datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d_%H:%M:%S')
     280
    275281# check if arguments is yes or no
    276282def yes_no(string):
     
    304310        return sh('gdb', '-n', path, core, '-batch', '-x', cmd, output=subprocess.PIPE)
    305311
     312def core_archive(dst, name, exe):
     313        # Get the files to copy
     314        core = os.path.join(os.getcwd(), "core" )
     315
     316        # Uncomment if we want timestamps on coredumps
     317        # dst  = os.path.join(dst, "%s_%s" % (name, pretty_now()))
     318
     319        # make a directory for this test
     320        mkdir(os.path.join(dst, "dir"))
     321
     322        # moves the files
     323        mv( core, os.path.join(dst, "core" ) )
     324        mv( exe , os.path.join(dst, name   ) )
     325
     326        # return explanatory test
     327        return "Archiving %s (executable and core) to %s" % (os.path.relpath(exe, settings.BUILDDIR), os.path.relpath(dst, settings.original_path))
     328
    306329class Timed:
    307330    def __enter__(self):
Note: See TracChangeset for help on using the changeset viewer.