Commit graph

1385 commits

Author SHA1 Message Date
Josep Puigdemont 7cafe7e74b boards: arm: olimex stm32-h103: Add board
The Olimex STM32-h103 is a development board based on the STM32F103RB,
very similar to the stm32_mini, which was used as a reference for the
pinmux configuration.

Signed-off-by: Josep Puigdemont <josep.puigdemont@gmail.com>
2020-07-24 14:48:07 +02:00
Maksim Masalski 9ccbfbd84e tests: code review changes
Code review changes.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-07-23 12:55:47 +02:00
Maksim Masalski 32aa91d803 tests: add new futex test
Add new standalone futex test that verifies next requirements:
-Futex can be placed in user memory using ZTEST_BMEM
-User thread can write to futex value
-User threads can make wait/wake syscalls on it

Added detailed Doxygen tag with information about the test

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-07-23 12:55:47 +02:00
Ningx Zhao 06ce1e4c32 tests: stack modifying and adding test case
1.Add some comments to describe functions performance
2.add a new testcase to implement push can be waited
when there are no items available.

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-07-21 21:54:11 -04:00
Anas Nashif 1fbbfc819a tests/samples: add tags to some tests
Some tests/samples had no tags, fill those..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-20 17:44:16 -04:00
Andrew Boie 13f2b7b848 tests: mslab_threadsafe: cleanup
Clean up the code some, and disable CONFIG_TIMESLICE_SIZE=1
until #13813 is resolved.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-17 11:38:18 +02:00
Andrew Boie 8ec248a0f9 tests: device: add device_mmio tests
Exercise the public macros as well as device_map().
This test has a whitelist for whatever reason; add
mps2_an385 so that the !DEVICE_MMIO_IS_IN_RAM stuff
is tested.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-17 11:38:18 +02:00
Maksim Masalski c9a9aacb3f tests: update kernel objects tests
1. Add code change to the test_permission_inheritance() to let it
test that child thread can't access parent thread object. Now that test
tests one more related to it feature.
2. Add new Doxygen tags with informative descriptions about the kernel
objects tests. That will make reading and understanding kernel object
tests code easier.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-07-16 12:10:31 +02:00
Maksim Masalski a3621cecd5 tests: copyright message add year to the existing
Instead of replacing of copyright year with the new one,
necessary to add new to the existing one

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-07-15 13:26:39 +02:00
Maksim Masalski 2893aa0bc1 tests: mem protection new test inherit resource pool
To improve Zephyr tests, I think that it will necessary to have test,
that verifies a child thread inherits resource pool assignment
of their parent.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-07-15 13:26:39 +02:00
Maksim Masalski 819197fba0 tests: add new semaphore tests
Add new semaphore tests, to test important features like:
-count limit
-semaphore define at compile time
-mutual exclusion

I decided to add new test cases that can improve Zephyr
semaphore testing infrastructure.
For each new test added informative Doxygen description.

New test cases test next important requirements:
1. test_k_sem_correct_count_limit()
That test verifies that semaphore can be taken correctly by a thread,
and taking of semaphore decrements its count as expected.
2. test_k_sem_define()
Explicit ans standalone test to test semaphore can be defined
compile time.
3. test_sem_queue_mutual_exclusion
Test that our system can provide a traditional counting
semaphore abstraction for mutual exclusion.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-07-15 13:07:46 +02:00
Ying ming 6e0c4c79bc tests: memory allocation: add test case
When a block which is released by function free,
the region would be release to heap memory pool.

Signed-off-by: Ying ming <mingx.ying@intel.com>
2020-07-14 19:36:56 -04:00
Maureen Helm 5c603d9edf tests: gen_isr_table: Disable gpio on lpcxpresso54114
One of the interrupts used by the gen_isr_table test conflicts with a
gpio interrupt on the lpc54114 soc, so disable gpio for this test on the
corresponding board. We do this for only the m4 core because the test is
not supported on the m0 core.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-07-11 08:49:50 -04:00
Enjia Mai 5e9ae9ec76 tests: add test cases for improving testing of mutex
1. Test the priority inheritance mechanism.
2. Test the recursive mutex.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2020-07-08 23:25:59 -04:00
Maksim Masalski 2053814d7c tests: make code style changes according with review comments
Made light code style changes.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-07-08 21:59:22 -04:00
Maksim Masalski 6eabee2681 tests: rebase with 2.3 release changes
Rebase using the latest master changes for 2.3 release

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-07-08 21:59:22 -04:00
Maksim Masalski 416feaab0c tests: resolve shippable errors
During previous commit Shippable let me know about errors
for some boards, resolved them.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-07-08 21:59:22 -04:00
Maksim Masalski 7808a78417 tests: workqueue tests overhaul adding new tests
During inspection of the workqueue tests, I find out testing gaps.
Decided to add new test cases that can improve Zephyr OS testing
quality.
Added new test cases:
1. test_work_item_supplied_with_func
In docs described that work item supplied with a handler function,
prove that it works.
2. test_process_work_items_fifo
Test that system process work items in first-in, first-out manner.
3. test_sched_delayed_work_item
Verify that delayed work item processed after specific period of time
stated by user.
4. test_workqueue_max_number
Test the limit of number of workqueues created
5. test_cancel_processed_work_item Created test to increase branch
coverage.

Modified existing test cases:
1. test_work_submit_handler updated Doxygen tag, added more detailed
description"

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-07-08 21:59:22 -04:00
Flavio Ceolin c4f7faea10 random: Include header where it is used
Unit tests were failing to build because random header was included by
kernel_includes.h. The problem is that rand32.h includes a generated
file that is either not generated or not included when building unit
tests. Also, it is better to limit the scope of this file to where it is
used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-07-08 21:05:36 -04:00
Andrzej Głąbek 8da1736c67 tests/kernel/gen_isr_table: Add special config for nRF5340 and nRF9160
In nRF9160 and application core in nRF5340, not all interrupts with
highest numbers are implemented. Thus, limit the number of interrupts
reported to the test, so that it does not try to use some unavailable
ones.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-07-08 12:37:58 +02:00
Andy Ross fdba8be777 tests/kernel/smp: Fixup IPI test
This test was written to assume that the only IPI handled would be the
one generated by the test, but the scheduler also generates an IPI any
time a thread becomes runnable, and there's no way to lock that out in
an SMP system where the other CPU is going to be doing its own thing
(we can't use "1cpu" because that locks interrupts on the other CPU
and obviously this is a test of an interrupt).

Change the logic to detect that "at least one IPI was received", which
is fine for coverage.  Really a better place for a test like this
would have been tests/kernel/mp, which is a test of the lower level
APIs and runs the other CPU deterministically (i.e. not under the
control of the Zephyr scheduler).

Also some misc fixes:

* Don't busy wait at the start, that's needless.

* Sleep instead of busywaiting after sending the IPI, spinning isn't
  needed here and acts to increase CI load needlessly.

* Declare the cross thread signal variable volatile for correctness
  (though this error seems to have been benign in practice).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-07-07 12:59:33 -04:00
Sandeep Tripathy 36d1bddb41 tests: interrupt: include bcm platform
GICv3 is now support for SGI generation and test case is updated
to use GICv3 apis. bcm958402m2_a72 can be enabled now.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-07-03 12:19:31 -04:00
Enjia Mai 7ac40aabc0 tests: adding test cases for arch-dependent SMP function
Add one another test case for testing both arch_curr_cpu() and
arch_sched_ipi() architecture layer interface.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2020-07-02 08:42:53 -04:00
Maksim Masalski 223723e8a9 tests: mem protect syscalls update Doxygen tags, fix API, misprints
1. Doxygen tags updates of the existing tests.
2. Fixed use of API K_MSEC in test_syscall_torture
3. Removed misprints

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-07-02 08:26:12 -04:00
Sandeep Tripathy f54c57effe tests: kernel: interrupt: fix gic sgi priority
GICC_BPR has minimum legal values in secure and non-secure states.
'3' is the minimum BPR value leading to group and sub-group priority
as 'gggg.ssss'. In order to make an IRQ preemptible they need to
be in different priority group.

Hence to be generic priority values should be above '0x0f'.

IRQ0 - default priority  (low prio)
IRQ1 - 0x0   (highest prio)

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-07-01 08:02:57 -04:00
Sandeep Tripathy ca6f04f554 tests: kernel: interrupt: Add gicv3 support
Generate SGI to self using own MPIDR.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-07-01 08:02:57 -04:00
Andy Ross 472b67e124 tests/kernel/smp: Don't wait so long at startup
Sleeping for a full second at startup is needless.  The currently
enabled subsystems on platforms that run this test don't even have any
other threads running at startup, so we're guaranteed the other core
is in idle before we even reach main().  Just a few ms is plenty.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-06-27 08:14:58 -04:00
Nicolas Pitre ae597c07b6 printk: print %p properly on 32-bit targets
The width for %p on 32-bit targets should be 8 regardless of
CONFIG_PRINTK64. Adjust the test accordingly.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-06-27 00:03:58 -04:00
Enjia Mai d678d7a65f tests: adding test cases for device abstraction
Add three test cases of device abstraction for improving test coverage.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2020-06-25 17:02:27 -04:00
Ioannis Glaropoulos 422ba1f11b tests: kernel: timer_api: add timer label for this test
Add timer label for this test suite, so it is included
in sanity check runs with -t timer.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-24 18:04:17 -07:00
Ioannis Glaropoulos 6209610820 tests: kernel: timer_api: enabling test-suite for Qemu Cortex-M0
After the Qemu Cortex-M0 timer driver rework, we may
enable the test-suite that had been (always) excluded
from running on this platform.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-24 18:04:17 -07:00
Ioannis Glaropoulos cfda90d32f tests: kernel: tickless: re-enabled test-suite for Qemu Cortex-M0
After the Qemu Cortex-M0 timer driver rework, we may
re-enable the test-suite that had been excluded for this
platform.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-24 18:04:17 -07:00
Ioannis Glaropoulos 6a3d460916 tests: kernel: common: re-enabled test-cases for Qemu Cortex-M0
After the Qemu Cortex-M0 timer driver rework, we may
re-enable the test-cases that had been skipped for this
platform.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-24 18:04:17 -07:00
Andy Ross 973487fdad lib/os: Rework/shrink printk conversions, add 64 bit support
Add support for 64 bit conversions in a uniformly expressable way by
printing values backwards into a buffer on the stack first.  This
allows all operations to work on the low bits of the value and so the
code doesn't need to care (beyond the size of that buffer) about the
word size.  This trick also doesn't care about the specifics of the
base value, so in the process this unifies the decimal and hex printk
conversion code to a single function.

This comes at a mild cost in CPU cycles to the decimal converter and
somewhat higher cost to hex (because it's now doing a full div/mod
operation instead of shifting and masking).  And stack usage has grown
by a few words to hold the temporary.  But the benefits in code size
are substantial (e.g. ~250 bytes of .text on arm32).

Note that this also contains a change to tests/kernel/common to
address what appears to have been a bug in the original converters.
The printk test uses a format string that looks like "%-4x%-2p" and
feeds it the literal arguments "0xABCDEF" and "(char *)42".
Now... clearly both those results are going to overflow the 4 and
2-byte field sizes, so there shouldn't be any whitespace between these
fields.  But the test was written to expect two spaces, inexplicably
(yes, I checked: POSIX-compatible printf implementations don't have
those spaces either).

The new code is definitely doing the right thing, so fix the test
instead.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-06-24 13:43:40 -07:00
Ningx Zhao d7d2cd5086 tests: queue modifying and adding test case
1.Add a new testcase to verify multiple queues can be defined
2.Add some code comments to describe function performance.

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-06-24 20:59:52 +02:00
Enjia Mai ce31b89e50 tests: adding test cases of spinlock
Add test case for testing achieve mutual exclusion using interrupt
masking, and initialize at runtime.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2020-06-23 16:14:55 -04:00
Maksim Masalski f221dfec2f tests: added new doxygen tags for memory protection tests
Added new doxygen tags for tests:
1. test_mem_domain_destroy
2. test_domain_add_part_drop_to_user

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-06-23 12:18:30 -04:00
Maksim Masalski f25406af99 tests: add new Doxygen tags to threads tests
Reason is that some threads tests have poor description Doxygen
tags. I decided to fix that situation in some tests which understand.

Update Doxygen tags for the next tests:
test_create_new_supervisor_thread_from_user()
test_user_mode_enter()
test_create_new_higher_prio_thread_from_user()
test_create_new_thread_from_user_huge_stacksize()

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-06-23 11:55:26 -04:00
Peter Bigot 219a3ca96d device: provide internal access to static device array
Device objects in Zephyr are currently placed into an array by linker
scripts, making it easy to iterate over all devices if the array
address and size can be obtained.  This has applications in device
power management, but the existing API for this was available only
when that feature was enabled.  It also uses a signed type to hold the
device count.

Provide a new API that is generally available, but marked as internal
since normally applications should not iterate over all devices.  Mark
the PM API approach deprecated.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-23 13:27:14 +02:00
Stephanos Ioannidis 27d42f060d tests: kernel: lifo_usage: Exclude on qemu_arc_em
This test has a very high failure rate on `qemu_arc_em` and needs to be
disabled until a fix is available.

To be addressed in #26163.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-06-21 09:47:24 -04:00
Anas Nashif 6f4f5b1fe5 tests: exclude qemu_arc_hs in lifo_usage test
Fails very frequently in CI, disabling until a fix is available, see

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-12 23:22:57 -04:00
Jian Kang 445576c8a2 tests: kernel: Add a new test for providing time duration in milliseconds
Add a new test case to verify whether kernel allow proving time duration
in milliseconds.

Signed-off-by: Jian Kang <jianx.kang@intel.com>
2020-06-11 07:13:23 -04:00
Ying ming 1b1d728a18 tests: atomic operation: add new test cases
add new test cases to illustrate the zephyr OS
support an array of atomic variables, each bit
of which can be modified.

Signed-off-by: Ying ming <mingx.ying@intel.com>
2020-06-10 10:46:28 -04:00
Krzysztof Chruscinski 1b4b9386e5 sys: util: Added separator to FOR_EACH_ macros
Added separator (e.g. comma or semicolon) parameter to FOR_EACH_ family.
Separator is added between macro execution for each argument and not at
the end.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-10 11:58:13 +02:00
Anas Nashif 603c24dec9 tests: common: skip bootdelay test on qemu_cortex_m0
Test fails on this one platform, to unblock other changes, skip the test
while the issues is being looked at. This test never ran on this
platform before due to ram restrictions.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-09 23:36:16 -04:00
Anas Nashif ac7756d4b1 tests: kernel: common: rename test boot_delay
rename boot_delay function name for clarity and change doxygen group to
be more generic and part of the init group.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-09 23:36:16 -04:00
Anas Nashif c815b062c6 tests: kernel: remove ram restrictions
Remove all ram restrictions in kernel tests and revisit all tests and
try to make them pass on all platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-09 23:36:16 -04:00
Maksim Masalski 82855aa4e0 tests: update doxygen tags for syscalls tests
Reason is that some tests have poor description in Doxygen tags,
decided to fix that situation in some tests which I understand.
Also remove small misprints from some parts of code.

Update Doxygen tags for the next tests:
test_access_kobject_without_init_access
test_thread_without_kobject_permission
test_bad_syscall
test_syscall_invalid_kobject

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-06-09 17:46:23 -04:00
Peter Bigot 31d615eab5 tests: kernel: timer_api: remove extra adjustment to expected result
The converted target value for remaining ticks was increased by one to
match original code, which used a one-sided test.  The current test is
two-sided, so that increment is already present in the allowed 1 tick
error for boards with no slew, and incorporating it into the absolute
error can cause the test to fail.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-09 18:57:31 +02:00
Peter Bigot 9c2c12d10f tests: tickless: fix build error on qemu_cortex_m3
Code compiled only for this platform had an unconverted legacy
sleep delay.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-09 08:14:53 -04:00