Commit graph

35 commits

Author SHA1 Message Date
Nightt
f8a48fa5f3 testing/sd_stress: Harden file creation cleanup
Close the temporary file descriptor when create_files() fails after open(), and release the read buffer before returning from the path-length failure branch.

This is logically separable from the #3205 stale-directory fix: it does not change how existing /sd/stress is handled, but keeps the same failure paths from leaking resources while the stress test exits after an error.

The scope intentionally stays within sd_stress failure cleanup and does not touch SD/MMC transfer behavior or other testing drivers.

Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
2026-05-25 10:28:32 +08:00
Nightt
2d6cd74215 testing/sd_stress: Handle stale temporary directories
Fix #3205 by removing stale sdstress work directories left by previous interrupted or failed runs before starting a new test.

The cleanup only removes entries matching the generated tmpNNN file pattern. If the directory contains any unexpected entry, the test fails instead of deleting user data.

Also make create_dir() and remove_dir() use their path argument instead of the fixed temporary directory names.

Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
2026-05-25 10:28:32 +08:00
Nightt
b4f1e29494 apps: Fix additional open() arguments.
Add missing mode arguments to direct open() calls that use O_CREAT.

Also open the lp503x device with explicit read-only flags instead of O_CREAT, matching the device-node usage.

Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
2026-05-22 13:39:04 +08:00
Xiang Xiao
f9f59bd0f8 !apps: drop redundant casts on tv_sec/tv_nsec and fix printf formats
Now that time_t is unconditionally 64-bit (signed int64_t) and the
struct timespec fields tv_sec / tv_nsec are wide enough on their own,
the explicit (uint64_t)/(int64_t)/(int) casts that used to guard the
multiplications and subtractions in *_us / *_ms / *_ns helpers are no
longer needed.  Drop them to keep the timekeeping math readable.

In the same spirit, this commit also normalises the printf-style format
specifiers and casts used to print tv_sec / tv_nsec / tv_usec values.
The prior code was a mix of "%d"/"%u"/"%ld"/"%lu"/"%lld" with matching
(int)/(unsigned long)/(long long) casts; some formats truncated time_t
on 32-bit hosts, others mismatched signedness or width.  Replace all
such cases with the portable POSIX-recommended forms:

  - tv_sec  (time_t,       signed, impl-defined width) -> %jd  + (intmax_t)
  - tv_nsec (long,         signed)                     -> %ld  (no cast)
  - tv_usec (suseconds_t / long)                       -> %ld  (no cast)

Also drop two stale `(FAR const time_t *)&ts.tv_sec` casts that are
unnecessary now that ts.tv_sec is plain time_t.

Arithmetic-cleanup files (existing scope):

  - benchmarks/cyclictest/cyclictest.c:        timediff_us()
  - benchmarks/sd_bench/sd_bench_main.c:       get_time_delta_us()
  - examples/oneshot/oneshot_main.c:           maxus computation
  - examples/watchdog/watchdog_main.c:         current_time_ms (x2)
  - industry/nxmodbus/nxmb_internal.h:         nxmb_util_clock_ms()
  - netutils/ntpclient/ntpclient.c:            timespec2ntp()
  - netutils/ptpd/ptpd.c:                      ptp_adjtime()
  - system/dd/dd_main.c:                       elapsed accounting
  - testing/drivers/drivertest/drivertest_posix_timer.c:
                                               get_timestamp()
  - testing/drivers/sd_stress/sd_stress_main.c:get_time_delta()
  - testing/sched/getprime/getprime_main.c:    elapsed accounting
  - testing/sched/pthread_mutex_perf/pthread_mutex_perf.c:
                                               timespec_avg()

Printf-format-fix files (new in this revision):

  - examples/adjtime/adjtime_main.c
  - examples/charger/charger_main.c
  - examples/netpkt/netpkt_ethercat.c
  - fsutils/mkfatfs/mkfatfs.c
  - graphics/tiff/tiff_initialize.c
  - netutils/ptpd/ptpd.c
  - nshlib/nsh_timcmds.c
  - system/coredump/coredump.c
  - system/ptpd/ptpd_main.c
  - testing/drivers/drivertest/drivertest_oneshot.c
  - testing/mm/kasantest/kasantest.c
  - testing/ostest/semtimed.c
  - testing/sched/pthread_mutex_perf/pthread_mutex_perf.c
  - testing/sched/timerjitter/timerjitter.c
  - testing/testsuites/kernel/time/cases/clock_test_clock01.c
  - testing/testsuites/kernel/time/cases/clock_test_smoke.c

No behavioural change.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-05-22 13:38:25 +08:00
raiden00pl
2fce07fe1c testing/drivertest_pwm: remove references to CONFIG_PWM_MULTICHAN
remove references to CONFIG_PWM_MULTICHAN

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-18 11:35:09 -04:00
Piyush Patle
9d849adfab include/debug.h: Use <nuttx/debug.h> in apps
Replace app-side includes of <debug.h> with <nuttx/debug.h> to use the
header from the NuttX tree explicitly after the header move.

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
2026-04-11 10:39:27 -03:00
Vlad Pruteanu
cd2b0c0e87 testing/crypto: Add pbkdf2 test app
This adds support for testing PBKDF2 implementation. Test
vectors for SHA1 are taken from RFC6070. SHA256 vectors
were extrapolated using an online PBKDF2 generator which
was checked against RFC6070.

Signed-off-by: Vlad Pruteanu <pruteanuvlad1611@yahoo.com>
2026-03-27 21:46:08 +08:00
Eren Terzioglu
0b084ded88 testing/crypto: Add options to disable hash tests
Add options to disable individual hash tests for devices not supported each hash

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-02-24 13:36:32 +08:00
fangpeina
bb9229de06 testing/drivers: set default vendor dalay to 1 for rtc cases run correctly
Set default VENDOR_DELAY to 1 for reliable test execution

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2026-02-03 17:36:49 +08:00
makejian
367e9dca01 testing: move nist-sts into drivers/rng directory
Move NIST Statistical Test Suite (nist-sts) testing module from testing/drivers/
into testing/drivers/rng/ directory to better organize RNG (random number generator)
related tests that utilize /dev/random device.

Changes:
- Create testing/drivers/rng/ directory structure
- Move nist-sts from testing/drivers/ to testing/drivers/rng/nist-sts
- Update build configuration file paths:
  - CMakeLists.txt
  - Makefile
  - Make.defs
- Maintain all test patches and Kconfig settings

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-29 12:08:50 +08:00
ouyangxiangzhen
7fb71aa57a testing/drivers: Fix posix timer assertions.
On QEMU, if vcpus are preempted by other threads, the deviation of the
timer might be very large, causing assertion failure. This commit
addressed the problem.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-27 22:59:36 +08:00
ouyangxiangzhen
35cf746025 testing/drivers: Fix wrong test-cases.
This commit fixed totally wrong test-cases for the periodical timers.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-27 22:59:36 +08:00
ouyangxiangzhen
b9bf7f5c4f testing/drivers: Change uint32_t time to uint64_t.
This commmit fixed the time multiplication overflow issue.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-27 22:59:36 +08:00
ouyangxiangzhen
a16c545134 testing/drivers: Fixed the wrong test-case.
This commit fixed the wrong-test case where the time is acquired after
the timer being set, leading to the assertion failure.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-27 22:59:36 +08:00
ouyangxiangzhen
ae7a0d81e9 testing/drivers: Fix posix timer assertions.
On QEMU, if vcpus are preempted by other threads, the deviation of the
timer might be very large, causing assertion failure. This commit
addressed the problem.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-27 22:59:36 +08:00
ouyangxiangzhen
a4b43521f4 testing/drivers: Fix posix timer assertions.
On QEMU, if vcpus are preempted by other threads, the deviation of the
timer might be very large, causing assertion failure. This commit
addressed the problem.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-27 22:59:36 +08:00
ouyangxiangzhen
0faaed99a5 testing/drivertest: Fix timing issues on QEMU and sims.
Since sim and qemu are not cycle accurate simulators, if the vCPU thread is preempted by other high priority tasks, it may cause timing issues. This is easy to happen when the test machine is busy. This commit modifies the condition of timing error and prints out the latency as a warning.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-27 22:59:36 +08:00
tengshuangshuang
34e4d7eacd testing: add unistd.h for drivertest_touchpanel.c
Add unistd.h header file to drivertest_touchpanel.c to fix missing
sleep/usleep function declarations in touchpanel driver tests.

Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2026-01-26 19:32:27 +08:00
hongfengchen
d0e949cb24 testing: add unistd.h and pthread.h headers
Add unistd.h and pthread.h for memorystress_main.c, unistd.h for
dhm.c and cachetest_main.c, and pthread.h for kv_test_019.c to fix
missing declarations.

Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
2026-01-26 19:32:27 +08:00
Vlad Pruteanu
c883c3f6dd testing/drivers/crypto/hmac.c: Add long keys
This adds 2 tests, which include keys that are
longer than the SHA's block size.

Signed-off-by: Vlad Pruteanu <pruteanuvlad1611@yahoo.com>
2026-01-26 10:58:22 +08:00
tengshuangshuang
b6203955f9 syscall: fix listen case bug
Skip UDP listen test when CONFIG_NET_UDP is disabled to prevent
test failures on configurations without UDP support.

Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2026-01-22 19:48:57 +08:00
tengshuangshuang
8afe3c0645 test: clean driver_audio_test (void *) cast
Drop unnecessary casts in driver_audio_test to silence compiler
warnings and improve code clarity.

Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2026-01-22 19:48:57 +08:00
wangchengdong
d9afe2db8c signals: fix build and runtime issues when signals all isabled
Fix build and runtime issues when signals all disabled.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-19 22:55:19 +08:00
guoshichao
5595a01fcd watchdog: disable the drivertest_watchdog_api testcase on some platform
When we support the watchdog interrupt on the Armv7-A platform with
the TEE enabled, the watchdog interrupt needs to be configured as
a FIQ to avoid the impact of interrupt disabling in the AP.
In this case, the drivertest_watchdog_api testcase cannot pass the
test in such a scenario.

This is because the drivertest_watchdog_api itself requires
calling a specified callback after the watchdog interrupt is
triggered, instead of directly dumping the AP's context and
then asserting the system.

Therefore, when both CONFIG_ARCH_ARMV7A and CONFIG_ARCH_HAVE_TRUSTZONE
are enabled, we need to skip the current drivertest_watchdog_api
testcase.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-19 17:51:42 +08:00
buxiasen
0f8bca6d8f testing/pm_smp: add more delay, avoid idle canot run one cycle
If the host performance low, possible not able to enter idle thread,
cause case break.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-12-01 19:10:11 +08:00
buxiasen
4ac0b10318 drivertest_uart: uart device open should use cfmakeraw to ensure raw.
reference: https://www.man7.org/linux/man-pages/man3/termios.3.html

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-12-01 19:09:41 +08:00
raiden00pl
1f1240a0f4 testing/drivers/fftest/fftest.c: fix compilation error
fix compilation error:

CC:  vfs/fs_rmdir.c fftest.c: In function ‘fftest_main’:
fftest.c:104:7: error: implicit declaration of function ‘ioctl’ [-Wimplicit-function-declaration]
  104 |   if (ioctl(fd, EVIOCGBIT, fffeatures) < 0)

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-11-02 22:33:46 +08:00
raiden00pl
44eeb1c7c8 testing: unify Private Types banners
unify Private Types banners according to NuttX coding standard

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-05-28 10:16:50 +08:00
Richard Tucker
18b72e89a4 apps/testing: fix typo 2025-05-26 18:56:32 +02:00
zhangshoukui
369729eea4 testing/drivers/drivertest: Uniform test case name
1.Some test functions are named too simply
2.Many driver tests depend on specific configurations and hardware, and the unified specification name facilitates cmocka to skip tests by using the skip parameter for wildcard matching

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2025-03-27 09:00:15 +01:00
zhangshoukui
7b65b2bb41 drivertest_uart: Pass in the specified parameters to test
https://github.com/apache/nuttx/blob/master/tools/ci/testrun/script/test_framework/test_cmocka.py
cmocka --skip test_case_posix_timer|test_case_oneshot|write_default|read_default|burst_test|gpiotest01

In the CI of the community, this test is skipped because this test will block the terminal, and I think that the test added to cmocka should not be designed this way

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2025-03-26 15:23:40 +08:00
Alan Carvalho de Assis
cdc5968c67 testing: Add Serial Error Reporting testing app
This commit adds support to Serial Error Reporting using the ioctl
TIOCGICOUNT.

This examples was inspired on this sample code:
https://stackoverflow.com/questions/78796301/c-serial-communication-why-does-read-lose-some-data-bytes-at-high-baud-rates/78800245#78800245

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-03-24 21:52:26 +08:00
Xiang Xiao
4e9d907677 testing: Move rpmsgdev to drivers/rpmsgdev
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-01-26 09:53:02 -03:00
Xiang Xiao
b7f05e89ba testing: Move crypto/setest to drivers and open_memstream to libc
follow the dissusion from:
https://github.com/apache/nuttx-apps/pull/2931

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-01-26 07:32:53 +01:00
tengshuangshuang
6bc2b3c933 apps/testing:move {drivertest fftest irtest monkey nand_sim pcitest sd_bench sd_stress sensortest} folders to the new driver folder
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2025-01-21 16:22:56 +08:00