# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import sys sys.path.insert(0, '../..') import test_harness # XXX need test to dump memory contents and ensure they are written out # properly test_harness.register_generic_assembly_tests([ 'data_page_fault_read', 'data_page_fault_write', 'data_supervisor_fault_read', 'data_supervisor_fault_write', 'dflush_tlb_miss', 'dinvalidate_tlb_miss', 'dtlb_insert_user', 'asid', 'execute_fault', 'instruction_page_fault', 'instruction_super_fault', 'write_fault', 'tlb_invalidate', 'tlb_invalidate_all', 'tlb_invalidate_user', 'tlb_invalidate_all_user', 'synonym', 'duplicate_tlb_insert', 'itlb_insert_user', 'io_supervisor_fault_read', 'io_supervisor_fault_write', 'io_write_fault', 'io_map', 'nested_fault', 'instruction_translate' ]) test_harness.execute_tests()
#!/usr/bin/env python3 # # Copyright 2019 Jeff Bush # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import sys sys.path.insert(0, '../..') import test_harness test_harness.register_generic_assembly_tests(['perf_counter.S'], ['verilator', 'fpga']) test_harness.execute_tests()
#!/usr/bin/env python # # Copyright 2011-2015 Jeff Bush # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # """ This test writes a pattern to memory and manually flushes it from code. It then checks the contents of system memory to ensure the data was flushed correctly. """ import struct import sys sys.path.insert(0, '../..') import test_harness test_harness.register_generic_assembly_tests(['atomic']) test_harness.execute_tests()
#!/usr/bin/env python3 # # Copyright 2017 Jeff Bush # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import sys sys.path.insert(0, '../..') import test_harness test_harness.register_generic_assembly_tests(['memory_test.S'], ['fpga']) test_harness.execute_tests()
# Make sure we see at least some of the base string printed after an # interrupt if output.find('*') >= len(output) - 1: raise test_harness.TestException( 'No instances of interrupt return:\n' + result) # Remove all asterisks (interrupts) and make sure string is intact stripped = output.replace('*', '') if stripped != '0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`' \ 'abcdefghijklmnopqrstuvwxyz' * 10: raise test_harness.TestException( 'Base string does not match:\n' + stripped) test_harness.register_generic_assembly_tests([ 'setcr_non_super.S', 'getcr_non_super.S', 'eret_non_super.S', 'dinvalidate_non_super.S', 'syscall.S', 'breakpoint.S', 'unaligned_inst_fault.S', 'unaligned_data_fault.S', 'multicycle.S', 'illegal_instruction.S', 'int_config.S' ], ['emulator', 'verilator', 'fpga']) test_harness.execute_tests()
args = [test_harness.BIN_DIR + 'emulator', '-o', SEND_PIPE_NAME, test_harness.HEX_FILE] emulator_process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) try: interrupt_pipe = os.open(SEND_PIPE_NAME, os.O_RDONLY | os.O_NONBLOCK) test_harness.TimedProcessRunner().communicate(emulator_process, 60) # Interrupts should be in pipe now interrupts = os.read(interrupt_pipe, 5) if interrupts != b'\x05\x06\x07\x08\x09': raise test_harness.TestException( 'Did not receive proper host interrupts') finally: os.close(interrupt_pipe) os.unlink(SEND_PIPE_NAME) test_harness.register_generic_assembly_tests([ 'setcr_non_super', 'eret_non_super', 'dinvalidate_non_super', 'syscall', 'inst_align_fault', 'unaligned_data_fault', 'multicycle', 'illegal_instruction' ]) test_harness.execute_tests()
# XXX need test to dump memory contents and ensure they are written out # properly test_harness.register_generic_assembly_tests([ 'data_page_fault_read', 'data_page_fault_write', 'data_supervisor_fault_read', 'data_supervisor_fault_write', 'dflush_tlb_miss', 'dinvalidate_tlb_miss', 'dtlb_insert_user', 'asid', 'execute_fault', 'instruction_page_fault', 'instruction_super_fault', 'write_fault', 'tlb_invalidate', 'tlb_invalidate_all', 'synonym', 'duplicate_tlb_insert', 'itlb_insert_user', 'io_supervisor_fault_read', 'io_supervisor_fault_write', 'io_write_fault', 'io_map', 'nested_fault', 'instruction_translate' ]) test_harness.execute_tests()
args = [ test_harness.BIN_DIR + 'emulator', '-o', SEND_PIPE_NAME, test_harness.HEX_FILE ] emulator_process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) try: interrupt_pipe = os.open(SEND_PIPE_NAME, os.O_RDONLY | os.O_NONBLOCK) test_harness.TimedProcessRunner().communicate(emulator_process, 60) # Interrupts should be in pipe now interrupts = os.read(interrupt_pipe, 5) if interrupts != b'\x05\x06\x07\x08\x09': raise test_harness.TestException( 'Did not receive proper host interrupts') finally: os.close(interrupt_pipe) os.unlink(SEND_PIPE_NAME) test_harness.register_generic_assembly_tests([ 'setcr_non_super', 'getcr_non_super', 'eret_non_super', 'dinvalidate_non_super', 'syscall', 'breakpoint', 'inst_align_fault', 'unaligned_data_fault', 'multicycle', 'illegal_instruction' ]) test_harness.execute_tests()
#!/usr/bin/env python3 # # Copyright 2011-2015 Jeff Bush # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import sys sys.path.insert(0, '../..') import test_harness # XXX need test to dump memory contents and ensure they are written out # properly test_harness.register_generic_assembly_tests( test_harness.find_files(('.s', '.S')), ['emulator', 'verilator', 'fpga']) test_harness.execute_tests()
#!/usr/bin/env python3 # # Copyright 2011-2015 Jeff Bush # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import sys sys.path.insert(0, '../..') import test_harness test_harness.register_generic_assembly_tests([ 'int_arithmetic', 'branch', 'compare', 'shuffle', 'load_store', 'atomic', 'float_ops', 'float' ]) test_harness.execute_tests()