Changeset: 5ecdd54d7474 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5ecdd54d7474 Modified Files: testing/Mz.py.in Branch: default Log Message:
Implement Mz using Mtest. diffs (truncated from 2709 to 300 lines): diff --git a/testing/Mz.py.in b/testing/Mz.py.in --- a/testing/Mz.py.in +++ b/testing/Mz.py.in @@ -6,2702 +6,7 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V. -#TODO: -#===== -# - check all TODO's below -# - tidy -up HTML-generation by "keeping in mind" during testing, -# which OUT/ERR differ or not and which tests were skipped. -# dump HTML-stuff only at end -# print an ascii summary at end, too -# - use sorting in .explain.functions_histogram -# - if no diffs, but warnings, say so at end -# - produce, keep & reference LOG -# - add a "grep-like" function and replace "inlined" grep -# contains(<file>,<string>) -# - do multi-level prompting? -# - normalize all path's used -# - Python 3? (or do a full rewrite?) - -import os +import Mtest import sys -import shutil -import re -import random -import time -import socket -import struct -import signal -import fnmatch -import glob -# check for pymonetdb early: it is essential for our work -import pymonetdb - -try: - import winreg # Python 3 on Windows -except ImportError: - winreg = None # not on Windows - -MonetDB_VERSION = '@MONETDB_VERSION@'.split('.') - -procdebug = False -verbose = False -quiet = False -approve = False - -initdb = None - -global_timeout = 0 -start_time = time.time() - -# whether output goes to a tty -isatty = os.isatty(sys.stdout.fileno()) - -mapiportre = re.compile(r'mapi:monetdb://[-.a-zA-Z0-9]+:(?P<port>\d+)/') - -geos_version = '@GEOS_VERSION@'.split('.') - -# default is no color (these three functions may get redefined) -def prred(str, write = sys.stdout.write): - write(str) -def prgreen(str, write = sys.stdout.write): - write(str) -def prpurple(str, write = sys.stdout.write): - write(str) -if isatty: - if os.name != 'nt': - # color output a little - RED = '\033[1;31m' - GREEN = '\033[0;32m' - PURPLE = '\033[1;35m' # actually magenta - BLACK = '\033[0;0m' - def prred(str, write = sys.stdout.write): - try: - write(RED) - write(str) - finally: - write(BLACK) - def prgreen(str, write = sys.stdout.write): - try: - write(GREEN) - write(str) - finally: - write(BLACK) - def prpurple(str, write = sys.stdout.write): - try: - write(PURPLE) - write(str) - finally: - write(BLACK) - else: - try: - import ctypes - except ImportError: - pass - else: - STD_OUTPUT_HANDLE = -11 - try: - handle = ctypes.windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE) - except AttributeError: - pass - else: - def get_csbi_attributes(handle): - # Based on IPython's winconsole.py, written by Alexander Belchenko - csbi = ctypes.create_string_buffer(22) - res = ctypes.windll.kernel32.GetConsoleScreenBufferInfo(handle, csbi) - assert res - (bufx, bufy, curx, cury, wattr, - left, top, right, bottom, maxx, maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw) - return wattr - reset = get_csbi_attributes(handle) - def prred(str, - write=sys.stdout.write, - flush=sys.stdout.flush, - scta=ctypes.windll.kernel32.SetConsoleTextAttribute): - try: - flush() - scta(handle, 0x4) - write(str) - flush() - finally: - scta(handle, reset) - def prgreen(str, - write=sys.stdout.write, - flush=sys.stdout.flush, - scta=ctypes.windll.kernel32.SetConsoleTextAttribute): - try: - flush() - scta(handle, 0x2) - write(str) - flush() - finally: - scta(handle, reset) - def prpurple(str, - write=sys.stdout.write, - flush=sys.stdout.flush, - scta=ctypes.windll.kernel32.SetConsoleTextAttribute): - try: - flush() - scta(handle, 0x5) - write(str) - flush() - finally: - scta(handle, reset) - -if os.path.exists('/usr/bin/coredumpctl'): - # probably Linux if /usr/bin/coredumpctl exists - # try raising the core dump size limit to infinite so that when we - # get a crash we have a chance to retrieve the stack trace - try: - import resource - except ImportError: - pass - else: - try: - resource.setrlimit(resource.RLIMIT_CORE, - (resource.RLIM_INFINITY, - resource.getrlimit(resource.RLIMIT_CORE)[1])) - except ValueError: - # if we can't raise the limit, just forget it - pass - -def ErrExit(msg): - sys.stderr.write(msg + '\n') - sys.exit(1) - -def _configure(str): - # expand configure variables in str and return result - config = [ - ('{source}', '@QXSOURCE@'), - ('${build}', '@QXBUILD@'), - - ('${bindir}', '@QXbindir@'), -## ('${sbindir}', '@QXsbindir@'), - ('${libexecdir}', '@QXlibexecdir@'), - ('${datarootdir}', '@QXdatarootdir@'), - ('${datadir}', '@QXdatadir@'), - ('${sysconfdir}', '@QXsysconfdir@'), - ('${localstatedir}', '@QXlocalstatedir@'), - ('${libdir}', '@QXlibdir@'), - ('${includedir}', '@QXincludedir@'), -## ('${oldincludedir}', '@QXoldincludedir@'), - ('${infodir}', '@QXinfodir@'), - ('${mandir}', '@QXmandir@'), - ('${Qbindir}', '@QXbindir@'), -## ('${Qsbindir}', '@QXsbindir@'), - ('${Qlibexecdir}', '@QXlibexecdir@'), - ('${Qdatarootdir}', '@QXdatarootdir@'), - ('${Qdatadir}', '@QXdatadir@'), - ('${Qsysconfdir}', '@QXsysconfdir@'), - ('${Qlocalstatedir}', '@QXlocalstatedir@'), - ('${Qlibdir}', '@QXlibdir@'), - ('${Qincludedir}', '@QXincludedir@'), -## ('${Qoldincludedir}', '@QXoldincludedir@'), - ('${Qinfodir}', '@QXinfodir@'), - ('${Qmandir}', '@QXmandir@'), - # put these at end (in this order!) for efficiency - ('${exec_prefix}', '@QXexec_prefix@'), - ('${Qexec_prefix}', '@QXexec_prefix@'), - ('${prefix}', '@QXprefix@'), - ('${Qprefix}', '@QXprefix@'), - ] - if os.name == 'nt': - str = str.replace('%prefix%', '${prefix}') - str = str.replace('%exec_prefix%', '${exec_prefix}') - changed = True - while '$' in str and changed: - changed = False - for key, val in config: - if os.name == 'nt': - val = val.replace('%prefix%', '${prefix}') - val = val.replace('%exec_prefix%', '${exec_prefix}') - nstr = str.replace(key, val) - changed = changed or str != nstr - str = nstr - return str - -try: - from helpers import build_work_ctx, splitcommand -except ImportError: - try: - from MonetDBtesting.helpers import build_work_ctx, splitcommand - except ImportError: - p = _configure(os.path.join('@QXprefix@', '@QXPYTHON_LIBDIR@')) - sys.path.insert(0, p) - from MonetDBtesting.helpers import build_work_ctx, splitcommand - if 'PYTHONPATH' in os.environ: - p += os.pathsep + os.environ['PYTHONPATH'] - os.environ['PYTHONPATH'] = p - -# use our own process module because it has _BufferedPipe -try: - import process -except ImportError: - try: - import MonetDBtesting.process as process - except ImportError: - p = _configure(os.path.join('@QXprefix@', '@QXPYTHON_LIBDIR@')) - sys.path.insert(0, p) - import MonetDBtesting.process as process - if 'PYTHONPATH' in os.environ: - p += os.pathsep + os.environ['PYTHONPATH'] - os.environ['PYTHONPATH'] = p - -# Replace os.fork by a version that forks but also sets the process -# group in the child. This is done so that we can easily kill a -# subprocess and its children in case of a timeout. -# To use this, set the global variable setpgrp to True before calling -# subprocess.Popen. It is reset automatically to False so that -# subprocess of our child don't get their own process group. -try: - os.setpgrp -except AttributeError: - try: - os.setpgid - except AttributeError: - # no function to set process group, so don't replace - pass - else: - # use os.setpgid to set process group - def myfork(osfork = os.fork): - global setpgrp - _setpgrp = setpgrp - setpgrp = False - pid = osfork() - if pid == 0 and _setpgrp: - os.setpgid(0, 0) - return pid - os.fork = myfork -else: - # use os.setpgrp to set process group - def myfork(osfork = os.fork): - global setpgrp - _setpgrp = setpgrp - setpgrp = False - pid = osfork() - if pid == 0 and _setpgrp: - os.setpgrp() - return pid - os.fork = myfork -setpgrp = False - -try: - ttywidth = os.get_terminal_size(1).columns -except: - ttywidth = 0 -else: - if ttywidth > 0 and os.name == 'nt': - ttywidth -= 1 # don't go to the edge - -def remove(file): - try: - os.remove(file) - except: - pass - _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org