diff --git a/bl45p-mo-ioc-03.boot b/bl45p-mo-ioc-03.boot deleted file mode 100644 index b1b8f4883..000000000 --- a/bl45p-mo-ioc-03.boot +++ /dev/null @@ -1,12 +0,0 @@ -cd "/repos/epics/ioc" - -dbLoadDatabase "dbd/ioc.dbd" -ioc_registerRecordDeviceDriver(pdbbase) - -pmacAsynIPConfigure(BRICK1port, 192.168.0.12:1112) -pmacCreateController(BL45P-MO-BRICK-01, BRICK1port, 0, 8, 500, 100) -pmacCreateAxes(BL45P-MO-BRICK-01, 8) -none - -dbLoadRecords("/tmp/ioc.db") -iocInit() diff --git a/bl45p-mo-ioc-04.boot b/bl45p-mo-ioc-04.boot deleted file mode 100644 index 8f9b1367c..000000000 --- a/bl45p-mo-ioc-04.boot +++ /dev/null @@ -1,10 +0,0 @@ -cd "/repos/epics/ioc" - -dbLoadDatabase "dbd/ioc.dbd" -ioc_registerRecordDeviceDriver(pdbbase) - - -dbLoadRecords("/tmp/ioc.db") -iocInit() - -dbpf "BL45P-MO-THIN-01:Y1.TWV", "0.5" diff --git a/ioc.boot b/ioc.boot deleted file mode 100644 index d97986112..000000000 --- a/ioc.boot +++ /dev/null @@ -1,11 +0,0 @@ -cd "/repos/epics/ioc" - -dbLoadDatabase "dbd/ioc.dbd" -ioc_registerRecordDeviceDriver(pdbbase) - -pmacAsynIPConfigure(BRICK1port, 192.168.0.12:1112) -pmacCreateController(BL45P-MO-BRICK-01, BRICK1port, 0, 8, 500, 100) -pmacCreateAxes(BL45P-MO-BRICK-01, 8) - -dbLoadRecords("/tmp/ioc.db") -iocInit() diff --git a/src/ibek/__main__.py b/src/ibek/__main__.py index 1b0d09e01..ecde3f163 100644 --- a/src/ibek/__main__.py +++ b/src/ibek/__main__.py @@ -100,6 +100,8 @@ def build_startup( ioc_instance = ioc_deserialize(instance, definitions) script_txt = create_boot_script(ioc_instance) + out.parent.mkdir(parents=True, exist_ok=True) + with out.open("w") as stream: stream.write(script_txt) diff --git a/tests/test_cli.py b/tests/test_cli.py index 25058cc58..3e28f3a1b 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -88,6 +88,33 @@ def test_container_schema(tmp_path: Path, samples: Path): assert expected == actual +def test_build_startup_output_path(tmp_path: Path, samples: Path): + """ + build an ioc startup script and ensure output directory gets generated + if it doesn't pre-exist + """ + clear_entity_classes() + entity_file = samples / "yaml" / "bl45p-mo-ioc-02.ibek.entities.yaml" + definition_file = samples / "yaml" / "pmac.ibek.defs.yaml" + out_file = tmp_path / "new_dir" / "ioc.boot" + out_db = tmp_path / "new_dir" / "make_db.sh" + + run_cli( + "build-startup", + entity_file, + definition_file, + "--out", + out_file, + "--db-out", + out_db, + ) + + example_boot = (samples / "boot_scripts" / "ioc.boot").read_text() + actual_boot = out_file.read_text() + + assert example_boot == actual_boot + + def test_build_startup_single(tmp_path: Path, samples: Path): """ build an ioc startup script from an IOC instance entity file