Commit graph

273 commits

Author SHA1 Message Date
Wentong Wu
6fae53c044 sanitycheck: handle timeouts correctly with qemu
In some cases we were not handling return code correctly and evaluating
timeouts as a pass. Report failure correctly.

Fixes #26065

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-06-25 11:05:29 -04:00
Andrew Boie
45979dafb4 linker: add iterable section macros
For iterable areas defined with Z_STRUCT_SECTION_ITERABLE(),
the corresponding output section in the linker script is just
boilerplate. Add macros to make these definitions simpler.

Unfortunately, we have a fair number of iterable sections not
defined with Z_STRUCT_SECTION_ITERABLE(), this patch does not
address this.

The output sections are all named <struct name>_area, update
sanitylib.py with this.

sys_sem with no userspace, and k_lifo/k_fifo are special cases
where different data types that are all equivalent need to be
put in the same iterable area. Add
Z_STRUCT_SECTION_ITERABLE_ALTERNATE() for this special case.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-24 17:09:22 -04:00
Anas Nashif
adb6a89be5 sanitycheck: capture non-ztest results
We were missing test results from non-ztest tests in the target reports.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-12 11:50:26 -04:00
Peter Bigot
3c36b42d03 sanitycheck: add notes key to schema
Prior to addition of schema validation running sanitycheck
--generate-hw-map would preserve the value of any field in an existing
map that it didn't update.  These fields now cause a parsing error.
Add notes as an optional key where information relevant to the board
can be added to provide useful context (such as which serial port
corresponds to the console, or why a non-standard runner is required).

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-10 12:03:17 +02:00
Peter Bigot
3cdd5b4be4 sanitycheck: add missing probe_id key to schema
probe_id is used as an optional key that overrides id as the source
of board_id when configured to use a runner that is not the default.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-10 12:03:17 +02:00
Spoorthy Priya Yerabolu
d434dfc22c sanitylib: Adding small change to enable create_overlay() testing
Returning the content from create_overlay() in TestInstance class

Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
2020-06-08 16:38:48 -04:00
Maciej Perkowski
b2fa99caf8 sanitycheck: Add filtered test cases to the JUnit full report
If a test instance from .yaml file was skipped due to being on
a filtered list then there are no entries about it in the
sanitycheck_report.xml for a given platform. This commit fills
instance.results with skipped test cases also for skipped instances so
those test cases are visible when the full report is generated. Tested
for ./tests/kernel/mem_protect/userspace on nrf52dk_nrf52832 where
userspace.gap_filling is filtered out.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2020-05-25 15:52:17 +02:00
Anas Nashif
3b86f13fab sanitycheck: add fixture support to hardware map
It is now possible to add a list of fixture a platform supports which is
matched to testcases requesting fixtures to be avaiable to be able to
run.

For example:

- available: true
  connected: true
  id: 0240000026334e450015400f5e0e000b4eb1000097969900
  platform: frdm_k64f
  product: DAPLink CMSIS-DAP
  runner: pyocd
  serial: /dev/ttyACM9
  fixtures:
    - gpio_loopback

Fixes #24943

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-24 20:25:51 +02:00
Anas Nashif
cefb9a170f sanitycheck: support fixtures
Add fixtures to hardware map schema.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-24 20:25:51 +02:00
Anas Nashif
ce8c12eb5a sanitycheck: cleanup fixture processing
Cleanup fixture processing and allow ztest testcases to support
harness_config with fixture definition.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-24 20:25:51 +02:00
Anas Nashif
77946fa835 sanitycheck: remove wrong message about --qemu-testing
--qemu-testing does not exist.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-21 22:47:36 -04:00
Aastha Grover
a0ae53410e sanitylib: Remove hardcoded sample.yaml & testcase.yaml in TestSuite class
This fix creates class variables SAMPLE_FILENAME & TESTCASE_FILENAME
in Class TestSuite and remove the hardcoded sample.yaml & testcase.yaml
from add_testcases function. This makes testing for sanitylib script
easier so that shippable do not detect the test_data for sanitylib
as actual zephyr testcases.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2020-05-14 22:48:09 +02:00
Wentong Wu
0d619aefd8 sanitycheck: Add cpu time for QEMUHandler
Add cpu time for QEMUHandler because the guest virtual time
in QEMU icount mode isn't host time and it's maintained by
counting guest instructions, we use QEMU process CPU time to
mostly simulate the time of guest OS.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-14 13:52:07 +02:00
Wentong Wu
7ec57b4666 scripts: sanitylib.py: enhancement for QEMUHandler
Sometimes QEMU can't handle SIGTERM signal correctly and just
run as normal, in that case kill -9 QEMU process directly and
leave sanitycheck judge the testing result by console output.

For failures caused by other reasons, terminate all releated
processes to avoid CI waits 2 hours and reports timeout.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-14 13:52:07 +02:00
Anas Nashif
44f7ba0781 sanitycheck: detect wrongly named tests and fail
Tests should always start with test_. If not, they will not be in the
report.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-13 18:16:07 +02:00
Anas Nashif
4258d8d34b sanitycheck: give summary about built vs executed
It is important to see that some tests are only building and not
executing...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-11 17:00:26 +02:00
Anas Nashif
91fd68dbbf sanitycheck: also look for cpp files when scanning
look for *.c* instead of just *.c files when scanning or testcases.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-11 17:00:26 +02:00
Anas Nashif
bb28035a82 sanitycheck: support exporting instances
Enable exporting tests per platform.

sanitycheck --export-tests out.txt  -p qemu_x86 -T tests/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-11 17:00:26 +02:00
Anas Nashif
1a5defa924 sanitycheck: support --force-platform
This option allows running tests on platforms that would be excluded
based on the test definition.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-11 17:00:26 +02:00
Kumar Gala
6a2cb94f6f sanitycheck: suppress warnings from EDT
We don't need sanitycheck's use of EDT to report warnings, we'll get
them from the build system.  So the warnings are just duplication and
noise, thus lets always suppress them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-08 21:54:02 -04:00
Anas Nashif
61c6e2b172 sanitycheck: raise exception on bad exclusion in ztest
Abort if we find tests that are being skipped incorrectly. Tests should
be skipped using ztest_test_skip().

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-07 14:24:02 -04:00
Anas Nashif
7a69125fbf sanitycheck: raise exceptions on bad test names
Raise exception on bad test names such as 'test' or 'sample'.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-07 14:23:45 -04:00
Anas Nashif
aff616de20 sanitycheck: fix initial types in classes and minor cleanup
While testing sanitycheck classes, found some wrongly initialisized
variables which caused issues, fixed those..

All Test* classes should now be ignored by pytest and should not be
treated as pytest code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-05 16:32:25 -04:00
Anas Nashif
43275c8eff sanitycheck: raise exception on harness without a config
console harness without a harness_config is not allowed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-05 06:16:50 -04:00
Anas Nashif
051602f4f3 sanitycheck: support coverage with unit tests
Fix setting coverage for unit tests and link against gcov when coverage
is enabled.

Fixes #24674

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-29 09:01:06 -04:00
Anas Nashif
9ace63e6f0 sanitycheck: keep recording.csv with -M option
Do not delete recordings when invoking sanitycheck with
--runtime-artifact-cleanup

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-28 11:41:08 -04:00
Anas Nashif
227392c732 sanitycheck: kill if terminate does not work
In some cases terminate (SIGTERM) is not enough and we have to kill the
proces (SIGKILL), otherwise the process is stuck forever and taking
hours to complete and finally timeout in CI.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-28 11:41:08 -04:00
Anas Nashif
b802af8350 sanitycheck: set reason to Failed
In some cases we were missing the reason and reporting 'Unknown',
check for failure and set the reason.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-28 11:41:08 -04:00
Anas Nashif
6915adf899 sanitycheck: add option for report suffix
Add option --report-suffix to append custom string to all generated
files. This is going to be useful for generating results for a specific
version, i.e. --report-suffix zephyr-v2.2.0-1814-ge737761d23

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-22 14:21:05 -04:00
Anas Nashif
56aac64bae boards: nsim: for smp testing, using mdb
This board require a special setup and does not work with standalone
nsim.

Fixes #24363

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-20 17:59:38 -04:00
Martí Bolívar
07dce820d5 sanitycheck: add --persistent-hardware-map
This option prefers serial device names which are stable
across device plug/un-plug on platforms that support it (currently
just Linux, via /dev/serial/by-id).

This feature is opt-in as not all manufacturers include the
appropriate metadata for udev to generate unique names for their
devices.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-17 18:31:28 +02:00
Jukka Rissanen
420b195b5e drivers: console: uart_mux: Initial UART muxing support
Create support for muxed UARTs which are attached to a real
UART and which use GSM 07.10 muxing protocol to create virtual
channels that can be run on top of the real UART.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Anas Nashif
904155021a sanitycheck: update old reports when called with --only-failed
When retrying failed tests, make sure we keep old results and only
update those tests that were retried.

Also, remove duplication of code for creating the reports and make the
report function a bit more generic.

sanitycheck.xml is now listing or tests, not only the test application.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-14 12:50:41 -04:00
Anas Nashif
47f1665e78 sanitycheck: match results with extra logging output
renode has extra output that was preventing detection of passing tests
for reporting.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-12 18:42:46 -04:00
Anas Nashif
b06a5b5707 sanitycheck: fix coverage capturing
We got the gcov with the coverage tool (lcov vs gcovr) confused..

Fixes #24003

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-07 14:53:20 -04:00
Jukka Rissanen
02fe85d5e0 net: Remove leftovers for obsolete net stacks shell command
The "net stacks" shell command support was just removed, but
the net_stacks linker section was left around.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-01 10:41:58 -04:00
Anas Nashif
c11f8acbb3 sanitycheck: fix setting of west_flash/runner
We are not propagting those options all the way to the device handler
now, fix this by using the suite member in the handler which has those
already.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-31 17:21:43 +03:00
Anas Nashif
f6462a3a8c sanitycheck: get rid of global VERBOSE
Do not declare VERBOSE as global, instead pass verbosity as argument.
Also get rid of options as global and fix coverage class to not use
global option variable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 09:59:42 -04:00
Anas Nashif
13d0c03761 sanitycheck: remove unused arg files
We do not use those arg files anymore, so remove them to avoid
confusion and for the sake of cleanup.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 09:59:42 -04:00
Anas Nashif
b366949498 sanitycheck: fix issue with generator setting
Do not set generator on None handler.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 09:59:42 -04:00
Anas Nashif
ce2b418027 sanitycheck: split main script into an exe and classes
Move most of the classes to sanitycheck.py under sanity_check directory.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 09:59:42 -04:00
Ioannis Glaropoulos
f3807f19dc boards: arm: nrf51_pca10028: rename board to nrf51dk_nrf51422
We rename the nRF51 Dev Kit board target (nrf51_pca10028)
to nrf51dk_nrf51422. We update all associated references
in the supportive documentation and all nRF51-related
cofigurations and overlay files in the samples and tests
in the tree.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-03-24 11:45:27 +01:00
Anas Nashif
497fe4267a release: update sanitycheck footprint file
Update for latest release.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-09 23:40:45 +02:00
Ulf Magnusson
cf89ba33ea global: Fix up leading/trailing blank lines in files
To make the updated test in
https://github.com/zephyrproject-rtos/ci-tools/pull/121 clean, though it
only checks modified files.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-27 17:41:55 -06:00
Anas Nashif
e9450065de sanitycheck: additional scripting hook after flashing
Support custom hooks after flashing is completed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-01-06 13:58:10 -05:00
Anas Nashif
2a5d61d3ea sanitycheck: define schema for hardware map
Add schema for hardware map and verify it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-12-19 22:55:16 -05:00
Anas Nashif
0b6a1041e1 release: fix sanitycheck release file
File was generated with footprint data by mistake, regenerated with
correct options.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-12-09 22:46:21 -05:00
Anas Nashif
a4dd49b380 sanitycheck: parse testcase names correctly
We were parsing random FAIL messages from the output of test runs ad
testcases and capturing them in the xml output. Now we only parse the
name if it starts with test_.

Fixes #21162

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-12-09 10:30:48 -05:00
Anas Nashif
f3a0ad013b release: update sanitycheck release file
Update sanity_last_release.csv required for footprint comparisons.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-12-07 19:17:08 -06:00
Kumar Gala
7733b94224 sanitycheck: Add functions to query device tree for filters
Add the following functions to allow filtering based on device tree

dt_compat_enabled(compat) - Returns true if a device tree node
compatible matches 'compat' and the node is enabled.

dt_alias_exists(alias) - Returns true if a device tree node exists with
'alias' and the node is enabled.

dt_compat_enabled_with_alias - Returns true if a device tree node
compatible matches 'compat' and the node has 'alias' and the node is
enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-11-04 09:02:14 -05:00