Changeset: c84795f72cea for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c84795f72cea Modified Files: testing/Mtest.py.in Branch: default Log Message:
Merge with Jan2022 branch. diffs (truncated from 526 to 300 lines): diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -40,13 +40,13 @@ except ImportError: MonetDB_VERSION = '@MONETDB_VERSION@'.split('.') procdebug = False -verbose = False -quiet = False +verbosity = 0 approve = False initdb = None single_in_memory = False restart = False +produce_html = True # extra mserver5 options mserver5_opts = [] @@ -301,8 +301,10 @@ def splitcommand(cmd): def remove(file): try: os.remove(file) + except FileNotFound: + pass except: - pass + Warn('could not remove {}'.format(file)) def isexecutable(TST, ext = '.sh') : if os.name == "nt": @@ -1116,11 +1118,9 @@ def AddSubToHtmlIndex (env, TSTDIR, diff def SkipTest(env, TST, EXT, REASON, length) : TSTDIR = env['TSTDIR'] TEXT = "Skipping test %s%s %s" % (TST, EXT, REASON) - if quiet: - pass - elif verbose: + if verbosity > 1: Warn(TEXT) - else: + elif verbosity == 1: if REASON.startswith('as '): REASON = REASON[3:] if REASON.endswith('.'): @@ -1137,7 +1137,7 @@ def SkipTest(env, TST, EXT, REASON, leng s = '%-*s' % (length, TST) print('%s%s skipped (%s)' % (prompt(), s, REASON)) - if testweb: + if testweb or not produce_html: return None f = openutf8(".%s.SKIPPED.html" % TST, "w") @@ -1345,7 +1345,7 @@ def PerformDir(env, testdir, testlist, a body_good = [] body_bad = [] oktests = [] - if not verbose and not quiet: + if verbosity == 1: print('\nRunning in %s' % TSTDIR) alllinks = [] pSrvr = None @@ -1386,7 +1386,7 @@ def PerformDir(env, testdir, testlist, a print('\nFailed to start server.\n') break os.environ['MAPIPORT'] = env['MAPIPORT'] = pSrvr.port - SetExecEnv(env['exe'],pSrvr.port,verbose) + SetExecEnv(env['exe'], pSrvr.port, verbosity > 1) if global_timeout and start_time + global_timeout < time.time(): if not testweb: print('\nGlobal testing timeout reached\n') @@ -1446,11 +1446,10 @@ def PerformDir(env, testdir, testlist, a for f in alllinks: remove(f) - if THISFILE == "Mtest.py": - if not testweb: - body = body_bad + body_good - CreateHtmlIndex(env, ssout, sserr, *body) - elem = AddSubToHtmlIndex(env, TSTDIR, max(FdOut, FdErr, ssout, sserr)) + if not testweb and produce_html: + body = body_bad + body_good + CreateHtmlIndex(env, ssout, sserr, *body) + elem = AddSubToHtmlIndex(env, TSTDIR, max(FdOut, FdErr, ssout, sserr)) # remove extra files created by tests for f in listdir(TSTTRGDIR): @@ -1815,41 +1814,6 @@ def StableOutErr(env,par,TST,SYST,RELEAS return STABLEout, STABLEerr ### StableOutErr(env,par,TST,SYST,RELEASE,DIST,VERSION) # -def CategorizeResult(TST, SockTime): - l = '<!--MajorDiffs-->' # assign something in case file is empty - for l in openutf8("%s.out.diff.html" % TST): - pass - if l.startswith('<!--NoDiffs-->'): - o = F_OK - elif l.startswith('<!--MinorDiffs-->'): - o = F_WARN - elif l.startswith('<!--MajorDiffs-->'): - o = F_ERROR - else: - Warn("Unexpected last line in %s.out.diff.html:\n%s" % (TST, l)) - ff = openutf8("%s.out.diff.html" % TST, "a") - ff.write("\n<!--MajorDiffs-->\n") - ff.close() - o = F_ERROR - l = '<!--MajorDiffs-->' # assign something in case file is empty - for l in openutf8("%s.err.diff.html" % TST): - pass - if l.startswith('<!--NoDiffs-->'): - e = F_OK - elif l.startswith('<!--MinorDiffs-->'): - e = F_WARN - elif l.startswith('<!--MajorDiffs-->'): - e = F_ERROR - else: - Warn("Unexpected last line in %s.err.diff.html:\n%s" % (TST, l)) - ff = openutf8("%s.err.diff.html" % TST, "a") - ff.write("\n<!--MajorDiffs-->\n") - ff.close() - e = F_ERROR - if e == F_ERROR and SockTime in (F_SOCK, F_TIME, F_RECU, F_ABRT, F_SEGV): - e = SockTime - return o, e - relcond = { # upgrade testing conditionals: # key is condition, value is tuple with file name and part of message @@ -1944,14 +1908,12 @@ def RunTest(env, TST, COND, oktests, len #elif os.name == "posix": else: reason = "test missing: '"+os.path.join(TSTSRCDIR,TST)+"[.py|.malC|.sql|.R|.rb]`" - if quiet: - pass - elif verbose: + if verbosity > 1: print('%s%s ' % (prompt(), os.path.join(env['TSTDIR'], TST + EXT)), end='') prred('TEST MISSING') print() - else: + elif verbosity == 1: if ttywidth > 0 and length + 10 + 21 >= ttywidth: # 10 - length of prompt() # 21 - length of time plus result @@ -2174,7 +2136,7 @@ def RunTest(env, TST, COND, oktests, len tres = DoIt(env, SERVER, CALL, TST, EXT, TestOutFile, TestErrFile, TIMEOUT, ME, length, nomito, threads, user, passwd, COND, all_tests, pSrvr, total_tests, test_progress) t1 = time.time() TX = t1 - t0 - if not quiet: + if verbosity > 0: print(" %7.3fs " % TX, end='') if tres == 'timeout': @@ -2224,36 +2186,36 @@ def RunTest(env, TST, COND, oktests, len ##if [ -f .all.left-over.tmp.bats. ] ; then mv -f .all.left-over.tmp.bats. $TSTTRGBASE/Tests/.old.left-over.tmp.bats. ; fi if tres == 'socket': - if quiet: + if verbosity == 0: print("\n%s : Socket!" % TST) - elif verbose: + elif verbosity > 1: print("(Socket!) ", end='') if tres == 'timeout': - if quiet: + if verbosity == 0: print("\n%s : Timeout!" % TST) - elif verbose: + elif verbosity > 1: print("(Timeout!) ", end='') if tres == 'recursion': - if quiet: + if verbosity == 0: print("\n%s : Recursion!" % TST) - elif verbose: + elif verbosity > 1: print("(Recursion!) ", end='') if tres == 'segfault': - if quiet: + if verbosity == 0: print("\n%s : Crashed!" % TST) - elif verbose: + elif verbosity > 1: print("(Crashed!) ", end='') if tres == 'signal': - if quiet: + if verbosity == 0: print("\n%s : Signaled!" % TST) - elif verbose: + elif verbosity > 1: print("(Signaled!) ", end='') - if verbose: + if verbosity > 1: print() try: @@ -2284,52 +2246,54 @@ def RunTest(env, TST, COND, oktests, len tst = '%s<a target="_blank" href="http://bugs.monetdb.org/%s";>%s</a>%s' % (TST[:res.start(0)+1], bugno, res.group(0)[1:], TST[res.end(0):]) else: tst = TST - titlefmt = '-tTest %s%s (id <a href="%s">%s</a>) (<a href="%s.%%s.diff.html">%%s</a>)' % (tst, EXT, f, REV, TST) - else: - # no need (and no space) to add link to bug report: - # it's done already elsewhere - titlefmt = '-tTest <a href="%s%s">%s%s</a> (id <a href="%s">%s</a>) (<a href="%s.%%s.diff.html">%%s</a>)' % (TST, EXT, TST, EXT, f, REV, TST) - elif testweb: - titlefmt = '-tTest %s%s (<a href="%s.%%s.diff.html">%%s</a>)' % (TST, EXT, TST) + out = openutf8('%s.test.out' % TST).read() + if out and [x for x in out.splitlines() if not x.startswith('#')]: + FailedOut = F_ERROR else: - titlefmt = '-tTest <a href="%s%s">%s%s</a> (<a href="%s.%%s.diff.html">%%s</a>)' % (TST, EXT, TST, EXT, TST) - diff_html = openutf8('%s.out.diff.html' % TST,"w") - out = openutf8('%s.test.out' % TST).read() - Element('html', None, -# Element('head', None, -# Element('style', None, -# Text(''' + FailedOut = F_OK + err = openutf8('%s.test.err' % TST).read() + if err and [x for x in err.splitlines() if not x.startswith('#')]: + if max(sockerr, errcode) in (F_SOCK, F_TIME, F_RECU, F_ABRT, F_SEGV): + FailedErr = max(sockerr, errcode) + else: + FailedErr = F_ERROR + else: + FailedErr = F_OK + if produce_html: + diff_html = openutf8('%s.out.diff.html' % TST,"w") + Element('html', None, +# Element('head', None, +# Element('style', None, +# Text(''' # .neutral { color: black; } # .deleted { color: red; } # .added { color: green; } # '''))), - Element('body', None, - Element('pre', None, - Text(out)))).write(diff_html, True) - if out and [x for x in out.splitlines() if not x.startswith('#')]: - diff_html.write('<!--MajorDiffs-->\n') - else: - diff_html.write('<!--NoDiffs-->\n') - diff_html.close() - diff_html = openutf8('%s.err.diff.html' % TST,"w") - err = openutf8('%s.test.err' % TST).read() - Element('html', None, -# Element('head', None, -# Element('style', None, -# Text(''' + Element('body', None, + Element('pre', None, + Text(out)))).write(diff_html, True) + if FailedOut == F_ERROR: + diff_html.write('<!--MajorDiffs-->\n') + else: + diff_html.write('<!--NoDiffs-->\n') + diff_html.close() + diff_html = openutf8('%s.err.diff.html' % TST,"w") + Element('html', None, +# Element('head', None, +# Element('style', None, +# Text(''' # .neutral { color: black; } # .deleted { color: red; } # .added { color: green; } # '''))), - Element('body', None, - Element('pre', None, - Text(err)))).write(diff_html, True) - if err and [x for x in err.splitlines() if not x.startswith('#')]: - diff_html.write('<!--MajorDiffs-->\n') - else: - diff_html.write('<!--NoDiffs-->\n') - diff_html.close() - FailedOut, FailedErr = CategorizeResult(TST, max(sockerr, errcode)) + Element('body', None, + Element('pre', None, + Text(err)))).write(diff_html, True) + if FailedErr == F_ERROR: + diff_html.write('<!--MajorDiffs-->\n') + else: + diff_html.write('<!--NoDiffs-->\n') + diff_html.close() if FailedOut == F_OK and FailedErr == F_OK and testweb: for f in ['%s.out.diff.html' % TST, '%s.test.out' % TST, '%s.server.out' % TST, '%s.client.out' % TST, @@ -2341,11 +2305,11 @@ def RunTest(env, TST, COND, oktests, len '%s%s.FILTERED' % (TST, STABLEerr)]: remove(f) _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org