|
14 | 14 | os.path.dirname(os.path.abspath(__file__)),
|
15 | 15 | "data")
|
16 | 16 | test_smoke_data_dir = os.path.join(data_dir, "test_smoke")
|
| 17 | +test_smoke_str_data_dir = os.path.join(data_dir, "test_smoke_str") |
17 | 18 |
|
18 | 19 |
|
19 | 20 | def test_smoke(dirconfig : pfv.DirConfig):
|
@@ -57,3 +58,43 @@ def test_smoke(dirconfig : pfv.DirConfig):
|
57 | 58 |
|
58 | 59 | assert status.startswith("PASS:")
|
59 | 60 |
|
| 61 | +def test_smoke_str(dirconfig : pfv.DirConfig): |
| 62 | + flow = pfv.FlowSim(dirconfig) |
| 63 | + |
| 64 | + print("test_smoke_data_dir: %s" % test_smoke_str_data_dir, flush=True) |
| 65 | + |
| 66 | + flow.addTaskToPhase("generate.main", pfv.TaskCmd("gen-api", |
| 67 | + cmd=[sys.executable, "-m", "hdl_if", "api-gen-sv", "-m", "call_sv_bfm", |
| 68 | + "--package", "call_sv_bfm_pkg", "-o", "call_sv_bfm_pkg.sv"], |
| 69 | + env=[pfv.EnvAction.prepend_path("PYTHONPATH", test_smoke_str_data_dir)], |
| 70 | + cwd=dirconfig.builddir() |
| 71 | + )) |
| 72 | + flow.fs.add_library(hdl_if.share()) |
| 73 | + flow.sim.addFileset(pfv.FSVlnv("fvutils::pyhdl-if", "systemVerilogSource")) |
| 74 | + |
| 75 | + flow.sim.addFileset(pfv.FSPaths( |
| 76 | + dirconfig.builddir(), |
| 77 | + ["call_sv_bfm_pkg.sv"], |
| 78 | + "systemVerilogSource")) |
| 79 | + |
| 80 | + flow.sim.addFileset(pfv.FSPaths( |
| 81 | + test_smoke_str_data_dir, |
| 82 | + ["wb_init_bfm.sv", "call_sv_bfm.sv"], |
| 83 | + "systemVerilogSource")) |
| 84 | + |
| 85 | + flow.sim.dpi_libs.append(hdl_if.get_entry()) |
| 86 | + flow.sim.top.add("call_sv_bfm") |
| 87 | + |
| 88 | + run_args = flow.sim.mkRunArgs(dirconfig.rundir()) |
| 89 | + run_args.prepend_pathenv("PYTHONPATH", test_smoke_str_data_dir) |
| 90 | + flow.addTaskToPhase("run.main", flow.sim.mkRunTask(run_args)) |
| 91 | + |
| 92 | + if dirconfig.config.getHdlSim() in SKIP_HDLSIM: |
| 93 | + pytest.skip("Unsupported simulator %s" % dirconfig.config.getHdlSim()) |
| 94 | + else: |
| 95 | + flow.run_all() |
| 96 | + |
| 97 | + with open(os.path.join(dirconfig.rundir(), "status.txt"), "r") as fp: |
| 98 | + status = fp.read().strip() |
| 99 | + |
| 100 | + assert status.startswith("PASS:") |
0 commit comments