Exemplo n.º 1
0
import sketch

# How many tests to run in parallel
NCPUS = 1

##-----------------------------------------------------------------------------
if __name__ == '__main__':
    cmd = sys.argv[1:]
    if not len(cmd): cmd = ['psketch', '--verbosity', '1']
    logf = sys.stdout
    cwd = os.getcwd()
    tmpfiles = []

    def test(t):
        _, outfile = tempfile.mkstemp('', t)
        tmpfiles.append(outfile)
        cmdline = cmd + ['--output', outfile]
        path = 'regtest/' + t
        return sketch.Test(path, cwd, logf, cmdline)

    try:
        sketch.runTests([
            test(t) for t in os.listdir('regtest')
            if re.match(r'^miniTest[^.]+\.sk$', t)
        ], NCPUS)
    finally:
        for tmpfile in tmpfiles:
            if os.access(tmpfile, os.R_OK): os.remove(tmpfile)
            if os.access(tmpfile + ".tmp", os.R_OK):
                os.remove(tmpfile + ".tmp")
Exemplo n.º 2
0
    tmpfiles = []

    def test(path, workdir=None, logfile=logf, extraopts=[]):
        dir, file = os.path.split(path)
        if not workdir: workdir = dir
        _, outfile = tempfile.mkstemp('', file)
        tmpfiles.append(outfile)
        cmdline = cmd + extraopts + ['--output', outfile]
        return sketch.Test(path, workdir, logfile, cmdline)

    o = ['--vectorszGuess', '16384', '--reorderEncoding', 'quadratic']

    try:
        tests = (
            ##-----------------------------------------------------------------------------
            ## Lazy list remove()

            # - Sanity checks
            test('lazy_list-based_set/lzsoln_2_a-a-r-r.sk', extraopts=o),
            test('lazy_list-based_set/lzsoln_2_a-r-a-r.sk', extraopts=o),
            test('lazy_list-based_set/lzsketch1_2_a-a-r-r.sk', extraopts=o),
            test('lazy_list-based_set/lzsketch1_2_a-r-a-r.sk', extraopts=o),
        )

        sketch.prettyPrint(sketch.runTests(tests, NCPUS))
    finally:
        for tmpfile in tmpfiles:
            if os.access(tmpfile, os.R_OK): os.remove(tmpfile)
            if os.access(tmpfile + ".tmp", os.R_OK):
                os.remove(tmpfile + ".tmp")
Exemplo n.º 3
0
import os, re, sys, tempfile
import sketch

# How many tests to run in parallel
NCPUS = 1

##-----------------------------------------------------------------------------
if __name__ == '__main__':
    cmd = sys.argv[1:]
    if not len (cmd):  cmd = ['psketch', '--verbosity', '1']
    logf = sys.stdout
    cwd = os.getcwd ()
    tmpfiles = []

    def test (t):
        _, outfile = tempfile.mkstemp ('', t)
        tmpfiles.append (outfile)
        cmdline = cmd + ['--output', outfile]
        path = 'regtest/'+ t
        return sketch.Test (path, cwd, logf, cmdline)

    try:
        sketch.runTests ([test (t) for t in os.listdir ('regtest')
                         if re.match (r'^miniTest[^.]+\.sk$', t)], NCPUS)
    finally:
        for tmpfile in tmpfiles:
            if os.access (tmpfile, os.R_OK):         os.remove (tmpfile)
            if os.access (tmpfile+".tmp", os.R_OK):  os.remove (tmpfile+".tmp")