def kernel_crash(name): underscore = name.rfind('_') if underscore == -1: raise test_harness.TestException('Internal error: unknown environment') environment = name[underscore + 1:] test_harness.build_program(['crash.c'], image_type='user') result = test_harness.run_kernel(environment=environment, timeout=240) test_harness.check_result('crash.c', result)
def run_compiler_test(source_file, target): if target == 'host': subprocess.check_call(['cc', source_file, '-o', HOST_EXE_FILE], stderr=subprocess.STDOUT) result = subprocess.check_output(HOST_EXE_FILE) test_harness.check_result(source_file, result.decode()) else: hex_file = test_harness.build_program([source_file]) result = test_harness.run_program(hex_file, target) test_harness.check_result(source_file, result)
def kernel_globalinit(name): underscore = name.rfind('_') if underscore == -1: raise test_harness.TestException( 'Internal error: unknown environment') environment = name[underscore + 1:] test_harness.build_program(['constructor.cpp'], image_type='user') result = test_harness.run_kernel(environment=environment, timeout=120) test_harness.check_result('constructor.cpp', result)
def kernel_ucf(name): underscore = name.rfind('_') if underscore == -1: raise test_harness.TestException( 'Internal error: unknown environment') environment = name[underscore + 1:] test_harness.build_program(['user_copy_fault.c'], image_type='user') result = test_harness.run_kernel(environment=environment, timeout=120) test_harness.check_result('user_copy_fault.c', result)
def run_compiler_test(source_file, target): if target == 'host': subprocess.check_call(['cc', source_file, '-o', 'obj/a.out'], stderr=subprocess.STDOUT) result = subprocess.check_output('obj/a.out') test_harness.check_result(source_file, result.decode()) else: test_harness.build_program([source_file]) result = test_harness.run_program(target) test_harness.check_result(source_file, result)
def run_test(name): if name.endswith('_emulator'): basename = name[0:-len('_emulator')] isverilator = False elif name.endswith('_verilator'): basename = name[0:-len('_verilator')] isverilator = True test_harness.compile_test([basename + '.c']) if isverilator: result = test_harness.run_verilator() else: result = test_harness.run_emulator() test_harness.check_result(basename + '.c', result)
def run_generic_test(name): if name.endswith('_emulator'): basename = name[0:-len('_emulator')] isverilator = False elif name.endswith('_verilator'): basename = name[0:-len('_verilator')] isverilator = True test_harness.compile_test([basename + '.c']) if isverilator: result = test_harness.run_verilator() else: result = test_harness.run_emulator() test_harness.check_result(basename + '.c', result)
def run_emulator_test(source_file): test_harness.compile_test(source_file, optlevel='3') result = test_harness.run_emulator() test_harness.check_result(source_file, result)
def run_host_test(source_file): subprocess.check_call(['c++', '-w', source_file, '-o', 'obj/a.out']) result = subprocess.check_output('obj/a.out') test_harness.check_result(source_file, result)
def kernel_panic(_, target): test_harness.build_program(['panic.c'], image_type='user') result = test_harness.run_kernel(target=target, timeout=240) test_harness.check_result('panic.c', result)
def run_kernel_test(source_file, target): test_harness.build_program([source_file], image_type='user') result = test_harness.run_kernel(target=target, timeout=240) test_harness.check_result(source_file, result)
def run_test(source_file, target): test_harness.build_program([source_file]) result = test_harness.run_program(target) test_harness.check_result(source_file, result)
def run_host_test(source_file): subprocess.check_call(["c++", "-w", source_file, "-o", "obj/a.out"]) result = subprocess.check_output("obj/a.out") test_harness.check_result(source_file, result)
def run_verilator_test(source_file): test_harness.compile_test(source_file, optlevel="3") result = test_harness.run_verilator() test_harness.check_result(source_file, result)
def kernel_globalinit(_, target): test_harness.build_program(['constructor.cpp'], image_type='user') result = test_harness.run_kernel(target=target, timeout=240) test_harness.check_result('constructor.cpp', result)
def run_emulator_test(source_file): test_harness.build_program([source_file]) result = test_harness.run_program(environment='emulator') test_harness.check_result(source_file, result)
def kernel_ucf(_, target): test_harness.build_program(['user_copy_fault.c'], image_type='user') result = test_harness.run_kernel(target=target, timeout=240) test_harness.check_result('user_copy_fault.c', result)
def kernel_crash(_, target): test_harness.build_program(['crash.c'], image_type='user') result = test_harness.run_kernel(target=target, timeout=240) test_harness.check_result('crash.c', result)