test iocsh functions

This commit is contained in:
Michael Davidsaver
2026-02-23 09:40:50 +00:00
parent ef7ef0f158
commit 1d182cb031
7 changed files with 185 additions and 4 deletions
+53 -1
View File
@@ -18,11 +18,14 @@
#include <epicsExit.h>
#include <asTrapWrite.h>
#include <generalTimeSup.h>
#include <iocsh.h>
#include "dblocker.h"
#include "testioc.h"
#include "utilpvt.h"
#include "capturestd.h"
#if EPICS_VERSION_INT >= VERSION_INT(3, 15, 0, 2)
# define HAVE_lsi
#endif
@@ -947,11 +950,59 @@ void testMonitorDBE(TestClient& ctxt)
testEq(val["value"].as<int32_t>(), 43);
}
void testiocsh(TestClient& ctxt)
{
testDiag("%s", __func__);
TestSubscription sub(ctxt.monitor("test:ai")
.maskConnected(true)
.maskDisconnected(true));
auto val(sub.waitForUpdate());
{
CaptureStd cap([](){
iocshCmd("pvxsr 5");
});
testStrEq(cap.err(), "");
testStrMatch(".*EPICS_PVAS_AUTO_BEACON_ADDR_LIST=NO.*", cap.out());
testStrMatch(".*Source: __server.*", cap.out());
testStrMatch(".*test:nsec.*", cap.out());
testStrMatch(".*State: Running TCP_Port:.*", cap.out());
testStrMatch(".*test:ai TX=.*", cap.out());
}
{
CaptureStd cap([](){
iocshCmd("pvxsi");
});
testStrEq(cap.err(), "");
testStrMatch(".*Toolchain.*", cap.out());
testStrMatch(".*epicsThreadGetCPUs.*", cap.out());
testStrMatch(".*EPICS_PVAS_AUTO_BEACON_ADDR_LIST=.*", cap.out());
}
{
CaptureStd cap([](){
iocshCmd("pvxrefshow");
iocshCmd("pvxrefsave");
iocshCmd("pvxrefdiff");
});
testStrEq(cap.err(), "");
testStrMatch(".*StructTop.*", cap.out());
}
{
CaptureStd cap([](){
iocshCmd("pvxsl 5");
});
testStrEq(cap.err(), "");
testStrMatch(".*RECORDS.*test:ai.*", cap.out());
}
}
} // namespace
MAIN(testqsingle)
{
testPlan(99);
testPlan(113);
testSetup();
pvxs::logger_config_env();
generalTimeRegisterCurrentProvider("test", 1, &testTimeCurrent);
@@ -996,6 +1047,7 @@ MAIN(testqsingle)
testMonitorAIFilt(mctxt);
testMonitorDBEAlarm(mctxt);
testMonitorDBE(mctxt);
testiocsh(mctxt);
}
timeSim = false;
testPutBlock();