Changeset 5c4a473 for tests


Ignore:
Timestamp:
Aug 15, 2019, 10:31:53 AM (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:
6daaee3
Parents:
d65f92c (diff), 3c7f01b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into distcc

Location:
tests
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • tests/Makefile.am

    rd65f92c r5c4a473  
    2222debug=yes
    2323installed=no
     24archiveerrors=
    2425
    2526INSTALL_FLAGS=-in-tree
     
    5859#----------------------------------------------------------------------------------------------------------------
    5960all-local :
    60         @+${TEST_PY} --debug=${debug} --install=${installed} ${concurrent} ${timeouts} ${quick_test}
     61        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
    6162
    6263all-tests :
    63         @+${TEST_PY} --debug=${debug} --install=${installed} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
     64        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
    6465
    6566clean-local :
  • tests/Makefile.in

    rd65f92c r5c4a473  
    378378debug = yes
    379379installed = no
     380archiveerrors =
    380381INSTALL_FLAGS = -in-tree
    381382DEBUG_FLAGS = -debug -O0
     
    777778#----------------------------------------------------------------------------------------------------------------
    778779all-local :
    779         @+${TEST_PY} --debug=${debug} --install=${installed} ${concurrent} ${timeouts} ${quick_test}
     780        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
    780781
    781782all-tests :
    782         @+${TEST_PY} --debug=${debug} --install=${installed} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
     783        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
    783784
    784785clean-local :
  • tests/pybin/settings.py

    rd65f92c r5c4a473  
    44from . import tools
    55
     6global original_path
     7
    68try :
     9        original_path = os.getcwd()
    710        testpath = os.path.dirname(os.path.abspath(os.path.join(os.getcwd(), sys.argv[0])))
    811        sys.path.append(testpath)
     
    118121        global timeout
    119122        global output_width
     123<<<<<<< HEAD
    120124        global distcc
     125=======
     126        global archive
     127>>>>>>> master
    121128
    122129        dry_run      = options.dry_run
     
    128135        timeout      = Timeouts(options.timeout, options.global_timeout)
    129136        output_width = 24
     137<<<<<<< HEAD
    130138        distcc       = "DISTCC_CFA_PATH=~/.cfadistcc/%s/cfa" % tools.config_hash()
     139=======
     140        archive      = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None
     141>>>>>>> master
    131142
    132143        if distribute and not os.environ.get('DISTCC_LOG'):
  • tests/pybin/tools.py

    rd65f92c r5c4a473  
    22import argparse
    33import contextlib
     4import datetime
    45import fileinput
    56import multiprocessing
     
    289290        return out.strip()
    290291
     292# get pretty string for time of day
     293def pretty_now():
     294        ts = time.time()
     295        print(ts, file=sys.stderr)
     296        return datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d_%H:%M:%S')
     297
    291298# check if arguments is yes or no
    292299def yes_no(string):
     
    320327        return sh('gdb', '-n', path, core, '-batch', '-x', cmd, output_file=subprocess.PIPE)
    321328
     329def core_archive(dst, name, exe):
     330        # Get the files to copy
     331        core = os.path.join(os.getcwd(), "core" )
     332
     333        # Uncomment if we want timestamps on coredumps
     334        # dst  = os.path.join(dst, "%s_%s" % (name, pretty_now()))
     335
     336        # make a directory for this test
     337        mkdir(os.path.join(dst, "dir"))
     338
     339        # moves the files
     340        mv( core, os.path.join(dst, "core" ) )
     341        mv( exe , os.path.join(dst, name   ) )
     342
     343        # return explanatory test
     344        return "Archiving %s (executable and core) to %s" % (os.path.relpath(exe, settings.BUILDDIR), os.path.relpath(dst, settings.original_path))
     345
    322346class Timed:
    323347    def __enter__(self):
  • tests/test.py

    rd65f92c r5c4a473  
    9191        parser.add_argument('--all', help='Run all test available', action='store_true')
    9292        parser.add_argument('--regenerate-expected', help='Regenerate the .expect by running the specified tets, can be used with --all option', action='store_true')
     93        parser.add_argument('--archive-errors', help='If called with a valid path, on test crashes the test script will copy the core dump and the executable to the specified path.', type=str, default='')
    9394        parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int)
    9495        parser.add_argument('--list-comp', help='List all valide arguments', action='store_true')
     
    179180                        error = error + info if error else info
    180181
     182                        if settings.archive:
     183                                error = error + '\n' + core_archive(settings.archive, test.target(), exe_file)
     184
    181185
    182186
     
    295299        # users may want to simply list the tests
    296300        if options.list_comp :
    297                 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --install --timeout --global-timeout -j --jobs ", end='')
     301                print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --archive-errors --install --timeout --global-timeout -j --jobs ", end='')
    298302                print(" ".join(map(lambda t: "%s" % (t.target()), tests)))
    299303
Note: See TracChangeset for help on using the changeset viewer.