[pypy-commit] pypy stm-gc: Fix test to run even if the working directory is different.
arigo
noreply at buildbot.pypy.org
Mon Apr 23 13:29:04 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r54673:3e95a592df1e
Date: 2012-04-23 12:15 +0200
http://bitbucket.org/pypy/pypy/changeset/3e95a592df1e/
Log: Fix test to run even if the working directory is different.
diff --git a/pypy/translator/stm/test/test_stmgcintf.py b/pypy/translator/stm/test/test_stmgcintf.py
--- a/pypy/translator/stm/test/test_stmgcintf.py
+++ b/pypy/translator/stm/test/test_stmgcintf.py
@@ -1,14 +1,22 @@
import os
+from pypy.tool import autopath
from pypy.tool.udir import udir
def test_all():
executable = str(udir.join('test_stmgcintf'))
- exitcode = os.system("gcc -g -o '%s' -pthread -I.. test_stmgcintf.c" % (
- executable,))
- assert exitcode == 0
+ prevdir = os.getcwd()
+ thisdir = os.path.join(autopath.pypydir, 'translator', 'stm', 'test')
+ try:
+ os.chdir(thisdir)
+ exitcode = os.system(
+ "gcc -g -o '%s' -pthread -I.. test_stmgcintf.c" % (
+ executable,))
+ assert exitcode == 0
+ finally:
+ os.chdir(prevdir)
#
- for line in open('test_stmgcintf.c'):
+ for line in open(os.path.join(thisdir, 'test_stmgcintf.c')):
line = line.strip()
if line.startswith('XTEST('):
assert line.endswith(');')
More information about the pypy-commit
mailing list