Commit Graph

69 Commits

Author SHA1 Message Date
Jordan Yates a18761e298 tests: misc: kconfigoptions: test new options
Test new kconfig options.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-08-02 10:38:23 +02:00
Anas Nashif 79e2f22c6e tests: misc: fix identifiers
Do no use misc as component for test identifier.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-01 13:24:09 -04:00
Jordan Yates f38e6aa0d1 tests: misc: check_init_priorities: update output
Update the expected output of the init priority checking.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 15:58:06 +00:00
Jordan Yates b65ac5b9e0 tests: misc: check_init_priorities: force two stage linking
Add `CONFIG_DEVICE_DEPS` to force two stage linking, otherwise the
following check means the test never runs:
```
if (TARGET zephyr_pre1)
  add_dependencies(zephyr_pre1 check_init_priorities_output)
endif()
```

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 15:58:06 +00:00
Gerard Marull-Paretas aedcc0b59d tests: misc: check_init_priorities: check for zephyr_pre1 target
zephyr_pre1 target may not always exists, e.g. if second linking pass is
not needed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-21 09:32:05 +02:00
Anas Nashif b835b02136 tests: cleanup metadata and filtering
- Add integration_platforms to avoid excessive filtering
- Make sure integration platforms are actually part of the filter
- Fix some tags and test meta data

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-13 09:38:27 -04:00
Anas Nashif 0064b6e8b6 tests: samples: cleanup test tags, add integration_platforms
Use integration platforms and sanitize tags.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-02 04:47:06 -04:00
Fabio Baltieri 2354cc9e25 test: misc: add a test application for check_init_priorities
Add a test specifically for the check_init_priorities scripts.

The test creates a set of fake devices to exercise the three possible
conditions, run a build, run the check script and validate the script
output.

The check is meant to fail the build on error but that's bypassed in
this case as that would fail the twister run. That specific bit is
covered in unit tests anyway.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-25 15:40:07 +02:00
Gerard Marull-Paretas dacb3dbfeb iterable_sections: move to specific header
Until now iterable sections APIs have been part of the toolchain
(common) headers. They are not strictly related to a toolchain, they
just rely on linker providing support for sections. Most files relied on
indirect includes to access the API, now, it is included as needed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-22 10:42:30 +02:00
Gerard Marull-Paretas b8efac92e0 linker: add ITERABLE_SECTION_RA|OM_NUMERIC
In some cases, like devices, it is necessary to sort numerically, that
is, sort 10 before 2. Add a new helper function to do that, up to 2
numeric digits.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-12 12:01:10 +02:00
Gerard Marull-Paretas aae0fe8dab toolchain: add STRUCT_SECTION_ITERABLE_NAMED
Add a new API that allows to customize the name of an iterable section.
This allows to influence how section elements are sorted.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-12 12:01:10 +02:00
Gerard Marull-Paretas 93b63df762 samples, tests: convert string-based twister lists to YAML lists
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-10 09:52:37 +02:00
Keith Packard 0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Kumar Gala 336803e96f tests: iterable_sections: Add missing zephyr_iterable_section
As the test is for iterable sections, we need to utilize
zephyr_iterable_section for targets that need linker script
generation like arm-clang.

So add zephyr_iterable_section() for the RAM & ROM sections
that the testcases utilizes.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-07 18:59:00 +02:00
Jamie McCrae e534da007d samples/tests: Add empty prj.conf files
Adds empty prj.conf files as this file is required to configure
a build.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-17 11:49:27 +01:00
Fabio Baltieri 29ac5d4381 tests: iterable_sections: stop excluding posix
The iterable_sections test is excluding posix. Whatever the issue was at
the time this was set, the test seems to run fine on native_posix just
fine now.

Dropping the exclude to make this test run on native_posix.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-03-14 16:23:24 -04:00
Chris Friedt 6841d96a59 tests: misc: iterable_sections: test alternate foreach
Add tests for `STRUCT_SECTION_FOREACH_ALTERNATE()`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-03-06 13:52:29 +01:00
Anas Nashif 9ec20f82e4 tests: move arm_mpu_regions into tests/arch/
This is an architecture specific test, move it under tests/arch and fix
identifier.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-02-06 10:06:10 +01:00
Martin Jäger 9973dc59cf tests: misc: iterable_sections: add const specifier for ROM data
Without the const specifier the data is stored in RAM instead of ROM.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-10-12 18:42:28 +02:00
Enjia Mai d41c56c430 tests: misc: move the kconfig options test to new ztest API
Migrate the testsuite tests/misc/kconfigoptions to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-09 10:17:29 -05:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Eivind Jølsgard 3865e08c96 scripts/Kconfig: add dt_node_array_prop Kconfig functions
The motivation is to allow accessing array elements from device tree
properties in Kconfig.
* Add dt_node_array_prop and _node_array_prop functions to extract the
array elements from properties.
* Add 'dt_node_array_prop_int' and 'dt_node_array_prop_hex' keys to use
in Kconfig.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
2022-08-18 12:21:33 +02:00
Fabio Baltieri def230187b test: fix more legacy #include paths
Add a bunch of missing "zephyr/" prefixes to #include statements in
various test and test framework files.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Reto Schneider 7a6c5710ff cmake: Update cmake_minimum_required to 3.20.0
As Zephyr currently requires CMake version 3.20.0, update all
occurrences of cmake_minimum_required.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2022-07-04 10:18:45 +02:00
Chen Peng1 02ad698ce9 tests: iterable_sections: move to new ztest API.
Move test iterable_sections to use new ztest API.

Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
2022-06-29 15:50:14 -04:00
Chen Peng1 aca68aec50 tests: arm_mpu_regions: move to new ztest API
Move test to use new ztest API.

Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
2022-06-29 15:50:14 -04:00
Keith Packard d0a788669e tests: Add picolibc tests
This adds picolibc-specific configurations for a couple of tests

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-22 13:15:55 +02:00
Gerard Marull-Paretas ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Carlo Caione 444d214211 test: mpu: Add arm_mpu_regions test
A a test for the new DT-configured memory regions.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-04-05 11:16:31 +02:00
Yuval Peress fab5bb9ed3 printk: Add tests for print format
Add tests to verify that the different print formats and constant
macros match.

Fixes #44199

Signed-off-by: Yuval Peress <peress@google.com>
2022-03-29 12:34:08 -07:00
Ederson de Souza 78aa71228b tests: Run test_build only on platforms whose console has a driver
Otherwise XCC (based on GCC 4.2) will complain at log related undefined
symbols, that won't be generated as CONFIG_STDOUT_CONSOLE=n will be
forced.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-02-21 22:17:27 -05:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Fabio Baltieri 29585ee864 tests: iterable_sections: add a tests for iterable_sections
Add a test for iterable sections macro, covering read write and read
only sections.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2021-08-12 17:47:04 -04:00
Kumar Gala 15edf55781 tests: test_build: Exclude some NS platforms from debug builds
The nrf9160dk_nrf9160_ns and nrf5340dk_nrf5340_cpuapp_ns don't have
enough space for debug builds as configured so excluded them from
this specific test.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-07-13 06:38:57 -05:00
Kevin Townsend 1470ef67aa tests: test_build: Exclude lpcxpresso55s69_ns from debug builds
When CONFIG_TFM_BL2 is enabled on the LPC55S69 there isn't
enough memory left for TF-M to perform a debug build. Exludes this
platform from this specific test case.

Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
2021-05-21 20:12:23 -05:00
Anas Nashif dca317c730 sanitycheck: inclusive language
change whitelist -> allow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-27 07:04:07 -04:00
Anas Nashif 5804edafe5 tests: misc: back to whitelisting mcuboot test
Need a better way to support filters here.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-07 09:50:22 -04:00
Anas Nashif eee3ffc7b9 tests/samples: enable for integration testing
Limit execution in CI when using --integration option of sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-30 08:00:03 -04:00
Anas Nashif 2c5d40437b kernel: logging: convert K_DEBUG to LOG_DBG
Move K_DEBUG to use LOG_DBG instead of plain printk.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-25 16:12:36 -05:00
Marc Herbert debade9121 tests: make find_package(Zephyr...) REQUIRED
... because it is (required).

This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.

In this particular case, REQUIRED turns this harmless looking log
statement:

-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
  Cannot specify sources for target "app" which is not built by
  this project.

... into this louder, clearer, faster and (last but not least) final
error:

CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a package configuration file provided by "Zephyr" with
  any of the following names:

    ZephyrConfig.cmake
    zephyr-config.cmake

  Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
  "Zephyr_DIR" to a directory containing one of the above files.  If
  "Zephyr" provides a separate development package or SDK, be sure it
  has been installed.

-- Configuring incomplete, errors occurred!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Carles Cufi 6656214af2 boards: nrf52_pca10040: Rename to nrf52dk_nrf52832
The board name for the nRF52 DK, so far known as nrf52_pca10040, is
renamed to nrf52dk_nrf52832.  Its documentation and all references
to its name in the tree are updated accordingly. Overlay and
configuration files specific to this board are also renamed, to
match the new board name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Andy Ross 32bb2395c2 timeout: Fix up API usage
Kernel timeouts have always been a 32 bit integer despite the
existence of generation macros, and existing code has been
inconsistent about using them.  Upcoming commits are going to make the
timeout arguments opaque, so fix things up to be rigorously correct.
Changes include:

+ Adding a K_TIMEOUT_EQ() macro for code that needs to compare timeout
  values for equality (e.g. with K_FOREVER or K_NO_WAIT).

+ Adding a k_msleep() synonym for k_sleep() which can continue to take
  integral arguments as k_sleep() moves away to timeout arguments.

+ Pervasively using the K_MSEC(), K_SECONDS(), et. al. macros to
  generate timeout arguments.

+ Removing the usage of K_NO_WAIT as the final argument to
  K_THREAD_DEFINE().  This is just a count of milliseconds and we need
  to use a zero.

This patch include no logic changes and should not affect generated
code at all.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-03-31 19:40:47 -04:00
Torsten Rasmussen 407b49b35c cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01: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 70758c4374 tests: fix test identifiers
The seasonal overhaul of test identifiers aligning the terms being used
and creating a structure. This is hopefully the last time we do this,
plan is to document the identifiers and enforce syntax.

The end-goal is to be able to generate a testsuite description from the
existing tests and sync it frequently with the testsuite in Testrail.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-12-09 15:53:44 -05:00
Anas Nashif 2051ad1846 tests: convert util test to a unit test
Merge tests/misc/util with existing util unit test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-30 07:09:42 -04:00
Anas Nashif cd60bd96ac tests: cleanup test_build
- Kconfig test does not really need to build on all platforms
- nmi test is already in tests/arch/arm/arm_runtime_nmi
- we have plenty of tests with newlib enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Krzysztof Chruscinski bd8e241733 tests: misc: util: Add test for Z_MAX and Z_MIN
Added tests for new macros in util.h

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-09-25 17:41:03 +02:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00