This patch adds overlay for nrf52_pca10040 and reel board to use
btp tester. These are based on nrf52840.
Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
We want to show that performing various memory domain
operations, and then either dropping to user mode, or
swapping to a user thread in the same domain, has the
correct memory policy for the user context.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The reftime variable used for performance numbers is not initialized
prior to being used. Initialize it to the current uptime so delta
can be calculated correctly.
Fixes#13877
Fixes CID-190936
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Inside test_file_truncate(), the results of fs_seek() are not
checked. So adds some checks there.
Fixes#13874
Fixes CID-190939
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Exactly one caller of pthread_barrier_wait() should receive a return
value of PTHREAD_BARRIER_SERIAL_WAIT; all others should receive zero
(or an error code). Added a test to match.
Fixes: #9953
Signed-off-by: Charles E. Youse <charles.youse@intel.com>
Removing the build_only option for tickless broke CI (for reasons
unrelated to the new tests I added in the prior commit).
Signed-off-by: Charles E. Youse <charles.youse@intel.com>
In some circumstances (e.g., a tickless kernel), k_timer_remaining_get()
would not account for time passed that didn't involve clock interrupts.
This adds a simple fix for that, and adds a test case. In addition, the
return value of k_timer_remaining_get() is clamped at 0 in the case of
overdue timers and the API description is adjusted to reflect this.
Fixes: #13353
Signed-off-by: Charles E. Youse <charles.youse@intel.com>
This test was written to wait on a fifo with a timeout, return, and
check the timing between the start and end using k_cycle_get_32() to
see that it didn't run long. But timeouts expire on tick boundaries,
and so if tick expires between the start of the test and the entry to
k_fifo_get(), the timeout will take one full tick longer than expected
due to aliasing.
As it happened this passed everywhere except nRF (whose cycle timer is
32 kHz and thus more susceptible to coarser aliasing like this), and
even there it passed for a while until the spinlock validation layer
went in and added just enough time to the userspace code paths
(i.e. the code between the start time fetch and the point where the
fifo blocks takes longer) to open the window and push us over the
limit.
The workaround here is just to add a k_sleep(1) call, which is
guaranteed to block and wake up synchronously at the next tick.
Fixes#13289
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Checking the return of fs_stat to ensure that there is not hidden error.
Problem spotted by coverity.
CID 190949
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Port all users of 'set_conf_file' to use the built-in rules
instead. This follows the convention-over-configuration principle to
make the system as a whole simpler and more consistent.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
The return of hwinfo_get_device_id is a signed size and it returns a
negative number in case of error. This test was using an unsigned
variable invalidating the errror check.
CID 190929
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
(Chunk 2 of 3 - this patch was split across pull requests to address
CI build time limitations)
Zephyr has always been a uniprocessor system, and its kernel tests are
rife with assumptions and outright dependence on single-CPU operation
(for example: "low priority threads will never run until this high
priority thread blocks" -- not true if there's another processor to
run it!)
About 1/3 of our tests fail right now on x86_64 when dual processor
operation is made default. Most of those can probably be recovered on
a case-by-case basis with simple changes (and a few of them might
represent real bugs in SMP!), but for now let's make sure the full
test suite passes by turning the second CPU off. There's still plenty
of SMP coverage in the remaining cases.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit removes the #ifdefs for ARM platforms in
tests/kernel/fatal/main.c, as all the tests suite can be
executed for platforms supporting the ARM and the NXP MPU.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Commit 0cc362f873 ("tests/kernel: Simplify timer spinning") was
added to work around a qemu bug with dropped interrupts on x86_64.
But it turns out that the tick alignment that the original
implementation provided (fundamentally, it spins waiting on the timer
driver to report tick changes) was needed for correct operation on
nRF52.
The effectively revert that commit (and refactors all the spinning
into a single utility) and replaces it with a workaround targeted to
qemu on x86_64 only. Fixes#11721
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
(Chunk 1 of 3 - this patch was split across pull requests to address
CI build time limitations)
Zephyr has always been a uniprocessor system, and its kernel tests are
rife with assumptions and outright dependence on single-CPU operation
(for example: "low priority threads will never run until this high
priority thread blocks" -- not true if there's another processor to
run it!)
About 1/3 of our tests fail right now on x86_64 when dual processor
operation is made default. Most of those can probably be recovered on
a case-by-case basis with simple changes (and a few of them might
represent real bugs in SMP!), but for now let's make sure the full
test suite passes by turning the second CPU off. There's still plenty
of SMP coverage in the remaining cases.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
MISRA rules (see #9892) forbid alloca() and family, even though those
features can be valuable performance and memory size optimizations
useful to Zephyr.
Introduce a MISRA_SANE kconfig, which when true enables a gcc error
condition whenever a variable length array is used.
When enabled, the mempool code will use a theoretical-maximum array
size on the stack instead of one tailored to the current pool
configuration.
The rbtree code will do similarly, but because the theoretical maximum
is quite a bit larger (236 bytes on 32 bit platforms) the array is
placed into struct rbtree instead so it can live in static data (and
also so I don't have to go and retune all the test stack sizes!).
Current code only uses at most two of these (one in the scheduler when
SCHED_SCALABLE is selected, and one for dynamic kernel objects when
USERSPACE and DYNAMIC_OBJECTS are set).
This tunable is false by default, but is selected in a single test (a
subcase of tests/kernel/common) for coverage. Note that the I2C and
SPI subsystems contain uncorrected VLAs, so a few platforms need to be
blacklisted with a filter.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit extends the arm_irq_vector_table test,
so it can run successfully in nRF9160-based platforms.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit adds the Clock Control Interrupt Service
Routine into the customized vector table, when building
for nRF52X-based platforms. As a result, the interrupts
generated by the clock control will not interfere with
the test.
Fixes#13823.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Minor typo and style fixes in the test logging, stressing
that the test is applicable for Cortex-M MCUs, in general.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
In order to make this test easy to extend for additional
Cortex-M-based platforms, we apply the following minor
refactoring to the test:
- we introduce the _ISR_OFFSET macro to denote the offset
inside the interrupts' vector table (starting from IRQ
line 0) of the first manually installed ISR.
- we move the asserts that ensure the validity of the custom
vector table to build-time and place them in the beginning
of the text, outside source code.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
(Chunk 3 of 3 - this patch was split across pull requests to address
CI build time limitations)
Zephyr has always been a uniprocessor system, and its kernel tests are
rife with assumptions and outright dependence on single-CPU operation
(for example: "low priority threads will never run until this high
priority thread blocks" -- not true if there's another processor to
run it!)
About 1/3 of our tests fail right now on x86_64 when dual processor
operation is made default. Most of those can probably be recovered on
a case-by-case basis with simple changes (and a few of them might
represent real bugs in SMP!), but for now let's make sure the full
test suite passes by turning the second CPU off. There's still plenty
of SMP coverage in the remaining cases.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The qmsi rtc hardware supports a single alarm only and a fixed top
value, so restructure the counter_basic_api test to skip unsupported
features.
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
This makes use of BT_GATT_CCC_MANAGED so instead of having a custom
attribute which is not managed by stack.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
patch exclude the watchdog test case for quark_d2000_crb
,as it seen that upon watchdog reset the conents of ram are lost.
Hence the existing testcase fails.
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Reworked platform_whitelist to enable the "test kernel.device" for
qemu_x86_64
kernel.device.pm is not yet enabled for qemu_x86_64 because
there is a link error
undefined symbol `_DEVICE_STRUCT_SIZEOF'
referenced in expression
Signed-off-by: Cinly Ooi <cinly.ooi@intel.com>
Add a build variant of the posix tests with newlib enabled. Since the
interation of posix is greatly related to the libc we should have these
tests build with and without newlib support.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The intent of this Kconfig is to allow libc stdout
functions like printf() to send their output to the
active console driver instead of discarding it.
This somehow evolved into preferring to use
printf() instead of printk() for all test case output
if enabled. Libc printf() implementation for both
minimal libc and newlib use considerably more stack
space than printk(), with nothing gained by using
them.
Remove all instances where we are conditionally
sending test case output based on this config, enable
it by default, and adjust a few tests that disabled
this because they were blowing stack.
printk() and vprintk() now work as expected for
unit_testing targets, they are just wrappers for
host printf().
Fixes: #13701
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
CPU_LPS_n name used to indicate a low power state is cryptic and
incorrect. The low power states act on the whole SoC and not exclusively
on the CPU. This patch renames CPU_LPS_n states to LOW_POWER_n. Also
HAS_ pattern for Kconfig options is used in favor of a non standard
_SUPPORTED. Naming of deep sleep states was adjusted accordingly.
Following is a detailed list of string replacements used:
s/SYS_POWER_STATE_CPU_LPS_(\d)_SUPPORTED/HAS_STATE_LOW_POWER_$1/
s/SYS_POWER_STATE_CPU_LPS_(\d)/SYS_POWER_STATE_LOW_POWER_$1/
s/SYS_POWER_STATE_DEEP_SLEEP_(\d)_SUPPORTED/HAS_STATE_DEEP_SLEEP_$1/
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
This commit removes dependency on SYS_POWER_LOW_POWER_STATES_SUPPORTED,
SYS_POWER_DEEP_SLEEP_STATES_SUPPORTED Kconfig options. Power management
SYS_POWER_LOW_POWER_STATES, SYS_POWER_DEEP_SLEEP_STATES options depend
now directly on specific power states supported by the given SoC. This
simplifies maintenance of SoC Kconfig files.
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
Follow the pattern we have for other peripherals in that if the driver
class (CAN) is enabled than enable the driver for that class
(CAN_STM32). Also have the STM32 CAN driver depend on being on a STM32
SoC.
Remove setting of CONFIG_CAN_STM32 in any .conf files as it will get set
of CONFIG_CAN is set/enabled.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The name of the CAN message and filter was changed so this
needs to be changed too here.
Fixes#13716
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This test is breaking CI, we need a fix first before we go and enable
tests.
This reverts commit dc39a9adcf.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a build variant of the posix tests with newlib enabled. Since the
interation of posix is greatly related to the libc we should have these
tests build with and without newlib support.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
- differentiating actual "fragment" to buffer element from a net_pkt
- instead of copying data (and thus allocating buffer) let's just take
the fragment buffer and put it into result packet.
- fixing compilation issue in relevant test
It's more efficient that way, as we use already allocated fragment
buffer instead of reallocating/deallocating after each fragment
reception.
A possible optimization would be to calculate the actual size + header
difference if only the actual size is close to the target size.
It would avoid to get a dry run of the header decompression for each
fragment received. The difficulty being in finding the sweet spot when
it is relevant to calculate the header difference.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This is an integral part of userspace and cannot be used
on its own. Fold into the main userspace configuration.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Test was failing on nios2 with:
../app/libapp.a(test_stack_contexts.c.obj): in function `tstack_pop':
/home/galak/git/zephyr/tests/kernel/stack/stack_api/src/test_stack_contexts.c:31:
warning: unable to reach (null) (at 0x004002f4) from the global pointer
(at 0x004082fc) because the offset (-32776) is out of the allowed range,
-32678 to 32767
Fixes#13595
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit fixes a test in kernel/mem_protect/userspace,
which was attempting to read from an address that was not
necessarily within the image memory range, causing faults
in ARM TrustZone-enabled builds.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
For now we are disabling support for POSIX lib on native posix arch. We
need to cleanup and support POSIX lib cleanly for hardware targets.
Once that is working properly we can look to support the feature on
native posix arch.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Move test related code and the testsuite away from tests/ and make it a
proper subsystem.
The way tests were integrate in the tree was not obvious and actual
tests were intermixed with the testsuite code.
This will allow us to have trees with the testcode and without the
samples by just remove the folders tests/ and samples, needed for
isolating actual code from test/sample code.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
In order to follow the naming from Linux, change the name of
can_msg to zcan_frame, and can_msg_filter to zcan_filter.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Make sure that can_copy_*() functions work as expected.
These functions are used by SocketCAN support.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>