--- a/tests/hghave.py Fri Nov 01 17:14:49 2013 +0000
+++ b/tests/hghave.py Sun Nov 17 17:30:23 2013 +0000
@@ -233,6 +233,9 @@
finally:
os.rmdir(d)
+def has_root():
+ return os.geteuid() == 0
+
def has_pyflakes():
return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"",
r"<stdin>:1: 're' imported but unused",
@@ -312,6 +315,7 @@
"p4": (has_p4, "Perforce server and client"),
"pyflakes": (has_pyflakes, "Pyflakes python linter"),
"pygments": (has_pygments, "Pygments source highlighting library"),
+ "root": (has_root, "root permissions"),
"serve": (has_serve, "platform and python can manage 'hg serve -d'"),
"ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"),
"svn": (has_svn, "subversion client and admin tools"),
--- a/tests/run-tests.py Fri Nov 01 17:14:49 2013 +0000
+++ b/tests/run-tests.py Sun Nov 17 17:30:23 2013 +0000
@@ -103,6 +103,7 @@
requiredtools = [os.path.basename(sys.executable), "diff", "grep", "unzip",
"gunzip", "bunzip2", "sed"]
+createdfiles = []
defaults = {
'jobs': ('HGTEST_JOBS', 1),
@@ -420,6 +421,11 @@
if not options.keep_tmpdir:
vlog("# Cleaning up HGTMP", HGTMP)
shutil.rmtree(HGTMP, True)
+ for f in createdfiles:
+ try:
+ os.remove(f)
+ except OSError:
+ pass
def usecorrectpython():
# some tests run python interpreter. they must use same
@@ -439,6 +445,7 @@
if findprogram(pyexename) != sys.executable:
try:
os.symlink(sys.executable, mypython)
+ createdfiles.append(mypython)
except OSError, err:
# child processes may race, which is harmless
if err.errno != errno.EEXIST:
@@ -498,18 +505,6 @@
usecorrectpython()
- vlog("# Installing dummy diffstat")
- f = open(os.path.join(BINDIR, 'diffstat'), 'w')
- f.write('#!' + sys.executable + '\n'
- 'import sys\n'
- 'files = 0\n'
- 'for line in sys.stdin:\n'
- ' if line.startswith("diff "):\n'
- ' files += 1\n'
- 'sys.stdout.write("files patched: %d\\n" % files)\n')
- f.close()
- os.chmod(os.path.join(BINDIR, 'diffstat'), 0700)
-
if options.py3k_warnings and not options.anycoverage:
vlog("# Updating hg command to enable Py3k Warnings switch")
f = open(os.path.join(BINDIR, 'hg'), 'r')