Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
32d06f79
Commit
32d06f79
authored
Apr 16, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Have the django test start up the server and get a page
parent
824bdfc6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
6 deletions
+64
-6
Makefile
Makefile
+2
-1
src/jit.cpp
src/jit.cpp
+10
-1
test/integration/django_test.py
test/integration/django_test.py
+52
-4
No files found.
Makefile
View file @
32d06f79
...
...
@@ -496,7 +496,7 @@ check:
$(PYTHON)
$(TOOLS_DIR)/tester.py
-R
pyston_dbg
-j$(TEST_THREADS)
-k
-a
=
-n
-a
=
-x
-a
=
-S
$(TESTS_DIR)
$(ARGS)
@
# skip -O for dbg
$(MAKE)
run_unittests
$(MAKE)
run_unittests
ARGS
=
@
# Building in gcc mode is helpful to find various compiler-specific warnings.
@
# We've also discovered UB in our code from running in gcc mode, so try running it as well.
...
...
@@ -936,6 +936,7 @@ $(eval \
$1
:
nosearch_$1
$1
:
$(TESTS_DIR)/nosearch_$1 ;
$1
:
$(TEST_DIR)/cpython/nosearch_$1 ;
$1
:
$(TEST_DIR)/integration/nosearch_$1 ;
$1
:
./microbenchmarks/nosearch_$1 ;
$1
:
./minibenchmarks/nosearch_$1 ;
$1
:
./benchmarks/nosearch_$1 ;
...
...
src/jit.cpp
View file @
32d06f79
...
...
@@ -78,8 +78,9 @@ static int main(int argc, char** argv) {
int
code
;
bool
force_repl
=
false
;
bool
stats
=
false
;
bool
unbuffered
=
false
;
const
char
*
command
=
NULL
;
while
((
code
=
getopt
(
argc
,
argv
,
"+OqdIibpjtrsSvnxc:F"
))
!=
-
1
)
{
while
((
code
=
getopt
(
argc
,
argv
,
"+OqdIibpjtrsSvnxc:F
u
"
))
!=
-
1
)
{
if
(
code
==
'O'
)
FORCE_OPTIMIZE
=
true
;
else
if
(
code
==
't'
)
...
...
@@ -104,6 +105,8 @@ static int main(int argc, char** argv) {
stats
=
true
;
}
else
if
(
code
==
'S'
)
{
Py_NoSiteFlag
=
1
;
}
else
if
(
code
==
'u'
)
{
unbuffered
=
true
;
}
else
if
(
code
==
'r'
)
{
USE_STRIPPED_STDLIB
=
true
;
}
else
if
(
code
==
'b'
)
{
...
...
@@ -127,6 +130,12 @@ static int main(int argc, char** argv) {
Py_SetProgramName
(
argv
[
0
]);
if
(
unbuffered
)
{
setvbuf
(
stdin
,
(
char
*
)
NULL
,
_IONBF
,
BUFSIZ
);
setvbuf
(
stdout
,
(
char
*
)
NULL
,
_IONBF
,
BUFSIZ
);
setvbuf
(
stderr
,
(
char
*
)
NULL
,
_IONBF
,
BUFSIZ
);
}
{
Timer
_t
(
"for initCodegen"
);
initCodegen
();
...
...
test/integration/django_test.py
View file @
32d06f79
...
...
@@ -3,8 +3,11 @@
# TODO remove that directive, and also remove it from the subprocess commands down below.
import
os
import
signal
import
subprocess
import
sys
import
time
import
urllib2
EXTRA_PATH
=
os
.
path
.
dirname
(
__file__
)
+
"/django"
sys
.
path
.
insert
(
0
,
EXTRA_PATH
)
...
...
@@ -14,6 +17,12 @@ from django.core.management import execute_from_command_line
import
os
import
shutil
is_pyston
=
True
if
is_pyston
:
ARGS
=
"-xu"
else
:
ARGS
=
"-u"
if
os
.
path
.
exists
(
"testsite"
):
print
"Removing the existing 'testsite/' directory"
shutil
.
rmtree
(
"testsite"
)
...
...
@@ -24,12 +33,51 @@ try:
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
,
"-x"
,
"testsite/manage.py"
,
"migrate"
],
env
=
env
)
# subprocess.check_call([sys.executable, "testsite/manage.py", "runserver", "--noreload"])
os
.
environ
[
"PYTHONPATH"
]
=
os
.
environ
.
get
(
"PYTHONPATH"
,
""
)
+
":"
+
EXTRA_PATH
subprocess
.
check_call
([
sys
.
executable
,
ARGS
,
"testsite/manage.py"
,
"migrate"
])
print
"Running runserver localhost:8000"
p
=
subprocess
.
Popen
([
sys
.
executable
,
ARGS
,
"testsite/manage.py"
,
"runserver"
,
"--noreload"
,
"localhost:8000"
],
stdout
=
subprocess
.
PIPE
)
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")
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment