When millisecond/tick conversion is not exact tick delta's are
dependent on the initial tick value. In those cases exact comparisons
need to also allow an adjacent value.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
When HFCLK has a slew making it faster than LFCLK the busy wait can
expire before the timer fires.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Reduce the duration of the timer test so that it will fire before the
busywait elapses even in the worst case of slew between the tick and
busy-wait clocks.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This test sets a timer using one clock, waits using a second clock,
then sees whether the remaining time is the expected value. When the
two clocks are skewed the comparison requires a threshold. Provide a
means to estimate the maximum expected error.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
When test is performed, it assumes that no other entity is changing
the state of the clock. That was not true because calibration was
turning on/off high frequency clock.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This socket is shared by all the test cases which run in
different threads. Just make it a global object here.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Certain types of system call validation may need to be pushed
deeper in the implementation and not performed in the verification
function. If such checks are only pertinent when the caller was
from user mode, we need an API to detect this situation.
This is implemented by having thread->syscall_frame be non-NULL
only while a user system call is in progress. The template for the
system call marshalling functions is changed to clear this value
on exit.
A test is added to prove that this works.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
If we are calling sendmsg() without any aux data, then msg_controllen
is 0 and msg_control is NULL. Check these allowed values properly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If we are calling sendmsg() for a connected socket, then msg_namelen
is 0 and msg_name is NULL. Check these allowed values properly.
Also modify unit tests so that we test this scenario.
Fixes#25925
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Adjusting the input value to allow round to nearest can cause an
overflow which invalidates the expectation that the 32-bit result is
the low 32 bits of the 64-bit result. If the adjustment overflows do
the full-precision conversion and truncate in the caller.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
When CONFIG_POLL was set, it was historically true that the queue
could (if a higher priority thread "stole" an insert) return a
spurious NULL instead of continuing to wait on a timeout.
This deliberately exercises that race.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The k_queue data structure, when CONFIG_POLL was enabled, would
inexplicably use k_poll() as its blocking mechanism instead of the
original wait_q/pend() code. This was actually racy, see commit
b173e4353f. The code was structured as a condition variable: using
a spinlock around the queue data before deciding to block. But unlike
pend_current_thread(), k_poll() cannot atomically release a lock.
A workaround had been in place for this, and then accidentally
reverted (both by me!) because the code looked "wrong".
This is just fragile, there's no reason to have two implementations of
k_queue_get(). Remove.
Note that this also removes a test case in the work_queue test where
(when CONFIG_POLL was enabled, but not otherwise) it was checking for
the ability to immediately cancel a delayed work item that was
submitted with a timeout of K_NO_WAIT (i.e. "queue it immediately").
This DOES NOT work with the origina/non-poll queue backend, and has
never been a documented behavior of k_delayed_work_submit_to_queue()
under any circumstances. I don't know why we were testing this.
Fixes#25904
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The tests normally verify that pin configuration succeeded by checking
the return value. That's not necessary on the cleanup path, so
expressly ignore the result.
Also lift the common code to before the exit branching.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
... 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>
Add test cases that verify various bits and pieces of the legacy
devicetree macros match the new APIs.
Writing these test cases without giving rise to deprecated macro
warnings which might break people's CI if they build with -Werror
requires turning off the __WARN() generation in
devicetree_legacy_unfixed.h. The entire file is deprecated at this
point and must be explicitly enabled with an opt-in Kconfig option, so
there isn't any harm in doing this.
Nevertheless, take a minimally invasive approach to avoiding __WARN()
generation in gen_legacy_defines.py, to avoid the possibility of
breakage. This code is basically frozen anyway, so hacks like this
won't cause maintainability problems since it isn't being actively
maintained.
Use the new tests as fodder for a migration guide from the old API in
the documentation.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This is preparation for an additional test suite specifically for the
legacy API which will be added next.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
At some point, "child-binding:" apparently only worked up to 2 levels
deep. That's not the case anymore, but add a regression test to make
sure that doesn't break. 3 levels deep ought to be enough for anyone.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Added configuration which allows to run test-suite
on nrf52840dk_nrf52840 and nrf52dk_rf52832 boards.
fixes#25701
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Increase the main thread stack size for this test
to 2048; this increase prevents stacking errors in
the main thread, in several Cortex-M platforms.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
On nucleo_f429zi and nucleo_f207zg boards,
0xFFFFFFF0 is not a faulty address.
Instead we can use 0x0FFFFFFFF.
Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
The cell paramater should have been last to match both the
DT_*_CELL_BY_NAME macros as well as how DT_PHA_BY_IDX works. We fix the
DT_INST_*_CELL_BY_NAME macros as well.
The dma macro's implemented the behavior correctly, but got the argument
names in correct. We fix that to make everything consistent.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Enhance the sample console output of the arm_interrupt
test, to reflect recent changes in test context as well
as kernel fault handling log output format.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
We add a test case to verify that the Cortex-M fault
handling is able to catch stacking errors explicitly
due to exception entry frame stacking (that is, when
the Cortex-M MCU does not report Data Access Violation
MemManage fault with a valid MMFAR value, but only a
Stacking MemManage fault). We update the README file
accordingly.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
A quick test on a dummy device that:
- opens a socket (success)
- sends data (success)
- suspends (success)
- suspends (failure)
- sends data (failure)
- resumes (success)
- resumes (failure)
- sends data (success)
This permits to show that PM states are properly handled in network
stack.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Because the sleep instruction issue for nsim_hs_smp, idle
loop is used to simulate behavior of sleep, so arch_cpu_idle will
forever loop. This causes cpu idle test loop, then the whole
context test timeouts.
as a fix, skip the cpu_idle test for nsim_hs_smp now.
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
Added test for check proper service of flush-write when buffer
contains unaligned amount of data.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Add a new test with clean output and warn the user that the version
without clean output will output garbled text.
Fixes#23799
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
For success cases, the net_pkt is handled by the IP stack
so no need to free the net_pkt. The double free is not causing
any issues as the net_pkt code will just ignore the request but
we should avoid doing it because of error prints that are printed.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
When the timer frequency is not a multiple of 1000 converting between
ticks and milliseconds introduces error. Avoid propagating the error
by converting divided values rather than dividing converted values.
Also compensate for observed rate differences between the busywait
clock and the timeout clock.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
A fast timer clock can advance before or after the remaining time
until an event is captured. Verify the expected relationship between
current and remaining time holds for at least one captured current
time.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
When one millisecond is not an integral number of ticks measuring
durations between tick events will sometimes be less than expected to
correct for error that was accumulated between other events. Allow
for that in the duration and period comparisons.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This test depends on additional hardware being connected to the board,
add a fixture and cleanup whitelist.
Fixes#25177
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The dummy driver never implemented device power management, so the
fact the not-implemented stub returned success was a false negative.
Verify the expected behavior now, leaving the test code in place for
when somebody provides a non-trivial PM control function.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Configures the adc api test to use the arduino header A2 pin on the
frdm_k82f board. This follows frdm_k64f and frdm_kw41z boards, which
also use the arduino header A2 pin for the test.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
arc emsdp's console will use irq 108/107 which will
conflict with irqs used in tests (emsdp has 112 irqs),
so add a workaround for emsdp.
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
For x86, TSC is being used to gather timing information. However,
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC is not the same as TSC
frequency when HPET (or other) timer is used. So use the system
clock to calibrate the TSC frequency so we can use it to
calculate timing information.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Kernel objects were being directly accessed without previously
calling k_thread_access_grant().
This change allows each test that requires an asynchronous
event to send it to a common work queue with correct
permissions.
Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>