Commit graph

20 commits

Author SHA1 Message Date
Jamie McCrae da3007e559 tests: cmake: overlays: Add soc_folder_overlay test
Adds a testcase for the new ``socs`` folder, with overlays

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-29 15:08:35 +01:00
Jamie McCrae 1ed6d89d13 tests: cmake: overlays: Add soc_folder_kconfig test
Adds a testcase for the new ``socs`` folder using Kconfig fragments

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-29 15:08:35 +01:00
Alberto Escolar Piedras 548739cf8c tests/cmake/*: Switch to native_sim
Switch from native_posix to native_sim as test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-27 16:06:42 +00:00
Anas Nashif 345735d0a8 tests: remove CONFIG_ZTEST_NEW_API in all tests
Remove all usage of CONFIG_ZTEST_NEW_API from tests and sample as this
is now enabled by default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Anas Nashif a2ed99687b tests: group all build system tests under build_system
Consistent naming of components related to build system.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-11 14:19:40 +03:00
Grzegorz Swiderski 199cc7f91b cmake: Fix scope pollution in zephyr_get(... MERGE)
Clear the output variable with an empty string, before appending to it.
Unsetting the variable locally is insufficient, because its value from
the parent scope or cache can still creep into the final result.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-08-16 15:01:57 +02:00
Grzegorz Swiderski 7f4b1abb39 cmake: Don't lose global sysbuild value with zephyr_get(... MERGE)
According to the doc comment:

  If using MERGE then SYSBUILD GLOBAL will get both the local and global
  sysbuild scope variables (in that order, if both exist).

This stopped working in commit 8460d91e32,
when support for `zephyr_get(... VAR <multiple-variables>)` was added.

Instead of returning both values, the local sysbuild scope value would
clobber the global one. Fix this by splitting the internal `sysbuild`
scope into `sysbuild_local` and `sysbuild_global`, in that order.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-08-16 15:01:57 +02:00
Grzegorz Swiderski 5ef7229a8c tests: cmake: Add zephyr_get
As `zephyr_get()` grows in complexity and significance, it must continue
working as expected. Unfortunately, it has a few minor bugs already, but
they will be taken care of in the next few commits. Before that, though,
let's go ahead and add a test suite for this function.

For now, some tests will pass by using incorrect values, annotated with
the `# BUG` comments; they will be removed in later patches. The purpose
of having them now is to make it easier to see what's about to be fixed.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-08-16 15:01:57 +02:00
Jordan Yates 15b003877f tests: cmake: snippets: test DTS_EXTRA_CPPFLAGS
Add tests for the `DTS_EXTRA_CPPFLAGS` append option in snippets.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-08-02 16:27:11 +02:00
Anas Nashif bc72b13c88 tests: cmake: fix identifier
config_dir is part of cmake testsuite.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-01 13:24:09 -04:00
Stephanos Ioannidis f1a18022be tests: snippets: Rework the snippet test
This commit reworks the snippet test to more comprehensively test the
different processing modes of snippets.

The following testcases have been added:

1. Initial state with no snippet applied
2. Applying `foo` snippet from the default application snippet root
3. Applying `bar` snippet from an extra snippet root
4. Sequentially applying `foo` and `bar` snippets to test the snippet
   processing order
5. Sequentially applying `bar` and `foo` snippets to test the snippet
   processing order.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2023-05-25 21:51:26 +02:00
Torsten Rasmussen 1561a0705f snippets: support for EXTRA_DTC_OVERLAY_FILE and EXTRA_CONF_FILE
This commit adds change snippets to use the new EXTRA_DTC_OVERLAY_FILE
and EXTRA_CONF_FILE Zephyr build system variables instead of
DTC_OVERLAY_FILE and OVERLAY_CONFIG.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2023-05-25 13:31:53 +00:00
Torsten Rasmussen a88502783b cmake: align Zephyr module variable to EXTRA_ZEPHYR_MODULES
Align Zephyr modules with other user facing variables where settings
can be defined or extended, meaning Zephyr modules now supports:
ZEPHYR_MODULES and EXTRA_ZEPHYR_MODULES.

Support for ZEPHYR_EXTRA_MODULES is kept foir backward compatibility.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2023-05-23 16:40:21 +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
Martí Bolívar a7aafcbbdc tests: add snippet test suite
Add an initial test suite for the basic SNIPPET_ROOT, SNIPPET, and
'append' features in snippet.yml.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2023-03-26 16:12:41 +02:00
Tristan Honscheid 1eb0452fcb twister: Fields for Kconfig and DT overlay files in testcase.yaml
This is an implementation of issue #48334 and adds support for
specifying additional config and device tree overlays through fields in
the testcase.yaml file, which is more readable than having to cram these
in to `extra_args`.

Consider this example which shows the original and new ways to add
config and DT overlays:

```
common:
  extra_args: "CONF_FILE=a.conf;b.conf
DTC_OVERLAY_FILE=w.overlay;x.overlay OVERLAY_CONFIG=e.conf
UNRELATED=abc"
tests:
  utilities.base64:
    extra_conf_files:
      - "c.conf"
      - "d.conf"
    extra_overlay_confs:
      - "extra_overlay.conf"
    extra_dtc_overlay_files:
      - "y.overlay"
      - "z.overlay"
    extra_configs:
      - CONFIG_SAMPLE=y
    tags: base64
    type: unit
```

The new fields are `extra_conf_files`, `extra_overlay_confs,
`extra_dtc_overlay_files`. Files specified in these sections are appended
to any `CONF_FILE`, `OVERLAY_CONFIG`, or `DTC_OVERLAY_FILE` fields in
`extra_args`, causing the following args being passed in to
`self.run_cmake` at `runner.py:850`:

```
['-DUNRELATED=abc',
 '-DCONF_FILE=a.conf;b.conf;c.conf;d.conf',
 '-DDTC_OVERLAY_FILE=w.overlay;x.overlay;y.overlay;z.overlay',
 '-DOVERLAY_CONFIG=e.conf extra_overlay.conf '
 '<build_dir>/twister/testsuite_extra.conf']
```

These fields can be used in the common or scenario-specific YAML
sections and will be merged in order of least to most specific:

 1. config files extracted from common's extra_args
 2. files listed in common's {extra_conf_files or extra_overlay_confs
    or extra_dtc_overlay_files}
 3. config files extracted from test scenario's extra_args
 4. files listed in test scenario's {extra_conf_files or
    extra_overlay_confs or extra_dtc_overlay_files}

Specifying these files in extra_args now triggers a deprecation warning,
as the direct YAML fields are preferred for readability. They will still
function for now but support will be dropped in the future.  One
testcase.yaml
(`zephyr/tests/cmake/overlays/var_expansions/testcase.yaml`) is
converted to use the new fields. A follow-up PR will convert the
remaining files to the new format.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-03-01 16:52:01 -05:00
Fabio Baltieri 7db1d17ee3 yamllint: fix all yamllint line-length errors
Fix all line-length errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(line-length)'

Using a limit is set to 100 columns, not touching the commandlines in
GitHub workflows (at least for now).

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 01:16:45 +09:00
Fabio Baltieri bd4cdde4b0 yamllint: fix all yamllint colons, commas and empty-lines errors
Fix all colons and commas errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(brackets)'

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(commas)'

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(empty-lines)'

Default config is no space before, one space after, max 2 empty lines.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 01:16:45 +09:00
Gregory Shue cfcf630184 build: Overlay build vars expand ${ZEPHYR_<module>_MODULE_DIR}
Support referencing module directories by name in CONF_FILE,
OVERLAY_CONFIG, and DTC_OVERLAY_FILE so that projects can reference
overlay files in arbitrary modules.

Verified by passing all the following tests:
  ./scripts/twister -T tests/cmake/overlays/

Fixes #41830

Signed-off-by: Gregory Shue <gregory.shue@legrand.us>
2022-10-13 12:04:38 +02:00
Torsten Rasmussen 1198087440 cmake: APPLICATION_CONFIG_DIR support implemented
With this commit a dedicated APPLICATION_CONFIG_DIR is added to the
Zephyr build system.

Currently, the APPLICATION_SOURCE_DIR is identical also the base
location of configuration files.

This is very practical for simple samples, but also has it limitations
for more complex setups.

Introducing a dedicated APPLICATION_CONFIG_DIR allows users more
customization options in Zephyr build system.
Especially in terms of custom build configuration files unknown to
Zephyr itself.

For example, instead of all configuration files being located directly
in the application source folder, a project might prefer to organize
their configuration files on a per board basis, for example:
<app>/boards/custom_board_A/prj.conf
<app>/boards/custom_board_A/app.overlay
<app>/boards/custom_board_A/custom_file.mine
<app>/boards/custom_board_B/prj.conf
<app>/boards/custom_board_B/app.overlay
<app>/boards/custom_board_B/custom_file.mine
...

instead of n-files located in the root of the sample.

If the user / sample specifies APPLICATION_CONFIG_DIR, then this folder
will always be used instead of the default configuration folder.

As part of this extension the behaviour of
`-DCONF_FILE=<relative-path>/prj_<build>.conf` and additional Kconfig
fragments automatic sourcing has been aligned with the default behavior
of `prj.conf`.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-11-10 08:25:36 -05:00