-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edited OERCONE ioc to boot using lua, calling scripts from the utilities support modules #433
Edited OERCONE ioc to boot using lua, calling scripts from the utilities support modules #433
Conversation
…ies support modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good work. As discussed can you remove the unfinished C code and remove the unused *.cmd code. Other minor comments in code.
|
||
#include "epicsExit.h" | ||
#include "epicsThread.h" | ||
#include "iocsh.h" | ||
#include "luaShell.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed remove this C code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@@ -1,46 +1,50 @@ | |||
epicsEnvSet "STREAM_PROTOCOL_PATH" "$(OERCONE)/data" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, remove unused code in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
iocsh.epicsEnvSet("STREAM_PROTOCOL_PATH", string.format("%s/data", oercone)) | ||
iocsh.epicsEnvSet("DEVICE", "L0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these variables are not used anywhere other than this file so need to set them externally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to local variables and removed stream protocol path as it is not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out that STREAM_PROTOCOL_PATH and DEVICE epics environment variables are used elsewhere, the tests fail otherwise.
devsim = getMacroValue{macro="DEVSIM", default="0"} | ||
isDevsim = devsim == "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually only need isDevsim
so can we just do this in one line? Similar for recsim
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to be one line for isDevsim.
recsim variable itself is used in iocsh.dbLoadRecords though, so kept that.
-- ##ISIS## Stuff that needs to be done after all records are loaded but before iocInit is called | ||
iocsh.iocshLoad(string.format("%s/preiocinit.cmd", iocstartup)) | ||
|
||
-- os.execute(string.format("cd %s/iocBoot/%s", getMacroValue{macro="TOP"}, getMacroValue{macro="IOC"})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code, remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
-- ## Start any sequence programs | ||
-- #seq sncxxx,"user=ltu34219" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code, remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
|
||
-- # calling common command file in ioc 01 boot dir | ||
-- # < ${TOP}/iocBoot/iocOERCONE-IOC-01/st-common.cmd | ||
require("st-common.lua") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The st.lua file is never called so was dead code.
Removed the file.
-- # Increase this if you get <<TRUNCATED>> or discarded messages warnings in your errlog output | ||
iocsh.errlogInit2(65536, 256) | ||
|
||
-- # envPaths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The st.lua file is never called so was dead code.
Removed the file.
-- # envPaths | ||
iocsh.iocshLoad(string.format("%s/dbload.cmd", iocstartup)) | ||
|
||
-- # cd ${TOP} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The st.lua file is never called so was dead code.
Removed the file.
There have been some changes since the review due to unforeseen strangeness in the way epics runs Lua. This included moving the script into a function so that local variables don't drop out of scope. Please see documented issues at the bottom of the Lua wiki page. There is also now documentation linked to here for installing and setting up luacheck, and also documentation for how to use our Lua utility functions. |
… scope of the variables in the script
Requested changes have been implemented
The OERCONE ioc now boots partially by using lua which is called from the st-common.cmd
Some of the code is messy as I have not had time for cleanup yet, but it is tested and works against the IocTestFramework.
There is a strong code smell in here (dead code) it is up to the reviewer whether they think it important I should get rid of this smell.
The 3 reasons I have not removed the dead code are:
Description of work
Edited the IOC for OERCONE to boot with lua called in the st-common.cmd
To test
Use the IOCTestFramework to test the oercone and eventually against hardware hopefully.
Ticket: (ISISComputingGroup/IBEX#4288)
Acceptance criteria
Code Review
Functional Tests
..._0n
wheren>1
) run correctlymacLib: macro
to find instances ofmacLib: macro [macro name] is undefined...
Final steps