Skip to content

Commit

Permalink
ioc: add test for dbLoadGroup command.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericonr authored and mdavidsaver committed Dec 11, 2024
1 parent 7e031a2 commit 28817ae
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ TESTFILES += ../image.json
TESTFILES += ../iq.db
TESTFILES += ../ntenum.db
TESTFILES += ../const.db
TESTFILES += ../qgroup.cmd
TESTFILES += ../qgroup.json
TESTS += testqgroup

PROD_SRCS_RTEMS += rtemsTestData.c
Expand Down
1 change: 1 addition & 0 deletions test/qgroup.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dbLoadGroup("../qgroup.json", "N=tst:")
5 changes: 5 additions & 0 deletions test/qgroup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$(N)fromFile": {
"value": {"+type": "const", "+const": 3}
}
}
23 changes: 22 additions & 1 deletion test/testqgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <epicsTime.h>
#include <epicsExit.h>
#include <generalTimeSup.h>
#include <iocsh.h>

#include "testioc.h"
#include "utilpvt.h"
Expand Down Expand Up @@ -715,11 +716,29 @@ void testConst()
);
}

void testDbLoadGroup()
{
testDiag("%s", __func__);
TestClient ctxt;

auto val(ctxt.get("tst:fromFile").exec()->wait(5.0));
testStrEq(std::string(SB()<<val.format()),
"struct {\n"
" struct {\n"
" struct {\n"
" int32_t queueSize = 0\n"
" bool atomic = true\n"
" } _options\n"
" } record\n"
" int64_t value = 3\n"
"}\n");
}

} // namespace

MAIN(testqgroup)
{
testPlan(37);
testPlan(38);
testSetup();
{
generalTimeRegisterCurrentProvider("test", 1, &testTimeCurrent);
Expand All @@ -734,12 +753,14 @@ MAIN(testqgroup)
testdbReadDatabase("ntenum.db", nullptr, "P=enm");
testdbReadDatabase("iq.db", nullptr, "N=iq:");
testdbReadDatabase("const.db", nullptr, "P=tst:");
iocsh("../qgroup.cmd");
ioc.init();
testTable();
testEnum();
testImage();
testIQ();
testConst();
testDbLoadGroup();
}
// call epics atexits explicitly to handle older base w/o de-init hooks
epicsExitCallAtExits();
Expand Down

0 comments on commit 28817ae

Please sign in to comment.