Ignore:
Timestamp:
Mar 12, 2019, 3:00:54 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
30e32b2, a2545593
Parents:
9d9a451 (diff), 91d6584 (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 second draft of Aaron's thesis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/pybin/tools.py

    r9d9a451 r53bb8f1  
    33import __main__
    44import argparse
     5import fileinput
    56import multiprocessing
    67import os
    78import re
     9import resource
    810import signal
    911import stat
    1012import sys
    11 import fileinput
     13import time
    1214
    1315from pybin import settings
     
    131133
    132134    return None
     135
     136def run(exe, output, input):
     137        ret, _ = sh("timeout %d %s > %s 2>&1" % (settings.timeout.single, exe, output), input = input)
     138        return ret
     139
    133140################################################################################
    134141#               file handling
    135142################################################################################
     143# move a file
     144def mv(source, dest):
     145        ret, _ = sh("mv %s %s" % (source, dest))
     146        return ret
     147
     148# cat one file into the other
     149def cat(source, dest):
     150        ret, _ = sh("cat %s > %s" % (source, dest))
     151        return ret
    136152
    137153# helper function to replace patterns in a file
     
    230246                signal.signal(signal.SIGINT, signal.SIG_IGN)
    231247
     248
     249# enable core dumps for all the test children
     250resource.setrlimit(resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
     251
    232252################################################################################
    233253#               misc
     
    251271        else:
    252272                print(text)
     273
     274
     275def coreInfo(path):
     276        cmd   = os.path.join(settings.SRCDIR, "pybin/print-core.gdb")
     277        if not os.path.isfile(cmd):
     278                return 1, "ERR Printing format for core dumps not found"
     279
     280        dname = os.path.dirname(path)
     281        core  = os.path.join(dname, "core" )
     282        if not os.path.isfile(path):
     283                return 1, "ERR Executable path is wrong"
     284
     285        if not os.path.isfile(core):
     286                return 1, "ERR No core dump"
     287
     288        return sh("gdb -n %s %s -batch -x %s" % (path, core, cmd), print2stdout=False)
     289
     290class Timed:
     291    def __enter__(self):
     292        self.start = time.time()
     293        return self
     294
     295    def __exit__(self, *args):
     296        self.end = time.time()
     297        self.duration = self.end - self.start
Note: See TracChangeset for help on using the changeset viewer.