Skip to content

Commit

Permalink
tests: drivers: test fake-pwm on native_sim for pwm_api test
Browse files Browse the repository at this point in the history
create native_sim overlay to use fake pwm for test of pwm_api

(cherry picked from commit 85e8303)

Original-Signed-off-by: Nathan Olff <nathan@kickmaker.net>
GitOrigin-RevId: 85e8303
Cr-Build-Id: 8728491766514056481
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8728491766514056481
Copybot-Job-Name: zephyr-main-copybot-downstream
Change-Id: I9cf1175e56977163d2716975e03fee64e0e0d89d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/6095261
Commit-Queue: Dawid Niedźwiecki <dawidn@google.com>
Tested-by: Dawid Niedźwiecki <dawidn@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Dawid Niedźwiecki <dawidn@google.com>
  • Loading branch information
Nathan Olff authored and Chromeos LUCI committed Dec 16, 2024
1 parent 2eac688 commit 6335053
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/drivers/pwm/pwm_api/boards/native_sim.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2024 Kickmaker
*
* SPDX-License-Identifier: Apache-2.0
*/

/{
pwm0: pwm0 {
compatible = "zephyr,fake-pwm";
status = "okay";
#pwm-cells = <2>;
frequency = <10000000>;
};

aliases {
pwm-0 = &pwm0;
};
};
5 changes: 5 additions & 0 deletions tests/drivers/pwm/pwm_api/src/test_pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
#define DEFAULT_PULSE_NSEC 1000000
#endif

#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_fake_pwm)
#include <zephyr/fff.h>
DEFINE_FFF_GLOBALS;
#endif

#if defined CONFIG_BOARD_SAM_E70_XPLAINED
#define DEFAULT_PWM_PORT 2 /* PWM on EXT2 connector, pin 8 */
#elif defined CONFIG_PWM_NRFX
Expand Down
5 changes: 5 additions & 0 deletions tests/drivers/pwm/pwm_api/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ tests:
platform_allow:
- frdm_mcxn947/mcxn947/cpu0
- frdm_mcxn947/mcxn947/cpu0/qspi
drivers.pwm.native_sim:
platform_allow:
- native_sim
integration_platforms:
- native_sim

0 comments on commit 6335053

Please sign in to comment.