epics-base / pva2pva

PV Access gateway/proxy and EPICS Process Database integration
https://epics-base.github.io/pva2pva/
Other
4 stars 13 forks source link

Modify testpvalink.db to avoid breakage when json5 merged #35

Closed anjohnson closed 3 years ago

anjohnson commented 3 years ago

No other changes will be needed when merging the json5 branch into Base-7.0, these changes let testpvalink pass with and without it.

AppVeyorBot commented 3 years ago

:white_check_mark: Build pva2pva 1.0.12 completed (commit https://github.com/epics-base/pva2pva/commit/42525dde36 by @anjohnson)

AppVeyorBot commented 3 years ago

:white_check_mark: Build pva2pva 1.0.15 completed (commit https://github.com/epics-base/pva2pva/commit/42525dde36 by @anjohnson)

mdavidsaver commented 3 years ago

Is this change truly required? At first glance this implies that every example I've shown for PVA links would become invalid. eg. in my documentation.

https://github.com/epics-base/pva2pva/blob/c66f22460284fabed246cf50c07c5aa95ccae9d6/documentation/qsrvpage.dox#L202-L207

anjohnson commented 3 years ago

Your examples will still work fine, the issue is that your test code is doing string comparisons of a link string that was parsed by the dbStatic parser, and the intermediate strings that it generates for the YAJL parser have changed subtly to not add quotes when they aren't supplied or needed. Previously it always quoted map keys in that intermediate string, but with JSON5 it only does that if the key contains characters that our old bareword strings allowed but JSON5 doesn't. Without this change the result is this:

not ok  3 - dbGetField("src:i1.INP", 0) -> "{"pva":"target:i"}" == "{pva:"target:i"}"
not ok 12 - dbGetField("src:o2.OUT", 0) -> "{"pva":"target:i2"}" == "{pva:"target:i2"}"

The alternative would be to put conditional code in testpvalink.cpp which expects different strings with different versions of YAJL. This change is much simpler, and is only there to ensure that the above tests pass.