zephyr/tests
Luca Burelli a90870da4c cmake: yaml: improve escaping of strings with backslashes and quotes
Switching the intermediate file format from JSON to YAML has a very
significant benefit: the file is now loaded via yaml_load(), which
internally calls Python to parse the file into the JSON format that
CMake expects. This means that the file contents are now automatically
escaped properly for JSON; it is a huge improvement over the previous
implementation, which was escaping everything given as input to
to_yaml().

With the removal of the now-redundant call in to_yaml(), escaping is
applied exactly once per value or list, when it is passed to yaml_set().
This allows to convert the logic in zephyr_string(ESCAPE ...) to a more
robust "escape everything" approach.

These changes fix the handling of strings with backslashes and different
types of quotes passed either directly or via generator expression. The
existing tests are updated to cover these cases.

Two other small changes are made in this commit:

- a small check in internal_yaml_list_append() is removed, as the same
  issue is already detected by the caller yaml_set() logic.

- the to_yaml() function is modified to initialize the YAML output
  variable at the top level, which is the expected behavior. This
  resulted in genex temp files sometimes having duplicate lines.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-04-10 10:11:47 +02:00
..
application_development tests: fix various test ids and use existing scheme 2025-04-07 11:22:36 +02:00
arch tests: arm: adjust test for relocated rom 2025-03-31 11:30:55 +02:00
benchmarks tests: Add benchmark for IPI performance 2025-04-04 21:15:14 +02:00
bluetooth tests: Bluetooth: Tester: Fix bad check for valid RX 2025-04-09 15:23:39 +02:00
boards tests: fix various test ids and use existing scheme 2025-04-07 11:22:36 +02:00
boot tests: boot: mcuboot_recovery_retention: rm OVERLAY_CONFIG 2025-04-08 22:58:43 +02:00
bsim tests: Bluetooth: Add BT Tester GAP smoke test 2025-04-08 10:49:00 +02:00
cmake cmake: yaml: improve escaping of strings with backslashes and quotes 2025-04-10 10:11:47 +02:00
crypto
ctest/base
drivers tests: spi_loopback: Extend RTIO fallback messages to 5 2025-04-09 21:10:53 +02:00
integration/kernel
kconfig
kernel tests: timer: validate K_TIMEOUT_ABS_SEC 2025-04-07 07:28:00 +02:00
lib json: improve parsing and serializing of 'float' and 'double' 2025-04-09 22:05:14 +02:00
misc tests: linker: iterable_sections: Test sorting with 5 numeric characters 2025-01-22 10:40:45 +01:00
modules
net tests: net: http_server: concurrent connections 2025-04-09 17:32:50 +02:00
posix test: posix: timers: Fix unused function warning 2025-03-24 07:53:10 +01:00
robot
subsys tests: littlefs: fix large partition mounting 2025-04-07 15:18:30 +02:00
unit everywhere: Use correct macro for gcc-specific warnings 2025-03-20 21:57:47 +01:00
ztest ztest: Fix confusing SKIP log 2025-04-04 21:16:34 +02:00
test_config_ci.yaml twister: config: test on integration plaforms if defined 2025-03-19 08:51:50 -04:00
test_config.yaml