Esempio n. 1
0
    def execute_test_hex_load(self, stage0hexfile, sha256hex):
        output_mem_buffer = BytesIO()

        with open(get_stage0_file(stage0hexfile), 'rb') as input_file_fd:
            vm = create_vm(
                size=0,
                registersize=self.registersize,
                tapefile1=self.get_tape1_file_path(input_file_fd),
                tapefile2=self.tape_02_temp_file_path,
                stdin=self.get_stdin_for_vm(input_file_fd),
                stdout=output_mem_buffer,
            )
            self.load_encoding_rom(vm)
            self.assertEqual(self.encoding_rom_binary.getbuffer(),
                             vm[MEM].tobytes())
            grow_memory(vm, self.get_end_of_memory())
            execute_vm(vm, optimize=self.optimize, halt_print=False)

        with open(self.get_output_file_path(), 'rb') as tape_file:
            checksum = sha256(tape_file.read())

        self.assertEqual(checksum.hexdigest(), sha256hex, stage0hexfile)
Esempio n. 2
0
 def compute_sha256_digest(self):
     input_filelist = ['High_level_prototypes/defs'] + self.input_filelist
     return \
         get_sha256sum_of_file_after_files_are_M1_assembled_and_hex2_linked(
             *[get_stage0_file(filename) for filename in input_filelist ]
         )
Esempio n. 3
0
 def get_tape_01_file():
     return get_stage0_file("stage1/SET.hex2")
Esempio n. 4
0
 def compute_sha256_digest(self):
     return get_sha256sum_of_file_after_hex2_encode(
         get_stage0_file('stage1/M0-macro.hex2'))
Esempio n. 5
0
class Test_dehex_256Sum(Hex256SumMatch, Hex0EncodeSpecificFile):
    sha256sumfilename = 'roms/DEHEX'
    sha256_compare_filename = get_stage0_file('stage1/dehex.hex0')
Esempio n. 6
0
    STAGE_0_HEX0_ASSEMBLER_FILEPATH,
    STAGE_0_HEX1_ASSEMBLER_RELATIVE_PATH,
)
from .testflags import OPTIMIZE_SKIP, DIFF_REG_SIZE_SKIP

get_sha256sum_of_file_after_hex0_encode = \
    make_get_sha256sum_of_file_after_encode(
        write_binary_filefd_from_hex0_filefd)

ADDITIONAL_SHA256SUMS_may_not_exist_exemptions = {
    'Linux Bootstrap/xeh.hex0',
}

ADDITIONAL_SHA256SUMS = [
    (filename,
     get_sha256sum_of_file_after_hex0_encode(get_stage0_file(filename)))
    for filename in (
        'stage1/more.hex0',
        'stage1/dehex.hex0',
        'Linux Bootstrap/xeh.hex0',
    )  # end tuple fed to for filename in
    if (filename not in ADDITIONAL_SHA256SUMS_may_not_exist_exemptions
        or exists(filename))
]


class Hex0Common(HexCommon):
    encoding_rom_filename = STAGE_0_MONITOR_HEX_FILEPATH
    rom_encode_func = staticmethod(write_binary_filefd_from_hex0_filefd)

Esempio n. 7
0
 def test_stage0_monitor_encoding_stage1_assembler_1(self):
     self.run_execution_test(
         STAGE_0_MONITOR_HEX_FILEPATH,
         get_stage0_file("stage1/stage1_assembler-1.hex0") )
Esempio n. 8
0
 def test_encode_M0_with_stage1_hex2(self):
     self.execute_test_hex_load_published_sha256(
         get_stage0_file('stage1/M0-macro.hex2'),
         "roms/M0",
     )
Esempio n. 9
0
 def test_encode_SET_with_stage1_hex2(self):
     self.execute_test_hex_load_published_sha256(
         get_stage0_file('stage1/SET.hex2'),
         "roms/SET",
     )