diff --git a/test_config/good_for_refl/galil01.cmd b/test_config/good_for_refl/galil01.cmd new file mode 100644 index 00000000..e5d7fc96 --- /dev/null +++ b/test_config/good_for_refl/galil01.cmd @@ -0,0 +1,24 @@ +## configure galil crate 1 + +## passed parameters +## GCID - galil crate software index. Numbering starts at 0 - will always be 0 if there is one to one galil crate <-> galil IOC mapping +## GALILADDR - address of this galil + +## see README_galil_cmd.txt for usage of commands below + +GalilCreateController("Galil", "127.0.0.1", 20) + +GalilCreateAxis("Galil","A",0,"",1) +GalilCreateAxis("Galil","B",0,"",1) +GalilCreateAxis("Galil","C",0,"",1) +GalilCreateAxis("Galil","D",0,"",1) +GalilCreateAxis("Galil","E",0,"",1) +GalilCreateAxis("Galil","F",0,"",1) +GalilCreateAxis("Galil","G",0,"",1) +GalilCreateAxis("Galil","H",0,"",1) + +$(IFNEWGALIL=#) GalilCreateCSAxes("Galil") + +GalilStartController("Galil","$(GALIL)/gmc/galil_Default_Header.gmc;$(GALIL)/gmc/galil_Home_Dummy_Do_Nothing.gmc!$(GALIL)/gmc/galil_Home_No_Home.gmc!$(GALIL)/gmc/galil_Home_Dummy_Do_Nothing.gmc!$(GALIL)/gmc/galil_Home_No_Home.gmc!$(GALIL)/gmc/galil_Home_Dummy_Do_Nothing.gmc!$(GALIL)/gmc/galil_Home_No_Home.gmc!$(GALIL)/gmc/galil_Home_Dummy_Do_Nothing.gmc!$(GALIL)/gmc/galil_Home_No_Home.gmc;$(GALIL)/gmc/galil_Default_Footer.gmc",0,0,3) + +$(IFNEWGALIL=#) GalilCreateProfile("Galil", 2000) diff --git a/test_config/good_for_refl/galil02.cmd b/test_config/good_for_refl/galil02.cmd new file mode 100644 index 00000000..6e294338 --- /dev/null +++ b/test_config/good_for_refl/galil02.cmd @@ -0,0 +1,24 @@ +## configure galil crate 2 + +## passed parameters +## GCID - galil crate software index. Numbering starts at 0 - will always be 0 if there is one to one galil crate <-> galil IOC mapping +## GALILADDR - address of this galil + +## see README_galil_cmd.txt for usage of commands below + +GalilCreateController("Galil", "127.0.0.1", 20) + +GalilCreateAxis("Galil","A",0,"",1) +GalilCreateAxis("Galil","B",0,"",1) +GalilCreateAxis("Galil","C",0,"",1) +GalilCreateAxis("Galil","D",0,"",1) +GalilCreateAxis("Galil","E",0,"",1) +GalilCreateAxis("Galil","F",0,"",1) +GalilCreateAxis("Galil","G",0,"",1) +GalilCreateAxis("Galil","H",0,"",1) + +$(IFNEWGALIL=#) GalilCreateCSAxes("Galil") + +GalilStartController("Galil","$(GALIL)/gmc/galil_Default_Header.gmc;$(GALIL)/gmc/galil_Home_Dummy_Do_Nothing.gmc!$(GALIL)/gmc/galil_Home_No_Home.gmc!$(GALIL)/gmc/galil_Home_Dummy_Do_Nothing.gmc!$(GALIL)/gmc/galil_Home_No_Home.gmc!$(GALIL)/gmc/galil_Home_Dummy_Do_Nothing.gmc!$(GALIL)/gmc/galil_Home_No_Home.gmc!$(GALIL)/gmc/galil_Home_Dummy_Do_Nothing.gmc!$(GALIL)/gmc/galil_Home_No_Home.gmc;$(GALIL)/gmc/galil_Default_Footer.gmc",0,0,3) + +$(IFNEWGALIL=#) GalilCreateProfile("Galil", 2000) diff --git a/test_config/good_for_refl/galil03.cmd b/test_config/good_for_refl/galil03.cmd new file mode 100644 index 00000000..423335f9 --- /dev/null +++ b/test_config/good_for_refl/galil03.cmd @@ -0,0 +1,24 @@ +## configure galil crate 3 + +## passed parameters +## GCID - galil crate software index. Numbering starts at 0 - will always be 0 if there is one to one galil crate <-> galil IOC mapping +## GALILADDR - address of this galil + +## see README_galil_cmd.txt for usage of commands below + +GalilCreateController("Galil", "127.0.0.1", 20) + +GalilCreateAxis("Galil","A",0,"",1) +GalilCreateAxis("Galil","B",0,"",1) +GalilCreateAxis("Galil","C",0,"",1) +GalilCreateAxis("Galil","D",0,"",1) +GalilCreateAxis("Galil","E",0,"",1) +GalilCreateAxis("Galil","F",0,"",1) +GalilCreateAxis("Galil","G",0,"",1) +GalilCreateAxis("Galil","H",0,"",1) + +$(IFNEWGALIL=#) GalilCreateCSAxes("Galil") + +GalilStartController("Galil","$(GALIL)/gmc/galil_Default_Header.gmc;$(GALIL)/gmc/galil_Home_Dummy_Do_Nothing.gmc!$(GALIL)/gmc/galil_Home_No_Home.gmc!$(GALIL)/gmc/galil_Home_Dummy_Do_Nothing.gmc!$(GALIL)/gmc/galil_Home_No_Home.gmc!$(GALIL)/gmc/galil_Home_Dummy_Do_Nothing.gmc!$(GALIL)/gmc/galil_Home_No_Home.gmc!$(GALIL)/gmc/galil_Home_Dummy_Do_Nothing.gmc!$(GALIL)/gmc/galil_Home_No_Home.gmc;$(GALIL)/gmc/galil_Default_Footer.gmc",0,0,3) + +$(IFNEWGALIL=#) GalilCreateProfile("Galil", 2000) diff --git a/tests/axis.py b/tests/axis.py index 07d856cb..5f7bcc27 100644 --- a/tests/axis.py +++ b/tests/axis.py @@ -1,13 +1,25 @@ +import os import unittest from utils.channel_access import ChannelAccess -from utils.ioc_launcher import get_default_ioc_dir +from utils.ioc_launcher import EPICS_TOP, get_default_ioc_dir from utils.test_modes import TestModes GALIL_ADDR = "127.0.0.11" GALIL_PREFIX = "GALIL_01" +test_path = os.path.realpath( + os.path.join( + EPICS_TOP, + "support", + "motorExtensions", + "master", + "settings", + "jaws_manager", + ) +) + IOCS = [ { "name": GALIL_PREFIX, @@ -17,6 +29,7 @@ "macros": { "GALILADDR": GALIL_ADDR, "MTRCTRL": "1", + "GALILCONFIGDIR": test_path.replace("\\", "/"), }, } ] @@ -64,25 +77,25 @@ def test_GIVEN_both_retry_deadband_and_setpoint_deadband_are_explicitly_set_WHEN def test_GIVEN_neither_retry_not_setpoint_deadbands_set_and_mres_bigger_than_eres_WHEN_checking_tolerance_WHEN_checking_tolerance_THEN_mres_times_ten_is_used( self, ): - MRES = 456 - ERES = 123 - self.ca.set_pv_value("MTR0101.MRES", MRES, sleep_after_set=0) - self.ca.set_pv_value("MTR0101.ERES", ERES, sleep_after_set=0) + mres = 456 + eres = 123 + self.ca.set_pv_value("MTR0101.MRES", mres, sleep_after_set=0) + self.ca.set_pv_value("MTR0101.ERES", eres, sleep_after_set=0) # RDBD can not be less than MRES, if it is the same as MRES that means unset - self.ca.set_pv_value("MTR0101.RDBD", MRES, sleep_after_set=0) + self.ca.set_pv_value("MTR0101.RDBD", mres, sleep_after_set=0) self.ca.set_pv_value("MTR0101.SPDB", 0, sleep_after_set=0) - self.ca.assert_that_pv_is("MTR0101:IN_POSITION:TOLERANCE", MRES * 10) + self.ca.assert_that_pv_is("MTR0101:IN_POSITION:TOLERANCE", mres * 10) def test_GIVEN_neither_retry_not_setpoint_deadbands_set_and_mres_smaller_than_eres_WHEN_checking_tolerance_WHEN_checking_tolerance_THEN_eres_times_ten_is_used( self, ): - MRES = 456 - ERES = 789 - self.ca.set_pv_value("MTR0101.MRES", MRES, sleep_after_set=0) - self.ca.set_pv_value("MTR0101.ERES", ERES, sleep_after_set=0) + mres = 456 + eres = 789 + self.ca.set_pv_value("MTR0101.MRES", mres, sleep_after_set=0) + self.ca.set_pv_value("MTR0101.ERES", eres, sleep_after_set=0) # RDBD can not be less than MRES, if it is the same as MRES that means unset - self.ca.set_pv_value("MTR0101.RDBD", MRES, sleep_after_set=0) + self.ca.set_pv_value("MTR0101.RDBD", mres, sleep_after_set=0) self.ca.set_pv_value("MTR0101.SPDB", 0, sleep_after_set=0) - self.ca.assert_that_pv_is("MTR0101:IN_POSITION:TOLERANCE", ERES * 10) + self.ca.assert_that_pv_is("MTR0101:IN_POSITION:TOLERANCE", eres * 10) diff --git a/tests/cryosms.py b/tests/cryosms.py index d3126e75..d926f798 100644 --- a/tests/cryosms.py +++ b/tests/cryosms.py @@ -7,7 +7,7 @@ from utils.channel_access import ChannelAccess from utils.emulator_launcher import EmulatorLauncher -from utils.ioc_launcher import BaseLauncher, IOCRegister, get_default_ioc_dir +from utils.ioc_launcher import EPICS_TOP, BaseLauncher, IOCRegister, get_default_ioc_dir from utils.test_modes import TestModes from utils.testing import get_running_lewis_and_ioc, parameterized_list, skip_if_recsim @@ -34,7 +34,9 @@ def local_cryosms_pv(pv): "MAX_VOLT": 9.9, "WRITE_UNIT": "TESLA", "DISPLAY_UNIT": "TESLA", - "RAMP_FILE": r"C:\\Instrument\\Apps\\EPICS\\support\\cryosms\\master\\ramps\\test.txt", + "RAMP_FILE": os.path.join( + EPICS_TOP, "support", "cryosms", "master", "ramps", "test.txt" + ), "MID_TOLERANCE": 0.1, "TARGET_TOLERANCE": 0.01, "ALLOW_PERSIST": "Yes", diff --git a/tests/fermi_chopper_lifter.py b/tests/fermi_chopper_lifter.py index 06963547..97a69e5f 100644 --- a/tests/fermi_chopper_lifter.py +++ b/tests/fermi_chopper_lifter.py @@ -16,7 +16,8 @@ "motorExtensions", "master", "settings", - "emma_chopper_lifter", + "EMMA-A", + "galil", ) ) @@ -27,7 +28,7 @@ "pv_for_existence": "AXIS1", "macros": { "MTRCTRL": "01", - "GALILADDR01": GALIL_ADDR, + "GALILADDR": GALIL_ADDR, "GALILCONFIGDIR": test_path.replace("\\", "/"), }, }, diff --git a/tests/galil.py b/tests/galil.py index b7ef063f..6057677e 100644 --- a/tests/galil.py +++ b/tests/galil.py @@ -20,7 +20,7 @@ "pv_for_existence": "AXIS1", "macros": { "MTRCTRL": "01", - "GALILADDR1": "127.0.0.11", + "GALILADDR": "127.0.0.11", "GALILCONFIGDIR": test_config_path.replace("\\", "/"), }, }, diff --git a/tests/gem_jaws_manager.py b/tests/gem_jaws_manager.py index bc7d3f0a..9926a378 100644 --- a/tests/gem_jaws_manager.py +++ b/tests/gem_jaws_manager.py @@ -4,7 +4,7 @@ from parameterized.parameterized import parameterized from common_tests.jaws_manager_utils import MOD_GAP, JawsManagerBase -from utils.ioc_launcher import get_default_ioc_dir +from utils.ioc_launcher import EPICS_TOP, get_default_ioc_dir # IP address of device from utils.test_modes import TestModes @@ -14,7 +14,13 @@ test_path = os.path.realpath( os.path.join( - os.getenv("EPICS_KIT_ROOT"), "support", "motorExtensions", "master", "settings", "gem_jaws" + EPICS_TOP, + "support", + "motorExtensions", + "master", + "settings", + "GEM", + "galil", ) ) diff --git a/tests/jaws.py b/tests/jaws.py index 7c1c1472..06c71bd4 100644 --- a/tests/jaws.py +++ b/tests/jaws.py @@ -29,6 +29,7 @@ "pv_for_existence": "AXIS1", "macros": { "MTRCTRL": "01", + "GALILADDR": "127.0.0.1", "GALILCONFIGDIR": test_path.replace("\\", "/"), }, }, diff --git a/tests/jaws_split.py b/tests/jaws_split.py index a7e813c2..cc616780 100644 --- a/tests/jaws_split.py +++ b/tests/jaws_split.py @@ -23,6 +23,7 @@ "pv_for_existence": "AXIS1", "macros": { "MTRCTRL": "01", + "GALILADDR": "127.0.0.1", "GALILCONFIGDIR": test_path.replace("\\", "/"), }, }, @@ -32,6 +33,7 @@ "pv_for_existence": "AXIS1", "macros": { "MTRCTRL": "02", + "GALILADDR": "127.0.0.1", "GALILCONFIGDIR": test_path.replace("\\", "/"), }, }, diff --git a/tests/mercuryitc_VTI_SPC.py b/tests/mercuryitc_VTI_SPC.py index 6b50f8e6..b3e9f7a9 100644 --- a/tests/mercuryitc_VTI_SPC.py +++ b/tests/mercuryitc_VTI_SPC.py @@ -64,7 +64,7 @@ def get_card_pv_prefix(card): macros["VTI_SPC_TEMP_CUTOFF_POINT"] = 5 macros["VTI_SPC_TEMP_SCALE"] = 5 -macros["VTI_CALIB_BASE_DIR"] = "C:/Instrument/Apps/EPICS/support" +macros["VTI_CALIB_BASE_DIR"] = EPICS_TOP.replace("\\", "/") + "/support" macros["VTI_SENS_DIR"] = "mercuryitc/master/test_calib/vti_spc" diff --git a/tests/nimrod_jaws_manager.py b/tests/nimrod_jaws_manager.py index b677afa7..c70d21f7 100644 --- a/tests/nimrod_jaws_manager.py +++ b/tests/nimrod_jaws_manager.py @@ -19,7 +19,8 @@ "motorExtensions", "master", "settings", - "nimrod_jaws", + "NIMROD", + "galil", ) ) diff --git a/tests/oscillating_collimator_let.py b/tests/oscillating_collimator_let.py index be39d0b8..077845b9 100644 --- a/tests/oscillating_collimator_let.py +++ b/tests/oscillating_collimator_let.py @@ -66,7 +66,8 @@ def setUp(self): # Set to 0 so stability buffer contents are consistent & known for each test # Takes 10 seconds for buffer to have consistent contents, so to be certain sleep for 11 - self.ca_mot.set_pv_value("DMC01:Galil0Bi5_STATUS", 0, sleep_after_set=11) + self.ca_mot.set_pv_value("DMC01:Galil0Bi5_STATUS:SIM", 1) + self.ca_mot.set_pv_value("DMC01:Galil0Bi5_STATUS:SIM:VAL", 0, sleep_after_set=11) @parameterized.expand( # [(angle, frequency, radius), (expected distance, expected velocity) @@ -119,7 +120,7 @@ def test_WHEN_laser_unstable_THEN_collimator_is_reported_moving(self): self.ca.assert_that_pv_is("MOVING", "Not Moving", timeout=30) self.ca.assert_that_pv_value_is_unchanged("MOVING", 5) # Give laser new value - self.ca_mot.set_pv_value("DMC01:Galil0Bi5_STATUS", 1) + self.ca_mot.set_pv_value("DMC01:Galil0Bi5_STATUS:SIM:VAL", 1) # Assert # Check PV is now moving @@ -129,7 +130,7 @@ def test_WHEN_laser_unstable_THEN_collimator_is_reported_moving(self): def test_WHEN_laser_stable_THEN_collimator_is_reported_not_moving(self): # Act - self.ca_mot.set_pv_value("DMC01:Galil0Bi5_STATUS", 1) + self.ca_mot.set_pv_value("DMC01:Galil0Bi5_STATUS:SIM:VAL", 1) # Assert # Check that PV was moving after laser change, then stops moving after buffer clears diff --git a/tests/polaris_jaws_manager.py b/tests/polaris_jaws_manager.py index 53672049..0e2361af 100644 --- a/tests/polaris_jaws_manager.py +++ b/tests/polaris_jaws_manager.py @@ -21,7 +21,8 @@ "motorExtensions", "master", "settings", - "polaris_jaws", + "POLARIS", + "galil", ) ) diff --git a/tests/readascii.py b/tests/readascii.py index c9d3e01c..08e5b716 100644 --- a/tests/readascii.py +++ b/tests/readascii.py @@ -10,9 +10,7 @@ from utils.ioc_launcher import EPICS_TOP, IOCRegister from utils.test_modes import TestModes -DEFAULT_SETTINGS_DIR = os.path.join( - "C:/", "Instrument", "Apps", "EPICS", "support", "ReadASCII", "master", "example_settings" -) +DEFAULT_SETTINGS_DIR = os.path.join(EPICS_TOP, "support", "ReadASCII", "master", "example_settings") DEFAULT_SETTINGS_FILE = "Default.txt" TEMP_TEST_SETTINGS_DIR = os.path.join("C:/", "Instrument", "var", "tmp", "readascii_test") @@ -141,9 +139,9 @@ def _set_ramp_status(self, status): ] ) def test_GIVEN_the_test_file_has_entries_for_a_setpoint_WHEN_that_exact_setpoint_is_set_THEN_it_updates_the_pid_pvs_with_the_values_from_the_file( - self, _, MH_name + self, _, mh_name ): - headers = ["SP", "P", "I", "D", MH_name] + headers = ["SP", "P", "I", "D", mh_name] rows = [ (50, 1, 2, 3, 4), (100, 5, 6, 7, 8), @@ -368,8 +366,9 @@ def test_GIVEN_data_file_name_changed_THEN_new_file_used(self): check_pvs = ["OUT_P", "OUT_I", "OUT_D", "OUT_MAX"] # we use file2 this time and expect new values - with self._generate_temporary_test_file(headers, rows, "file2"), self._use_test_file( - "file2" + with ( + self._generate_temporary_test_file(headers, rows, "file2"), + self._use_test_file("file2"), ): for row in rows: self._set_and_check_flexible(row[0], check_pvs, row[1:]) @@ -391,8 +390,9 @@ def test_GIVEN_invalid_filename_then_fixing_it_THEN_first_alarm_then_correct(sel ] check_pvs = ["OUT_P", "OUT_I", "OUT_D", "OUT_MAX"] - with self._generate_temporary_test_file(headers, rows, "RealFile"), self._use_test_file( - "RealFile" + with ( + self._generate_temporary_test_file(headers, rows, "RealFile"), + self._use_test_file("RealFile"), ): for row in rows: self._set_and_check_flexible(row[0], check_pvs, row[1:]) @@ -407,7 +407,8 @@ def test_GIVEN_file_is_set_THEN__file_not_default_PV_is_true(self): (0, 0, 0, 0, 0), ] - with self._generate_temporary_test_file(headers, rows, "RealFile"), self._use_test_file( - "RealFile" + with ( + self._generate_temporary_test_file(headers, rows, "RealFile"), + self._use_test_file("RealFile"), ): self.ca.assert_that_pv_is("RAMP_FILE_NOT_DEFAULT", 1) diff --git a/tests/spinflipper.py b/tests/spinflipper.py index 63130251..5f04db19 100644 --- a/tests/spinflipper.py +++ b/tests/spinflipper.py @@ -2,11 +2,11 @@ import unittest from utils.channel_access import ChannelAccess +from utils.ioc_launcher import EPICS_TOP from utils.test_modes import TestModes from utils.testing import get_running_lewis_and_ioc DEVICE_PREFIX = "SPINFLIPPER_01" -EPICS_TOP = os.environ.get("KIT_ROOT", os.path.join("C:\\", "Instrument", "Apps", "EPICS")) IOCS = [ { diff --git a/tests/zfhifi.py b/tests/zfhifi.py index 36393c71..f9f7052d 100644 --- a/tests/zfhifi.py +++ b/tests/zfhifi.py @@ -7,7 +7,7 @@ from utils.channel_access import ChannelAccess from utils.emulator_launcher import EmulatorLauncher -from utils.ioc_launcher import BaseLauncher, get_default_ioc_dir +from utils.ioc_launcher import EPICS_TOP, BaseLauncher, get_default_ioc_dir from utils.test_modes import TestModes from utils.testing import get_running_lewis_and_ioc @@ -30,7 +30,9 @@ def cryosms_macros(iocnum: int) -> dict[str, Any]: "MAX_VOLT": 5, "WRITE_UNIT": "AMPS", "DISPLAY_UNIT": "GAUSS", - "RAMP_FILE": r"C:\\Instrument\\Apps\\EPICS\\support\\cryosms\\master\\ramps\\default.txt", + "RAMP_FILE": os.path.join( + EPICS_TOP, "support", "cryosms", "master", "ramps", "default.txt" + ), "MID_TOLERANCE": 999999999, # 0.1 "TARGET_TOLERANCE": 999999999, # 0.1 "ALLOW_PERSIST": "No", @@ -87,10 +89,7 @@ def group3_hall_probe_ioc(iocnum: int) -> dict[str, Any]: "emulator": "group3hallprobe", "emulator_id": f"group3hallprobe_{iocnum}", "lewis_additional_path": os.path.join( - "c:\\", - "Instrument", - "Apps", - "EPICS", + EPICS_TOP, "support", "group3hallprobe", "master",