Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
3dd0b69e
Commit
3dd0b69e
authored
Jul 23, 2015
by
Tom Soulanille
Committed by
Damien George
Jul 26, 2015
Browse files
Options
Downloads
Patches
Plain Diff
run-tests: Use PTY when running REPL tests.
parent
7d588b0c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/cmdline/repl_cont.py.exp
+3
-3
3 additions, 3 deletions
tests/cmdline/repl_cont.py.exp
tests/run-tests
+33
-7
33 additions, 7 deletions
tests/run-tests
with
36 additions
and
10 deletions
tests/cmdline/repl_cont.py.exp
+
3
−
3
View file @
3dd0b69e
Micro Python \.\+ linux version
>>> # check REPL allows to continue input
>>> 1 \
>>> 1 \
\\\
... + 2
3
>>> 'abc'
...
...
@@ -9,10 +9,10 @@ Micro Python \.\+ linux version
'abc'
>>> '''abc
... def'''
'abc\ndef'
'abc\
\\\
ndef'
>>> """ABC
... DEF"""
'ABC\nDEF'
'ABC\
\\\
nDEF'
>>> print(
... 1 + 2)
3
...
...
This diff is collapsed.
Click to expand it.
tests/run-tests
+
33
−
7
View file @
3dd0b69e
...
...
@@ -42,9 +42,33 @@ def run_micropython(pyb, args, test_file):
# run the test, possibly with redirected input
try
:
if
test_file
.
startswith
(
'
cmdline/repl_
'
):
f
=
open
(
test_file
,
'
rb
'
)
output_mupy
=
subprocess
.
check_output
(
args
,
stdin
=
f
)
f
.
close
()
# Need to use a PTY to test command line editing
import
pty
import
select
def
get
():
rv
=
b
''
while
True
:
ready
=
select
.
select
([
master
],
[],
[],
0.02
)
if
ready
[
0
]
==
[
master
]:
rv
+=
os
.
read
(
master
,
1024
)
else
:
return
rv
def
send_get
(
what
):
os
.
write
(
master
,
what
)
return
get
()
with
open
(
test_file
,
'
rb
'
)
as
f
:
# instead of: output_mupy = subprocess.check_output(args, stdin=f)
master
,
slave
=
pty
.
openpty
()
p
=
subprocess
.
Popen
(
args
,
stdin
=
slave
,
stdout
=
slave
,
stderr
=
subprocess
.
STDOUT
,
bufsize
=
0
)
banner
=
get
()
output_mupy
=
banner
+
b
''
.
join
(
send_get
(
line
)
for
line
in
f
)
p
.
kill
()
os
.
close
(
master
)
os
.
close
(
slave
)
else
:
output_mupy
=
subprocess
.
check_output
(
args
+
[
test_file
])
except
subprocess
.
CalledProcessError
:
...
...
@@ -64,6 +88,9 @@ def run_micropython(pyb, args, test_file):
cs
.
append
(
'
\\
'
+
c
)
else
:
cs
.
append
(
c
)
# accept carriage-return(s) before final newline
if
cs
[
-
1
]
==
'
\n
'
:
cs
[
-
1
]
=
'
\r
*
\n
'
return
bytes
(
''
.
join
(
cs
),
'
utf8
'
)
# convert parts of the output that are not stable across runs
...
...
@@ -96,6 +123,9 @@ def run_micropython(pyb, args, test_file):
# a regex
if
lines_exp
[
i
][
1
].
match
(
lines_mupy
[
i_mupy
]):
lines_mupy
[
i_mupy
]
=
lines_exp
[
i
][
0
]
else
:
#print("don't match: %r %s" % (lines_exp[i][1], lines_mupy[i_mupy])) # DEBUG
pass
i_mupy
+=
1
if
i_mupy
>=
len
(
lines_mupy
):
break
...
...
@@ -133,10 +163,6 @@ def run_tests(pyb, tests, args):
if
native
==
b
'
CRASH
'
:
skip_native
=
True
# These tests no longer work; TODO change them or remove them
skip_tests
.
add
(
'
cmdline/repl_basic.py
'
)
skip_tests
.
add
(
'
cmdline/repl_cont.py
'
)
# Some tests shouldn't be run under Travis CI
if
os
.
getenv
(
'
TRAVIS
'
)
==
'
true
'
:
skip_tests
.
add
(
'
basics/memoryerror.py
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment