Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions test_config/good_for_refl/galil01.cmd
Original file line number Diff line number Diff line change
@@ -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)
24 changes: 24 additions & 0 deletions test_config/good_for_refl/galil02.cmd
Original file line number Diff line number Diff line change
@@ -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)
24 changes: 24 additions & 0 deletions test_config/good_for_refl/galil03.cmd
Original file line number Diff line number Diff line change
@@ -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)
39 changes: 26 additions & 13 deletions tests/axis.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -17,6 +29,7 @@
"macros": {
"GALILADDR": GALIL_ADDR,
"MTRCTRL": "1",
"GALILCONFIGDIR": test_path.replace("\\", "/"),
},
}
]
Expand Down Expand Up @@ -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)
6 changes: 4 additions & 2 deletions tests/cryosms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions tests/fermi_chopper_lifter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"motorExtensions",
"master",
"settings",
"emma_chopper_lifter",
"EMMA-A",
"galil",
)
)

Expand All @@ -27,7 +28,7 @@
"pv_for_existence": "AXIS1",
"macros": {
"MTRCTRL": "01",
"GALILADDR01": GALIL_ADDR,
"GALILADDR": GALIL_ADDR,
"GALILCONFIGDIR": test_path.replace("\\", "/"),
},
},
Expand Down
2 changes: 1 addition & 1 deletion tests/galil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("\\", "/"),
},
},
Expand Down
10 changes: 8 additions & 2 deletions tests/gem_jaws_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
)
)

Expand Down
1 change: 1 addition & 0 deletions tests/jaws.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"pv_for_existence": "AXIS1",
"macros": {
"MTRCTRL": "01",
"GALILADDR": "127.0.0.1",
"GALILCONFIGDIR": test_path.replace("\\", "/"),
},
},
Expand Down
2 changes: 2 additions & 0 deletions tests/jaws_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"pv_for_existence": "AXIS1",
"macros": {
"MTRCTRL": "01",
"GALILADDR": "127.0.0.1",
"GALILCONFIGDIR": test_path.replace("\\", "/"),
},
},
Expand All @@ -32,6 +33,7 @@
"pv_for_existence": "AXIS1",
"macros": {
"MTRCTRL": "02",
"GALILADDR": "127.0.0.1",
"GALILCONFIGDIR": test_path.replace("\\", "/"),
},
},
Expand Down
2 changes: 1 addition & 1 deletion tests/mercuryitc_VTI_SPC.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
3 changes: 2 additions & 1 deletion tests/nimrod_jaws_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"motorExtensions",
"master",
"settings",
"nimrod_jaws",
"NIMROD",
"galil",
)
)

Expand Down
7 changes: 4 additions & 3 deletions tests/oscillating_collimator_let.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/polaris_jaws_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"motorExtensions",
"master",
"settings",
"polaris_jaws",
"POLARIS",
"galil",
)
)

Expand Down
23 changes: 12 additions & 11 deletions tests/readascii.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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:])
Expand All @@ -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:])
Expand All @@ -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)
2 changes: 1 addition & 1 deletion tests/spinflipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
{
Expand Down
Loading
Loading