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
2251fc41
Commit
2251fc41
authored
Nov 13, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #214 from vinzenz/astprint-improvements
Astprint improvements
parents
287ead74
a2cb7c95
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
11 deletions
+31
-11
src/Makefile
src/Makefile
+5
-1
tools/astprint.cpp
tools/astprint.cpp
+11
-3
tools/astprint_test.sh
tools/astprint_test.sh
+15
-7
No files found.
src/Makefile
View file @
2251fc41
...
...
@@ -589,10 +589,14 @@ $(TOOLS_DIR)/astprint: $(TOOLS_DIR)/astprint.cpp $(BUILD_SYSTEM_DEPS) $(LLVM_DEP
$(ECHO)
Linking
$(TOOLS_DIR)
/astprint
$(VERB)
$(CXX)
$<
-o
$@
$(LLVM_LIB_DEPS)
$(ASTPRINT_OBJS)
$(LDFLAGS)
$(STDLIB_SRCS:.cpp=.o)
$(CXXFLAGS_DBG)
.PHONY
:
astprint
.PHONY
:
astprint
astcompare
astprint
:
$(TOOLS_DIR)/astprint
astcompare
:
astprint
$(ECHO)
Running libpypa vs CPython AST result comparison
test
$(TOOLS_DIR)
/astprint_test.sh
&&
echo
"Success"
||
echo
"Failure"
## END OF TOOLS
...
...
tools/astprint.cpp
View file @
2251fc41
...
...
@@ -20,8 +20,16 @@ int main(int argc, char const ** argv) {
std
::
string
fn
=
argv
[
1
+
int
(
argc
>
2
)];
AST_Module
*
m
=
caching_parse
(
fn
.
c_str
());
PrintVisitor
*
visitor
=
new
PrintVisitor
(
4
);
visitor
->
visit_module
(
m
);
try
{
AST_Module
*
m
=
caching_parse
(
fn
.
c_str
());
PrintVisitor
*
visitor
=
new
PrintVisitor
(
4
);
visitor
->
visit_module
(
m
);
}
catch
(
Box
*
b
)
{
std
::
string
msg
=
formatException
(
b
);
printLastTraceback
();
fprintf
(
stderr
,
"%s
\n
"
,
msg
.
c_str
());
return
1
;
}
return
0
;
}
tools/astprint_test.sh
View file @
2251fc41
...
...
@@ -6,16 +6,24 @@ pushd `dirname $0` > /dev/null
SCRIPTPATH
=
`
pwd
-P
`
popd
>
/dev/null
pad
=
$(
printf
'%0.1s'
" "
{
1..90
}
)
TESTSDIR
=
`
realpath
$SCRIPTPATH
/../test/tests
`
pad
=
$(
printf
'%0.1s'
" "
{
1..90
}
)
for
test_script
in
`
find
$TESTSDIR
-name
"*.py"
`
;
mkdir
-p
results
for
test_script
in
`
find
$TESTSDIR
-name
"*.py"
`
do
$SCRIPTPATH
/astprint
$test_script
>
$test_script
.python
$SCRIPTPATH
/astprint
-x
$test_script
>
$test_script
.pypa
diff
-q
$test_script
.python
$test_script
.pypa 2>&1
>
/dev/null
&&
result
=
`
echo
-e
"[
\0
33[0;32mSUCCESS
\0
33[0m]"
`
||
result
=
`
echo
-e
"[
\0
33[0;31mFAILED
\0
33[0m]"
`
&&
TOTALRESULT
=
1
resultspath
=
"./results/
${
test_script
#
$TESTSDIR
}
"
echo
$resultspath
|
grep
"encoding"
&&
continue
echo
$resultspath
|
grep
"codec"
&&
continue
$SCRIPTPATH
/astprint
$test_script
2>&1
>
/dev/null
||
(
echo
$test_script
"[SKIPPED]"
&&
continue
)
mkdir
-p
`
dirname
$resultspath
`
touch
$resultspath
.python
$resultspath
.pypa
$SCRIPTPATH
/astprint
$test_script
>
$resultspath
.python
grep
"Warning: converting unicode literal to str"
$resultspath
.python 2>&1
>
/dev/null
&&
rm
-f
$resultspath
.python
&&
continue
$SCRIPTPATH
/astprint
-x
$test_script
>
$resultspath
.pypa
diff
-q
$resultspath
.python
$resultspath
.pypa 2>&1
>
/dev/null
&&
result
=
`
echo
-e
"[
\0
33[0;32mSUCCESS
\0
33[0m]"
`
&&
rm
-f
$resultspath
.pypa
$resultspath
.python
||
result
=
`
echo
-e
"[
\0
33[0;31mFAILED
\0
33[0m]"
`
&&
TOTALRESULT
=
1
reltestscript
=
$(
perl
-MFile
::Spec
-e
"print File::Spec->abs2rel(q(
$test_script
),q(
$SCRIPTPATH
))"
)
echo
"
$reltestscript
${
pad
:
${#
test_script
}}
"
$result
done
exit
$TOTAL_RESULT
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