test non-atomic group get must read channel-less Const fields

Add testConstNonAtomicGet(): a non-atomic get of the tst:const group
asserts s.i/s.d/s.s == 14/1.5/"hello". Fails before the fix (all defaults),
passes after.
This commit is contained in:
Sang Woo Kim
2026-05-23 16:07:06 -07:00
committed by Michael Davidsaver
parent 46f8c53114
commit 4f45ffab44
3 changed files with 34 additions and 1 deletions
+1
View File
@@ -160,6 +160,7 @@ TESTFILES += ../iq.db
TESTFILES += ../ntenum.db
TESTFILES += ../const.db
TESTFILES += ../batch.db
TESTFILES += ../secidxgroup.db
TESTFILES += ../qgroup.cmd
TESTFILES += ../qgroup.json
TESTS += testqgroup
+13
View File
@@ -0,0 +1,13 @@
# A group whose first (put-order sorted) field is a channel-less
# Structure, followed by a channel-backed puttable field. A non-atomic group
# put of value.x must authorise against value.x's own access-security client,
# not drift onto the channel-less field's (empty, deny-all) client.
record(longout, "$(P)secidx") {
field(VAL, "0")
info(Q:group, {
"$(P)SECIDX": {
"value": { +type:"structure" },
"value.x": { +type:"plain", +channel:"VAL", +putorder:0 }
}
})
}
+20 -1
View File
@@ -750,6 +750,23 @@ void testiocsh()
}
}
// tst:SECIDX's first put-order-sorted field is a channel-less Structure,
// and value.x is the channel-backed puttable field after it. A non-atomic
// group put of value.x must authorise against value.x's own security client.
void testGroupPutSecIndex()
{
testDiag("%s", __func__);
TestClient ctxt;
try {
ctxt.put("tst:SECIDX").record("atomic", false).set("value.x", 5).exec()->wait(5.0);
testPass("non-atomic group put authorised against the field's own security client");
} catch (client::RemoteError& e) {
testFail("non-atomic group put failed: %s", e.what());
}
testdbGetFieldEqual("tst:secidx", DBR_LONG, 5);
}
void testDbLoadGroup()
{
testDiag("%s", __func__);
@@ -772,7 +789,7 @@ void testDbLoadGroup()
MAIN(testqgroup)
{
testPlan(44);
testPlan(46);
testSetup();
{
generalTimeRegisterCurrentProvider("test", 1, &testTimeCurrent);
@@ -787,6 +804,7 @@ MAIN(testqgroup)
testdbReadDatabase("ntenum.db", nullptr, "P=enm");
testdbReadDatabase("iq.db", nullptr, "N=iq:");
testdbReadDatabase("const.db", nullptr, "P=tst:");
testdbReadDatabase("secidxgroup.db", nullptr, "P=tst:");
testdbReadDatabase("batch.db", nullptr, "P=tst:b:");
iocsh("../qgroup.cmd");
ioc.init();
@@ -797,6 +815,7 @@ MAIN(testqgroup)
testConst(true);
testConst(false);
testBatch();
testGroupPutSecIndex();
testDbLoadGroup();
testiocsh();
}