This patch should improve couting and reporting of the number
of passed/skipped tests.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
When running with --test-only we get:
Traceback (most recent call last):
File "./scripts/sanitycheck", line 1168, in <module>
main()
File "./scripts/sanitycheck", line 1160, in main
options.only_failed)
File "scripts/sanity_chk/sanitylib.py", line 2543, in save_reports
self.xunit_report(filename + ".xml", full_report=False, append=only_failed)
File "scripts/sanity_chk/sanitylib.py", line 3220, in xunit_report
return fails, passes, errors, skips
UnboundLocalError: local variable 'fails' referenced before assignment
This is due to the fact that selected_platforms was not set.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Sanitycheck discards test instances if a set of given coditions
is not fulfilled. This leads to empty test results for these
instances. This can introduce ambiguity with results that are
missing due to some bugs in the framework. This commit fills
the results for skipped tests with 'skipped' states and provides
the reason for filtering them out in the msg field. The commit
also fixes the way sanitycheck counts and reports tests/test cases
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
Use --integration testing for CI to limit execution and builds on
platforms that actually provide most of the coverage instead of blindly
building/running on all available platforms.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add option to provide to sanitycheck argument for creating
pseudoterminal. Used with hardware without serial console connected.
A pseudoterminal is used to make a sanitycheck believe that it
interacts with a terminal although it actually interacts with the
script.
E.g "sanitycheck --device-testing --device-serial-pty <script>"
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
--warnings-as-errors was basically doing nothing, it is the default.
Replace this with an option to disable erroring on warning:
-W, --disable-warnings-as-errors
Fixes#26910
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
restore how --only-failed works by allow rebuilds in case of build
errors, however, do not rebuild when --retry-failed is used, which is a
CI usecase and nothing would change in the second iteration.
Fixes#26685
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
- Report build errors as errors, not test failures
- Do not try and build/run tests with build failures
- Fix issue with empty reports when running --only-failed
- Report build errors in the detailed and target reports
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Missed the case we use in CI where we pre-generate the testcase list and
load it, this was resulting in empty test reports in CI.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Cleanup fixture processing and allow ztest testcases to support
harness_config with fixture definition.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
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>
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>
Now that the main Zephyr build system (and the documentation's) no
longer require ZEPHYR_BASE in the environment, the sanitycheck
script's continuing to require this makes less sense.
We can easily find ZEPHYR_BASE starting from a given sanitycheck
script, so let's just do that. Preserve the ability for a user to
override the ZEPHYR_BASE location in the environment as usual for
compatibility.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
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>
Reorder classes to be on top of loose functions. Move a few globals into
the related classes where they are being used.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This will make it easier for us to test classes and functions without
having arg options in the middle.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
CMake is not returning any error codes on build failures so those go
undetected in some cases. Handle the case where we get no output at all
from cmake and deal with that as a failure.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add named exceptions instead of a generic one. Should help point to the
right issue when something goes wrong.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
We used the column 'passed' as a boolean to signify pass or fail,
however we do have other states that need to be tracked.
Remove the boolean and use a text field instead that has the status as a
string.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When running 1 specific test, counting was off. Combine functions adding
tests into one and optimize filtering.
Fixes#22270
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
add lstrip function to delete the '\r' char in front of the
serial output from serail readline, because this '\r'
will influence the result match function in harness.py.
Signed-off-by: peng1 chen <peng1.chen@intel.com>
This commit updates the section names for memory size calculation in
the sanitycheck script as follows:
1. Remove `_TEXT_SECTION_NAME_2` section, which no longer exists, from
the `rw_sections`.
2. Add `rom_start` section, which mostly contains read-only data such
as the exception vector table, to the `ro_sections`.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
We only need pyserial python module if we are doing device testing.
Treat it similar to how we treat tabulate module.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The SDK has a new path for x86 gcov, point to the new binary. Also, do
not clean artifacts when running coverage.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Since we do interger division to determine how many items are in each
set, its possible we can have bad rounding error and the last set having
a much larger amount of items compared to all other sets.
For example, total = 3740, sets = 300:
per_set = 3740 / 300 = 12.466 = 12
last_set = 3740 - 299 * 12 = 152
So instead of doing simple division, we add on extra item to the early
sets and we've exhausted the rounding error:
num_extra_sets = total - per_set * sets
140 = 3740 - 12 * 300
So the first 140 subsets will have 13 per_set, and the last 160 will
have 12 per_set.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Overlay files were concatenated into single string with no whitespace
between them. If '--extra-args OVERLAY_CONFIG="overlay-1.conf"
--extra-args OVERLAY_CONFIG="overlay-2.conf"' was used, then the result
was OVERLAY_CONFIG="overlay-1.confoverlay-2.conf".
Another thing was that overlay extra args were not properly removed from
the list of regular arguments. As a result we had incorrect list of
overlays and incorrect list of other arguments.
Rework code to extract overlays in loop in a safe manner. Use for that a
list of strings instead of string directly. Join those strings and form
a single OVERLAY_CONFIG argument just before running cmake.
Tested with following testcase.yaml line:
extra_args: ARG1 OVERLAY_CONFIG="overlay-1.conf"
ARG2 OVERLAY_CONFIG="overlay-2.conf"
Before this patch we got:
args = ['OVERLAY_CONFIG="overlay-1.conf"',
'OVERLAY_CONFIG="overlay-2.conf"']
After this patch we get:
args = ['ARG1', 'ARG2',
'OVERLAY_CONFIG="overlay-1.conf overlay-2.conf"']
While at it, fix also regex pattern by removing requirement of double
quotes around value. Match any option value instead and strip both
single and double quotes when match is positive. Tested with:
$ ./scripts/sanitycheck -T samples/hello_world/ -p qemu_x86 \
--extra-args OVERLAY_CONFIG=overlay1.conf '
--extra-args OVERLAY_CONFIG=\"overlay2.conf\" '
--extra-args OVERLAY_CONFIG=\'overlay3.conf\'
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Only dump data when we are interested in the analysing coverage. By
default just collect the data.
CONFIG_COVERAGE_DUMP is used to control this behaviour.
This will help speed up sanitycheck and will avoid lots of noise in the
log when some tests with coverage enabled failed. Dumping data to
console is also suspected to be one of the reason why qemu hangs in CI.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The terminal configuration should not be reset on exit if
sanitycheck's output is being directed to something that mediates the
terminal control, such as a pager. Only do the reset if stdout is
interactive.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Sort by testcase name and path and not by platforms. This way we do not
have the same platform executing on CI system causing failures to
overload.
Right now we have almost all qemu targets executing on 1 or 2 nodes,
causing those systems to be overloaded. Instead of taking the default
sorting by platforms, we now sort by testcases, so the distribution is
more "random", but still reproducible.
Remove the ordering function that would put native_posix in the first
set, it is not being used anymore.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Outer if is checking if the variable is in a list with two options
which means that we can just do an if / else and remove an assignment.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Timeouts were not reported correctly in the XML file as failures,
causing some confusion in the shippable results.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
It is often needed to run sanitycheck and exclude a specific platform or
multiple platforms. Add an option to provide this using
--exclude-platform. The option can be used multiple times to exclude
multiple platforms at the same time.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Using --runtime-artifact-cleanup, the script will now remove all
artifacts of passing tests. This is useful for running sanitycheck on
systems with little disk space.
Fixes#21922
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Show how many tests passed out of those that were actually
performed, not including skipped tests (which we also report
a count of)
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
stderr from the binary handler (native_posix for example) was redirected
to the logger as errors, this is confusing the console and users, so
remove this.
Fixes#21784
Signed-off-by: Anas Nashif <anas.nashif@intel.com>