Commit 754de023 authored by Kevin Modzelewski's avatar Kevin Modzelewski Committed by Kevin Modzelewski

Move test files to the testsuite repo

parent f0450c2a
[submodule "test/integration/django"]
path = test/integration/django
url = https://github.com/django/django
[submodule "test/integration/virtualenv"]
path = test/integration/virtualenv
url = https://github.com/dropbox/virtualenv
[submodule "test/integration/pycrypto"]
path = test/integration/pycrypto
url = https://github.com/dlitz/pycrypto.git
[submodule "test/integration/gflags"]
path = test/integration/gflags
url = https://github.com/google/python-gflags
ignore = untracked
[submodule "test/integration/sqlalchemy"]
path = test/integration/sqlalchemy
url = https://github.com/zzzeek/sqlalchemy
[submodule "test/integration/pyxl"]
path = test/integration/pyxl
url = https://github.com/dropbox/pyxl.git
ignore = untracked
[submodule "build_deps/libunwind"]
path = build_deps/libunwind
url = git://git.sv.gnu.org/libunwind.git
......@@ -31,3 +11,6 @@
[submodule "build_deps/jemalloc"]
path = build_deps/jemalloc
url = git://github.com/jemalloc/jemalloc.git
[submodule "test/testsuite"]
path = test/testsuite
url = https://github.com/dropbox/pyston-testsuite
......@@ -984,7 +984,7 @@ $(eval \
$1: nosearch_$1
$1: $(TESTS_DIR)/nosearch_$1 ;
$1: $(TEST_DIR)/cpython/nosearch_$1 ;
$1: $(TEST_DIR)/integration/nosearch_$1 ;
$1: $(TEST_DIR)/testsuite/integration/nosearch_$1 ;
$1: $(TEST_DIR)/extra/nosearch_$1 ;
$1: ./microbenchmarks/nosearch_$1 ;
$1: ./minibenchmarks/nosearch_$1 ;
......@@ -1001,7 +1001,7 @@ check$1 test$1: $(PYTHON_EXE_DEPS) pyston$1
$(PYTHON) $(TOOLS_DIR)/tester.py -R pyston$1 -j$(TEST_THREADS) -a=-S -k $(TESTS_DIR) $(ARGS)
@# we pass -I to cpython tests and skip failing ones because they are sloooow otherwise
$(PYTHON) $(TOOLS_DIR)/tester.py -R pyston$1 -j$(TEST_THREADS) -a=-S -k --exit-code-only --skip-failing -t50 $(TEST_DIR)/cpython $(ARGS)
$(PYTHON) $(TOOLS_DIR)/tester.py -R pyston$1 -j$(TEST_THREADS) -k -a=-S --exit-code-only --skip-failing -t600 $(TEST_DIR)/integration $(ARGS)
$(PYTHON) $(TOOLS_DIR)/tester.py -R pyston$1 -j$(TEST_THREADS) -k -a=-S --exit-code-only --skip-failing -t600 $(TEST_DIR)/testsuite/integration $(ARGS)
$(PYTHON) $(TOOLS_DIR)/tester.py -a=-x -R pyston$1 -j$(TEST_THREADS) -a=-n -a=-S -k $(TESTS_DIR) $(ARGS)
$(PYTHON) $(TOOLS_DIR)/tester.py -R pyston$1 -j$(TEST_THREADS) -a=-O -a=-S -k $(TESTS_DIR) $(ARGS)
......
import os, sys, subprocess
from test_helper import create_virtenv, run_test
ENV_NAME = "babel_test_env_" + os.path.basename(sys.executable)
SRC_DIR = os.path.abspath(os.path.join(ENV_NAME, "src"))
PYTHON_EXE = os.path.abspath(os.path.join(ENV_NAME, "bin", "python"))
BABEL_DIR = os.path.abspath(os.path.join(ENV_NAME, "src", "babel"))
NOSETESTS_EXE = os.path.abspath(os.path.join(ENV_NAME, "bin", "nosetests"))
packages = ["nose==1.3.7", "pytz==2015.4", "-e", "git+http://github.com/mitsuhiko/babel.git@1.3#egg=Babel"]
create_virtenv(ENV_NAME, packages, force_create = True)
subprocess.check_call([PYTHON_EXE, "setup.py", "import_cldr"], cwd=BABEL_DIR)
subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=BABEL_DIR)
subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=BABEL_DIR)
expected = [{"ran": 227, "failures": 3, "errors": 3}]
run_test([NOSETESTS_EXE], cwd=BABEL_DIR, expected=expected)
import os, sys
from test_helper import create_virtenv, run_test
ENV_NAME = os.path.abspath("cheetah_test_env_" + os.path.basename(sys.executable))
create_virtenv(ENV_NAME, ["cheetah==2.4.4"], force_create = True)
cheetah_exe = os.path.join(ENV_NAME, "bin", "cheetah")
env = os.environ
env["PATH"] = os.path.join(ENV_NAME, "bin")
expected = [{'ran': 2138, 'errors': 4, 'failures': 53}, {'ran': 2138, 'errors': 232, 'failures': 53}]
run_test([cheetah_exe, "test"], cwd=ENV_NAME, expected=expected, env=env)
From e1e415a1738fd296f83d0b1ce7ad8e7a1682d97a Mon Sep 17 00:00:00 2001
From: Marius Wachtler <undingen@gmail.com>
Date: Mon, 8 Jun 2015 17:35:14 +0200
Subject: [PATCH] Pyston change: register types
---
_mysql.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/_mysql.c b/_mysql.c
index 5b81c79..718d3f8 100644
--- a/_mysql.c
+++ b/_mysql.c
@@ -3086,6 +3086,11 @@ init_mysql(void)
_mysql_ResultObject_Type.tp_free = _PyObject_GC_Del;
#endif
#endif
+ // Pyston change:
+ if (PyType_Ready(&_mysql_ConnectionObject_Type) < 0)
+ return;
+ if (PyType_Ready(&_mysql_ResultObject_Type) < 0)
+ return;
if (!(dict = PyModule_GetDict(module))) goto error;
if (PyDict_SetItemString(dict, "version_info",
--
2.1.4
# This tests needs mysql and a database:
# mysql -e 'create database mysqldb_test charset utf8;'
import os, sys, subprocess, shutil
from test_helper import create_virtenv, run_test
ENV_NAME = "mysqldb_test_env_" + os.path.basename(sys.executable)
SRC_DIR = os.path.abspath(os.path.join(ENV_NAME, "src"))
PYTHON_EXE = os.path.abspath(os.path.join(ENV_NAME, "bin", "python"))
def install_and_test_mysqldb():
shutil.rmtree(SRC_DIR, ignore_errors=True)
os.makedirs(SRC_DIR)
subprocess.check_call(["git", "clone", "https://github.com/farcepest/MySQLdb1.git"], cwd=SRC_DIR)
MYSQLDB_DIR = os.path.abspath(os.path.join(SRC_DIR, "MySQLdb1"))
subprocess.check_call(["git", "checkout", "MySQLdb-1.2.5"], cwd=MYSQLDB_DIR)
nosetests_exe = os.path.abspath(ENV_NAME + "/bin/nosetests")
#apply patch
PATCH_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "mysqldb_0001-Pyston-change-register-types.patch"))
subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=MYSQLDB_DIR)
print "Applied mysqldb patch"
subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=MYSQLDB_DIR)
subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=MYSQLDB_DIR)
env = os.environ
env["TESTDB"] = "travis.cnf"
expected = [{"ran": 69}]
run_test([nosetests_exe], cwd=MYSQLDB_DIR, expected=expected, env=env)
packages = ["nose==1.3.7"]
create_virtenv(ENV_NAME, packages, force_create = True)
install_and_test_mysqldb()
import os, sys, subprocess, shutil
from test_helper import create_virtenv, run_test
ENV_NAME = "protobuf_test_env_" + os.path.basename(sys.executable)
SRC_DIR = os.path.abspath(os.path.join(ENV_NAME, "src"))
PYTHON_EXE = os.path.abspath(os.path.join(ENV_NAME, "bin", "python"))
def install_and_test_protobuf():
shutil.rmtree(SRC_DIR, ignore_errors=True)
os.makedirs(SRC_DIR)
url = "http://archive.ubuntu.com/ubuntu/pool/main/p/protobuf/protobuf_2.5.0.orig.tar.gz"
subprocess.check_call(["wget", url], cwd=SRC_DIR)
subprocess.check_call(["tar", "-zxf", "protobuf_2.5.0.orig.tar.gz"], cwd=SRC_DIR)
PROTOBUF_DIR = os.path.abspath(os.path.join(SRC_DIR, "protobuf-2.5.0"))
INSTALL_DIR = os.path.join(SRC_DIR, "protobuf_install")
subprocess.check_call(["./configure", "--prefix="+INSTALL_DIR], cwd=PROTOBUF_DIR)
subprocess.check_call(["make", "-j4"], cwd=PROTOBUF_DIR)
subprocess.check_call(["make", "install"], cwd=PROTOBUF_DIR)
PROTOBUF_PY_DIR = os.path.join(PROTOBUF_DIR, "python")
env = os.environ
env["PATH"] = env["PATH"] + ":" + os.path.join(INSTALL_DIR, "bin")
env["LD_LIBRARY_PATH"] = os.path.join(INSTALL_DIR, "lib")
subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=PROTOBUF_PY_DIR, env=env)
expected = [{"ran": 216}]
run_test([PYTHON_EXE, "setup.py", "test"], cwd=PROTOBUF_PY_DIR, expected=expected, env=env)
create_virtenv(ENV_NAME, None, force_create = True)
install_and_test_protobuf()
# pycurl depends on libcurl
import os
import sys
import subprocess
import shutil
p = subprocess.Popen(["which", "curl-config"], stdout=open("/dev/null", 'w'))
if p.wait() != 0:
print >>sys.stderr, "curl-config not available; try 'sudo apt-get install libcurl4-openssl-dev'"
sys.exit(1)
VIRTUALENV_SCRIPT = os.path.dirname(__file__) + "/../integration/virtualenv/virtualenv.py"
if os.path.exists("pycurl_test_env"):
print "Removing the existing 'pycurl_test_env/' directory"
subprocess.check_call(["rm", "-rf", "pycurl_test_env"])
# shutil follows symlinks to directories, and deletes whatever those contain.
# shutil.rmtree("pycurl_test_env")
args = [sys.executable, VIRTUALENV_SCRIPT, "-p", sys.executable, "pycurl_test_env"]
print "Running", args
subprocess.check_call(args)
sh_script = """
set -e
. pycurl_test_env/bin/activate
set -ux
pip install pycurl==7.19.5.1
python -c 'import pycurl; print "pycurl imports"'
""".strip()
# print sh_script
subprocess.check_call(["sh", "-c", sh_script])
print
print "PASSED"
diff -ur PyICU-1.0.1_o/_icu.cpp PyICU-1.0.1/_icu.cpp
--- PyICU-1.0.1_o/_icu.cpp 2010-04-02 00:12:54.000000000 +0200
+++ PyICU-1.0.1/_icu.cpp 2015-05-19 15:26:15.131375981 +0200
@@ -193,6 +193,8 @@
if (!PyArg_ParseTuple(args, "Os", &object, &doc))
return NULL;
+// Pyston change:
+#if 0
/* constructors */
if (PyObject_TypeCheck(object, &PyWrapperDescr_Type))
{
@@ -206,6 +208,14 @@
((PyMethodDescrObject *) object)->d_method->ml_doc = strdup(doc);
Py_RETURN_NONE;
}
+#else
+ if (PyObject_TypeCheck(object, &PyWrapperDescr_Type) ||
+ PyObject_TypeCheck(object, &PyMethod_Type) ||
+ PyObject_TypeCheck(object, _method_type)) {
+ // Ignore the doc string for now.
+ Py_RETURN_NONE;
+ }
+#endif
/* class methods */
if (PyObject_TypeCheck(object, &PyCFunction_Type))
import os, sys, subprocess, shutil
from test_helper import create_virtenv, run_test
ENV_NAME = "pyicu_test_env_" + os.path.basename(sys.executable)
SRC_DIR = os.path.abspath(os.path.join(ENV_NAME, "src"))
PYTHON_EXE = os.path.abspath(os.path.join(ENV_NAME, "bin", "python"))
def install_and_test_pyicu():
shutil.rmtree(SRC_DIR, ignore_errors=True)
os.makedirs(SRC_DIR)
url = "http://download.icu-project.org/files/icu4c/4.2.1/icu4c-4_2_1-src.tgz"
subprocess.check_call(["wget", url], cwd=SRC_DIR)
subprocess.check_call(["tar", "-zxf", "icu4c-4_2_1-src.tgz"], cwd=SRC_DIR)
ICU_DIR = os.path.abspath(os.path.join(SRC_DIR, "icu", "source"))
INSTALL_DIR = os.path.join(SRC_DIR, "icu_install")
subprocess.check_call(["./runConfigureICU", "Linux", "--prefix=" + INSTALL_DIR], cwd=ICU_DIR)
subprocess.check_call(["make", "-j4"], cwd=ICU_DIR)
subprocess.check_call(["make", "install"], cwd=ICU_DIR)
url = "https://pypi.python.org/packages/source/P/PyICU/PyICU-1.0.1.tar.gz"
subprocess.check_call(["wget", url], cwd=SRC_DIR)
subprocess.check_call(["tar", "-zxf", "PyICU-1.0.1.tar.gz"], cwd=SRC_DIR)
PYICU_DIR = os.path.abspath(os.path.join(SRC_DIR, "PyICU-1.0.1"))
PATCH_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "pyicu_101.patch"))
subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=PYICU_DIR)
print "Applied PyICU patch"
env = os.environ
INC_DIR = os.path.abspath(os.path.join(INSTALL_DIR, "include"))
LIB_DIR = os.path.abspath(os.path.join(INSTALL_DIR, "lib"))
env["CFLAGS"] = env["CXXFLAGS"] = " ".join(["-I" + INC_DIR, "-L" + LIB_DIR])
env["LD_LIBRARY_PATH"] = LIB_DIR
subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=PYICU_DIR, env=env)
subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=PYICU_DIR, env=env)
expected = [{'ran': 17}]
run_test([PYTHON_EXE, "setup.py", "test"], cwd=PYICU_DIR, expected=expected)
create_virtenv(ENV_NAME, None, force_create = True)
install_and_test_pyicu()
# skip-if: True
import os
import sys
import subprocess
import re
def create_virtenv(name, package_list = None, force_create = False):
if force_create or not os.path.exists(name) or os.stat(sys.executable).st_mtime > os.stat(name + "/bin/python").st_mtime:
if os.path.exists(name):
subprocess.check_call(["rm", "-rf", name])
print "Creating virtualenv to install testing dependencies..."
VIRTUALENV_SCRIPT = os.path.dirname(__file__) + "/../integration/virtualenv/virtualenv.py"
try:
args = [sys.executable, VIRTUALENV_SCRIPT, "-p", sys.executable, name]
print "Running", args
subprocess.check_call(args)
if package_list:
pip_install(name, package_list)
except:
print "Error occurred; trying to remove partially-created directory"
ei = sys.exc_info()
try:
subprocess.check_call(["rm", "-rf", name])
except Exception as e:
print e
raise ei[0], ei[1], ei[2]
else:
print "Reusing existing virtualenv"
def pip_install(name, package_list):
subprocess.check_call([name + "/bin/pip", "install"] + package_list)
def parse_output(output):
result = []
for l in output.split('\n'):
m = re.match("Ran (\d+) tests in", l)
if m:
result.append({"ran": int(m.group(1))})
m = re.match("FAILED \(failures=(\d+), errors=(\d+)\)", l)
if m:
d = result[-1]
assert d.keys() == ["ran"]
d['failures'] = int(m.group(1))
d['errors'] = int(m.group(2))
m = re.match("FAILED \(errors=(\d+), failures=(\d+)\)", l)
if m:
d = result[-1]
assert d.keys() == ["ran"]
d['failures'] = int(m.group(2))
d['errors'] = int(m.group(1))
m = re.match("FAILED \(failures=(\d+)\)", l)
if m:
d = result[-1]
assert d.keys() == ["ran"]
d['failures'] = int(m.group(1))
d['errors'] = 0
m = re.match("FAILED \(errors=(\d+)\)", l)
if m:
d = result[-1]
assert d.keys() == ["ran"]
d['failures'] = 0
d['errors'] = int(m.group(1))
return result
def run_test(cmd, cwd, expected, env = None):
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=cwd, env=env)
output, unused_err = process.communicate()
errcode = process.poll()
result = parse_output(output)
print
print "Return code:", errcode
if expected == result:
print "Received expected output"
else:
print >> sys.stderr, '\n'.join(output.split('\n')[-500:])
print >> sys.stderr, "WRONG output"
print >> sys.stderr, "is:", result
print >> sys.stderr, "expected:", expected
assert result == expected
From 0d1aaa649bd47a3f78e573eb4e5b9e35f9aa02d3 Mon Sep 17 00:00:00 2001
From: Marius Wachtler <undingen@gmail.com>
Date: Tue, 9 Jun 2015 19:26:44 +0200
Subject: [PATCH] Pyston change: we don't support custom traceback entries yet
---
Cython/Compiler/ModuleNode.py | 8 ++++++--
Cython/Utility/Exceptions.c | 7 ++++++-
Cython/Utility/Generator.c | 31 +++++++++++++++++++++----------
3 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 4785858..699cd15 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -1399,9 +1399,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("{")
code.putln("PyObject *etype, *eval, *etb;")
code.putln("PyErr_Fetch(&etype, &eval, &etb);")
- code.putln("++Py_REFCNT(o);")
+ # Pyston change:
+ # code.putln("++Py_REFCNT(o);")
+ code.putln("Py_INCREF(o);")
code.putln("%s(o);" % entry.func_cname)
- code.putln("--Py_REFCNT(o);")
+ # Pyston change:
+ # code.putln("--Py_REFCNT(o);")
+ code.putln("Py_DECREF(o);")
code.putln("PyErr_Restore(etype, eval, etb);")
code.putln("}")
diff --git a/Cython/Utility/Exceptions.c b/Cython/Utility/Exceptions.c
index 354a776..8af3cb7 100644
--- a/Cython/Utility/Exceptions.c
+++ b/Cython/Utility/Exceptions.c
@@ -450,7 +450,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
/////////////// AddTraceback ///////////////
//@requires: ModuleSetupCode.c::CodeObjectCache
//@substitute: naming
-
+// Pyston change: We don't support custom traceback entries currently
+#if 0
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
@@ -534,3 +535,7 @@ bad:
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
+#else
+static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) {
+}
+#endif
diff --git a/Cython/Utility/Generator.c b/Cython/Utility/Generator.c
index 0310570..bcd0eb2 100644
--- a/Cython/Utility/Generator.c
+++ b/Cython/Utility/Generator.c
@@ -43,7 +43,9 @@ static void __Pyx_Generator_Replace_StopIteration(void) {
//////////////////// Generator.proto ////////////////////
#define __Pyx_Generator_USED
#include <structmember.h>
-#include <frameobject.h>
+
+// Pyston change:
+// #include <frameobject.h>
typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *);
@@ -487,7 +489,8 @@ static void __Pyx_Generator_dealloc(PyObject *self) {
if (PyObject_CallFinalizerFromDealloc(self))
#else
Py_TYPE(gen)->tp_del(self);
- if (self->ob_refcnt > 0)
+ // Pyston change:
+ // if (self->ob_refcnt > 0)
#endif
{
// resurrected. :(
@@ -509,9 +512,10 @@ static void __Pyx_Generator_del(PyObject *self) {
return ;
#if PY_VERSION_HEX < 0x030400a1
- // Temporarily resurrect the object.
- assert(self->ob_refcnt == 0);
- self->ob_refcnt = 1;
+ // Pyston change:
+ // // Temporarily resurrect the object.
+ // assert(self->ob_refcnt == 0);
+ // self->ob_refcnt = 1;
#endif
// Save the current exception, if any.
@@ -530,18 +534,25 @@ static void __Pyx_Generator_del(PyObject *self) {
#if PY_VERSION_HEX < 0x030400a1
// Undo the temporary resurrection; can't use DECREF here, it would
// cause a recursive call.
- assert(self->ob_refcnt > 0);
- if (--self->ob_refcnt == 0) {
- // this is the normal path out
- return;
- }
+
+ // Pyston change:
+ // assert(self->ob_refcnt > 0);
+ // if (--self->ob_refcnt == 0) {
+ // // this is the normal path out
+ // return;
+ // }
// close() resurrected it! Make it look like the original Py_DECREF
// never happened.
{
+// Pyston change:
+#if 0
Py_ssize_t refcnt = self->ob_refcnt;
_Py_NewReference(self);
self->ob_refcnt = refcnt;
+#else
+ _Py_NewReference(self);
+#endif
}
#if CYTHON_COMPILING_IN_CPYTHON
assert(PyType_IS_GC(self->ob_type) &&
--
2.1.4
Subproject commit 634f4229c5cafeb3a1c03e5deb9434d7c0f74ebe
import os
import signal
import subprocess
import sys
import time
import urllib2
EXTRA_PATH = os.path.dirname(os.path.abspath(__file__)) + "/django"
sys.path.insert(0, EXTRA_PATH)
from django.core.management import execute_from_command_line
import os
import shutil
is_pyston = True
if is_pyston:
ARGS = "-u"
else:
ARGS = "-u"
if os.path.exists("testsite"):
print "Removing the existing 'testsite/' directory"
shutil.rmtree("testsite")
try:
sys.argv += ["startproject", "testsite"]
print "Running 'startproject testsite'"
r = execute_from_command_line()
assert not r
# In theory we could run this in the current process (migrate.py is only a couple lines),
# but I guess the "startproject testsite" command changed enough global state that
# it won't work. So create a new subprocess to run it instead.
print "Running testsite/manage.py migrate"
env = dict(os.environ)
env["PYTHONPATH"] = env.get("PYTHONPATH", "") + ":" + EXTRA_PATH
subprocess.check_call([sys.executable, ARGS, "testsite/manage.py", "migrate"], env=env)
print "Running runserver localhost:8000"
p = subprocess.Popen([sys.executable, ARGS, "testsite/manage.py", "runserver", "--noreload", "localhost:8000"], stdout=subprocess.PIPE, env=env)
try:
print "Waiting for server to start up"
while True:
l = p.stdout.readline()
assert l, "unexpected eof"
print l
if l.startswith("Quit the server with CONTROL-C"):
break
# Give the server some extra time to start up:
time.sleep(1)
print "Server started up, fetching home page"
f = urllib2.urlopen("http://localhost:8000/", timeout=1)
s = f.read()
assert "Congratulations on your first Django-powered page" in s
print "Shutting down server"
# ctrl-C is how you shut down the django development server cleanly, but Pyston doesn't yet support that.
# So you'll see a "SIGINT! someone called about" message and then a traceback on stderr.
p.send_signal(signal.SIGINT)
while True:
l = p.stdout.readline()
if not l:
break
assert "Error" not in l, l
print l
code = p.wait()
# We can enable this assert once we support signals such as ctrl-C:
# assert code == 0
except:
p.kill()
p.wait()
raise
finally:
pass
# shutil.rmtree("testsite")
print
print "PASSED"
Subproject commit 1569dd1f3855abd262ea3a7741527d4413b35bc9
import glob
import subprocess, sys, os
gflags_dir = os.path.dirname(os.path.abspath(__file__)) + "/gflags"
os.chdir(gflags_dir)
env = os.environ
env["PYTHONPATH"] = "."
TESTS_DIR = "tests"
for fn in glob.glob("%s/*.py" % TESTS_DIR):
# We don't support xml.dom.minidom yet
if "helpxml_test.py" in fn:
print "Skipping", fn
continue
print "Running", fn
subprocess.check_call([sys.executable, fn])
print "-- Tests finished"
# skip-if: True
# script expects to find the numpy directory at the same level as the Pyston directory
import os
import sys
import subprocess
import shutil
ENV_NAME = "numpy_test_env_" + os.path.basename(sys.executable)
if not os.path.exists(ENV_NAME) or os.stat(sys.executable).st_mtime > os.stat(ENV_NAME + "/bin/python").st_mtime:
print "Creating virtualenv to install testing dependencies..."
VIRTUALENV_SCRIPT = os.path.dirname(__file__) + "/virtualenv/virtualenv.py"
try:
args = [sys.executable, VIRTUALENV_SCRIPT, "-p", sys.executable, ENV_NAME]
print "Running", args
subprocess.check_call(args)
except:
print "Error occurred; trying to remove partially-created directory"
ei = sys.exc_info()
try:
subprocess.check_call(["rm", "-rf", ENV_NAME])
except Exception as e:
print e
raise ei[0], ei[1], ei[2]
SRC_DIR = ENV_NAME
PYTHON_EXE = os.path.abspath(ENV_NAME + "/bin/python")
CYTHON_DIR = os.path.abspath(os.path.join(SRC_DIR, "Cython-0.22"))
NUMPY_DIR = ENV_NAME + "/../../numpy"
print "\n>>>"
print ">>> Setting up Cython..."
if not os.path.exists(CYTHON_DIR):
print ">>>"
url = "http://cython.org/release/Cython-0.22.tar.gz"
subprocess.check_call(["wget", url], cwd=SRC_DIR)
subprocess.check_call(["tar", "-zxf", "Cython-0.22.tar.gz"], cwd=SRC_DIR)
PATCH_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), "Cython_0001-Pyston-change-we-don-t-support-custom-traceback-entr.patch"))
subprocess.check_call(["patch", "-p1", "--input=" + PATCH_FILE], cwd=CYTHON_DIR)
print "Applied Cython patch"
subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=CYTHON_DIR)
subprocess.check_call([PYTHON_EXE, "-c", "import Cython"], cwd=CYTHON_DIR)
else:
print ">>> Cython already installed."
print ">>>"
print "\n>>>"
print ">>> Setting up NumPy..."
print ">>>"
subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=NUMPY_DIR)
subprocess.check_call([PYTHON_EXE, "setup.py", "install"], cwd=NUMPY_DIR)
print
print "PASSED"
Subproject commit 7acba5f3a6ff10f1424c309d0d34d2b713233019
From 7303cd6db08b41a513bbd45aad0676a47eb3820a Mon Sep 17 00:00:00 2001
From: Marius Wachtler <undingen@gmail.com>
Date: Tue, 28 Apr 2015 11:49:32 +0200
Subject: [PATCH] fastmath: Add support for Pyston
---
src/_fastmath.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/_fastmath.c b/src/_fastmath.c
index e369f5a..c4cf2aa 100644
--- a/src/_fastmath.c
+++ b/src/_fastmath.c
@@ -29,7 +29,14 @@
#include "pycrypto_common.h"
#include <stdio.h>
#include <string.h>
+
+#ifdef Py_HAVE_LONG_MPZ_API
+#ifndef HAVE_LIBGMP
+#error Pyston only supports GMP.
+#endif
+#else
#include <longintrepr.h> /* for conversions */
+#endif
#if HAVE_LIBGMP
# include <gmp.h>
#elif HAVE_LIBMPIR
@@ -60,6 +67,19 @@
static unsigned int sieve_base[10000];
static int rabinMillerTest (mpz_t n, int rounds, PyObject *randfunc);
+#ifdef Py_HAVE_LONG_MPZ_API
+static void
+longObjToMPZ (mpz_t m, PyLongObject * p)
+{
+ _PyLong_AsMPZ ((PyObject*)p, m);
+}
+
+static PyObject *
+mpzToLongObj (mpz_t m)
+{
+ return _PyLong_FromMPZ (m);
+}
+#else
static void
longObjToMPZ (mpz_t m, PyLongObject * p)
{
@@ -113,6 +133,7 @@ mpzToLongObj (mpz_t m)
mpz_clear (temp);
return (PyObject *) l;
}
+#endif
typedef struct
{
--
2.1.0
import subprocess, sys, os, shutil, StringIO
pycrypto_dir = os.path.dirname(os.path.abspath(__file__)) + "/pycrypto"
os.chdir(pycrypto_dir)
for d in ("build", "install"):
if os.path.exists(d):
print "Removing the existing", d, "directory"
shutil.rmtree(d)
devnull = open(os.devnull, "w")
print "-- Patching pycrypto"
patches = ["../pycrypto_0001-fastmath-Add-support-for-Pyston.patch"]
for patch in patches:
try:
cmd = ["patch", "-p1", "--forward", "-i", patch]
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
print e.output
if "Reversed (or previously applied) patch detected! Skipping patch" not in e.output:
raise e
print "-- Building pycrypto"
subprocess.check_call([sys.executable, "setup.py", "build"], stdout=devnull)
print "-- Installing pycrypto"
subprocess.check_call([sys.executable, "setup.py", "install", "--prefix=install"], stdout=devnull)
print "-- Testing pycrypto"
sys.path.append("install/site-packages")
test_string = "test string".ljust(16)
from Crypto.Hash import SHA256, MD5
assert SHA256.new(test_string).hexdigest() == "edce3184097ede907d91c4069c55104785a3a989b9706e5919202d6f5fe2d814"
assert MD5.new(test_string).hexdigest() == "e135865bb047e78e1827b0cf83696725"
from Crypto.Cipher import AES
aes1 = AES.new("pwd1__0123456789")
aes2 = AES.new("pwd2__0123456789")
enc_data = aes1.encrypt(test_string)
enc_data2 = aes2.encrypt(test_string)
assert enc_data != enc_data2
assert aes1.decrypt(enc_data) == test_string
assert aes2.decrypt(enc_data2) == test_string
from Crypto.PublicKey import RSA
from Crypto import Random
key = RSA.generate(1024, Random.new().read)
public_key = key.publickey()
enc_data = public_key.encrypt(test_string, 32)
assert enc_data != test_string
assert key.decrypt(enc_data) == test_string
print "-- Tests finished"
print "-- Unpatching pycrypto"
for patch in reversed(patches):
cmd = ["patch", "-p1", "--forward", "-i", patch]
cmd += ["-R"]
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
for d in ("build", "install"):
if os.path.exists(d):
print "Removing the created", d, "directory"
shutil.rmtree(d)
Subproject commit ebe32acd6f779069a6a9e03ca48c7eb5ffcd0831
import os
import sys
import subprocess
import shutil
ENV_NAME = "pyxl_test_env_" + os.path.basename(sys.executable)
if not os.path.exists(ENV_NAME) or os.stat(sys.executable).st_mtime > os.stat(ENV_NAME + "/bin/python").st_mtime:
print "Creating virtualenv to install testing dependencies..."
VIRTUALENV_SCRIPT = os.path.dirname(__file__) + "/virtualenv/virtualenv.py"
try:
args = [sys.executable, VIRTUALENV_SCRIPT, "-p", sys.executable, ENV_NAME]
print "Running", args
subprocess.check_call(args)
except:
print "Error occurred; trying to remove partially-created directory"
ei = sys.exc_info()
try:
subprocess.check_call(["rm", "-rf", ENV_NAME])
except Exception as e:
print e
raise ei[0], ei[1], ei[2]
PYXL_DIR = os.path.dirname(__file__) + "/pyxl"
python_exe = os.path.abspath(ENV_NAME + "/bin/python")
subprocess.check_call([python_exe, "setup.py", "build"], cwd=PYXL_DIR)
subprocess.check_call([python_exe, "setup.py", "install"], cwd=PYXL_DIR)
subprocess.check_call([python_exe, "finish_install.py"], cwd=PYXL_DIR)
out = subprocess.check_output([python_exe, "pyxl/examples/hello_world.py"], cwd=PYXL_DIR)
print
print "Output: '%s'" % out
assert out == "<html><body>Hello World!</body></html>\n"
subprocess.check_call(["rm", "-rf", os.path.join(PYXL_DIR, "build")])
print "PASSED"
Subproject commit eb1bb84fbc10c801c7269a3d38c9e0235327857e
# run_args: -x
import os
import sys
import subprocess
import traceback
ENV_NAME = "sqlalchemy_test_env_" + os.path.basename(sys.executable)
if not os.path.exists(ENV_NAME) or os.stat(sys.executable).st_mtime > os.stat(ENV_NAME + "/bin/python").st_mtime:
print "Creating virtualenv to install testing dependencies..."
VIRTUALENV_SCRIPT = os.path.dirname(__file__) + "/virtualenv/virtualenv.py"
try:
args = [sys.executable, VIRTUALENV_SCRIPT, "-p", sys.executable, ENV_NAME]
print "Running", args
subprocess.check_call(args)
subprocess.check_call([ENV_NAME + "/bin/pip", "install", "mock==1.0.0", "pytest==2.7.2", "py==1.4.30"])
except:
print "Error occurred; trying to remove partially-created directory"
ei = sys.exc_info()
try:
subprocess.check_call(["rm", "-rf", ENV_NAME])
except Exception as e:
print e
raise ei[0], ei[1], ei[2]
# subprocess.check_call([os.path.abspath("sqlalchemy_test_env/bin/python"), "-c", "import py; print type(py); print py.builtin"])
SQLALCHEMY_DIR = os.path.dirname(__file__) + "/sqlalchemy"
TEST_DIR = SQLALCHEMY_DIR + "/test"
python_exe = os.path.abspath(ENV_NAME + "/bin/python")
sys.path.append(SQLALCHEMY_DIR + "/lib")
sys.path.insert(0, SQLALCHEMY_DIR)
sys.path.append(ENV_NAME + "/site-packages")
sys.path.append(ENV_NAME + "/lib/python2.7/site-packages")
# make sure this is importable:
import mock
import sqlalchemy.testing
class Requirements(object):
def __getattr__(self, n):
def inner(f):
return f
inner.not_ = lambda: inner
return inner
sqlalchemy.testing.config.requirements = sqlalchemy.testing.requires = Requirements()
import glob
test_files = glob.glob(TEST_DIR + "/test*.py") + glob.glob(TEST_DIR + "/*/test*.py")
# These are the ones that pass on CPython (ie that we've stubbed enough of their testing
# infrastructure to run):
MODULES_TO_TEST = ['test.engine.test_parseconnect', 'test.ext.test_compiler', 'test.dialect.test_pyodbc', 'test.dialect.test_sybase', 'test.dialect.test_mxodbc', 'test.sql.test_inspect', 'test.sql.test_operators', 'test.sql.test_ddlemit', 'test.sql.test_cte', 'test.base.test_dependency', 'test.base.test_except', 'test.base.test_inspect', 'test.base.test_events', 'test.orm.test_inspect', 'test.orm.test_descriptor']
# These are currently broken on Pyston:
MODULES_TO_TEST.remove("test.sql.test_operators")
MODULES_TO_TEST.remove("test.base.test_events")
MODULES_TO_TEST.remove("test.orm.test_descriptor")
passed = []
failed = []
for fn in test_files:
assert fn.startswith(TEST_DIR + '/')
assert fn.endswith(".py")
mname = fn[len(SQLALCHEMY_DIR) + 1:-3].replace('/', '.')
if mname not in MODULES_TO_TEST:
continue
print
print mname
try:
m = __import__(mname, fromlist=["__all__"])
for nname in dir(m):
n = getattr(m, nname)
if not nname.endswith("Test") or not isinstance(n, type):
continue
print "Running", n
n = n()
for t in dir(n):
if not t.startswith("test_"):
continue
print "Running", t
n.setup()
getattr(n, t)()
n.teardown()
except Exception:
print mname, "FAILED"
traceback.print_exc()
failed.append(mname)
else:
print mname, "PASSED"
passed.append(mname)
print "passing:", passed
print "failing:", failed
print
if failed:
print "FAILED"
sys.exit(1)
else:
print "PASSED"
# skip-if: True
# - getting to the point of running the sqlalchemy tests is quite hard, since there is a lot
# of pytest code that runs beforehand.
import os
import sys
import subprocess
import shutil
ENV_NAME = "sqlalchemy_test_env_" + os.path.basename(sys.executable)
if not os.path.exists(ENV_NAME) or os.stat(sys.executable).st_mtime > os.stat(ENV_NAME + "/bin/python").st_mtime:
print "Creating virtualenv to install testing dependencies..."
VIRTUALENV_SCRIPT = os.path.dirname(__file__) + "/virtualenv/virtualenv.py"
try:
args = [sys.executable, VIRTUALENV_SCRIPT, "-p", sys.executable, ENV_NAME]
print "Running", args
subprocess.check_call(args)
subprocess.check_call([ENV_NAME + "/bin/pip", "install", "mock==1.0.0", "pytest==2.7.2", "py==1.4.30"])
except:
print "Error occurred; trying to remove partially-created directory"
ei = sys.exc_info()
try:
subprocess.check_call(["rm", "-rf", ENV_NAME])
except Exception as e:
print e
raise ei[0], ei[1], ei[2]
# subprocess.check_call([os.path.abspath("sqlalchemy_test_env/bin/python"), "-c", "import py; print type(py); print py.builtin"])
SQLALCHEMY_DIR = os.path.dirname(__file__) + "/sqlalchemy"
python_exe = os.path.abspath(ENV_NAME + "/bin/python")
# Exec'ing the test suite can be nice for debugging, but let's the subprocess version
# in case we want to do stuff afterwards:
do_exec = True
if do_exec:
print "About to exec"
os.chdir(SQLALCHEMY_DIR)
os.execl(python_exe, python_exe, "-m", "pytest")
else:
subprocess.check_call([python_exe, "-m", "pytest"], cwd=SQLALCHEMY_DIR)
print
print "PASSED"
Subproject commit e715c2e4beec912248bcaa258b4dfd7c015a9273
import os
import sys
import subprocess
import shutil
VIRTUALENV_SCRIPT = os.path.dirname(__file__) + "/virtualenv/virtualenv.py"
if os.path.exists("test_env"):
print "Removing the existing 'test_env/' directory"
subprocess.check_call(["rm", "-rf", "test_env"])
# shutil follows symlinks to directories, and deletes whatever those contain.
# shutil.rmtree("test_env")
args = [sys.executable, VIRTUALENV_SCRIPT, "-p", sys.executable, "test_env"]
print "Running", args
subprocess.check_call(args)
sh_script = """
set -e
. test_env/bin/activate
set -ux
python -c 'import __future__'
python -c 'import sys; print sys.executable'
# The first entry of each line is the main thing we're testing; the rest are dependencies.
# List the dependencies explicitly so that we can enforce specific revisions; these were the
# versions that got installed as of 6/5/15
pip install bcrypt==1.1.0 cffi==1.1.0 six==1.9.0 pycparser==2.13
pip install python-gflags==2.0
pip install sqlalchemy==1.0.0
pip install Pillow==2.8.1
pip install decorator==3.4.2
pip install oauth2client==1.4.11 httplib2==0.9.1 pyasn1==0.1.7 pyasn1-modules==0.0.5 rsa==3.1.4
python -c 'import bcrypt; assert bcrypt.__version__ == "1.1.0"; assert bcrypt.hashpw("password1", "$2a$12$0123456789012345678901").endswith("I1hdtg4K"); print "bcrypt seems to work"'
python -c 'import gflags; print "gflags imports"'
python -c 'import sqlalchemy; print "sqlalchemy imports"'
python -c 'from PIL import Image; print "Pillow imports"'
python -c 'import decorator; print "decorator imports"'
python -c 'import oauth2client; print "oauth2client imports"'
""".strip()
# print sh_script
subprocess.check_call(["sh", "-c", sh_script], stdout=sys.stderr)
print
print "PASSED"
Subproject commit 56631b487c6bfa7ccd9525cba2a27baff9b6b491
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment