1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests
benpicco 1c148ba2f2
Merge pull request #10092 from gschorcht/drivers_itg320x
drivers: add driver for InvenSense ITG-320X 3-axis gyroscope
2020-01-11 17:37:48 +01:00
..
bench_msg_pingpong
bench_mutex_pingpong
bench_runtime_coreapis
bench_sched_nop
bench_sizeof_coretypes
bench_thread_flags_pingpong
bench_thread_yield_pingpong
bench_timers
bench_xtimer tests/bench_xtimer: decrease mem usage for some boards 2020-01-09 22:53:40 +01:00
bitarithm_timings
blob
bloom_bytes
board_calliope-mini
board_microbit
build_system_cflags_spaces
build_system_utils
buttons
c11_atomics_cpp_compat
can_trx
cb_mux
cb_mux_bench
cond_order
conn_can
cortexm_common_ldscript
cpp11_condition_variable
cpp11_mutex
cpp11_thread
cpp_ctors
cpp_exclude
cpp_ext
cpu_cortexm_address_check
cpu_efm32_features
devfs
driver_ad7746
driver_adcxx1c
driver_ads101x
driver_adt7310
driver_adxl345
driver_apa102
driver_at
driver_at30tse75x
driver_at86rf2xx
driver_ata8520e
driver_bh1750
driver_bmp180
driver_bmx055
driver_bmx280
driver_cc110x
driver_ccs811
driver_ccs811_full
driver_dcf77
driver_dht
driver_ds18
driver_ds75lx
driver_ds1307
driver_ds3234
driver_dsp0401
driver_dynamixel
driver_enc28j60
driver_encx24j600
driver_feetech
driver_fxos8700
driver_grove_ledbar
driver_hd44780
driver_hdc1000
driver_hih6130
driver_hts221
driver_ili9341
driver_ina2xx
driver_ina3221
driver_io1_xplained
driver_isl29020
driver_isl29125
driver_itg320x tests: add driver for ITG320X 3-axis gyroscope 2020-01-11 08:02:34 +01:00
driver_jc42
driver_kw2xrf
driver_l3g4200d
driver_lc709203f
driver_lis2dh12
driver_lis3dh
driver_lis3mdl
driver_lpd8808
driver_lpsxxx
driver_lsm6dsl
driver_lsm303dlhc
driver_ltc4150
driver_mag3110
driver_mma8x5x
driver_mma7660
driver_motor_driver
driver_mpl3115a2
driver_mpu9x50
driver_mpu9150
driver_mq3
driver_my9221
driver_nrf24l01p_lowlevel
driver_nrfmin
driver_nvram_spi
driver_opt3001
driver_pca9685
driver_pcd8544
driver_ph_oem
driver_pir
driver_pn532
driver_pulse_counter
driver_qmc5883l
driver_rn2xx3
driver_sdcard_spi
driver_sds011
driver_servo
driver_sht1x
driver_sht2x
driver_sht3x
driver_shtc1
driver_si70xx
driver_si114x
driver_soft_spi
driver_srf02
driver_srf04
driver_srf08
driver_sx127x
driver_tcs37727
driver_tmp00x
driver_tps6274x
driver_tsl2561
driver_tsl4531x
driver_vcnl40x0
driver_veml6070
driver_ws281x
driver_xbee
eepreg
emb6
embunit
event_wait_timeout
events
evtimer_msg
evtimer_underflow
external_board_native tests/external_board_native: require arch_native 2019-12-30 17:15:08 +01:00
external_module_dirs
fault_handler
float
fmt_print
frac-config
gnrc_gomach
gnrc_ipv6_ext
gnrc_ipv6_ext_frag
gnrc_ipv6_fwd_w_sub
gnrc_ipv6_nib
gnrc_ipv6_nib_6ln
gnrc_lwmac
gnrc_mac_timeout
gnrc_ndp
gnrc_netif
gnrc_netif_ieee802154
gnrc_rpl_srh
gnrc_sixlowpan
gnrc_sixlowpan_frag
gnrc_sixlowpan_iphc_w_vrb
gnrc_sock_async test/gnrc_sock_async: include net/sock/async.h 2020-01-07 10:13:02 +01:00
gnrc_sock_dns
gnrc_sock_ip
gnrc_sock_neterr
gnrc_sock_udp
gnrc_tcp
gnrc_udp
heap_cmd
irq
isr_yield_higher
kconfig
l2util
leds
libc_newlib
log_color
log_printfnoformat
lua_loader tests/lua_loader: cleanup Python test script 2020-01-08 09:46:09 +01:00
lwip tests/lwip: enable IPv4 2019-12-20 06:51:34 +01:00
lwip_sock_ip
lwip_sock_tcp
lwip_sock_udp
malloc
mcuboot
memarray
minimal
mpu_stack_guard
msg_avail
msg_send_receive
msg_try_receive
mtd_flashpage
mutex_order
mutex_unlock_and_sleep
nanocoap_cli
netdev_test
netstats_l2
nhdp
nimble_autoconn_ccnl
nimble_autoconn_gnrc
nimble_l2cap
nimble_l2cap_server
nordic_softdevice
od
periph_adc
periph_backup_ram
periph_cpuid
periph_dac
periph_dma
periph_eeprom
periph_flashpage
periph_gpio
periph_gpio_arduino
periph_hwrng
periph_i2c
periph_pm
periph_pwm
periph_qdec
periph_rtc
periph_rtt
periph_spi
periph_timer
periph_timer_short_relative_set
periph_uart
periph_uart_mode
periph_uart_nonblocking
periph_wdt
pipe
pkg_c25519
pkg_cayenne-lpp
pkg_cifra
pkg_cmsis-dsp tests/pkg_cmsis-dsp: cleanup Python test script 2020-01-08 09:43:16 +01:00
pkg_cn-cbor
pkg_fatfs
pkg_fatfs_vfs
pkg_hacl
pkg_heatshrink
pkg_jsmn
pkg_libb2
pkg_libcoap
pkg_libcose
pkg_libfixmath
pkg_libfixmath_unittests test/libfixmath: remove use of export for LINKFLAGS 2020-01-02 09:52:30 +01:00
pkg_libhydrogen
pkg_littlefs
pkg_lora-serialization
pkg_micro-ecc
pkg_micro-ecc-with-hwrng
pkg_microcoap
pkg_minmea
pkg_monocypher
pkg_nanocbor
pkg_nanopb
pkg_oonf_api
pkg_qdsa
pkg_relic
pkg_semtech-loramac
pkg_spiffs
pkg_tiny-asn1
pkg_tinycbor
pkg_tinycrypt
pkg_tweetnacl
pkg_u8g2
pkg_ubasic
pkg_ucglib
pkg_umorse
pkg_utensor tests/pkg_utensor: set boards without enough memory 2020-01-07 11:22:38 +01:00
pkg_wolfcrypt-ed25519-verify
pkg_wolfssl
posix_semaphore
posix_time
progress_bar
ps_schedstatistics
pthread
pthread_barrier
pthread_cleanup
pthread_condition_variable
pthread_cooperation
pthread_flood
pthread_rwlock
pthread_tls
puf_sram
riotboot
riotboot_flashwrite
riotboot_hdr
rmutex
rmutex_cpp
rng
saul
sched_testing
shell
slip
sntp
socket_zep
ssp
stdin
struct_tm_utility
sys_arduino
sys_arduino_analog
sys_arduino_lib
sys_crypto tests/sys_crypto: test that the whole plaintext_len is written 2020-01-08 19:49:15 +01:00
sys_irq_handler
test_tools
thread_basic
thread_cooperation
thread_exit
thread_flags
thread_flags_xtimer
thread_float
thread_flood
thread_msg
thread_msg_block_race
thread_msg_block_w_queue
thread_msg_block_wo_queue
thread_msg_seq
thread_priority_inversion
thread_race
thread_zombie
trace
trickle
unittests tests/unittests/tests-core/tests-core-ringbuffer: test underflow 2020-01-07 12:56:17 +01:00
usbus
usbus_cdc_acm_stdio
usbus_cdc_ecm
vfs_plus_stdio tests: provide test for vfs+fmt corner-case 2019-12-18 14:15:40 +01:00
warn_conflict
xtimer_drift
xtimer_hang
xtimer_longterm
xtimer_msg
xtimer_msg_receive_timeout
xtimer_mutex_lock_timeout
xtimer_now64_continuity
xtimer_periodic_wakeup
xtimer_remove
xtimer_reset
xtimer_usleep
xtimer_usleep_short
Makefile.tests_common
README.md

Running and creating tests

There are a number of tests included in RIOT. They are located in the tests folder. These tests allow basic functionality to be verified as well as provide an example of usage.

Implementing automated tests

The goal is to be able to run all tests in a sequential way for as many targets as possible.

As some board can't be reset without a manual trigger tests should be implemented with some kind of synchronization. This can be done in two ways:

  • use test_utils_interactive_sync when uart input/output does not need to be disabled for the test. This is enabled by default.
  • set up the test in a loop so the test script will be able so sync with some kind of start condition in the test.

The module for the first option is test_utils_interactive_sync and is set as a default module in Makefile.tests_common. It can be disabled by setting in the application makefile DISABLE_MODULE += test_utils_interactive_sync. The python test script will adapt to it automatically.

Running automated tests

Some tests can be performed automatically. The test automation scripts are defined in the <test_application>/tests/ folder. They are written in python and interact through the uart with the test application code running on a board to do the validation. It is recommended to flash the board with the test just before running it because some platforms cannot be reset while testing.

From the test application directory run:

BOARD=<board_of_your_choice> make flash test

An automated way of knowing if a test is available is to execute the 'test/available' target from the test application directory. It executes without error if tests run by 'make test' are present.

make test/available

Automated Tests Guidelines

When using pexpect $ is useless for matching the end of a line, instead use \r\n(pexpect end-of-line).

Beware of + and * at the end of patterns. These patterns will always get a minimal match (non-greedy).(pexpect end-of-patterns) This can be an issue when matching groups and using the matched groups to verify some kind of behavior since * could return an empty match and + only a subset.

This is especially prevalent since printf() is buffered so the output might not arrive in a single read to pexpect.

To avoid this make sure to match a non-ambiguous character at the end of the pattern like \r\n, \s, \), etc..

don't:

    child.expect(r'some string: (\d+)')

do:

    child.expect(r'some string: (\d+)\r\n')
    child.expect(r'some string: (\d+)\s')
    child.expect(r'some string: (\d+) ,')

Interaction through the uart

Tests implemented with testrunner use the cleanterm target that provides an interaction without adding extra text output or input handling. It can currently be expected to have unmodified line based interaction with the board.

The expected behavior is verified with the test in tests/test_tools.

Tests cannot rely on having on all boards and terminal programs:

  • unbuffered input
  • allowing sending special characters like ctrl+c/ctrl+d