fix TypeStore maintenance

This commit is contained in:
Michael Davidsaver
2022-12-14 12:25:46 -08:00
parent c6eec978fe
commit c7b4650ba1
2 changed files with 90 additions and 2 deletions
+87 -1
View File
@@ -1076,6 +1076,91 @@ void testRegressRedundantBitMask()
}, reencoded_value);
}
// issue with TypeStore maintenance
void testRegressCNEN()
{
testDiag("%s", __func__);
uint8_t payload_type1[] =
"\xfd\x01\x00\x80\x15\x65\x70\x69\x63\x73\x3a\x6e\x74\x2f\x4e\x54" \
"\x53\x63\x61\x6c\x61\x72\x3a\x31\x2e\x30\x06\x05\x76\x61\x6c\x75" \
"\x65\x43\x05\x61\x6c\x61\x72\x6d\xfd\x02\x00\x80\x07\x61\x6c\x61" \
"\x72\x6d\x5f\x74\x03\x08\x73\x65\x76\x65\x72\x69\x74\x79\x22\x06" \
"\x73\x74\x61\x74\x75\x73\x22\x07\x6d\x65\x73\x73\x61\x67\x65\x60" \
"\x09\x74\x69\x6d\x65\x53\x74\x61\x6d\x70\xfd\x03\x00\x80\x00\x03" \
"\x10\x73\x65\x63\x6f\x6e\x64\x73\x50\x61\x73\x74\x45\x70\x6f\x63" \
"\x68\x23\x0b\x6e\x61\x6e\x6f\x73\x65\x63\x6f\x6e\x64\x73\x22\x07" \
"\x75\x73\x65\x72\x54\x61\x67\x22\x07\x64\x69\x73\x70\x6c\x61\x79" \
"\xfd\x04\x00\x80\x00\x06\x08\x6c\x69\x6d\x69\x74\x4c\x6f\x77\x43" \
"\x09\x6c\x69\x6d\x69\x74\x48\x69\x67\x68\x43\x0b\x64\x65\x73\x63" \
"\x72\x69\x70\x74\x69\x6f\x6e\x60\x05\x75\x6e\x69\x74\x73\x60\x09" \
"\x70\x72\x65\x63\x69\x73\x69\x6f\x6e\x22\x04\x66\x6f\x72\x6d\xfd" \
"\x05\x00\x80\x06\x65\x6e\x75\x6d\x5f\x74\x02\x05\x69\x6e\x64\x65" \
"\x78\x22\x07\x63\x68\x6f\x69\x63\x65\x73\x68\x07\x63\x6f\x6e\x74" \
"\x72\x6f\x6c\xfd\x06\x00\x80\x09\x63\x6f\x6e\x74\x72\x6f\x6c\x5f" \
"\x74\x03\x08\x6c\x69\x6d\x69\x74\x4c\x6f\x77\x43\x09\x6c\x69\x6d" \
"\x69\x74\x48\x69\x67\x68\x43\x07\x6d\x69\x6e\x53\x74\x65\x70\x43" \
"\x0a\x76\x61\x6c\x75\x65\x41\x6c\x61\x72\x6d\xfd\x07\x00\x80\x0c" \
"\x76\x61\x6c\x75\x65\x41\x6c\x61\x72\x6d\x5f\x74\x0a\x06\x61\x63" \
"\x74\x69\x76\x65\x00\x0d\x6c\x6f\x77\x41\x6c\x61\x72\x6d\x4c\x69" \
"\x6d\x69\x74\x43\x0f\x6c\x6f\x77\x57\x61\x72\x6e\x69\x6e\x67\x4c" \
"\x69\x6d\x69\x74\x43\x10\x68\x69\x67\x68\x57\x61\x72\x6e\x69\x6e" \
"\x67\x4c\x69\x6d\x69\x74\x43\x0e\x68\x69\x67\x68\x41\x6c\x61\x72" \
"\x6d\x4c\x69\x6d\x69\x74\x43\x10\x6c\x6f\x77\x41\x6c\x61\x72\x6d" \
"\x53\x65\x76\x65\x72\x69\x74\x79\x22\x12\x6c\x6f\x77\x57\x61\x72" \
"\x6e\x69\x6e\x67\x53\x65\x76\x65\x72\x69\x74\x79\x22\x13\x68\x69" \
"\x67\x68\x57\x61\x72\x6e\x69\x6e\x67\x53\x65\x76\x65\x72\x69\x74" \
"\x79\x22\x11\x68\x69\x67\x68\x41\x6c\x61\x72\x6d\x53\x65\x76\x65" \
"\x72\x69\x74\x79\x22\x0a\x68\x79\x73\x74\x65\x72\x65\x73\x69\x73\x20";
uint8_t payload_type2[] =
"\xfd\x08\x00\x80\x13\x65\x70\x69\x63\x73\x3a\x6e\x74\x2f\x4e\x54" \
"\x45\x6e\x75\x6d\x3a\x31\x2e\x30\x03\x05\x76\x61\x6c\x75\x65\xfe" \
"\x05\x00\x05\x61\x6c\x61\x72\x6d\xfe\x02\x00\x09\x74\x69\x6d\x65" \
"\x53\x74\x61\x6d\x70\xfe\x03\x00"
;
uint8_t payload_type_expected[] =
"\xfd\x01\x00\x80\x13\x65\x70\x69\x63\x73\x3a\x6e\x74\x2f\x4e\x54" \
"\x45\x6e\x75\x6d\x3a\x31\x2e\x30\x03\x05\x76\x61\x6c\x75\x65\xfd" \
"\x02\x00\x80\x06\x65\x6e\x75\x6d\x5f\x74\x02\x05\x69\x6e\x64\x65" \
"\x78\x22\x07\x63\x68\x6f\x69\x63\x65\x73\x68\x05\x61\x6c\x61\x72" \
"\x6d\xfd\x03\x00\x80\x07\x61\x6c\x61\x72\x6d\x5f\x74\x03\x08\x73" \
"\x65\x76\x65\x72\x69\x74\x79\x22\x06\x73\x74\x61\x74\x75\x73\x22" \
"\x07\x6d\x65\x73\x73\x61\x67\x65\x60\x09\x74\x69\x6d\x65\x53\x74" \
"\x61\x6d\x70\xfd\x04\x00\x80\x00\x03\x10\x73\x65\x63\x6f\x6e\x64" \
"\x73\x50\x61\x73\x74\x45\x70\x6f\x63\x68\x23\x0b\x6e\x61\x6e\x6f" \
"\x73\x65\x63\x6f\x6e\x64\x73\x22\x07\x75\x73\x65\x72\x54\x61\x67\x22";
Value prototype1;
TypeStore registry;
{
FixedBuf buf(false, payload_type1);
from_wire_type(buf, registry, prototype1);
testTrue(buf.good())<<" at"<<buf.file()<<":"<<buf.line();
testEq(buf.size(), 0u);
}
Value prototype2;
{
FixedBuf buf(false, payload_type2);
from_wire_type(buf, registry, prototype2);
testTrue(buf.good())<<" at"<<buf.file()<<":"<<buf.line();
testEq(buf.size(), 0u);
}
Value prototypeE;
TypeStore registryE;
{
FixedBuf buf(false, payload_type_expected);
from_wire_type(buf, registryE, prototypeE);
testTrue(buf.good())<<" at"<<buf.file()<<":"<<buf.line();
testEq(buf.size(), 0u);
}
testTrue(prototype2.equalType(prototypeE))<<" "<<prototype2<<"\n"<<prototypeE;
}
// test the common case for a pvRequest of caching an empty Struct
void testEmptyRequest()
{
@@ -1119,7 +1204,7 @@ void testEmptyRequest()
MAIN(testxcode)
{
testPlan(135);
testPlan(142);
testSetup();
testDeserializeString();
testSerialize1();
@@ -1133,6 +1218,7 @@ MAIN(testxcode)
testXCodeNTScalar();
testXCodeNTNDArray();
testRegressRedundantBitMask();
testRegressCNEN();
testBadFieldName();
testEmptyRequest();
return testDone();