From b855a7f86834d5e77012ece0c90c75546dd47d1d Mon Sep 17 00:00:00 2001 From: Fred Wright Date: Sat, 4 Mar 2017 16:14:25 -0800 Subject: Makes "silent" build quieter. 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. --- SConstruct | 5 ++++- gpsfake | 7 +++++-- regress-driver | 14 +++++++++++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/SConstruct b/SConstruct index 63ff4fc1..6bdb3c22 100644 --- a/SConstruct +++ b/SConstruct @@ -338,6 +338,8 @@ if env["slow"]: else: env['REGRESSOPTS'] = "" +if env.GetOption("silent"): + env['REGRESSOPTS'] += " -Q" def announce(msg): if not env.GetOption("silent"): @@ -1753,7 +1755,8 @@ else: gpsfake_tests = [] for name, opts in [['pty', ''], ['udp', '-u'], ['tcp', '-o -t']]: gpsfake_tests.append(Utility('gpsfake-' + name, gps_herald, - '$SRCDIR/regress-driver -q %s %s' + '$SRCDIR/regress-driver' + ' $REGRESSOPTS -q %s %s' % (opts, gpsfake_log))) env.Alias('gpsfake-tests', gpsfake_tests) diff --git a/gpsfake b/gpsfake index 82e4809a..f9450359 100755 --- a/gpsfake +++ b/gpsfake @@ -106,7 +106,7 @@ def fakehook(linenumber, fakegps): if __name__ == '__main__': try: - (options, arguments) = getopt.getopt(sys.argv[1:], "1bc:D:ghilm:no:pP:r:s:StTuvx") + (options, arguments) = getopt.getopt(sys.argv[1:], "1bc:D:ghilm:no:pP:qr:s:StTuvx") except getopt.GetoptError as msg: print("gpsfake: " + str(msg)) raise SystemExit(1) @@ -127,6 +127,7 @@ if __name__ == '__main__': udp = False verbose = 0 slow = False + quiet = False for (switch, val) in options: if switch == '-1': singleshot = True @@ -154,6 +155,8 @@ if __name__ == '__main__': pipe = True elif switch == '-P': port = int(val) + elif switch == '-q': + quiet = True elif switch == '-r': client_init = val elif switch == '-s': @@ -185,7 +188,7 @@ if __name__ == '__main__': if progress: baton = Baton("Processing %s" % ",".join(arguments), "done") - else: + elif not quiet: sys.stderr.write("Processing %s\n" % ",".join(arguments)) # Don't allocate a private port when cycling logs for client testing. diff --git a/regress-driver b/regress-driver index 8092d84a..fe42970a 100755 --- a/regress-driver +++ b/regress-driver @@ -49,7 +49,8 @@ logfile="" help="0" baton=false quiet=false -while getopts cl:sStbuvo:qh opt +quieter=false +while getopts cl:sStbuvo:qQh opt do case $opt in c) testing=clientlib ;; # 'client' rather than the daemon @@ -62,6 +63,7 @@ do v) mode=view ;; # View result of generating a check file o) opts="$opts $OPTARG" ;; # Pass options to gpsfake q) quiet=true ;; # Suppress header/trailer messages + Q) quiet=true; quieter=true ;; # Suppress all success chatter h) help="1" ;; esac done @@ -79,10 +81,11 @@ then echo "-S - run regression tests with realistic timing delays" echo "-t - Run regression tests w/baton" echo "-b - Rebuild regression check files" - echo "-u - Force UDP" + echo "-u - Force UDP" echo "-v - view result of generating a check file" echo "-o - Pass options to gpsfake" echo "-q - Suppress header/trailer messages" + echo "-Q - Suppress all success chatter" echo exit 0 @@ -120,6 +123,11 @@ then opts="$opts -S" fi +if [ $quieter = true ] +then + opts="$opts -q" +fi + case $mode in regress|slowregress) [ $quiet = true ] || echo "Testing the $testing..." >&2 @@ -174,7 +182,7 @@ case $mode in else if [ $quiet = true ] && [ $total -eq 1 ] && [ $notfound -eq 0 ] then - echo "Regression test $1 successful" + [ $quieter = true ] || echo "Regression test $1 successful" else echo "Regression test successful: no errors in $total tests ($notfound not found)."; fi -- cgit v1.2.1