summaryrefslogtreecommitdiff
path: root/test_json.c
Commit message (Collapse)AuthorAgeFilesLines
* uint to unsigned int. uint gone in C99.Gary E. Miller2016-08-151-1/+1
|
* Add concept of a GPS-disciplined oscillatorMichael Brown2016-02-091-11/+27
| | | | Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
* Address Savannah bug #46804: JSON satellite view parsing is somewhat broken.Fred Wright2016-01-041-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fred Wright <fhgwright> writes: While trying the regression tests on a MacBook (PowerPC), I ran across some failures in the JSON unit test. Although this is ostensibly an endian issue, it turns out that the code for parsing satellite view data is actually incorrect for all processors, albeit more so for big-endian processors. The problem is that the three "integer" fields in struct satellite_t are defined as shorts, but parsed as ints by the JSON parser. On a big-endian processor, this causes the values to be misaddressed and hence have incorrect values, but even on a little-endian processor this is incorrect since it's storing four-byte values into two-byte fields. The unit tests don't catch this aspect, since the fields are favorably ordered such that the clobbered fields are clobbered before being written pseudo-correctly. I was able to demonstrate the "buffer overflow" misbehavior by modifying the test data for the last satellite to provide the fields in the reverse order from their order in the structure. The simple fix for this would be just to change the shorts to ints in the definition of struct satellite_t. On most processors, this doesn't even cost any memory, since the presence of the double forces eight-bye alignment, so the padded structure is 24 bytes regardless of whether the three fields in question are shorts or ints. However, there might be some processors with less strict alignment requirements where using shorts would actually be helpful. With the existing layout, the only possible fix is to add support for shorts to the JSON parser, and adjust the satellite-view parsing accordingly. The attached patch does that, as well as adding u_short support for completeness (though it's not currently used). It also provides the aforementioned change in the test data, in keeping with the philosophy of "create a test for what just failed, so it doesn't happen again". Note that using shorts for these fields would be more effective if the "used" field were also reduced to a short, instead of inheriting "int" from "bool". That would shrink the structure to 16 bytes. It could be further reduced to 12 bytes by using a float instead of a double for the "ss" field (and even a float is gross overkill for this purpose). This could all be more significant when MAXCHANNELS needs to be increased (again) to accommodate the deployment of the newer GNSSes.
* Trailing whitespace fixup.Gary E. Miller2015-04-301-3/+3
|
* Add test for json_toff_read()Gary E. Miller2015-04-061-20/+35
|
* Add a JSON test for the PPS message.Gary E. Miller2015-04-021-17/+34
| | | | Still need a place for PPS precision.
* Retire splint from our set of static analyzers.Eric S. Raymond2015-03-301-14/+0
| | | | | | | | | | | | | | | | | | | The proximate cause was that we've been seing emission of error messages that were randomly and disturbingly variable across different environments - notably Raspbian and Gentoo splint gave nontrivially different results than Ubuntu 14.10 splint. And this was *not* due to Ubuntu patches! A pristine splint built from the 3.1.2 tarball on Ubuntu didn't match the Raspbian and Gentoo results either. But this has been coming for a while. Easy access to more modern static analyzers such as coverity, scan-build and cppcheck has been decreasing the utility of splint, which is unmaintained and somewhat buggy and not easy to use. Only file not cleaned is ppsthread.c, because Gary has been working on it during this cleanup. All regression tests pass. PPS observed live on GR601-W.
* add CLIENTDEBUG_ENABLED ifdef guard on test_json.cJon Schlueter2015-03-261-0/+2
| | | | This allow scons test_json clientdebug=off to compile
* Clean up a silly clang warning. All tests continue to pass with a clang build.Eric S. Raymond2015-01-271-1/+2
|
* Fix range check on test_json regression testingJon Schlueter2015-01-071-1/+1
| | | | We were missing the last test case every time
* Refactor representation of satellite data into an array of structs...Eric S. Raymond2014-09-221-12/+12
| | | | | | | | | | | | | | | | | | ...from a set of parallel arrays. This change flushed out a longstanding bug in the computation of DOPs for estimated error bars. Some test-load rebuilds were required: geostar-geos1m-binary.log.chk: With this change error estimates are computed and reported. trimble-lassen_iq-3dfix.log, trimble-lassen_iq-3dfix.log: the change revealed a bug in the computation of satellite-seen bits. Error estimates did not change. navcom.log: Error estimates changed. With these rebuilds, all regression tests pass.
* Condition out extended JSON features.Eric S. Raymond2014-09-221-4/+5
| | | | All regression tests pass.
* Implement and test extended JSON array parsing.Eric S. Raymond2014-09-221-1/+80
| | | | | | Now supported: JSON arrays with int, unit, bool, and real elements. All regressiion tests pass.
* Drop the obsolete tag field from JSON output. Bump the minor protocol number.Eric S. Raymond2014-08-241-4/+2
| | | | | | | Required a regression-test rebuild, of course. The field is still set by the TSIP and SiRF drivers; the SiRF driver actually uses it. It may be possible to eliminate the TSIP uses, but so far attempting this has produced odd regression-test failures.
* splint/cppcheck cleanup.Eric S. Raymond2013-09-171-1/+2
|
* cppcheck ckeanup. All regression tests pass.Eric S. Raymond2013-09-171-4/+6
|
* Make the JSON unit tester more flexible.Eric S. Raymond2013-05-161-80/+121
|
* Replace exit({0,1}) with exit(EXIT_{SUCCESS,FAILURE})Eric S. Raymond2012-09-071-8/+8
| | | | Note there are some exit(2) instances we bneed to decide what to do with.
* json parser: fix empty array bugChristian Gagneraud2012-06-201-0/+9
|
* Use t_time consistently for timestamps.Eric S. Raymond2011-04-161-0/+15
| | | | All regression tests pass. Livetesting with cgps looks good.
* Timestamps in TPV and SKY go from float seconds since Unix epoch to ISO8601.Eric S. Raymond2011-01-291-3/+3
| | | | | | | | Protocol version number is bumped. Python and C test clients are known to work; interfaces of the C and Python client bindings are unchanged. Third-party client-side bindings which rely on naively copying JSON members will break (implementers have been repeatedly warned not to do this).
* More header portability auditing by deheader.Eric S. Raymond2010-12-221-0/+1
|
* More deheaderizing. All regression tests pass.Eric S. Raymond2010-12-011-3/+1
|
* Reindent the test programs. All regression tests pass.Eric S. Raymond2010-04-141-20/+27
|
* Duh, it's embarrassing when the bug is in your unit test...Eric S. Raymond2010-03-271-2/+2
|
* Vanish away Id and Rev $ keywords, git won't expand them to anything useful.Eric S. Raymond2010-03-131-2/+0
|
* Copyright stamps everywhere. No code changes.Eric S. Raymond2010-03-111-2/+7
|
* Avoid a collision with typedef boolean.Eric S. Raymond2010-01-041-19/+19
| | | | All regression tests pass.
* Fix a test that was broken by the last fix to the json client-side stuff.Eric S. Raymond2009-11-261-3/+3
| | | | All regression tests pass.
* Include the whole config file in gpsd.h.Eric S. Raymond2009-11-201-1/+1
| | | | | | | That is, instead of sectioning out two little config defines and putting them in. This makes gpsd.h self-copntained (e.g. in case it gets installed as a library header) and means we can get rid of most inclusions of it.
* Fix up some regression tests to track a recent API change.Eric S. Raymond2009-11-191-4/+4
|
* Have a single point of truth in the JSON skyview reports...Eric S. Raymond2009-10-011-2/+1
| | | | | | ...about the number of visible satellites. (Yes, there was an actual bug there.) Required removing a field from the JSON dumps on the regression tests.
* GPSD-NG code is no longer experimental.Eric S. Raymond2009-09-271-6/+0
|
* Daemon now has its own version symbols for the wire protocol...Eric S. Raymond2009-09-181-3/+3
| | | | ...and will announce them in the banner.
* Add and annotate more stuff to be splint-audited.Eric S. Raymond2009-09-111-3/+21
| | | | | All regression tests pass. Everything splints clean.
* Split eph into epx and epy internally... Eric S. Raymond2009-09-031-1/+1
| | | | | | ...but still report eph by re-mixing them in the JSON dumper. This was worth doing because all regression tests still pass, showing that visible behavior for old-protocol users gas not changed.
* Allow mapping of strings to enumerated values in JSON.Eric S. Raymond2009-08-281-1/+23
|
* Add an unsigned integer field type to the JSON parser (needed for RTCM2).Eric S. Raymond2009-08-271-5/+8
| | | | Also add a unit test for this.
* Change the way JSON parse templates are declared... Eric S. Raymond2009-08-251-1/+1
| | | | so that string lengths won't step on offsets.
* Fix up JSON unit test.Eric S. Raymond2009-08-241-1/+2
|
* Things that aren't macros should not be named like macros.Eric S. Raymond2009-08-201-65/+70
|
* Parsing of JSON VERSION response, with unit test.Eric S. Raymond2009-08-191-2/+15
|
* Change some flag names.Eric S. Raymond2009-08-191-1/+1
|
* Checkpoint before simplifying JSON parser.Eric S. Raymond2009-08-191-1/+1
|
* JSON parser can now unpack JSON lists into structure arrays.Eric S. Raymond2009-08-191-0/+50
|
* Hide an argument that doesn't need to be exposed.Eric S. Raymond2009-08-191-1/+1
|
* Change enumerated array JSON type to yield a bitmask rather than an array.Eric S. Raymond2009-08-191-29/+4
|
* Library parse code, and unit test, for DEVICE responses.Eric S. Raymond2009-08-191-4/+20
|
* Give the JSON parser the ability to map strings to enumerated types.Eric S. Raymond2009-08-191-0/+24
|
* Add check-string attributes to JSON parser.Eric S. Raymond2009-08-181-13/+14
| | | | Add JSON unit test to default test sequence.