testcases: add automation markup to samples/

Code in samples does not follow an standarized format for reporting
success or operation failure -- thus we use markup (in file sample.tc)
to specify what shall be found in the console to consider execution a
success.

There is a few functional code modifications that add/extend console
messages so verification is possible or easier:

 - hello_world, synchronization: extend the success message to also
   print which core is running the testcase

- pci_enum: print message on success.

Change-Id: Idb6cea03adebe97d97854603f963f4e3d4cb856a
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
This commit is contained in:
Inaky Perez-Gonzalez 2016-04-21 12:43:51 -07:00
parent 11693c1bf9
commit eb2d8b418c
21 changed files with 203 additions and 4 deletions

View file

@ -0,0 +1,15 @@
# @testcase dynamic
# d2000 have not enough RAM for this
# _ctb: there are no configs
# arduino_101_sss, quark_se_sss_ctb: task_arch.h not found -> micro not supported
# @targets \
# board:(?!quark_d2000_crb) \
# board:(?!quark_se_sss_ctb) \
# board:(?!quark_se_sss_devboard) \
# board:(?!quark_se_sss_dvp) \
# board:(?!quark_se_sss_emu) \
# board:(?!quark_se_ctb) \
# board:(?!arduino_101_sss) \
#
# @eval console-rx %(console)s:5 task_a: Hello World!
# @eval console-rx %(console)s:5 task_b: Hello World!

View file

@ -0,0 +1,5 @@
# @testcase dynamic
#
# @eval console-rx %(console)s:20 Create semaphore
# @eval console-rx %(console)s:20 main: Hello World!
# @eval console-rx %(console)s:20 fiber_entry: Hello World!

View file

@ -0,0 +1,5 @@
# @testcase dynamic
# @targets \
# board:(galileo|qemu_x86|qemu_cortex_m3)
#
# @eval console-rx %(console)s:20 Enumeration complete on %(bsp)s

View file

@ -59,7 +59,7 @@ void task_enum_pci(void)
}
pci_enumerate();
PRINT("Enumeration complete on %s", CONFIG_ARCH);
done = 1;
}
@ -68,6 +68,7 @@ void task_enum_pci(void)
void main(void)
{
pci_enumerate();
PRINT("Enumeration complete on %s", CONFIG_ARCH);
}
#endif /* CONFIG_MICROKERNEL */

View file

@ -0,0 +1,5 @@
# @testcase dynamic
# @targets \
# board:(?!quark_se_sss_devboard) \
#
# @eval console-rx %(console)s:15 LSM9DS0 Who Am I

View file

@ -0,0 +1,18 @@
# @testcase dynamic
# @targets \
# board:(?!arduino_101) \
# board:(?!arduino_101_sss) \
# board:(?!arduino_due) \
# board:(?!basic_cortex_m3) \
# board:(?!basic_minuteia) \
# board:(?!frdm_k64f) \
# board:(?!galileo) \
# board:(?!minnowboard) \
# board:(?!qemu_cortex_m3) \
# board:(?!qemu_x86) \
# board:(?!quark_d2000_crb) \
# board:(?!quark_se_devboard) \
# board:(?!quark_se_sss_devboard) \
#
# @eval console-rx %(console)s:15 SPI Flash Manufacturer [0-9a-zA-Z]+ Device Id [0-9a-zA-Z]+

View file

@ -0,0 +1,7 @@
# @testcase dynamic
# @tags kernel:micro
# @targets \
# board:(?!arduino_101_sss) \
# board:(?!quark_se_sss_devboard)
#
# @eval console-rx %(console)s:5 Hello World! %(bsp)s

View file

@ -26,5 +26,5 @@
void main(void)
{
PRINT("Hello World!\n");
PRINT("Hello World! %s\n", CONFIG_ARCH);
}

View file

@ -0,0 +1,4 @@
# @testcase dynamic
# @tags kernel:nano
#
# @eval console-rx %(console)s:15 Hello World! %(bsp)s

View file

@ -34,6 +34,6 @@
void main(void)
{
PRINT("Hello World!\n");
PRINT("Hello World! %s\n", CONFIG_ARCH);
}

35
samples/ipm/sample.tc Normal file
View file

@ -0,0 +1,35 @@
# @testcase dynamic defaults=none
# @targets bsp_models:x86\+arc
#
# @build [ bsp == "x86" ] \
# make -j -C %(srcdir)s/ipm_demo_lmt CONFIG_KERNEL_BIN_NAME=zephyr \
# BOARD=%(board)s O=outdir-%(target)s-%(bsp_model)s-%(board)s
# @build [ bsp == "arc" ] \
# make -j -C %(srcdir)s/ipm_demo_arc CONFIG_KERNEL_BIN_NAME=zephyr \
# BOARD=%(board)s O=outdir-%(target)s-%(bsp_model)s-%(board)s
#
# @clean rm -rf %(srcdir)s/ipm_demo_*/outdir-%(target)s-%(bsp_model)s-*
#
# @images [ bsp == "x86" ] \
# kernel-%(bsp)s:%(srcdir)s/ipm_demo_lmt/outdir-%(target)s-%(bsp_model)s-%(board)s/%(kernelname)s
#
# @images [ bsp == "arc" ] \
# kernel-%(bsp)s:%(srcdir)s/ipm_demo_arc/outdir-%(target)s-%(bsp_model)s-%(board)s/%(kernelname)s
#
#
# Maybe we should switch to: Arduino has a hard time recovering some
# times, so we power cycle it instead of resetting
# @eval [ target == "arduino101" ] target-power-cycle one-shot wait=5
# @eval [ target != "arduino101" ] target-reset one-shot
#
# ^eval [ bsp == 'arc' ] console-rx ::fail "unexpected data payload"
# ^eval [ bsp == 'arc' ] console-rx ::fail "expected [0-9]+ got [0-9]+"
# @eval [ bsp == 'arc' ] console-rx :15 counters: [0-9]+ [0-9]+ [0-9]+
# @eval [ bsp == 'arc' ] console-rx :15 Hello from ARC
# @eval [ bsp == 'x86' ] console-rx :15 Hello from lakemont!
# @eval [ bsp == 'x86' ] console-rx :15 === app started ===
# @eval [ bsp == 'x86' ] console-rx :15 pinging arc for counter status
# @eval [ bsp == 'x86' ] console-rx :15 ARC (is (halted|sleeping|running)|status:)
# @eval [ bsp == 'x86' ] console-rx :15 mailbox status: [0-9a-f]+ mask [0-9a-f]+
# @eval [ bsp == 'x86' ] console-rx :15 sending messages for IPM device

View file

@ -0,0 +1,4 @@
#
# this is a very lousy test on the output, we need to look for more precise
# information that informs that this is working.
# @eval console-rx %(console)s:10 System tick count : [0-9]+

View file

@ -0,0 +1,8 @@
# @testcase dynamic
# @targets \
# board:(?!arduino_101_sss) \
# board:(?!quark_se_sss_devboard) \
# board:(?!quark_se_sss_devboard) \
# board:(?!arduino_101_sss) \
# board:(?!quark_d2000_crb) \
#

View file

@ -0,0 +1,6 @@
# @testcase dynamic
# @targets \
# board:(?!arduino_101_sss) \
# board:(?!quark_d2000_crb) \
# board:(?!quark_se_sss_devboard) \

View file

@ -0,0 +1,8 @@
# @testcase dynamic
# No configuration?
# @targets \
# board:(?!quark_se_ctb) \
# board:(?!quark_d2000_crb) \
#
# @eval console-rx %(console)s:15 received [0-9]+ bytes
# @eval console-rx %(console)s:15 sent [0-9]+ bytes

View file

@ -0,0 +1,18 @@
# @testcase dynamic
# @targets \
# board:(?!arduino_101) \
# board:(?!arduino_101_sss) \
# board:(?!arduino_due) \
# board:(?!basic_minuteia) \
# board:(?!basic_cortex_m3) \
# board:(?!frdm_k64f) \
# board:(?!galileo) \
# board:(?!minnowboard) \
# board:(?!qemu_cortex_m3) \
# board:(?!qemu_x86) \
# board:(?!quark_d2000_crb) \
# board:(?!quark_se_sss_devboard) \
#
# @eval console-rx %(console)s:15 received [0-9]+ bytes
# @eval console-rx %(console)s:15 sent [0-9]+ bytes

View file

@ -0,0 +1,22 @@
# @testcase dynamic
# @tags kernel:micro
#
# quark_d200_crb -> RAM too small
#
# @targets \
# board:(?!quark_d2000_crb) \
# board:(?!arduino_101_sss) \
# board:(?!quark_se_sss_devboard) \
#
# @eval console-rx %(console)s:10 Philosopher 0 EATING
# @eval console-rx %(console)s:10 Philosopher 0 THINKING
# @eval console-rx %(console)s:10 Philosopher 1 EATING
# @eval console-rx %(console)s:10 Philosopher 1 THINKING
# @eval console-rx %(console)s:10 Philosopher 2 EATING
# @eval console-rx %(console)s:10 Philosopher 2 THINKING
# @eval console-rx %(console)s:10 Philosopher 3 EATING
# @eval console-rx %(console)s:10 Philosopher 3 THINKING
# @eval console-rx %(console)s:10 Philosopher 4 EATING
# @eval console-rx %(console)s:10 Philosopher 4 THINKING
# @eval console-rx %(console)s:10 Philosopher 5 EATING
# @eval console-rx %(console)s:10 Philosopher 5 THINKING

View file

@ -0,0 +1,15 @@
# @testcase dynamic
# @tags kernel:nano
#
# @eval console-rx %(console)s:10 Philosopher 0 EATING
# @eval console-rx %(console)s:10 Philosopher 0 THINKING
# @eval console-rx %(console)s:10 Philosopher 1 EATING
# @eval console-rx %(console)s:10 Philosopher 1 THINKING
# @eval console-rx %(console)s:10 Philosopher 2 EATING
# @eval console-rx %(console)s:10 Philosopher 2 THINKING
# @eval console-rx %(console)s:10 Philosopher 3 EATING
# @eval console-rx %(console)s:10 Philosopher 3 THINKING
# @eval console-rx %(console)s:10 Philosopher 4 EATING
# @eval console-rx %(console)s:10 Philosopher 4 THINKING
# @eval console-rx %(console)s:10 Philosopher 5 EATING
# @eval console-rx %(console)s:10 Philosopher 5 THINKING

13
samples/shell/sample.tc Normal file
View file

@ -0,0 +1,13 @@
# @testcase dynamic
#
# @targets \
# board:(?!arduino_101_sss) \
# board:(?!quark_se_sss_devboard) \
#
# @eval console-rx %(console)s:15 shell>
# @eval console-tx %(console)s:1 ping\r\n
# @eval console-rx %(console)s:15 pong
# @eval console-tx %(console)s:1 ticks\r\n
# @eval console-rx %(console)s:15 ticks:
# @eval console-tx %(console)s:1 highticks\r\n
# @eval console-rx %(console)s:15 highticks:

View file

@ -0,0 +1,10 @@
# @testcase dynamic
# @targets \
# board:(?!arduino_101_sss) \
# board:(?!minnowboard) \
# board:(?!quark_d2000_crb) \
# board:(?!quark_se_sss_devboard) \
#
# @eval console-rx %(console)s:10 taskA: Hello World from %(bsp)s!
# @eval console-rx %(console)s:10 taskB: Hello World from %(bsp)s!

View file

@ -51,7 +51,7 @@ void helloLoop(const char *taskname, ksem_t mySem, ksem_t otherSem)
task_sem_take(mySem, TICKS_UNLIMITED);
/* say "hello" */
PRINT("%s: Hello World!\n", taskname);
PRINT("%s: Hello World from %s!\n", taskname, CONFIG_ARCH);
/* wait a while, then let other task have a turn */
task_sleep(SLEEPTICKS);