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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,8 @@ FakesAssemblies/
# Visual Studio 6 workspace options file
*.opt
.project

__pycache__/
*.py[cod]
*$py.class
test-reports/
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ iocBoot_DEPEND_DIRS += $(filter %App,$(DIRS))
# Add any additional dependency rules here:

include $(TOP)/configure/RULES_TOP

ioctests:
.\system_tests\run_tests.bat
Empty file added system_tests/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions system_tests/run_tests.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@echo off
setlocal
REM Run this directory's tests using the IOC Testing Framework

call "%~dp0..\..\..\..\config_env.bat"

REM Command line arguments always passed to the test script
SET ARGS=--test_and_emulator %~dp0
call %PYTHON3% -u "%EPICS_KIT_ROOT%\support\IocTestFramework\master\run_tests.py" %ARGS% %*
IF %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
Empty file added system_tests/tests/__init__.py
Empty file.
50 changes: 50 additions & 0 deletions system_tests/tests/mk3chopper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import unittest

from utils.channel_access import ChannelAccess
from utils.ioc_launcher import IOCRegister, get_default_ioc_dir
from utils.test_modes import TestModes
from utils.testing import skip_if_devsim

DEVICE_PREFIX = "MK3CHOPR_01"

IOCS = [
{
"name": DEVICE_PREFIX,
"directory": get_default_ioc_dir("MK3CHOPR"),
"macros": {
"NUM_CHANNELS": 1
},
},
]


TEST_MODES = [TestModes.RECSIM, TestModes.DEVSIM]


class Mk3chopperTests(unittest.TestCase):

# Remote access modes
LOCAL = "LOCAL"
REMOTE = "REMOTE"
COMP_MODE_PV = "COMP:MODE"

def setUp(self):
self._ioc = IOCRegister.get_running(DEVICE_PREFIX)
# Comp mode is on a slow 10s read. Needs a longer timeout than default
self.ca = ChannelAccess(device_prefix=DEVICE_PREFIX, default_timeout=30)
self.ca.assert_that_pv_exists(self.COMP_MODE_PV)

def test_WHEN_ioc_is_in_remote_mode_THEN_it_has_no_alarm(self):
# In RECSIM, switch to remote explicitly. DEVSIM can only have remote mode so no switch needed
if IOCRegister.uses_rec_sim:
# Bug in CA channel. Reports invalid alarm severity if you set enum directly
self.ca.set_pv_value("SIM:{}.VAL".format(self.COMP_MODE_PV), 1)
self.ca.assert_that_pv_is(self.COMP_MODE_PV, self.REMOTE)
self.ca.assert_that_pv_alarm_is(self.COMP_MODE_PV, ChannelAccess.Alarms.NONE)

@skip_if_devsim("Can't switch to local mode in DEVSIM")
def test_WHEN_ioc_is_in_local_mode_THEN_it_has_a_major_alarm(self):
# Bug in CA channel. Reports invalid alarm severity if you set enum directly
self.ca.set_pv_value("SIM:{}.VAL".format(self.COMP_MODE_PV), 0)
self.ca.assert_that_pv_is(self.COMP_MODE_PV, self.LOCAL)
self.ca.assert_that_pv_alarm_is(self.COMP_MODE_PV, ChannelAccess.Alarms.MAJOR)