Exemple #1
0
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)
Exemple #2
0
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)
Exemple #3
0
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)
Exemple #4
0
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)
Exemple #6
0
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)
Exemple #7
0
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)
Exemple #8
0
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)
Exemple #9
0
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)
Exemple #10
0
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)
Exemple #11
0
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)
Exemple #12
0
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)
Exemple #13
0
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)
Exemple #14
0
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)
Exemple #15
0
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)
Exemple #16
0
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)
Exemple #17
0
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)
Exemple #18
0
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)
Exemple #19
0
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)
Exemple #20
0
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)
Exemple #21
0
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)
Exemple #22
0
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)
Exemple #23
0
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)
Exemple #24
0
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)