Further changes as part of MVPwq!
This commit is contained in:
@@ -3,10 +3,10 @@
|
|||||||
epicsEnvSet("NAME","masterMacs1")
|
epicsEnvSet("NAME","masterMacs1")
|
||||||
epicsEnvSet("ASYN_PORT","p$(NAME)")
|
epicsEnvSet("ASYN_PORT","p$(NAME)")
|
||||||
|
|
||||||
drvAsynIPPortConfigure("$(ASYN_PORT)","$(ASYN_PORT)","$(MASTERMACS1_IP):$(MASTERMACS1_PORT)")
|
drvAsynIPPortConfigure("$(ASYN_PORT)","$(MASTERMACS1_IP):$(MASTERMACS1_PORT)")
|
||||||
masterMacsController("$(NAME)","$(ASYN_PORT)",8,0.05,0.05,0.3);
|
masterMacsController("$(NAME)","$(ASYN_PORT)",8,0.05,0.05,0.3);
|
||||||
masterMacsAxis("$(NAME)",1);
|
masterMacsAxis("$(NAME)",1);
|
||||||
# masterMacsAxis("$(NAME)",2);
|
# masterMacsAxis("$(NAME)",2);
|
||||||
|
|
||||||
epicsEnvSet("SINQDBPATH","$(masterMacs_DB)/sinqMotor.db")
|
epicsEnvSet("SINQDBPATH","$(masterMacs_DB)/sinqMotor.db")
|
||||||
dbLoadTemplate("$(IOCDIR)/motors/$(NAME).substitutions", "INSTR=$(PVPREFIX)$(NAME):,CONTROLLER=$(NAME)")
|
dbLoadTemplate("$(IOCDIR)/motors/$(NAME).substitutions", "INSTR=$(PVPREFIX):$(NAME):,CONTROLLER=$(NAME)")
|
||||||
|
|||||||
@@ -39,6 +39,6 @@ setMaxSubsequentTimeouts("$(NAME)", 20);
|
|||||||
setThresholdComTimeout("$(NAME)", 100, 1);
|
setThresholdComTimeout("$(NAME)", 100, 1);
|
||||||
|
|
||||||
epicsEnvSet("SINQDBPATH","$(turboPmac_DB)/sinqMotor.db")
|
epicsEnvSet("SINQDBPATH","$(turboPmac_DB)/sinqMotor.db")
|
||||||
dbLoadTemplate("$(IOCDIR)/motors/$(NAME).substitutions", "INSTR=$(PVPREFIX)$(NAME):,CONTROLLER=$(NAME)")
|
dbLoadTemplate("$(IOCDIR)/motors/$(NAME).substitutions", "INSTR=$(PVPREFIX):$(NAME):,CONTROLLER=$(NAME)")
|
||||||
epicsEnvSet("SINQDBPATH","$(turboPmac_DB)/turboPmac.db")
|
epicsEnvSet("SINQDBPATH","$(turboPmac_DB)/turboPmac.db")
|
||||||
dbLoadTemplate("$(IOCDIR)/motors/$(NAME).substitutions", "INSTR=$(PVPREFIX)$(NAME):,CONTROLLER=$(NAME)")
|
dbLoadTemplate("$(IOCDIR)/motors/$(NAME).substitutions", "INSTR=$(PVPREFIX):$(NAME):,CONTROLLER=$(NAME)")
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# This script is used to start the test IOC and is usually run as part of a
|
# This script is used to start the test IOC and is usually run as part of a
|
||||||
# test startup procedure. It autogenerates an IOC shell script from motors.yaml
|
# test startup procedure. It autogenerates an IOC shell script from motors.yaml
|
||||||
# which contains the IP adresses and ports of the motor controllers.
|
# which contains the IP adresses and ports of the motor controllers.
|
||||||
@@ -18,7 +20,7 @@ def startioc():
|
|||||||
|
|
||||||
# General configuration
|
# General configuration
|
||||||
out.write(
|
out.write(
|
||||||
f'epicsEnvSet("PVPREFIX"," {config["pvprefix"]})\n')
|
f'epicsEnvSet("PVPREFIX", "{config["pvprefix"]}")\n')
|
||||||
out.write(
|
out.write(
|
||||||
f'epicsEnvSet("IOCDIR", "{root_dir + "ioc"}" )\n')
|
f'epicsEnvSet("IOCDIR", "{root_dir + "ioc"}" )\n')
|
||||||
|
|
||||||
@@ -36,9 +38,14 @@ def startioc():
|
|||||||
out.write(
|
out.write(
|
||||||
f'epicsEnvSet("MASTERMACS1_PORT", "{config["controllers"]["masterMacs1"]["port"]}")\n')
|
f'epicsEnvSet("MASTERMACS1_PORT", "{config["controllers"]["masterMacs1"]["port"]}")\n')
|
||||||
|
|
||||||
# Start the IOC itself
|
# Start the IOC itself and keep it running in the background.
|
||||||
subprocess.run(root_dir + 'ioc/startioc')
|
# We need to start a new session so Pytest doesn't kill the process
|
||||||
|
proc = subprocess.Popen([root_dir + 'ioc/startioc'], start_new_session=True)
|
||||||
|
|
||||||
|
print(f"Started IOC with PID {proc.pid}")
|
||||||
|
|
||||||
|
# Yield control back to the test
|
||||||
|
# yield
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
startioc()
|
startioc()
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ require masterMacs, $(MASTERMACS_VERSION)
|
|||||||
|
|
||||||
# Initialize the motors itself
|
# Initialize the motors itself
|
||||||
< motors/turboPmac1.cmd
|
< motors/turboPmac1.cmd
|
||||||
< motors/masterMacs1.cmd
|
#< motors/masterMacs1.cmd
|
||||||
|
|
||||||
# Create the test record which is used to detect if the IOC is running
|
# Create the test record which is used to detect if the IOC is running
|
||||||
dbLoadRecords("$(IOCDIR)/db/ready.db", "P=$(PVPREFIX)")
|
dbLoadRecords("$(IOCDIR)/db/ready.db", "PVPREFIX=$(PVPREFIX)")
|
||||||
|
|
||||||
iocInit()
|
iocInit()
|
||||||
|
|||||||
2
ioc/startioc
Normal file → Executable file
2
ioc/startioc
Normal file → Executable file
@@ -9,4 +9,4 @@ SCRIPT_DIR=$(dirname "$(realpath "$0")")
|
|||||||
cd "$SCRIPT_DIR" || exit 1
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
|
||||||
# Run the IOC shell script
|
# Run the IOC shell script
|
||||||
st.cmd
|
st.cmd
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from caproto.sync.client import read, write
|
from caproto.sync.client import read, write
|
||||||
from ioc.startioc import startioc
|
from ioc.pystartioc import startioc
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from common import read_config
|
from common import read_config
|
||||||
|
|
||||||
TIMEOUT_IOC_STARTUP = 30
|
TIMEOUT_IOC_STARTUP = 10
|
||||||
TIMEOUT_READ = 3.0
|
TIMEOUT_READ = 2
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
@@ -32,7 +32,7 @@ def prepare_ioc():
|
|||||||
|
|
||||||
# Check periodically if the IOC started successfully
|
# Check periodically if the IOC started successfully
|
||||||
now = time.time()
|
now = time.time()
|
||||||
while now + TIMEOUT_IOC_STARTUP < time.time():
|
while now + TIMEOUT_IOC_STARTUP > time.time():
|
||||||
try:
|
try:
|
||||||
read(f'{pvprefix}:IOCREADY', timeout=TIMEOUT_READ)
|
read(f'{pvprefix}:IOCREADY', timeout=TIMEOUT_READ)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ def motor():
|
|||||||
config = read_config()
|
config = read_config()
|
||||||
return TurboPMAC(config['controllers']['turboPmac1']['ip'],
|
return TurboPMAC(config['controllers']['turboPmac1']['ip'],
|
||||||
config['controllers']['turboPmac1']['port'],
|
config['controllers']['turboPmac1']['port'],
|
||||||
config['pvprefix'] + 'turboPmac1:rot1')
|
config['pvprefix'] + ':turboPmac1:rot1')
|
||||||
|
|
||||||
|
|
||||||
def reset(motor):
|
def reset(motor):
|
||||||
|
|||||||
Reference in New Issue
Block a user