summaryrefslogtreecommitdiff
path: root/gpsfake
Commit message (Collapse)AuthorAgeFilesLines
* Makes "silent" build quieter.Fred Wright2017-03-041-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | This suppresses all "success chatter" from the daemon regression tests when building in --silent (or -s) mode. Failing cases still output the usual messages (except for "Processing..."). Other regression chatter is still present, but this puts a big dent in it. This involves three changes: 1) It adds a -q option to gpsfake, to suppress the "Processing" messages. 2) It adds a -Q option to regress-driver, which passes -q to gpsfake and also suppresses its own output in the success case. Failure output is unaffected. 3) It adds the -Q option to regress-driver invocations when the build is running in silent mode. TESTED: Ran regress-driver in normal, -q, and -Q modes. Ran "scons build-all check", with and without -s. Also tested an error case with a garbled .chk file.
* Changes fake.py stream type to 'bytes'.Fred Wright2016-12-251-3/+3
| | | | | | | | | | | | | | | | | | | Given that the data returned bye fake.py may include binary data, 'bytes' is a more appropriate type. Unlike the client API, where it's easy to provide both return types, it would be less convenient to do that here, so 'bytes' is preferred as the one choice (and is consistent with network sockets). When sending such data to stdout (or stderr), the straightforward method is to write to sys.stdXXX.buffer rather than sys.stdXXX. That doesn't exist in Python 2, but a helper function is now provided to get the appropriate 'bytes' stream for stdXXX. Since no previous *release* of GPSD is compatible with Python 3, changing this now doesn't break anything based on released code. TESTED: Ran "scons check" on OSX with all supported Python versions.
* Fixes Python programs to use new-style classes.Fred Wright2016-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Although this isn't strictly a Python 3 requirement, using the new-style class definition syntax improves consistency between Python 2 and Python 3. Old-style classes have been deprecated since Python 2.2, but many such definitions linger on. Python 3 eliminates old-style classes, but instead of complaining about old-style definitions, it simply unconditionally and silently makes all classes new-style. The only incompatible differences are quite subtle and rarely matter in practice, but things are more consistent across versions if the new-style definitions are used. Also, the preferred method for subclasses to invoke parent init methods is via the super() construct, which is only available with new-style classes. Using super() is especially useful with multiple inheritance, which it handles automatically (provided that the init methods have compatible signatures). TESTED: Using an SConstruct patched to run the build helpers with the target Python, ran "scons build-all check ", as well as gpsprof and xgps, with all six supported Python versions (except 2.6 for xgps).
* Makes "future imports" and Python version comments consistent.Fred Wright2016-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | This makes the "future import" statements consistently specify absolute_import, print_function, and division, for maximum consistency between Python 2 and Python 3. Although absolute_import is probably a don't care for top-level programs, if unit tests were ever implemented for the programs they would be imported as modules, making the module import behavior relevant. Note that previous Python 3 fixes are a prerequisite for this change. Also makes the "polyglot comment" consistent across sources. TESTED: Using a version of SConstruct patched to use the target Python for build helpers, ran "scons build-all check valgrind-audit www/hardware.html" with all six supported Python versions. Also ran gegps, gpscat, gpsprof, xgps, and xgpsspeed with both Python 2 and Python 3.
* Fixes fake.py and gpsfake for Python 3.Fred Wright2016-04-091-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This incorporates the following changes: 1) Adds definitions for polystr(), polybytes(), and make_std_wrapper() to misc.py (the most logical place for code needed by multiple modules), using dummy definitions in the Python 2 case. For more info, see the Practical Python Porting guide. 2) Reworks the logfile->daemon data path in fake.py to use 'bytes' consistently. 3) Uses polybytes() in fake.py to construct control-socket commands as 'bytes', as expected by the socket I/O. 4) Uses make_std_wrapper() in gpsfake, to ensure that binary data is correctly written to stdout. 5) Adds 'division' to the future imports in gpsfake for consistency, though it doesn't actually matter in practice. Also updates the compatibility comments in all three files, and fixes a minor typo in misc.py. TESTED: Ran "scons build-all check" with Python 2.7, and ran all daemon regression tests with Python 2.6 and with Python 3.2-3.5 (with appropriately built extensions; not yet a build option).
* gpsfake now runs polyglot under Python 2 or 3.Eric S. Raymond2016-03-221-1/+2
|
* Forward-port Python utilities to run polyglot under either Python 2 or 3.Eric S. Raymond2016-03-221-27/+33
| | | | | | For the moment most shebang lines still say 'python2' rather than just 'python'. This is because the client code in gps/ hasn't been touched yet; the internal imports break under Python 3 and that needs to be fixed.
* Makes gpsfake -T take -S into account.Fred Wright2016-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | This makes it possible to view the "slow" as well as the normal WRITE_PAD values with gpsfake -T, without having to look at the source code. It adds a new GetDelay() function to fake.py, which returns the proper delay value, taking into account both the possible environment variable and the "slow" option. This is now used for all hree uses of WRITE_PAD. Because the environment override is now part of the function, the WRITE_PAD constant is no longer modified by the environment value, but instead reflects the platform default. TESTED: Ran the full set of regression tests, with both default and acceptably shortened WRITE_PAD. Also verified that a zero value causes trouble (OSX), and that adding -S to the zero value makes it work. Signed-off-by: Jon Schlueter <jon.schlueter@gmail.com>
* Fixes gpsfake -v to use stderr instead of stdout.Fred Wright2016-02-291-1/+1
| | | | | | | TESTED: Ran a quick gpsfake -v with >/dev/null, and observed output. Signed-off-by: Jon Schlueter <jon.schlueter@gmail.com>
* Add more startup delay in gpsfake, and explain why.Eric S. Raymond2016-02-091-1/+5
| | | | | Part of a the isync patch series from Michael Brown <mbrown@fensystems.co.uk>, which failed to apply properly and had to be hand-atched a bit.
* Change Python hashbang lines to invoke 'python2'Eric S. Raymond2015-07-191-1/+1
| | | | | | We've learned that Ubuntu 15.10 will have python3 as default. The ugly transition gas befun; our only recourse is to hape that all our deployment targets have 'pyton2' do the right thing. Works on 14.10.
* gpsfake: pylint cleanup. Regression tests (using gpsfake) pass.Eric S. Raymond2015-02-221-1/+1
|
* gpsfake code fell out of sync with documentation. Fix this.Eric S. Raymond2015-02-131-1/+1
| | | | All regression tests pass.
* pylint cleanup in gpsfake for superfluous-parensJon Schlueter2015-02-131-21/+21
| | | | in python you don't need parens around values for if elseif statements
* more pep8 cleanup in gpsfake for whitespaceJon Schlueter2015-02-131-3/+6
| | | | whitespace around operators and before function delcarations
* pep8 cleanup in gpsfakeJon Schlueter2015-02-131-1/+1
| | | | use "is None" instead of ""== None"
* Split up imports in gpsfake and remove unusedJon Schlueter2015-02-131-2/+10
| | | | random was imported but never used
* Revert "Significantly speed up testing."Eric S. Raymond2015-02-131-4/+7
| | | | It creates a race condition.
* Significantly speed up testing.Eric S. Raymond2015-02-131-7/+4
| | | | | | A delay in gpsfake is replaced by a watch for acknowledgment. All regression tests pass.
* Fix inexpplicably corrupted Python code.Eric S. Raymond2015-02-131-2/+2
|
* Don't allocate a private port when cycling logs for client testing.Eric S. Raymond2015-02-131-0/+4
| | | | All regression tests pass.
* Change the way EOF is injected in hopes of beating a *BSD timing problem.Eric S. Raymond2015-02-111-1/+1
| | | | All regression tests pass.
* CLOSE_DELAY is gone. Test source termination is now deterministic.Eric S. Raymond2015-02-091-1/+1
| | | | All regression tests pass.
* In the test framework, use the bind-to-port-0 trick to get a random unused port.Eric S. Raymond2015-02-021-13/+1
| | | | | | This makes the -f option of gpsfake obsolete, and it has been removed. All regression tests pass.
* Open ttys with CLOCAL, following a suggestion by Hal Murray.Eric S. Raymond2015-02-021-1/+1
| | | | | | Also, zero in on shorter delays in the regression tests. All regression tests pass.
* Use %.3f for WRITE_PAD, because 0.004 is a typical value.Greg Troxel2015-01-271-1/+1
|
* Fix an erroneous format literal.Eric S. Raymond2015-01-271-1/+1
|
* Print sys.platform and platform.platform().Greg Troxel2015-01-251-1/+1
| | | | | They are different! This code printed one, and the if statement in gps/fake.py used the other.
* Dump platform ID and delay parameters before doing test runs.Eric S. Raymond2015-01-251-2/+5
|
* Add slow=yes option for regression tests in an attempt to avoid flakeouts.Eric S. Raymond2014-08-241-3/+6
|
* Documentation and TODO tweaks.Eric S. Raymond2013-11-221-1/+1
|
* Simplify the build. No logic changes.Eric S. Raymond2013-11-191-1/+7
|
* More splint and pylint cleanups.Eric S. Raymond2013-11-151-5/+5
| | | | All regression tests pass with pps=tru or pps=false, PPS is live.
* Fix a small but fatal typo.All regression tests pass.Eric S. Raymond2013-11-051-1/+1
|
* Test machinery improvements. raw-regress is now only partially broken.Eric S. Raymond2013-11-051-0/+3
|
* Improve gpsfake debugging.Eric S. Raymond2013-11-031-1/+4
|
* Enhance gpsfake so it can be used to test TCP sources.Eric S. Raymond2013-09-291-2/+7
|
* Magic-number elimination. Document Beat Bolli's assumptions.Eric S. Raymond2012-05-171-1/+6
| | | | All regression tests pass.
* dvancing the twirly baton only each 11th line, the wholeGary E. Miller2012-05-171-2/+3
| | | | | regress-driver run is sped up by 7% when run over SSH. Patch by: Beat Bolli <bbolli@ewanet.ch>
* Minor bug fix: make gpsfake -h work as it should.Eric S. Raymond2011-11-141-4/+4
|
* gpsfake is now part of the pychecker set.Eric S. Raymond2011-08-251-5/+5
|
* gpsfake doesn't require the signal module, remove unneeded importEric S. Raymond2011-08-251-1/+1
|
* Add -f option to gpsfake, removing a non-ortogonality in the behavior of -1.Eric S. Raymond2011-04-041-0/+1
| | | | Patch concept due to Gleb Smirnoff.
* Add a gpsfake option to set the listening port.Eric S. Raymond2011-02-131-1/+3
|
* Catch and display regression errors from malformed JSON.Eric S. Raymond2011-01-291-0/+3
|
* Rip out grubby code from a previous attempt to fix the multipacket problem.Eric S. Raymond2010-06-041-1/+0
| | | | All regression tests pass.
* Dead-code removal.Eric S. Raymond2010-05-061-5/+1
|
* Implement a -u switch to force the test framework to use UDP, not ptys.Eric S. Raymond2010-05-041-2/+5
| | | | | | The good news is that rgression tests all pass with this case and -u off. The bad news is that they fail with -u on. It looks like the switch forces some other bug, previously masked, into the open.
* Typo fix.Eric S. Raymond2010-04-291-1/+1
|
* The gpsfake.py module can broadcacst on UDP rather than using a pty.Eric S. Raymond2010-04-251-1/+1
| | | | This is a step towards making UDP data sources work.