8000 Turn on Rosie CI testing to test new builds on real hardware. · eighthree/circuitpython@fab634e · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit fab634e

Browse files
committed
Turn on Rosie CI testing to test new builds on real hardware.
This introduces a skip_if module that can be used by tests to determine when they should be skipped due to the environment. Some tests have been split in order to have finer grained skip control.
1 parent f6a7025 commit fab634e

31 files changed

+306
-84
lines changed

.rosie.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This configuration file tells Rosie where to find prebuilt .bin files (Travis
2+
# builds them) and where to find the tests.
3+
4+
binaries:
5+
prebuilt_s3: adafruit-circuit-python
6+
file_pattern: bin/{board}/adafruit-circuitpython-{board}-*-{short_sha}.{extension}
7+
8+
circuitpython_tests:
9+
test_directories:
10+
- tests/basics
11+
- tests/circuitpython
12+
test_helper:
13+
- tests/skip_if.py

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ notifications:
2020
on_success: change # options: [always|never|change] default: always
2121
on_failure: always # options: [always|never|change] default: always
2222
on_start: never # options: [always|never|change] default: always
23+
webhooks:
24+
urls:
25+
- https://rosie-ci.ngrok.io/travis
26+
on_success: always
27+
on_failure: always
28+
on_start: always
29+
on_cancel: always
30+
on_error: always
2331

2432
before_script:
2533
- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa

atmel-samd/mpconfigport.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#define MICROPY_ENABLE_DOC_STRING (0)
3434
//#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
3535
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)
36-
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0)
3736
#define MICROPY_PY_ASYNC_AWAIT (0)
3837
#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
3938
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
@@ -61,7 +60,6 @@
6160
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (0)
6261
#define MICROPY_PY_STRUCT (1)
6362
#define MICROPY_PY_SYS (1)
64-
#define MICROPY_CPYTHON_COMPAT (0)
6563
// If you change MICROPY_LONGINT_IMPL, also change MPY_TOOL_LONGINT_IMPL in mpconfigport.mk.
6664
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
6765
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
@@ -166,6 +164,13 @@ extern const struct _mp_obj_module_t usb_hid_module;
166164
#define MICROPY_PY_URE (1)
167165
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
168166
#define MICROPY_PY_FRAMEBUF (1)
167+
168+
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (1)
169+
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
170+
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
171+
#define MICROPY_PY_SYS_MAXSIZE (1)
172+
#define MICROPY_CPYTHON_COMPAT (1)
173+
169174
#define EXTRA_BUILTIN_MODULES \
170175
{ MP_OBJ_NEW_QSTR(MP_QSTR_audioio), (mp_obj_t)&audioio_module }, \
171176
{ MP_OBJ_NEW_QSTR(MP_QSTR_audiobusio), (mp_obj_t)&audiobusio_module }, \
@@ -177,6 +182,9 @@ extern const struct _mp_obj_module_t usb_hid_module;
177182
#define MICROPY_PY_MICROPYTHON_MEM_INFO (0)
178183
#define MICROPY_PY_FRAMEBUF (0)
179184
#define EXTRA_BUILTIN_MODULES
185+
186+
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0)
187+
#define MICROPY_CPYTHON_COMPAT (0)
180188
#endif
181189

182190
#define MICROPY_PORT_BUILTIN_MODULES \

index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Adafruit CircuitPython API Reference
1313
:target: https://gitter.im/adafruit/circuitpython?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
1414
:alt: Gitter
1515

16+
.. image :: https://img.shields.io/discord/327254708534116352.svg
17+
:target: https://adafru.it/discord
18+
:alt: Discord
19+
1620
Welcome! This is the documentation for Adafruit CircuitPython. It is an open
1721
source derivative of `MicroPython <https://micropython.org>`_ for use on
1822
educational development boards designed and sold by `Adafruit

lib/utils/pyexec.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
136136
if (mp_obj_is_exception_instance(return_value)) {
137137
size_t n, *values;
138138
mp_obj_exception_get_traceback(return_value, &n, &values);
139-
result->exception_line = values[n - 2];
139+
if (values != NULL) {
140+
result->exception_line = values[n - 2];
141+
}
140142
}
141143
}
142144
}

py/builtinimport.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ STATIC mp_import_stat_t find_file(const char *file_str, uint file_len, vstr_t *d
115115
vstr_reset(dest);
116116
size_t p_len;
117117
const char *p = mp_obj_str_get_data(path_items[i], &p_len);
118+
DEBUG_printf("Looking in path: %d =%s=\n", i, p);
118119
if (p_len > 0) {
119120
vstr_add_strn(dest, p, p_len);
120121
vstr_add_char(dest, PATH_SEP_CHAR);
@@ -386,6 +387,7 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
386387
mp_import_stat_t stat;
387388
if (vstr_len(&path) == 0) {
388389
// first module in the dotted-name; search for a directory or file
390+
DEBUG_printf("Find file =%.*s=\n", vstr_len(&path), vstr_str(&path));
389391
stat = find_file(mod_str, i, &path);
390392
} else {
391393
// latter module in the dotted-name; append to path

py/frozenmod.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ STATIC mp_lexer_t *mp_lexer_frozen_str(const char *str, size_t str_len) {
7272
mp_lexer_t *lex = MICROPY_MODULE_FROZEN_LEXER(source, content, file_len, 0);
7373
return lex;
7474
}
75-
7675
#endif
7776

7877
#if MICROPY_MODULE_FROZEN_MPY

py/mkrules.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ $(TOP)/mpy-cross/mpy-cross: $(TOP)/py/*.[ch] $(TOP)/mpy-cross/*.[ch] $(TOP)/wind
107107
$(Q)$(MAKE) -C $(TOP)/mpy-cross
108108

109109
# make a list of all the .py files that need compiling and freezing
110+
BLAH := $(info $(shell pwd))
110111

111112
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py' | $(SED) -e 's=^$(FROZEN_MPY_DIR)/==')
112113
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/frozen_mpy/,$(FROZEN_MPY_PY_FILES:.py=.mpy))

py/mpconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
// to another, you must rebuild from scratch using "-B" switch to make.
4141

4242
#ifdef MP_CONFIGFILE
43-
#include MP_CONFIGFILE
43+
#include "mpconfigport_coverage.h"
4444
#else
4545
#include <mpconfigport.h>
4646
#endif

tests/basics/array_intbig.py

< F438 div class="d-flex mr-2 flex-justify-end flex-items-center flex-1">
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# test array types QqLl that require big-ints
2+
import skip_if
3+
skip_if.no_bigint()
24

35
try:
46
from array import array

tests/basics/builtin_reversed.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
# test the builtin reverse() function
2-
try:
3-
reversed
4-
except:
5-
print("SKIP")
6-
raise SystemExit
1+
import skip_if
2+
skip_if.no_reversed()
73

84
# list
95
print(list(reversed([])))

tests/basics/bytearray_intbig.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1+
# Skip if long ints are not supported.
2+
try:
3+
# We have to use variables because 1 << 40 causes an exception on parse and
4+
# cannot be caught.
5+
x = 40
6+
x = 1 << x
7+
except OverflowError:
8+
print("SKIP")
9+
import sys
10+
sys.exit(1)
11+
112
print(bytearray(2**65 - (2**65 - 1)))

tests/basics/class_store_class.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
print("SKIP")
1212
raise SystemExit
1313

14+
import skip_if
15+
skip_if.no_cpython_compat()
16+
1417
_DefragResultBase = namedtuple('DefragResult', [ 'foo', 'bar' ])
1518

1619
class _ResultMixinStr(object):

tests/basics/dict_fromkeys2.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
try:
2-
reversed
3-
except:
4-
print("SKIP")
5-
raise SystemExit
1+
import skip_if
2+
skip_if.no_reversed()
63

74
# argument to fromkeys has no __len__
85
d = dict.fromkeys(reversed(range(1)))
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Skip this test if reversed() isn't built in.
2+
import skip_if
3+
skip_if.no_reversed()
4+
5+
# argument to fromkeys has no __len__
6+
d = dict.fromkeys(reversed(range(1)))
7+
print(d)

tests/basics/int_big_zeroone.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# test [0,-0,1,-1] edge cases of bignum
22

3+
# Skip if long ints are not supported.
4+
try:
5+
# We have to use variables because 1 << 40 causes an exception on parse and
6+
# cannot be caught.
7+
x = 40
8+
x = 1 << x
9+
except OverflowError:
10+
print("SKIP")
11+
import sys
12+
sys.exit(1)
13+
314
long_zero = (2**64) >> 65
415
long_neg_zero = -long_zero
516
long_one = long_zero + 1

tests/basics/int_bytes.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
print((10).to_bytes(1, "little"))
22
print((111111).to_bytes(4, "little"))
33
print((100).to_bytes(10, "little"))
4-
print(int.from_bytes(b"\x00\x01\0\0\0\0\0\0", "little"))
5-
print(int.from_bytes(b"\x01\0\0\0\0\0\0\0", "little"))
6-
print(int.from_bytes(b"\x00\x01\0\0\0\0\0\0", "little"))
74

85
# check that extra zero bytes don't change the internal int value
96
print(int.from_bytes(bytes(20), "little") == 0)

tests/basics/int_bytes_intbig.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import skip_if
2+
skip_if.no_bigint()
3+
14
print((2**64).to_bytes(9, "little"))
25

36
b = bytes(range(20))

tests/basics/int_longint_bytes.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Skip if long ints are not supported.
2+
try:
3+
# We have to use variables because 1 << 40 causes an exception on parse and
4+
# cannot be caught.
5+
x = 40
6+
x = 1 << x
7+
except OverflowError:
8+
print("SKIP")
9+
import sys
10+
sys.exit(1)
11+
12+
print((2**64).to_bytes(9, "little"))
13+
print(int.from_bytes(b"\x00\x01\0\0\0\0\0\0", "little"))
14+
print(int.from_bytes(b"\x01\0\0\0\0\0\0\0", "little"))
15+
print(int.from_bytes(b"\x00\x01\0\0\0\0\0\0", "little"))

tests/basics/memoryview1.py

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -46,51 +46,3 @@
4646
print(list(m[1:-1]))
4747
m[2] = 6
4848
print(a)
49-
50-
# test slice assignment between memoryviews
51-
b1 = bytearray(b'1234')
52-
b2 = bytearray(b'5678')
53-
b3 = bytearray(b'5678')
54-
m1 = memoryview(b1)
55-
m2 = memoryview(b2)
56-
m3 = memoryview(b3)
57-
m2[1:3] = m1[0:2]
58-
print(b2)
59-
b3[1:3] = m1[0:2]
60-
print(b3)
61-
m1[2:4] = b3[1:3]
62-
print(b1)
63-
64-
try:
65-
m2[1:3] = b1[0:4]
66-
except ValueError:
67-
print("ValueError")
68-
69-
try:
70-
m2[1:3] = m1[0:4]
71-
except ValueError:
72-
print("ValueError")
73-
74-
try:
75-
m2[0:4] = m1[1:3]
76-
except ValueError:
77-
print("ValueError")
78-
79-
# test memoryview of arrays with items sized larger than 1
80-
a1 = array.array('i', [0]*5)
81-
m4 = memoryview(a1)
82-
a2 = array.array('i', [3]*5)
83-
m5 = memoryview(a2)
84-
m4[1:3] = m5[1:3]
85-
print(a1)
86-
87-
try:
88-
m4[1:3] = m2[1:3]
89-
except ValueError:
90-
print("ValueError")
91-
92-
# invalid assignment on RHS
93-
try:
94-
memoryview(array.array('i'))[0:2] = b'1234'
95-
except ValueError:
96-
print('ValueError')
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import skip_if
2+
3+
try:
4+
memoryview
5+
except:
6+
skip_if.skip()
7+
8+
skip_if.no_slice_assign()
9+
10+
# test slice assignment between memoryviews
11+
b1 = bytearray(b'1234')
12+
b2 = bytearray(b'5678')
13+
b3 = bytearray(b'5678')
14+
m1 = memoryview(b1)
15+
m2 = memoryview(b2)
16+
m3 = memoryview(b3)
17+
m2[1:3] = m1[0:2]
18+
print(b2)
19+
b3[1:3] = m1[0:2]
20+
print(b3)
21+
m1[2:4] = b3[1:3]
22+
print(b1)
23+
24+
try:
25+
m2[1:3] = b1[0:4]
26+
except ValueError:
27+
print("ValueError")
28+
29+
try:
30+
m2[1:3] = m1[0:4]
31+
except ValueError:
32+
print("ValueError")
33+
34+
try:
35+
m2[0:4] = m1[1:3]
36+
except ValueError:
37+
print("ValueError")
38+
39+
import array
40+
41+
# test memoryview of arrays with items sized larger than 1
42+
a1 = array.array('i', [0]*5)
43+
m4 = memoryview(a1)
44+
a2 = array.array('i', [3]*5)
45+
m5 = memoryview(a2)
46+
m4[1:3] = m5[1:3]
47+
print(a1)
48+
49+
try:
50+
m4[1:3] = m2[1:3]
51+
except ValueError:
52+
print("ValueError")
53+
54+
# invalid assignment on RHS
55+
try:
56+
memoryview(array.array('i'))[0:2] = b'1234'
57+
except ValueError:
58+
print('ValueError')

tests/basics/namedtuple1.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@
6565
except TypeError:
6666
print("TypeError")
6767

68-
# Try single string
69-
T3 = namedtuple("TupComma", "foo bar")
70-
t = T3(1, 2)
71-
print(t.foo, t.bar)
72-
7368
# Try tuple
7469
T4 = namedtuple("TupTuple", ("foo", "bar"))
7570
t = T4(1, 2)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import skip_if
2+
skip_if.no_cpython_compat()
3+
4+
try:
5+
try:
6+
from collections import namedtuple
7+
except ImportError:
8+
from ucollections import namedtuple
9+
except ImportError:
10+
skip_if.skip()
11+
12+
# Try single string
13+
T3 = namedtuple("TupComma", "foo bar")
14+
t = T3(1, 2)
15+
print(t.foo, t.bar)
16+
17+
# Try single string with comma field separator
18+
# Not implemented so far
19+
#T2 = namedtuple("TupComma", "foo,bar")
20+
#t = T2(1, 2)

tests/basics/print.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# test builtin print function
22

3+
print("break the test")
34
print()
45
print(None)
56
print('')

0 commit comments

Comments
 (0)
0