From c4f66edba1e357cca7d20b21f700cb8bf6f6adfa Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Sat, 18 Nov 2017 20:15:38 +0100 Subject: [PATCH] tests: fix python style 'E302 expected 2 blank lines, found 1' --- tests/bitarithm_timings/tests/01-run.py | 1 + tests/bloom_bytes/tests/01-run.py | 1 + tests/buttons/tests/01-run.py | 1 + tests/cbor/tests/01-run.py | 1 + tests/cpp11_condition_variable/tests/01-run.py | 2 +- tests/cpp11_mutex/tests/01-run.py | 2 +- tests/cpp11_thread/tests/01-run.py | 2 +- tests/driver_ds1307/tests/01-run.py | 1 + tests/driver_grove_ledbar/tests/01-run.py | 1 + tests/driver_hd44780/tests/01-run.py | 1 + tests/driver_my9221/tests/01-run.py | 1 + tests/events/tests/01-run.py | 1 + tests/evtimer_msg/tests/01-run.py | 1 + tests/evtimer_underflow/tests/01-run.py | 1 + tests/float/tests/01-run.py | 1 + tests/gnrc_ipv6_ext/tests/01-run.py | 1 + tests/gnrc_ipv6_nib/tests/01-run.py | 1 + tests/gnrc_ipv6_nib_6ln/tests/01-run.py | 1 + tests/gnrc_ndp/tests/01-run.py | 1 + tests/gnrc_netif/tests/01-run.py | 1 + tests/gnrc_sixlowpan/tests/01-run.py | 1 + tests/gnrc_sock_ip/tests/01-run.py | 1 + tests/gnrc_sock_udp/tests/01-run.py | 1 + tests/libfixmath/do-test.py | 1 + tests/lwip/tests/01-run.py | 16 ++++++++++++++++ tests/lwip_sock_ip/tests/01-run.py | 3 +++ tests/lwip_sock_tcp/tests/01-run.py | 4 ++++ tests/lwip_sock_udp/tests/01-run.py | 4 ++++ tests/msg_avail/tests/01-run.py | 1 + tests/msg_send_receive/tests/01-run.py | 1 + tests/mutex_order/tests/01-run.py | 1 + tests/od/tests/01-run.py | 1 + tests/od/tests/02-run.py | 1 + tests/pkg_tiny-asn1/tests/01-run.py | 1 + tests/pkg_umorse/tests/01-run.py | 2 +- tests/posix_semaphore/tests/01-run.py | 5 +++++ tests/posix_time/tests/01-run.py | 2 ++ tests/ps_schedstatistics/tests/01-run.py | 1 + tests/rmutex/tests/01-run.py | 2 ++ tests/thread_cooperation/tests/01-run.py | 1 + tests/thread_msg_block_w_queue/tests/01-run.py | 1 + tests/thread_msg_block_wo_queue/tests/01-run.py | 1 + tests/trickle/tests/01-run.py | 1 + tests/unittests/tests/01-run.py | 1 + tests/xtimer_hang/tests/01-run.py | 1 + tests/xtimer_msg_receive_timeout/tests/01-run.py | 1 + tests/xtimer_now64_continuity/tests/01-run.py | 1 + tests/xtimer_periodic_wakeup/tests/01-run.py | 1 + tests/xtimer_remove/tests/01-run.py | 1 + tests/xtimer_reset/tests/01-run.py | 1 + tests/xtimer_usleep/tests/01-run.py | 2 ++ tests/xtimer_usleep_short/tests/01-run.py | 2 +- 52 files changed, 82 insertions(+), 5 deletions(-) diff --git a/tests/bitarithm_timings/tests/01-run.py b/tests/bitarithm_timings/tests/01-run.py index dfc6f446f9..bc8f4c236f 100755 --- a/tests/bitarithm_timings/tests/01-run.py +++ b/tests/bitarithm_timings/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("Start.") child.expect('\+ bitarithm_msb: \d+ iterations per second') diff --git a/tests/bloom_bytes/tests/01-run.py b/tests/bloom_bytes/tests/01-run.py index fc4a816117..6585ca3487 100755 --- a/tests/bloom_bytes/tests/01-run.py +++ b/tests/bloom_bytes/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("Testing Bloom filter.") child.expect_exact("m: 4096 k: 8") diff --git a/tests/buttons/tests/01-run.py b/tests/buttons/tests/01-run.py index 54647e5483..6037857e9d 100755 --- a/tests/buttons/tests/01-run.py +++ b/tests/buttons/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("On-board button test") index = child.expect([ diff --git a/tests/cbor/tests/01-run.py b/tests/cbor/tests/01-run.py index bd97513d24..c3ec006d31 100755 --- a/tests/cbor/tests/01-run.py +++ b/tests/cbor/tests/01-run.py @@ -14,6 +14,7 @@ import testrunner ACCEPTED_ERROR = 20 + def testfunc(child): child.expect_exact('Data:') child.expect_exact('(uint64_t, 1)') diff --git a/tests/cpp11_condition_variable/tests/01-run.py b/tests/cpp11_condition_variable/tests/01-run.py index 3ac6d799f1..5fde64fe27 100755 --- a/tests/cpp11_condition_variable/tests/01-run.py +++ b/tests/cpp11_condition_variable/tests/01-run.py @@ -13,8 +13,8 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner -def testfunc(child): +def testfunc(child): child.expect_exact("************ C++ condition_variable test ***********") child.expect_exact("Wait with predicate and notify one ...") child.expect_exact("Done") diff --git a/tests/cpp11_mutex/tests/01-run.py b/tests/cpp11_mutex/tests/01-run.py index 5be11d836a..1646e6adf4 100755 --- a/tests/cpp11_mutex/tests/01-run.py +++ b/tests/cpp11_mutex/tests/01-run.py @@ -13,8 +13,8 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner -def testfunc(child): +def testfunc(child): child.expect_exact("************ C++ mutex test ***********") child.expect_exact("Lock and unlock ...") child.expect_exact("Done") diff --git a/tests/cpp11_thread/tests/01-run.py b/tests/cpp11_thread/tests/01-run.py index 6636188ea9..0307f92388 100755 --- a/tests/cpp11_thread/tests/01-run.py +++ b/tests/cpp11_thread/tests/01-run.py @@ -13,8 +13,8 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner -def testfunc(child): +def testfunc(child): child.expect_exact("************ C++ thread test ***********") child.expect_exact("Creating one thread and passing an argument ...") child.expect_exact("Done") diff --git a/tests/driver_ds1307/tests/01-run.py b/tests/driver_ds1307/tests/01-run.py index ab9bdb938f..055199ef0f 100755 --- a/tests/driver_ds1307/tests/01-run.py +++ b/tests/driver_ds1307/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect([r"OK \([0-9]+ tests\)", r"error: unable to initialize RTC \[I2C initialization error\]"]) diff --git a/tests/driver_grove_ledbar/tests/01-run.py b/tests/driver_grove_ledbar/tests/01-run.py index 70e38e81ac..3d121d9933 100755 --- a/tests/driver_grove_ledbar/tests/01-run.py +++ b/tests/driver_grove_ledbar/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact(u"[SUCCESS]", timeout=60) diff --git a/tests/driver_hd44780/tests/01-run.py b/tests/driver_hd44780/tests/01-run.py index 1e1baaae75..c3b9f15a90 100644 --- a/tests/driver_hd44780/tests/01-run.py +++ b/tests/driver_hd44780/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("[START]") child.expect_exact("[SUCCESS]") diff --git a/tests/driver_my9221/tests/01-run.py b/tests/driver_my9221/tests/01-run.py index 5801a4475c..7e48651f84 100755 --- a/tests/driver_my9221/tests/01-run.py +++ b/tests/driver_my9221/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("[SUCCESS]", timeout=60) diff --git a/tests/events/tests/01-run.py b/tests/events/tests/01-run.py index eace7ab6ba..2b3bd8b378 100755 --- a/tests/events/tests/01-run.py +++ b/tests/events/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact(u"[SUCCESS]") diff --git a/tests/evtimer_msg/tests/01-run.py b/tests/evtimer_msg/tests/01-run.py index fb96639f52..b6be878ca4 100755 --- a/tests/evtimer_msg/tests/01-run.py +++ b/tests/evtimer_msg/tests/01-run.py @@ -15,6 +15,7 @@ import testrunner ACCEPTED_ERROR = 20 + def testfunc(child): child.expect(r"Testing generic evtimer \(start time = (\d+) ms\)") timer_offset = int(child.match.group(1)) diff --git a/tests/evtimer_underflow/tests/01-run.py b/tests/evtimer_underflow/tests/01-run.py index 7b65ac4cc1..926f6cee54 100755 --- a/tests/evtimer_underflow/tests/01-run.py +++ b/tests/evtimer_underflow/tests/01-run.py @@ -15,6 +15,7 @@ import testrunner how_many = 100 + def testfunc(child): for i in range(how_many): for j in range(8): diff --git a/tests/float/tests/01-run.py b/tests/float/tests/01-run.py index 07987991a5..38339e9492 100755 --- a/tests/float/tests/01-run.py +++ b/tests/float/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("Testing floating point arithmetics...") child.expect_exact("[SUCCESS]") diff --git a/tests/gnrc_ipv6_ext/tests/01-run.py b/tests/gnrc_ipv6_ext/tests/01-run.py index a03fe08448..1db44826b7 100755 --- a/tests/gnrc_ipv6_ext/tests/01-run.py +++ b/tests/gnrc_ipv6_ext/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): index = child.expect_exact([ "ipv6: Received (src = fd01::1, dst = fd01::2, next header = 0, length = 42)", diff --git a/tests/gnrc_ipv6_nib/tests/01-run.py b/tests/gnrc_ipv6_nib/tests/01-run.py index c12bc5b8ca..d2ade821ec 100755 --- a/tests/gnrc_ipv6_nib/tests/01-run.py +++ b/tests/gnrc_ipv6_nib/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect(r"OK \(\d+ tests\)") diff --git a/tests/gnrc_ipv6_nib_6ln/tests/01-run.py b/tests/gnrc_ipv6_nib_6ln/tests/01-run.py index c12bc5b8ca..d2ade821ec 100755 --- a/tests/gnrc_ipv6_nib_6ln/tests/01-run.py +++ b/tests/gnrc_ipv6_nib_6ln/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect(r"OK \(\d+ tests\)") diff --git a/tests/gnrc_ndp/tests/01-run.py b/tests/gnrc_ndp/tests/01-run.py index decad68b6f..1f1039f78b 100755 --- a/tests/gnrc_ndp/tests/01-run.py +++ b/tests/gnrc_ndp/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): # 1st 6LoWPAN fragment child.expect(r"OK \(\d+ tests\)") diff --git a/tests/gnrc_netif/tests/01-run.py b/tests/gnrc_netif/tests/01-run.py index e1dc2d2582..bdd3a01c84 100755 --- a/tests/gnrc_netif/tests/01-run.py +++ b/tests/gnrc_netif/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): # embUnit tests child.expect(r"OK \(\d+ tests\)") diff --git a/tests/gnrc_sixlowpan/tests/01-run.py b/tests/gnrc_sixlowpan/tests/01-run.py index 832ad5e29e..a7d1842ceb 100755 --- a/tests/gnrc_sixlowpan/tests/01-run.py +++ b/tests/gnrc_sixlowpan/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): # 1st 6LoWPAN fragment child.expect_exact("PKTDUMP: data received:") diff --git a/tests/gnrc_sock_ip/tests/01-run.py b/tests/gnrc_sock_ip/tests/01-run.py index 7b866e9565..0f5eea832e 100755 --- a/tests/gnrc_sock_ip/tests/01-run.py +++ b/tests/gnrc_sock_ip/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact(u"Calling test_sock_ip_create__EAFNOSUPPORT()") child.expect_exact(u"Calling test_sock_ip_create__EINVAL_addr()") diff --git a/tests/gnrc_sock_udp/tests/01-run.py b/tests/gnrc_sock_udp/tests/01-run.py index 1705cca707..f553d17c10 100755 --- a/tests/gnrc_sock_udp/tests/01-run.py +++ b/tests/gnrc_sock_udp/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact(u"Calling test_sock_udp_create__EADDRINUSE()") child.expect_exact(u"Calling test_sock_udp_create__EAFNOSUPPORT()") diff --git a/tests/libfixmath/do-test.py b/tests/libfixmath/do-test.py index 70393f32c7..2577a511c6 100755 --- a/tests/libfixmath/do-test.py +++ b/tests/libfixmath/do-test.py @@ -47,6 +47,7 @@ FUNS = { ABS_ERROR_LIMIT = 0.011 + def main(): total = 0 errors = 0 diff --git a/tests/lwip/tests/01-run.py b/tests/lwip/tests/01-run.py index 62c9e2a60c..788748c275 100755 --- a/tests/lwip/tests/01-run.py +++ b/tests/lwip/tests/01-run.py @@ -17,6 +17,7 @@ import pexpect DEFAULT_TIMEOUT = 5 + class Strategy(object): def __init__(self, func=None): if func != None: @@ -28,11 +29,13 @@ class Strategy(object): def execute(self, *args, **kwargs): raise NotImplementedError() + class ApplicationStrategy(Strategy): def __init__(self, app_dir=os.getcwd(), func=None): super(ApplicationStrategy, self).__init__(func) self.app_dir = app_dir + class BoardStrategy(Strategy): def __init__(self, board, func=None): super(BoardStrategy, self).__init__(func) @@ -50,22 +53,27 @@ class BoardStrategy(Strategy): def execute(self, application): super(BoardStrategy, self).execute(application) + class CleanStrategy(BoardStrategy): def execute(self, application, env=None): super(CleanStrategy, self).__run_make(application, ("-B", "clean"), env) + class BuildStrategy(BoardStrategy): def execute(self, application, env=None): super(BuildStrategy, self).__run_make(application, ("all",), env) + class FlashStrategy(BoardStrategy): def execute(self, application, env=None): super(FlashStrategy, self).__run_make(application, ("all",), env) + class ResetStrategy(BoardStrategy): def execute(self, application, env=None): super(ResetStrategy, self).__run_make(application, ("reset",), env) + class Board(object): def __init__(self, name, port=None, serial=None, clean=None, build=None, flash=None, @@ -119,6 +127,7 @@ class Board(object): def reset(self, application=os.getcwd(), env=None): self.reset_strategy.execute(application, env) + class BoardGroup(object): def __init__(self, boards): self.boards = boards @@ -148,6 +157,7 @@ class BoardGroup(object): for board in self.boards: board.reset(application, env) + def default_test_case(board_group, application, env=None): for board in board_group: env = os.environ.copy() @@ -159,6 +169,7 @@ def default_test_case(board_group, application, env=None): logfile=sys.stdout) as spawn: spawn.expect("TEST: SUCCESS") + class TestStrategy(ApplicationStrategy): def execute(self, board_groups, test_cases=[default_test_case], timeout=DEFAULT_TIMEOUT, env=None): @@ -171,11 +182,13 @@ class TestStrategy(ApplicationStrategy): sys.stdout.flush() print() + def get_ipv6_address(spawn): spawn.sendline(u"ifconfig") spawn.expect(u"[A-Za-z0-9]{2}_[0-9]+: inet6 (fe80::[0-9a-f:]+)") return spawn.match.group(1) + def test_ipv6_send(board_group, application, env=None): env_sender = os.environ.copy() if env != None: @@ -199,6 +212,7 @@ def test_ipv6_send(board_group, application, env=None): (receiver_ip, ipprot)) receiver.expect(u"00000000 01 23 45 67 89 AB CD EF") + def test_udpv6_send(board_group, application, env=None): env_sender = os.environ.copy() if env != None: @@ -223,6 +237,7 @@ def test_udpv6_send(board_group, application, env=None): (receiver_ip, port)) receiver.expect(u"00000000 AB CD EF") + def test_tcpv6_send(board_group, application, env=None): env_client = os.environ.copy() if env != None: @@ -252,6 +267,7 @@ def test_tcpv6_send(board_group, application, env=None): client.sendline(u"tcp send affe:abe") client.expect_exact(u"could not send") + def test_triple_send(board_group, application, env=None): env_sender = os.environ.copy() if env != None: diff --git a/tests/lwip_sock_ip/tests/01-run.py b/tests/lwip_sock_ip/tests/01-run.py index f466335371..96f73bdd80 100755 --- a/tests/lwip_sock_ip/tests/01-run.py +++ b/tests/lwip_sock_ip/tests/01-run.py @@ -12,12 +12,15 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def _ipv6_tests(code): return code & (1 << 6) + def _ipv4_tests(code): return code & (1 << 4) + def testfunc(child): child.expect(u"code (0x[0-9a-f]{2})") code = int(child.match.group(1), base=16) diff --git a/tests/lwip_sock_tcp/tests/01-run.py b/tests/lwip_sock_tcp/tests/01-run.py index 7a98ab975a..176c998522 100755 --- a/tests/lwip_sock_tcp/tests/01-run.py +++ b/tests/lwip_sock_tcp/tests/01-run.py @@ -12,15 +12,19 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def _reuse_tests(code): return code & 1 + def _ipv6_tests(code): return code & (1 << 6) + def _ipv4_tests(code): return code & (1 << 4) + def testfunc(child): child.expect(u"code (0x[0-9a-f]{2})") code = int(child.match.group(1), base=16) diff --git a/tests/lwip_sock_udp/tests/01-run.py b/tests/lwip_sock_udp/tests/01-run.py index 0a9e036727..ba0887ad2c 100755 --- a/tests/lwip_sock_udp/tests/01-run.py +++ b/tests/lwip_sock_udp/tests/01-run.py @@ -12,15 +12,19 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def _reuse_tests(code): return code & 1 + def _ipv6_tests(code): return code & (1 << 6) + def _ipv4_tests(code): return code & (1 << 4) + def testfunc(child): child.expect(u"code (0x[0-9a-f]{2})") code = int(child.match.group(1), base=16) diff --git a/tests/msg_avail/tests/01-run.py b/tests/msg_avail/tests/01-run.py index eace7ab6ba..2b3bd8b378 100755 --- a/tests/msg_avail/tests/01-run.py +++ b/tests/msg_avail/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact(u"[SUCCESS]") diff --git a/tests/msg_send_receive/tests/01-run.py b/tests/msg_send_receive/tests/01-run.py index 3e25a1bc50..9ff95cf953 100755 --- a/tests/msg_send_receive/tests/01-run.py +++ b/tests/msg_send_receive/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect(u"Test successful.") diff --git a/tests/mutex_order/tests/01-run.py b/tests/mutex_order/tests/01-run.py index 7448a66b46..85e800f948 100755 --- a/tests/mutex_order/tests/01-run.py +++ b/tests/mutex_order/tests/01-run.py @@ -21,6 +21,7 @@ thread_prio = { 7: 1 } + def testfunc(child): for k in thread_prio.keys(): child.expect(u"T%i \(prio %i\): trying to lock mutex now" % (k, thread_prio[k])) diff --git a/tests/od/tests/01-run.py b/tests/od/tests/01-run.py index b9808e85bd..cb4e8f7f62 100755 --- a/tests/od/tests/01-run.py +++ b/tests/od/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("od_hex_dump(short_str, sizeof(short_str), OD_WIDTH_DEFAULT)") child.expect_exact("00000000 41 42 00") diff --git a/tests/od/tests/02-run.py b/tests/od/tests/02-run.py index 0e2e6bef51..5d6c14abe8 100755 --- a/tests/od/tests/02-run.py +++ b/tests/od/tests/02-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("od_hex_dump(short_str, sizeof(short_str), OD_WIDTH_DEFAULT)") child.expect_exact("00000000 41 42 00 AB.") diff --git a/tests/pkg_tiny-asn1/tests/01-run.py b/tests/pkg_tiny-asn1/tests/01-run.py index 259eaf6264..0c25de9354 100755 --- a/tests/pkg_tiny-asn1/tests/01-run.py +++ b/tests/pkg_tiny-asn1/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect('Decoding finished succesfully') diff --git a/tests/pkg_umorse/tests/01-run.py b/tests/pkg_umorse/tests/01-run.py index 6dcb504210..19c6dd918f 100755 --- a/tests/pkg_umorse/tests/01-run.py +++ b/tests/pkg_umorse/tests/01-run.py @@ -12,8 +12,8 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner -def testfunc(child): +def testfunc(child): child.expect(u".... . ._.. ._.. ___ / ._. .. ___ _ ___ ...", timeout=30) child.expect(u"_ .... .. ... / .. ... / .._ __ ___ ._. ... .", timeout=30) diff --git a/tests/posix_semaphore/tests/01-run.py b/tests/posix_semaphore/tests/01-run.py index e9c61de8fb..6e827717ba 100755 --- a/tests/posix_semaphore/tests/01-run.py +++ b/tests/posix_semaphore/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def test1(term): term.expect_exact("######################### TEST1:") term.expect_exact("first: sem_init") @@ -34,6 +35,7 @@ def test1(term): term.expect_exact("first: sem_destroy") term.expect_exact("first: end") + def test2(term): term.expect_exact("######################### TEST2:") term.expect_exact("first: sem_init") @@ -64,6 +66,7 @@ def test2(term): term.expect_exact("Thread 'priority 5' woke up.") term.expect_exact("Back in main thread.") + def test3(term): term.expect_exact("######################### TEST3:") term.expect_exact("first: sem_init s1") @@ -80,6 +83,7 @@ def test3(term): term.expect_exact("post s1") term.expect_exact("Thread 2 woke up after waiting for s1.") + def test4(term): term.expect_exact("######################### TEST4:") term.expect_exact("first: sem_init s1") @@ -87,6 +91,7 @@ def test4(term): term.expect_exact("first: timed out") term.expect(r"first: waited 1\d{6} usec") + def testfunc(child): test1(child) test2(child) diff --git a/tests/posix_time/tests/01-run.py b/tests/posix_time/tests/01-run.py index 285e4d807e..8e2f66173a 100755 --- a/tests/posix_time/tests/01-run.py +++ b/tests/posix_time/tests/01-run.py @@ -18,9 +18,11 @@ import testrunner US_PER_SEC = 1000000 EXTERNAL_JITTER = 0.15 + class InvalidTimeout(Exception): pass + def testfunc(child): try: child.expect_exact("Please hit any key and then ENTER to continue") diff --git a/tests/ps_schedstatistics/tests/01-run.py b/tests/ps_schedstatistics/tests/01-run.py index 4a0227fc8a..3138b3dd09 100755 --- a/tests/ps_schedstatistics/tests/01-run.py +++ b/tests/ps_schedstatistics/tests/01-run.py @@ -35,6 +35,7 @@ PS_EXPECTED = ( ('\t | SUM | | | \d+ (\d+)') ) + def _check_startup(child): for i in range(5): child.expect_exact('Creating thread #{}, next={}' diff --git a/tests/rmutex/tests/01-run.py b/tests/rmutex/tests/01-run.py index 174b6e779c..f9a86d1c60 100755 --- a/tests/rmutex/tests/01-run.py +++ b/tests/rmutex/tests/01-run.py @@ -30,9 +30,11 @@ lock_depth = { 7: 5 } + def thread_prio_sort(x): return thread_prio.get(x)*1000 + x + def testfunc(child): for k in thread_prio.keys(): child.expect(u"T%i \(prio %i, depth 0\): trying to lock rmutex now" % diff --git a/tests/thread_cooperation/tests/01-run.py b/tests/thread_cooperation/tests/01-run.py index 4876418231..9b6ecbfbd1 100755 --- a/tests/thread_cooperation/tests/01-run.py +++ b/tests/thread_cooperation/tests/01-run.py @@ -13,6 +13,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect(r"MAIN: reply from T-\d+") child.expect(r"MAIN: \d+! = \d+") diff --git a/tests/thread_msg_block_w_queue/tests/01-run.py b/tests/thread_msg_block_w_queue/tests/01-run.py index 69f13d11d4..0a9a8ee4bd 100755 --- a/tests/thread_msg_block_w_queue/tests/01-run.py +++ b/tests/thread_msg_block_w_queue/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect('sender_thread start\r\n') child.expect('main thread alive\r\n') diff --git a/tests/thread_msg_block_wo_queue/tests/01-run.py b/tests/thread_msg_block_wo_queue/tests/01-run.py index 69f13d11d4..0a9a8ee4bd 100755 --- a/tests/thread_msg_block_wo_queue/tests/01-run.py +++ b/tests/thread_msg_block_wo_queue/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect('sender_thread start\r\n') child.expect('main thread alive\r\n') diff --git a/tests/trickle/tests/01-run.py b/tests/trickle/tests/01-run.py index ed0d8aa28e..33ad94d772 100755 --- a/tests/trickle/tests/01-run.py +++ b/tests/trickle/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("[START]") diff --git a/tests/unittests/tests/01-run.py b/tests/unittests/tests/01-run.py index 8764fc08e2..c8183c2a4f 100755 --- a/tests/unittests/tests/01-run.py +++ b/tests/unittests/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect(u"OK \\([0-9]+ tests\\)") diff --git a/tests/xtimer_hang/tests/01-run.py b/tests/xtimer_hang/tests/01-run.py index 9e58b4e945..cc44b205af 100755 --- a/tests/xtimer_hang/tests/01-run.py +++ b/tests/xtimer_hang/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("[START]") diff --git a/tests/xtimer_msg_receive_timeout/tests/01-run.py b/tests/xtimer_msg_receive_timeout/tests/01-run.py index 37ac3704d8..5cfc83c7a5 100755 --- a/tests/xtimer_msg_receive_timeout/tests/01-run.py +++ b/tests/xtimer_msg_receive_timeout/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect("[START]") for i in range(5): diff --git a/tests/xtimer_now64_continuity/tests/01-run.py b/tests/xtimer_now64_continuity/tests/01-run.py index a81d8efba9..828efb6606 100755 --- a/tests/xtimer_now64_continuity/tests/01-run.py +++ b/tests/xtimer_now64_continuity/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("[START]") child.expect(u"\[RESULTS\] min=\d+, avg=\d+, max=\d+") diff --git a/tests/xtimer_periodic_wakeup/tests/01-run.py b/tests/xtimer_periodic_wakeup/tests/01-run.py index f9fc611b87..433ce16241 100755 --- a/tests/xtimer_periodic_wakeup/tests/01-run.py +++ b/tests/xtimer_periodic_wakeup/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("xtimer_periodic_wakeup test application.") diff --git a/tests/xtimer_remove/tests/01-run.py b/tests/xtimer_remove/tests/01-run.py index 203ad6dd8c..8b7c527066 100755 --- a/tests/xtimer_remove/tests/01-run.py +++ b/tests/xtimer_remove/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("xtimer_remove test application.") child.expect_exact("Setting 3 timers, removing timer 0/3") diff --git a/tests/xtimer_reset/tests/01-run.py b/tests/xtimer_reset/tests/01-run.py index 92cc933adb..87f31a0b89 100755 --- a/tests/xtimer_reset/tests/01-run.py +++ b/tests/xtimer_reset/tests/01-run.py @@ -12,6 +12,7 @@ import sys sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner + def testfunc(child): child.expect_exact("This test tests re-setting of an already active timer.") child.expect_exact("It should print three times \"now=\", with " diff --git a/tests/xtimer_usleep/tests/01-run.py b/tests/xtimer_usleep/tests/01-run.py index 1d8cb6ecfb..489cae3b91 100755 --- a/tests/xtimer_usleep/tests/01-run.py +++ b/tests/xtimer_usleep/tests/01-run.py @@ -20,9 +20,11 @@ US_PER_SEC = 1000000 INTERNAL_JITTER = 0.05 EXTERNAL_JITTER = 0.15 + class InvalidTimeout(Exception): pass + def testfunc(child): child.expect(u"Running test (\\d+) times with (\\d+) distinct sleep times") RUNS = int(child.match.group(1)) diff --git a/tests/xtimer_usleep_short/tests/01-run.py b/tests/xtimer_usleep_short/tests/01-run.py index 3379c94e48..5fc2385ef5 100755 --- a/tests/xtimer_usleep_short/tests/01-run.py +++ b/tests/xtimer_usleep_short/tests/01-run.py @@ -13,8 +13,8 @@ import pexpect sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) import testrunner -def testfunc(child): +def testfunc(child): child.expect(u"This test will call xtimer_usleep for values from \\d+ down to \\d+\r\n") i = 500