Mercurial > hg
changeset 18060:d2e97d86e4db
merge with mpm
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed, 12 Dec 2012 15:12:28 -0800 |
parents | c135ab6413b4 (diff) e440a2c0d944 (current diff) |
children | 0e4316c3a703 |
files | tests/run-tests.py |
diffstat | 2 files changed, 44 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Sun Dec 09 23:33:16 2012 +0100 +++ b/Makefile Wed Dec 12 15:12:28 2012 -0800 @@ -11,6 +11,9 @@ PYFILES:=$(shell find mercurial hgext doc -name '*.py') DOCFILES=mercurial/help/*.txt +# Set this to e.g. "mingw32" to use a non-default compiler. +COMPILER= + help: @echo 'Commonly used make targets:' @echo ' all - build program and documentation' @@ -33,11 +36,15 @@ all: build doc local: - $(PYTHON) setup.py $(PURE) build_py -c -d . build_ext -i build_hgexe -i build_mo + $(PYTHON) setup.py $(PURE) \ + build_py -c -d . \ + build_ext $(COMPILER:%=-c %) -i \ + build_hgexe $(COMPILER:%=-c %) -i \ + build_mo env HGRCPATH= $(PYTHON) hg version build: - $(PYTHON) setup.py $(PURE) build + $(PYTHON) setup.py $(PURE) build $(COMPILER:%=-c %) doc: $(MAKE) -C doc
--- a/tests/run-tests.py Sun Dec 09 23:33:16 2012 +0100 +++ b/tests/run-tests.py Wed Dec 12 15:12:28 2012 -0800 @@ -56,6 +56,7 @@ import threading import killdaemons as killmod import cPickle as pickle +import Queue as queue processlock = threading.Lock() @@ -327,7 +328,7 @@ # Before we go any further, check for pre-requisite tools # stuff from coreutils (cat, rm, etc) are not tested for p in requiredtools: - if os.name == 'nt': + if os.name == 'nt' and not p.endswith('.exe'): p += '.exe' found = findprogram(p) if found: @@ -362,18 +363,26 @@ return else: exename = 'python' - vlog('# Making python executable in test path use correct Python') - mypython = os.path.join(BINDIR, exename) - try: - os.symlink(sys.executable, mypython) - except AttributeError: - # windows fallback - shutil.copyfile(sys.executable, mypython) - shutil.copymode(sys.executable, mypython) - except OSError, err: - # child processes may race, which is harmless - if err.errno != errno.EEXIST: - raise + if sys.platform == 'win32': + exename = 'python.exe' + if getattr(os, 'symlink', None): + vlog("# Making python executable in test path a symlink to '%s'" % + sys.executable) + mypython = os.path.join(BINDIR, exename) + try: + os.symlink(sys.executable, mypython) + except OSError, err: + # child processes may race, which is harmless + if err.errno != errno.EEXIST: + raise + else: + vlog("# Modifying search path to find %s in '%s'" % (exename, exedir)) + path = os.environ['PATH'].split(os.pathsep) + while exedir in path: + path.remove(exedir) + os.environ['PATH'] = os.pathsep.join([exedir] + path) + if not findprogram(exename): + print "WARNING: Cannot find %s in search path" % exename def installhg(options): vlog("# Performing temporary installation of HG") @@ -1079,7 +1088,13 @@ blacklisted.append(test) else: job.append(test) - fps = {} + + waitq = queue.Queue() + + # windows lacks os.wait, so we must emulate it + def waitfor(proc, rfd): + fp = os.fdopen(rfd, 'rb') + return lambda: waitq.put((proc.pid, proc.wait(), fp)) for j, job in enumerate(jobs): if not job: @@ -1090,16 +1105,18 @@ childopts += ['--tmpdir', childtmp] cmdline = [PYTHON, sys.argv[0]] + opts + childopts + job vlog(' '.join(cmdline)) - fps[os.spawnvp(os.P_NOWAIT, cmdline[0], cmdline)] = os.fdopen(rfd, 'rb') + proc = subprocess.Popen(cmdline, executable=cmdline[0]) + threading.Thread(target=waitfor(proc, rfd)).start() os.close(wfd) signal.signal(signal.SIGINT, signal.SIG_IGN) failures = 0 passed, skipped, failed = 0, 0, 0 skips = [] fails = [] - while fps: - pid, status = os.wait() - fp = fps.pop(pid) + for job in jobs: + if not job: + continue + pid, status, fp = waitq.get() try: childresults = pickle.load(fp) except pickle.UnpicklingError: