-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Unit tests and workflow to run them
- Loading branch information
Showing
45 changed files
with
1,360 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: RunTests | ||
# Runs the workflow on the below events: | ||
# 1. on pull request raised to trunk branch. | ||
# 2. on push event to trunk branch. | ||
on: | ||
push: | ||
branches: | ||
- trunk | ||
pull_request: | ||
branches: | ||
- trunk | ||
|
||
permissions: # added using https://github.com/step-security/secure-workflows | ||
contents: read | ||
|
||
jobs: | ||
lint-markdown: | ||
runs-on: ubuntu-latest | ||
name: Run Tests | ||
steps: | ||
- name: checkout repo content | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- name: Install MicroPython and run tests | ||
run: | | ||
DLURL="https://github.com/atsign-foundation/micropython/releases/download/" | ||
ATMPREL="1.20.0_3faded33f_AES_CTR/micropython_1.20.0_3faded33f_linux_x64.tgz" | ||
wget ${DLURL}${ATMPREL} | ||
tar -xvf ${ATMPREL} | ||
export MICROPY_MICROPYTHON="$(pwd)/micropython" | ||
cd tests | ||
./run-tests.py -d atsign | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os | ||
import sys | ||
TEST_PATH = os.getcwd() | ||
sys.path.append(TEST_PATH+'/../../src') | ||
sys.path.append(TEST_PATH+'/../../src/lib') | ||
import atclient | ||
|
||
print(atclient.b42_urlsafe_encode("abc")) | ||
print(atclient.b42_urlsafe_encode("1")) | ||
print(atclient.b42_urlsafe_encode("The quick brown fox jumps over the lazy dog!")) | ||
print(atclient.b42_urlsafe_encode("These characters are {, }, |, \, ^, ~, [, ], and `.")) | ||
print(atclient.b42_urlsafe_encode('The characters ";", "/", "?", ":", "@", "=" and "&" are the characters which may be reserved for special meaning within a scheme.')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
YWJj | ||
MQ== | ||
VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZyE= | ||
VGhlc2UgY2hhcmFjdGVycyBhcmUgeywgfSwgfCwgXCwgXiwgfiwgWywgXSwgYW5kIGAu | ||
VGhlIGNoYXJhY3RlcnMgIjsiLCAiLyIsICI_IiwgIjoiLCAiQCIsICI9IiBhbmQgIiYiIGFyZSB0aGUgY2hhcmFjdGVycyB3aGljaCBtYXkgYmUgcmVzZXJ2ZWQgZm9yIHNwZWNpYWwgbWVhbmluZyB3aXRoaW4gYSBzY2hlbWUu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print("42") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import sys | ||
TEST_PATH = os.getcwd() | ||
sys.path.append(TEST_PATH+'/../../src') | ||
sys.path.append(TEST_PATH+'/../../src/lib') | ||
import atclient | ||
|
||
print(str.encode(atclient.pkcs7pad("abc"))) | ||
print(str.encode(atclient.pkcs7pad(""))) | ||
print(str.encode(atclient.pkcs7pad("1"))) | ||
print(str.encode(atclient.pkcs7pad("12"))) | ||
print(str.encode(atclient.pkcs7pad("123"))) | ||
print(str.encode(atclient.pkcs7pad("1234"))) | ||
print(str.encode(atclient.pkcs7pad("12345"))) | ||
print(str.encode(atclient.pkcs7pad("123456"))) | ||
print(str.encode(atclient.pkcs7pad("1234567"))) | ||
print(str.encode(atclient.pkcs7pad("12345678"))) | ||
print(str.encode(atclient.pkcs7pad("123456789"))) | ||
print(str.encode(atclient.pkcs7pad("123456789a"))) | ||
print(str.encode(atclient.pkcs7pad("123456789ab"))) | ||
print(str.encode(atclient.pkcs7pad("123456789abc"))) | ||
print(str.encode(atclient.pkcs7pad("123456789abcd"))) | ||
print(str.encode(atclient.pkcs7pad("123456789abcde"))) | ||
print(str.encode(atclient.pkcs7pad("123456789abcdef"))) | ||
print(str.encode(atclient.pkcs7pad("123456789abcdef1"))) | ||
print(str.encode(atclient.pkcs7pad("The quick brown fox jumps over the lazy dog!"))) | ||
print(str.encode(atclient.pkcs7pad("These characters are {, }, |, \, ^, ~, [, ], and `."))) | ||
print(str.encode(atclient.pkcs7pad('The characters ";", "/", "?", ":", "@", "=" and "&" are the characters which may be reserved for special meaning within a scheme.'))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
b'abc\r\r\r\r\r\r\r\r\r\r\r\r\r' | ||
b'\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10' | ||
b'1\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f' | ||
b'12\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e' | ||
b'123\r\r\r\r\r\r\r\r\r\r\r\r\r' | ||
b'1234\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c' | ||
b'12345\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b' | ||
b'123456\n\n\n\n\n\n\n\n\n\n' | ||
b'1234567\t\t\t\t\t\t\t\t\t' | ||
b'12345678\x08\x08\x08\x08\x08\x08\x08\x08' | ||
b'123456789\x07\x07\x07\x07\x07\x07\x07' | ||
b'123456789a\x06\x06\x06\x06\x06\x06' | ||
b'123456789ab\x05\x05\x05\x05\x05' | ||
b'123456789abc\x04\x04\x04\x04' | ||
b'123456789abcd\x03\x03\x03' | ||
b'123456789abcde\x02\x02' | ||
b'123456789abcdef\x01' | ||
b'123456789abcdef1\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10' | ||
b'The quick brown fox jumps over the lazy dog!\x04\x04\x04\x04' | ||
b'These characters are {, }, |, \\, ^, ~, [, ], and `.\r\r\r\r\r\r\r\r\r\r\r\r\r' | ||
b'The characters ";", "/", "?", ":", "@", "=" and "&" are the characters which may be reserved for special meaning within a scheme.\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import sys | ||
TEST_PATH = os.getcwd() | ||
sys.path.append(TEST_PATH+'/../../src') | ||
sys.path.append(TEST_PATH+'/../../src/lib') | ||
import atclient | ||
|
||
print(atclient.unpad(b'abc\r\r\r\r\r\r\r\r\r\r\r\r\r')) | ||
print(atclient.unpad(b'\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10')) | ||
print(atclient.unpad(b'1\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f')) | ||
print(atclient.unpad(b'12\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e')) | ||
print(atclient.unpad(b'123\r\r\r\r\r\r\r\r\r\r\r\r\r')) | ||
print(atclient.unpad(b'1234\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c')) | ||
print(atclient.unpad(b'12345\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b')) | ||
print(atclient.unpad(b'123456\n\n\n\n\n\n\n\n\n\n')) | ||
print(atclient.unpad(b'1234567\t\t\t\t\t\t\t\t\t')) | ||
print(atclient.unpad(b'12345678\x08\x08\x08\x08\x08\x08\x08\x08')) | ||
print(atclient.unpad(b'123456789\x07\x07\x07\x07\x07\x07\x07')) | ||
print(atclient.unpad(b'123456789a\x06\x06\x06\x06\x06\x06')) | ||
print(atclient.unpad(b'123456789ab\x05\x05\x05\x05\x05')) | ||
print(atclient.unpad(b'123456789abc\x04\x04\x04\x04')) | ||
print(atclient.unpad(b'123456789abcd\x03\x03\x03')) | ||
print(atclient.unpad(b'123456789abcde\x02\x02')) | ||
print(atclient.unpad(b'123456789abcdef\x01')) | ||
print(atclient.unpad(b'123456789abcdef1\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10')) | ||
print(atclient.unpad(b'The quick brown fox jumps over the lazy dog!\x04\x04\x04\x04')) | ||
print(atclient.unpad(b'These characters are {, }, |, \\, ^, ~, [, ], and `.\r\r\r\r\r\r\r\r\r\r\r\r\r')) | ||
print(atclient.unpad(b'The characters ";", "/", "?", ":", "@", "=" and "&" are the characters which may be reserved for special meaning within a scheme.\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
b'abc' | ||
b'' | ||
b'1' | ||
b'12' | ||
b'123' | ||
b'1234' | ||
b'12345' | ||
b'123456' | ||
b'1234567' | ||
b'12345678' | ||
b'123456789' | ||
b'123456789a' | ||
b'123456789ab' | ||
b'123456789abc' | ||
b'123456789abcd' | ||
b'123456789abcde' | ||
b'123456789abcdef' | ||
b'123456789abcdef1' | ||
b'The quick brown fox jumps over the lazy dog!' | ||
b'These characters are {, }, |, \\, ^, ~, [, ], and `.' | ||
b'The characters ";", "/", "?", ":", "@", "=" and "&" are the characters which may be reserved for special meaning within a scheme.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This directory doesn't contain real tests, but code snippets to detect | ||
various interpreter features, which can't be/inconvenient to detect by | ||
other means. Scripts here are executed by run-tests.py at the beginning of | ||
testsuite to decide what other test groups to run/exclude. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# check if async/await keywords are supported | ||
async def foo(): | ||
await 1 | ||
|
||
|
||
print("async") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
try: | ||
bytearray | ||
print("bytearray") | ||
except NameError: | ||
print("no") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import sys | ||
|
||
print(sys.byteorder) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
try: | ||
complex | ||
print("complex") | ||
except NameError: | ||
print("no") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
x = const(1) | ||
print(x) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
try: | ||
extra_coverage | ||
print("coverage") | ||
except NameError: | ||
print("no") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# detect how many bits of precision the floating point implementation has | ||
|
||
try: | ||
float | ||
except NameError: | ||
print(0) | ||
else: | ||
if float("1.0000001") == float("1.0"): | ||
print(30) | ||
elif float("1e300") == float("inf"): | ||
print(32) | ||
else: | ||
print(64) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# check whether f-strings (PEP-498) are supported | ||
a = 1 | ||
print(f"a={a}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# check if Thumb2/ARMV7M instructions are supported | ||
|
||
|
||
@micropython.asm_thumb | ||
def f(): | ||
it(eq) | ||
nop() | ||
|
||
|
||
print("thumb2") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
thumb2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Check whether arbitrary-precision integers (MPZ) are supported | ||
print(1000000000000000000000000000000000000000000000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1000000000000000000000000000000000000000000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
try: | ||
import io | ||
|
||
print("io") | ||
except ImportError: | ||
print("no") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# this test for the availability of native emitter | ||
@micropython.native | ||
def f(): | ||
pass | ||
|
||
|
||
f() | ||
print("native") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Check for emacs keys in REPL | ||
t = +11 | ||
t == 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
MicroPython \.\+ version | ||
Use \.\+ | ||
>>> # Check for emacs keys in REPL | ||
>>> t = \.\+ | ||
>>> t == 2 | ||
True | ||
>>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# just check if ctrl+w is supported, because it makes sure that | ||
# both MICROPY_REPL_EMACS_WORDS_MOVE and MICROPY_REPL_EXTRA_WORDS_MOVE are enabled. | ||
t = 1231 | ||
t == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
MicroPython \.\+ version | ||
Use \.\+ | ||
>>> # Check for emacs keys in REPL | ||
>>> t = \.\+ | ||
>>> t == 2 | ||
True | ||
>>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Foo: | ||
def __radd__(self, other): | ||
pass | ||
|
||
|
||
try: | ||
5 + Foo() | ||
except TypeError: | ||
print("TypeError") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# check if set literal syntax is supported | ||
print({1}) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
try: | ||
slice | ||
print("slice") | ||
except NameError: | ||
print("no") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"args": {"target": "unix", "device": "/dev/ttyACM0", "baudrate": 115200, "user": "micro", "password": "python", "test_dirs": ["atsign"], "result_dir": "/home/chris/git/github.com/atsign-foundation/at_pico_w/tests/results", "filters": [], "write_exp": false, "list_tests": false, "emit": "bytecode", "heapsize": null, "via_mpy": false, "mpy_cross_flags": "-march=host", "keep_path": false, "jobs": 12, "files": [], "print_failures": false, "clean_failures": false, "run_failures": false}, "failed_tests": []} |
Oops, something went wrong.