Skip to content

tools/testrunner: make interactive test sync retries/delay configurable#12891

Merged
fjmolinas merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/boards/hifive1b_fix_autotest
Dec 13, 2019
Merged

tools/testrunner: make interactive test sync retries/delay configurable#12891
fjmolinas merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/boards/hifive1b_fix_autotest

Conversation

@aabadie
Copy link
Copy Markdown
Contributor

@aabadie aabadie commented Dec 6, 2019

Contribution description

This PR is an attempt to fix (most of) the automatic tests on hifive1b.
On this board, with the new test_interactive_sync feature, sending too much characters on UART before the firmware is ready can lead to a crash. Example on master:

Bench Clock Reset Complete

ATE0-->ATE0
OK
AT+BLEINIT=0-->OK
AT+CWMODE=0-->OK

r
r
Unhandled trap:
  mcause: 0x00000002
  mepc:   0x00000000
  mtval:  0x00000000
*** RIOT kernel panic:
Unhandled trap

*** halted.

The proposed solution is to make the test_interactive_sync delay/retries configurable from environment variables and use a large enough delay value for hifive1b. 3 seconds is enough.

I also tried to find a fix by looking at the fe310 cpu initialization but couldn't find it and I have no idea how this could be fixed from there.

Testing procedure

Run compile_and_test_for_board.py for hifive1b: on master almost all tests are failing with the above message. With this PR they are almost all passing. Some tests are failing because of a bug on fe310, some tests can randomly fail because the flasher fails or because some initialization sequence with the on-board ESP32 radio fails.

Here I give the final results (no output) with this PR (on master they all fail):

Details
Failures during compilation:
- [tests/lwip_sock_ip](tests/lwip_sock_ip/compilation.failed)
- [tests/lwip_sock_tcp](tests/lwip_sock_tcp/compilation.failed)
- [tests/lwip_sock_udp](tests/lwip_sock_udp/compilation.failed)

Failures during test:
- [tests/bench_sizeof_coretypes](tests/bench_sizeof_coretypes/test.failed)
- [tests/bitarithm_timings](tests/bitarithm_timings/test.failed)
- [tests/gnrc_ipv6_fwd_w_sub](tests/gnrc_ipv6_fwd_w_sub/test.failed)
- [tests/gnrc_ipv6_nib](tests/gnrc_ipv6_nib/test.failed)
- [tests/gnrc_ndp](tests/gnrc_ndp/test.failed)
- [tests/pkg_nanopb](tests/pkg_nanopb/test.failed)
- [tests/pkg_tinycbor](tests/pkg_tinycbor/test.failed)
- [tests/ps_schedstatistics](tests/ps_schedstatistics/test.failed)
- [tests/pthread_barrier](tests/pthread_barrier/test.failed)
- [tests/pthread_condition_variable](tests/pthread_condition_variable/test.failed)
- [tests/pthread_tls](tests/pthread_tls/test.failed)
- [tests/shell](tests/shell/test.failed)
- [tests/stdin](tests/stdin/test.failed)
- [tests/thread_exit](tests/thread_exit/test.failed)
- [tests/xtimer_periodic_wakeup](tests/xtimer_periodic_wakeup/test.failed)
- [tests/xtimer_usleep](tests/xtimer_usleep/test.failed)

Failures during test.flash:
- [tests/events](tests/events/test.flash.failed)
- [tests/periph_timer](tests/periph_timer/test.flash.failed)
- [tests/pkg_ucglib](tests/pkg_ucglib/test.flash.failed)
- [tests/xtimer_msg_receive_timeout](tests/xtimer_msg_receive_timeout/test.flash.failed)
  • lwip tests failed because of an issue during the download (error HTTP 502 when fetching the package)
  • some xtimer tests don't work on this board
  • some pthread test don't work on this board

Issues/PRs references

None

@aabadie aabadie added Area: tests Area: tests and testing framework Area: tools Area: Supplementary tools Area: boards Area: Board ports labels Dec 6, 2019
@aabadie aabadie requested a review from fjmolinas December 6, 2019 10:52
@aabadie aabadie added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Dec 6, 2019
@aabadie aabadie force-pushed the pr/boards/hifive1b_fix_autotest branch from 9718696 to 1648a19 Compare December 6, 2019 13:39
@aabadie aabadie force-pushed the pr/boards/hifive1b_fix_autotest branch from 1648a19 to 55ef046 Compare December 12, 2019 08:44
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Dec 12, 2019

I dropped the commit related to hifive1b because I found another way (which I think is better) to fix the failing tests.
Anyway I keep the first commit because I think it's an improvement in the management of the test_interactive_sync in testrunner code.

@aabadie aabadie changed the title boards/hifive1b: partially fix automatic testing tools/testrunner: make interactive test sync retries/delay configurable Dec 12, 2019
Copy link
Copy Markdown
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I don't see a clear use case for setting the variables yet, it causes no harm and could be used down the line. Tested that they can be set through the environment:

BOARD=iotlab-m3 TEST_INTERACTIVE_RETRIES=0 make -C tests/xtimer_usleep test --no-print-directory

Details
Connect to serial port /dev/riot/tty-iotlab-m3
Welcome to pyterm!
Type '/exit' to exit.
�Help: Press s to start test, r to print it is ready
Traceback (most recent call last):
  File "/home/francisco/.local/lib/python3.6/site-packages/pexpect/expect.py", line 109, in expect_loop
    return self.timeout()
  File "/home/francisco/.local/lib/python3.6/site-packages/pexpect/expect.py", line 82, in timeout
    raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: <pexpect.pty_spawn.spawn object at 0x7f96955c9c50>
command: /usr/bin/make
args: [b'/usr/bin/make', b'cleanterm']
buffer (last 100 chars): "3\r\nWelcome to pyterm!\r\nType '/exit' to exit.\r\n�Help: Press s to start test, r to print it is ready\r\n"
before (last 100 chars): "3\r\nWelcome to pyterm!\r\nType '/exit' to exit.\r\n�Help: Press s to start test, r to print it is ready\r\n"
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 7943
child_fd: 15
closed: False
timeout: 10
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_string:
    0: 'READY'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/francisco/workspace/RIOT-test/tests/xtimer_usleep/tests/01-run.py", line 59, in <module>
    sys.exit(run(testfunc))
  File "/home/francisco/workspace/RIOT-test/dist/pythonlibs/testrunner/__init__.py", line 27, in run
    logfile=sys.stdout if echo else None)
  File "/home/francisco/workspace/RIOT-test/dist/pythonlibs/testrunner/spawn.py", line 60, in setup_child
    sync_child(child)
  File "/home/francisco/workspace/RIOT-test/dist/pythonlibs/testrunner/spawn.py", line 83, in sync_child
    _test_utils_interactive_sync(child, modules)
  File "/home/francisco/workspace/RIOT-test/dist/pythonlibs/testrunner/spawn.py", line 92, in _test_utils_interactive_sync
    TEST_INTERACTIVE_DELAY)
  File "/home/francisco/workspace/RIOT-test/dist/pythonlibs/testrunner/utils.py", line 24, in test_utils_interactive_sync
    child.expect_exact('READY', timeout=0)
  File "/home/francisco/.local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 418, in expect_exact
    return exp.expect_loop(timeout)
  File "/home/francisco/.local/lib/python3.6/site-packages/pexpect/expect.py", line 119, in expect_loop
    return self.timeout(e)
  File "/home/francisco/.local/lib/python3.6/site-packages/pexpect/expect.py", line 82, in timeout
    raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: <pexpect.pty_spawn.spawn object at 0x7f96955c9c50>
command: /usr/bin/make
args: [b'/usr/bin/make', b'cleanterm']
buffer (last 100 chars): "3\r\nWelcome to pyterm!\r\nType '/exit' to exit.\r\n�Help: Press s to start test, r to print it is ready\r\n"
before (last 100 chars): "3\r\nWelcome to pyterm!\r\nType '/exit' to exit.\r\n�Help: Press s to start test, r to print it is ready\r\n"
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 7943
child_fd: 15
closed: False
timeout: 10
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_string:
    0: 'READY'
<pexpect.pty_spawn.spawn object at 0x7f96955c9c50>
command: /usr/bin/make
args: [b'/usr/bin/make', b'cleanterm']
buffer (last 100 chars): "3\r\nWelcome to pyterm!\r\nType '/exit' to exit.\r\n�Help: Press s to start test, r to print it is ready\r\n"
before (last 100 chars): "3\r\nWelcome to pyterm!\r\nType '/exit' to exit.\r\n�Help: Press s to start test, r to print it is ready\r\n"
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 7943
child_fd: 15
closed: False
timeout: 10
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_string:
    0: 'READY'
/home/francisco/workspace/RIOT-test/tests/xtimer_usleep/../../Makefile.include:704: recipe for target 'test' failed
make: *** [test] Error 1

@fjmolinas
Copy link
Copy Markdown
Contributor

ACK and GO!

@fjmolinas fjmolinas merged commit e8a5eb8 into RIOT-OS:master Dec 13, 2019
@fjmolinas fjmolinas added this to the Release 2020.01 milestone Dec 13, 2019
@aabadie aabadie deleted the pr/boards/hifive1b_fix_autotest branch December 17, 2019 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: boards Area: Board ports Area: tests Area: tests and testing framework Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants