11#! /bin/bash
22
3+ CP=/bin/cp
4+
35# #######################################################################################
46# commit formatting
57
@@ -12,6 +14,92 @@ function ci_commit_formatting_run {
1214 tools/verifygitlog.py -v upstream/master..HEAD --no-merges
1315}
1416
17+ # #######################################################################################
18+ # package tests
19+
20+ MICROPYTHON=/tmp/micropython/ports/unix/build-standard/micropython
21+
22+ function ci_package_tests_setup_micropython {
23+ git clone https://github.com/micropython/micropython.git /tmp/micropython
24+
25+ # build mpy-cross and micropython (use -O0 to speed up the build)
26+ make -C /tmp/micropython/mpy-cross -j CFLAGS_EXTRA=-O0
27+ make -C /tmp/micropython/ports/unix submodules
28+ make -C /tmp/micropython/ports/unix -j CFLAGS_EXTRA=-O0
29+ }
30+
31+ function ci_package_tests_setup_lib {
32+ mkdir -p ~ /.micropython/lib
33+ $CP micropython/ucontextlib/ucontextlib.py ~ /.micropython/lib/
34+ $CP python-stdlib/fnmatch/fnmatch.py ~ /.micropython/lib/
35+ $CP -r python-stdlib/hashlib-core/hashlib ~ /.micropython/lib/
36+ $CP -r python-stdlib/hashlib-sha224/hashlib ~ /.micropython/lib/
37+ $CP -r python-stdlib/hashlib-sha256/hashlib ~ /.micropython/lib/
38+ $CP -r python-stdlib/hashlib-sha384/hashlib ~ /.micropython/lib/
39+ $CP -r python-stdlib/hashlib-sha512/hashlib ~ /.micropython/lib/
40+ $CP python-stdlib/shutil/shutil.py ~ /.micropython/lib/
41+ $CP python-stdlib/tempfile/tempfile.py ~ /.micropython/lib/
42+ $CP -r python-stdlib/unittest/unittest ~ /.micropython/lib/
43+ $CP -r python-stdlib/unittest-discover/unittest ~ /.micropython/lib/
44+ $CP unix-ffi/ffilib/ffilib.py ~ /.micropython/lib/
45+ tree ~ /.micropython
46+ }
47+
48+ function ci_package_tests_run {
49+ for test in \
50+ micropython/drivers/storage/sdcard/sdtest.py \
51+ micropython/xmltok/test_xmltok.py \
52+ python-ecosys/requests/test_requests.py \
53+ python-stdlib/argparse/test_argparse.py \
54+ python-stdlib/base64/test_base64.py \
55+ python-stdlib/binascii/test_binascii.py \
56+ python-stdlib/collections-defaultdict/test_defaultdict.py \
57+ python-stdlib/functools/test_partial.py \
58+ python-stdlib/functools/test_reduce.py \
59+ python-stdlib/heapq/test_heapq.py \
60+ python-stdlib/hmac/test_hmac.py \
61+ python-stdlib/itertools/test_itertools.py \
62+ python-stdlib/operator/test_operator.py \
63+ python-stdlib/os-path/test_path.py \
64+ python-stdlib/pickle/test_pickle.py \
65+ python-stdlib/string/test_translate.py \
66+ unix-ffi/gettext/test_gettext.py \
67+ unix-ffi/pwd/test_getpwnam.py \
68+ unix-ffi/re/test_re.py \
69+ unix-ffi/time/test_strftime.py \
70+ ; do
71+ echo " Running test $test "
72+ (cd ` dirname $test ` && $MICROPYTHON ` basename $test ` )
73+ if [ $? -ne 0 ]; then
74+ false # make this function return an error code
75+ return
76+ fi
77+ done
78+
79+ for path in \
80+ micropython/ucontextlib \
81+ python-stdlib/contextlib \
82+ python-stdlib/datetime \
83+ python-stdlib/fnmatch \
84+ python-stdlib/hashlib \
85+ python-stdlib/pathlib \
86+ python-stdlib/quopri \
87+ python-stdlib/shutil \
88+ python-stdlib/tempfile \
89+ python-stdlib/time \
90+ python-stdlib/unittest-discover/tests \
91+ ; do
92+ (cd $path && $MICROPYTHON -m unittest)
93+ if [ $? -ne 0 ]; then false ; return ; fi
94+ done
95+
96+ (cd micropython/usb/usb-device && $MICROPYTHON -m tests.test_core_buffer)
97+ if [ $? -ne 0 ]; then false ; return ; fi
98+
99+ (cd python-ecosys/cbor2 && $MICROPYTHON -m examples.cbor_test)
100+ if [ $? -ne 0 ]; then false ; return ; fi
101+ }
102+
15103# #######################################################################################
16104# build packages
17105
0 commit comments