Beispiel #1
0
    def test_openocd_riscv_compliancetest(self, tmp_path, sim_top_earlgrey,
                                          topsrcdir, openocd):
        """Run RISC-V Debug compliance test built into OpenOCD."""
        assert subprocess.call([str(openocd), '--version']) == 0
        cmd_openocd = [
            str(openocd), '-s',
            str(topsrcdir / 'util' / 'openocd'), '-f',
            'board/lowrisc-earlgrey-verilator.cfg', '-c',
            'init; riscv test_compliance; shutdown'
        ]
        p_openocd = test_utils.Process(cmd_openocd,
                                       logdir=str(tmp_path),
                                       cwd=str(tmp_path))
        p_openocd.run()

        logging.getLogger(__name__).info(
            "OpenOCD should terminate itself; give it up to 5 minutes")
        p_openocd.proc.wait(timeout=300)
        assert p_openocd.proc.returncode == 0

        logging.getLogger(__name__).info(
            "Now wait 60 seconds until the program has finished execution")
        time.sleep(60)

        try:
            p_openocd.terminate()
        except ProcessLookupError:
            # process is already dead
            pass
    def spiflash_proc(self, tmp_path, spiflash, sw_test_bin):
        cmd_flash = [str(spiflash), '--input', str(sw_test_bin)]
        p_flash = test_utils.Process(
            cmd_flash,
            logdir=str(tmp_path),
            cwd=str(tmp_path),
            startup_done_expect='Running SPI flash update.',
            startup_timeout=10)
        p_flash.run()

        yield p_flash

        p_flash.terminate()
Beispiel #3
0
    def sim_top_earlgrey(self, tmp_path, sim_top_build, sw_test_bin, rom_bin):
        cmd_sim = [
            str(sim_top_build), '--meminit=flash,' + str(sw_test_bin),
            '--meminit=rom,' + str(rom_bin)
        ]
        p_sim = test_utils.Process(cmd_sim,
                                   logdir=str(tmp_path),
                                   cwd=str(tmp_path),
                                   startup_done_expect='Simulation running',
                                   startup_timeout=10)
        p_sim.run()

        yield p_sim

        p_sim.terminate()