Skip to content

travis: Add job to build and test unix minimal port. #5227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ jobs:
after_failure:
- (cd tests && for exp in *.exp; do testbase=$(basename $exp .exp); echo -e "\nFAILURE $testbase"; diff -u $testbase.exp $testbase.out; done)

# minimal unix port with tests
- stage: test
env: NAME="minimal unix port build and tests"
script:
- make ${MAKEOPTS} -C ports/unix minimal
- (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/micropython_minimal ./run-tests -e exception_chain -e self_type_check -e subclass_native_init -d basics)

# windows port via mingw
- stage: test
env: NAME="windows port build via mingw"
Expand Down
1 change: 1 addition & 0 deletions ports/unix/mphalport.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

void mp_hal_set_interrupt_char(char c);

#define mp_hal_stdio_poll unused // this is not implemented, nor needed
void mp_hal_stdio_mode_raw(void);
void mp_hal_stdio_mode_orig(void);

Expand Down
2 changes: 1 addition & 1 deletion tests/basics/async_await2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@coroutine
def wait(value):
print('wait value:', value)
msg = yield 'message from wait(%u)' % value
msg = yield 'message from wait({})'.format(value)
print('wait got back:', msg)
return 10

Expand Down
2 changes: 1 addition & 1 deletion tests/basics/builtin_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# dir of module
import sys
print('exit' in dir(sys))
print('version' in dir(sys))

# dir of type
print('append' in dir(list))
Expand Down
2 changes: 0 additions & 2 deletions tests/basics/bytes_add.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# test bytes + other

print(b"123" + b"456")
print(b"123" + bytearray(2))

print(b"123" + b"") # RHS is empty, can be optimised
print(b"" + b"123") # LHS is empty, can be optimised
print(b"" + bytearray(1)) # LHS is empty but can't be optimised
5 changes: 5 additions & 0 deletions tests/basics/bytes_add_bytearray.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# test bytes + bytearray

print(b"123" + bytearray(2))

print(b"" + bytearray(1)) # LHS is empty but can't be optimised
4 changes: 0 additions & 4 deletions tests/basics/bytes_compare2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
print(b"1" == 1)
print(b"123" == bytearray(b"123"))
print(b'123' < bytearray(b"124"))
print(b'123' > bytearray(b"122"))
print(bytearray(b"23") in b"1234")
4 changes: 4 additions & 0 deletions tests/basics/bytes_compare_bytearray.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
print(b"123" == bytearray(b"123"))
print(b'123' < bytearray(b"124"))
print(b'123' > bytearray(b"122"))
print(bytearray(b"23") in b"1234")
3 changes: 1 addition & 2 deletions tests/basics/bytes_construct.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# test construction of bytes from different objects

# tuple, list, bytearray
# tuple, list
print(bytes((1, 2)))
print(bytes([1, 2]))
print(bytes(bytearray(4)))

# constructor value out of range
try:
Expand Down
3 changes: 3 additions & 0 deletions tests/basics/bytes_construct_bytearray.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# test construction of bytes from bytearray

print(bytes(bytearray(4)))
7 changes: 7 additions & 0 deletions tests/basics/bytes_format_modulo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# This test requires CPython3.5

try:
b'' % ()
except TypeError:
print("SKIP")
raise SystemExit

print(b"%%" % ())
print(b"=%d=" % 1)
print(b"=%d=%d=" % (1, 2))
Expand Down
4 changes: 2 additions & 2 deletions tests/basics/class_inplace_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __add__(self, o):
return A(self.v + o.v)

def __repr__(self):
return "A(%s)" % self.v
return "A({})".format(self.v)

a = A(5)
b = a
Expand All @@ -37,7 +37,7 @@ def __iadd__(self, o):
return self

def __repr__(self):
return "L(%s)" % self.v
return "L({})".format(self.v)

c = L([1, 2])
d = c
Expand Down
2 changes: 1 addition & 1 deletion tests/basics/class_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ class C:

c = C()
try:
d = bytearray(c)
d = bytes(c)
except TypeError:
print('TypeError')
2 changes: 1 addition & 1 deletion tests/basics/class_notimpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, value):
self.value = value

def __str__(self):
return "C(%s)" % self.value
return "C({})".format(self.value)

def __add__(self, rhs):
print(self, '+', rhs)
Expand Down
2 changes: 1 addition & 1 deletion tests/basics/class_reverse_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __radd__(self, o):
return A(self.v + o)

def __repr__(self):
return "A(%s)" % self.v
return "A({})".format(self.v)

print(A(3) + 1)
print(2 + A(5))
4 changes: 0 additions & 4 deletions tests/basics/list1.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
x += [2, 1]
print(x)

print(x[1:])
print(x[:-1])
print(x[2:3])

# unsupported type on RHS of add
try:
[] + None
Expand Down
5 changes: 5 additions & 0 deletions tests/basics/list_slice.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# test list slices, getting values

x = list(range(10))

print(x[1:])
print(x[:-1])
print(x[2:3])

a = 2
b = 4
c = 3
Expand Down
14 changes: 0 additions & 14 deletions tests/basics/op_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
~[]
except TypeError:
print('TypeError')
try:
~bytearray()
except TypeError:
print('TypeError')

# unsupported binary operators
try:
Expand All @@ -31,16 +27,6 @@
1 in 1
except TypeError:
print('TypeError')
try:
bytearray() // 2
except TypeError:
print('TypeError')

# object with buffer protocol needed on rhs
try:
bytearray(1) + 1
except TypeError:
print('TypeError')

# unsupported subscription
try:
Expand Down
19 changes: 19 additions & 0 deletions tests/basics/op_error_bytearray.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# test errors from bad operations (unary, binary, etc)

# unsupported unary operators
try:
~bytearray()
except TypeError:
print('TypeError')

# unsupported binary operators
try:
bytearray() // 2
except TypeError:
print('TypeError')

# object with buffer protocol needed on rhs
try:
bytearray(1) + 1
except TypeError:
print('TypeError')
6 changes: 6 additions & 0 deletions tests/basics/string_format_modulo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
try:
'' % ()
except TypeError:
print("SKIP")
raise SystemExit

print("%%" % ())
print("=%s=" % 1)
print("=%s=%s=" % (1, 2))
Expand Down
6 changes: 6 additions & 0 deletions tests/basics/string_format_modulo_int.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# test string modulo formatting with int values

try:
'' % ()
except TypeError:
print("SKIP")
raise SystemExit

# basic cases
print("%d" % 10)
print("%+d" % 10)
Expand Down
2 changes: 1 addition & 1 deletion tests/basics/string_repr.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# anything above 0xa0 is printed as Unicode by CPython
# the abobe is CPython implementation detail, stick to ASCII
for c in range(0x80):
print("0x%02x: %s" % (c, repr(chr(c))))
print("0x{:02x}: {}".format(c, repr(chr(c))))
4 changes: 2 additions & 2 deletions tests/basics/subclass_native_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class my_bytes(bytes):
print(b1 + b3)
print(b3 + b1)

# bytearray construction will use the buffer protocol
print(bytearray(b1))
# bytes construction will use the buffer protocol
print(bytes(b1))
15 changes: 0 additions & 15 deletions tests/basics/sys1.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,3 @@
except AttributeError:
# Effectively skip subtests
print(True)

try:
raise SystemExit
except SystemExit as e:
print("SystemExit", e.args)

try:
sys.exit()
except SystemExit as e:
print("SystemExit", e.args)

try:
sys.exit(42)
except SystemExit as e:
print("SystemExit", e.args)
24 changes: 24 additions & 0 deletions tests/basics/sys_exit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# test sys module's exit function

import sys

try:
sys.exit
except AttributeError:
print("SKIP")
raise SystemExit

try:
raise SystemExit
except SystemExit as e:
print("SystemExit", e.args)

try:
sys.exit()
except SystemExit as e:
print("SystemExit", e.args)

try:
sys.exit(42)
except SystemExit as e:
print("SystemExit", e.args)
4 changes: 0 additions & 4 deletions tests/basics/tuple1.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
except AttributeError:
print("AttributeError")

print(x[1:])
print(x[:-1])
print(x[2:3])

print(x + (10, 100, 10000))

# inplace add operator
Expand Down
7 changes: 7 additions & 0 deletions tests/basics/tuple_slice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# tuple slicing

x = (1, 2, 3 * 4)

print(x[1:])
print(x[:-1])
print(x[2:3])
5 changes: 5 additions & 0 deletions tests/feature_check/bytearray.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
try:
bytearray
print("bytearray")
except NameError:
print("no")
Empty file.
5 changes: 5 additions & 0 deletions tests/feature_check/slice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
try:
slice
print("slice")
except NameError:
print("no")
Empty file.
5 changes: 5 additions & 0 deletions tests/feature_check/uio_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
try:
import uio
print("uio")
except ImportError:
print("no")
Empty file.
Loading