Exemple #1
0
def regist_test():
    if request.method == "POST":
        data = request.get_data()
        x = data.decode("utf8").split("//")
        if x[0] != "jiongjidanci":
            return "Invalid Password"
        add_result = tests.add_test(x[1])
        if add_result == 1:
            return "OK"
        return "Insertion Failed"

    if request.method == "GET":
        result = list(cfg.tests.find().sort([("updateTime", DESCENDING)]))
        for i, doc in enumerate(result):
            d = doc.copy()
            d["_id"] = str(d["_id"])
            result[i] = d

        return jsonify(result)
Exemple #2
0
def generate_test_cases(prefix, testlist):
    for i, ts in enumerate(chunker(testlist, CHUNK_SIZE)):
        # append new class to our array
        compiler_rt_tests_classes.append(
            # this is essentially the decorator @tests.add_test
            tests.add_test(
                # type is the (built-in) base-class for python classes, here we
                # construct classes by calling its constructor
                # signature of type constructor:
                #   type(classname, baseclass tuple, dict with methods/attributes)
                type('CompilerRTBuiltins%d' % (i+1),
                     (CompilerRTBuiltinsAbstract,),
                     { 'name': '%s%d' % (prefix, (i+1)),
                        # partially bind the get_modules() template to select the
                        # right set of tests. Note the ts=ts in the lambda
                        # arguments, this prevents python's default late-binding
                        # for closure arguments.
                         'get_modules':
                             lambda s, b, m, ts=ts: get_modules_tpl(ts, s, b, m)})))
Exemple #3
0
    class DistTest(TestCommon):
        name = "distops_%s" % testname

        def get_modules(self, build, machine):
            modules = super(DistTest, self).get_modules(build, machine)
            modules.add_module("test_remote_%s" % testname,
                               ["core=0", "server"])
            modules.add_module("test_remote_%s" % testname,
                               ["core=1", "client"])
            return modules

        def get_finish_string(self):
            return finish_string

        def process_data(self, testdir, rawiter):
            # the test passed iff we do not find a line matching the given
            # error regex
            error_re = re.compile(error_regex)
            passed = True
            for line in rawiter:
                if error_re.match(line):
                    passed = False
            return PassFailResult(passed)

    return DistTest


for t in distops_tests:
    klass = dist_test_factory(**t)
    tests.add_test(klass)
Exemple #4
0
    long remainder of the sequence'''
    return (seq[pos:pos + size] for pos in xrange(0, len(seq), size))


# generate test-cases with <=CHUNK_SIZE compiler-rt tests each
CHUNK_SIZE = 35
# array just to keep the class objects somewhere
compiler_rt_tests_classes = []
for i, ts in enumerate(chunker(fp_tests, CHUNK_SIZE)):
    # append new class to our array
    compiler_rt_tests_classes.append(
        # this is essentially the decorator @tests.add_test
        tests.add_test(
            # type is the (built-in) base-class for python classes, here we
            # construct classes by calling its constructor
            # signature of type constructor:
            #   type(classname, baseclass tuple, dict with methods/attributes)
            type(
                'CompilerRTBuiltins%d' % (i + 1),
                (CompilerRTBuiltinsAbstract, ),
                {
                    'name':
                    'compiler-rt-fp%d' % (i + 1),
                    # partially bind the get_modules() template to select the
                    # right set of tests. Note the ts=ts in the lambda
                    # arguments, this prevents python's default late-binding
                    # for closure arguments.
                    'get_modules':
                    lambda s, b, m, ts=ts: get_modules_tpl(ts, s, b, m)
                })))