Commit graph

1715 commits

Author SHA1 Message Date
Jukka Rissanen 0bde2df491 net: tests: Add tests for IP address parsing
Add IPv4 and IPv6 address parsing tests.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-08-31 14:33:59 -04:00
Youvedeep Singh 91063a33a4 tests: benchmark: timing_info: Add support for nrf series processors
nrf SOC uses nrf rtc timer (not sys tick), which is 32kHz,
whereas CPU runs at higher speed (nrf52 runs at 64MHz).
So 32Khz is too slow to measure critical kernel parameters.

This patch does :-
1. Add support for nrf SOC for timing_info benchmarking.
2. Uses SOC timer to measure kernel parameters.

Jira: ZEP-2314

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-31 14:25:31 -04:00
Youvedeep Singh 76b577e180 tests: benchmark: timing_info: Change API/variable Name.
The API/Variable names in timing_info looks very speicific to
platform (like systick etc), whereas these variabled are used
across platforms (nrf/arm/quark).
So this patch :-
1. changing API/Variable names to generic one.
2. Creating some of Macros whose implimentation is platform
depenent.

Jira: ZEP-2314

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-31 14:25:31 -04:00
Tomasz Bursztyka 3e2e1c3e09 tests/ieee802154: Fix a coverity warning
Jira: ZEP-2539
Coverity-CID: 173636

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-08-31 08:56:05 -04:00
Savinay Dharmappa 3c9fb93dc5 tests: bluetooth: tester: Make UART usage consistent
We use UART1 for UART pipe in a number of qemu tests, so lets do the
same thing for the bluetooth test and move the bluetooth uart to UART2.

Jira: ZEP-2412.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-08-30 10:07:07 -05:00
Carles Cufi b7a5fab4cf Bluetooth: controller: Add Read Static Addresses VS command
Implement the first Vendor-Specific Command of the Zephyr specification
other than the 3 mandatory ones already present in the codebase, along
with a Kconfig option to enable and disable the presence of the VS
commands.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-08-30 08:18:42 -04:00
Luiz Augusto von Dentz d229ec07ad Bluetooth: tester: Fix using invalid elements with k_fifo
The documentation of k_fifo_put mentions that the items must have 32
bits reserved for kernel use as that is where the sys_snode_t pointer
is placed but this detail was not taken into consideration when
designing the cmd_queue which access each element as a btp_cmd.

Note: This probably used to work just because k_fifo_get used to place
data directly into thread's swap_data so the kernel never really touched
the list but with the changes to use k_poll the list is always updated
exposing this issue.

Jira: ZEP-2568

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-30 08:16:16 -04:00
Anas Nashif de8b88bb0b license: fix license identifiers
Also add copyright headers and license tags where missing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-29 07:42:09 -04:00
Inaky Perez-Gonzalez a132b2ac41 tests/object_footprint: fix build error due to bad Kconfig specification
This was failing to build when the PWD was not that of the
tests/benchmarks/object_footprint because it was asking to load
$(PWD)/Kconfig.

Kconfig shall be specified with no directory location, as the file
will be imported relative to to Zephyr app's directory.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-08-28 18:29:56 -04:00
Jukka Rissanen e0dd4ff74a tests: net: mld: Ignore already joined error when sending report
The verify_send_report() failed in quark_se_c1000_devboard because
the multicast group was already joined. We can safely ignore this
error for this specific test.

Fixes #1240

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-08-25 22:15:33 -04:00
Luiz Augusto von Dentz 26cd8cefd1 Bluetooth: shell: Enable CONFIG_BT_SHELL for arduino_101
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-25 15:32:38 -04:00
Luiz Augusto von Dentz 251a8a8c28 test: queue: Add test for multiple threads using k_queue_get
This tests the situation when there are multiple threads calling
k_queue_get which was causing issues when using k_poll.

Jira: ZEP-2553

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-25 09:00:46 -04:00
Luiz Augusto von Dentz 7d01c5ecb7 poll: Enable multiple threads to use k_poll in the same object
This is necessary in order for k_queue_get to work properly since that
is used with buffer pools which might be used by multiple threads asking
for buffers.

Jira: ZEP-2553

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-25 09:00:46 -04:00
Anas Nashif b8e2ed02b0 tests: kernel: mutex: minor rework
Rename task -> thread and use main as the entry thread saving 512
bytes of RAM.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-24 14:49:24 -04:00
Anas Nashif 5a938df11b tests: mslab: use main thread
Fix legacy naming and function names to be tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-24 09:29:14 -07:00
Anas Nashif 704f879f8a tests: ztest: call test_main() without arguments
Arguments are not needed and in some cases are being set as unused in
the same function. The test_main function is called from ztest main
routine without any arguments.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-24 09:29:14 -07:00
Anas Nashif a2affd75d2 tests: benchmarks: use main thread for benchmark
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-24 09:29:14 -07:00
Kumar Gala 9075e1e368 tests: crypto: mbedtls: set a code size constraint
We have a few systems with small amounts of flash that this test can't
fit into.  For now I set the limit right above 32k, however that might
need to get bumped up if we have any systems with flash sizes between
32k and 64k.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-08-24 10:26:33 -04:00
Leandro Pereira aa0e931ecc tests: gpio: Add support for ESP32
Adds an #elif for ESP32 boards.  Connect a wire from pin IO2 to pin IO4
so that the test can be executed.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-23 10:28:59 -04:00
Anas Nashif 67c83d8033 tests: footprint: add testcase.yaml to object tests
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-22 16:37:30 -04:00
Andrew Boie 176e48745e object_footprint: don't adjust IDT size
The size of the interrupt descriptor table is not really
relevant to this test.

If any driver enabled for the target board gets enabled and
has a priority level outside the IDT range, gen_idt.py is properly
reporting an error. The old C-based gen_idt seems to have allowed
this to slide by.

Issue: ZEP-2496
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-22 16:37:30 -04:00
Vinayak Kariappa Chettimada 6a39ed084f Bluetooth: controller: Add Minimum Number of Used Channels Proc
Add implementation to support Bluetooth 5.0 Minimum Number
of Used Channels Procedure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-08-21 08:41:56 -04:00
Leandro Pereira dd740c164b tests: crypto: Do not use unitialized variable
The `z` vector was not initialized in the call to
uECC_vli_nativeToBytes(), resulting in undefined behavior.  Use the
properly initialized `exp_z` array instead.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-19 07:48:07 -04:00
Paul Sokolovsky dcb80f7ab8 net: struct sockaddr should have field "sa_family"
POSIX requires struct sockaddr's field to be named "sa_family"
(not just "family"):
http://pubs.opengroup.org/onlinepubs/009696699/basedefs/sys/socket.h.html

This change allows to port POSIX apps easier (including writing
portable apps using BSD Sockets compatible API).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-08-18 16:34:51 -04:00
Tomasz Bursztyka 9034d73f1d tests/dns_resolve: Fix possible NULL dereference
Coverity-CID: 173653

Jira: ZEP-2531

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-08-17 14:10:01 -04:00
Tomasz Bursztyka 8e77ef5493 tests/zoap: Fix possible NULL pointer dereference
Coverity-CID: 173648

Jira: ZEP-2535

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-08-17 14:10:01 -04:00
Punit Vara f381b421f0 tests: ztest: remove confusing tc_start() in ztest framework
This patch removes "tc_start()" string with "starting test" and
arranges PRINT_LINE appropriatly.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-16 21:29:00 -04:00
David B. Kinder 81f7c82625 doc: fix misspellings and missing EOF newlines
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-08-16 17:38:41 -05:00
Andrew Boie 5996bca13b schedule_api: fix stack overflow on xt-sim
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-16 10:59:10 -07:00
Andrew Boie 222f37ded9 tests: schedule_api: fix variable shadowing
The array of k_thread "t" was declared non-static in 2 different
C files. Make them static.

Semaphores only used in local C file now declared static.

Use of variable 't' in thread_tslice() no longer shadows global
definition.

Fixes build errors with XCC compiler.

Increase RAM requirement to 20K.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-16 10:59:10 -07:00
Andy Ross 40e669e798 tests/kernel: Add pthread API test
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-08-15 19:42:07 -04:00
Carles Cufi fc965e5554 Bluetooth: controller: Split Ext Scan Filter Policies out
Since Extended Scanner Filter Policies is an independent feature from
Controller-based Privacy, split it out so it can be built independently
and included without it.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-08-15 22:55:15 +03:00
Gil Pitney 4f67a6c76d cc3200: Remove TI cc3200 SOC and LaunchXL board support
Per ZEP-1958, Phase 2 of adding CC3220sf LaunchXL support,
was to "deprecate the CC3200 launchxl support in Zephyr
(redundant to the CC3220)."

Effectively, the CC3220 SOC replaces the CC3200.

This patch removes the following:
* the imported CC3200 SDK
* CC3200 SOC, board, DTS files.
* adjusts other files where cc3200 was mentioned.

Also, it fixes explicit references to CC3200 in generic
CC32xx driver files.

Jira: ZEP-1958

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-08-15 11:02:48 -05:00
Luiz Augusto von Dentz 4c6007756c tests: work_q: Add test for k_delayed_work_cancel
This adds a test that attempts to submit a work with 0 timeout thus
causing it to immediatelly be submitted to the queue so it is pending
execution which is then cancelled with k_delayed_work_cancel.

Note this can only be done with coop threads with the same or higher
priority otherwise the work_q thread is wakeup before
k_delayed_work_cancel takes place, thus why test_delayed_cancel uses
K_HIGHEST_THREAD_PRIO.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-15 08:49:09 -04:00
Luiz Augusto von Dentz c1fa82b3c6 work_q: Make k_delayed_work_cancel cancel work already pending
This has been a limitation caused by k_fifo which could only remove
items from the beggining, but with the change to use k_queue in
k_work_q it is now possible to remove items from any position with
use of k_queue_remove.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-15 08:49:09 -04:00
Luiz Augusto von Dentz 84db641de6 queue: Use k_poll if enabled
This makes use of POLL_EVENT in case k_poll is enabled which is
preferable over wait_q as that allows objects to be removed for the
data_q at any time.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-15 08:49:09 -04:00
Luiz Augusto von Dentz 42d9aa785d tests: queue: Add tests for k_queue_remove
Add another list of elements which is removed before k_queue_get is
called.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-15 08:49:09 -04:00
Anas Nashif 2de59023dc tests: update min ram requirements and filters
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-14 13:28:42 -04:00
Anas Nashif e0e559001f tests: kernel: reduce thread stack size for pend
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-14 13:28:42 -04:00
Anas Nashif 4c7233b84d tests: json: reduce ztest stack size
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-14 13:28:42 -04:00
Anas Nashif 41febf2e7a tests: benchmarks: reduce message size
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-14 13:28:42 -04:00
Carles Cufi d5c13a7530 Bluetooth: controller: Rename Kconfig prefix
Rename the BT_CONTROLLER prefix used in all of the Kconfig variables
related to the Bluetooth controller to BT_CTLR.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-08-14 15:44:56 +03:00
Kumar Gala f319660ce5 tests: json: only build if newlib isn't configured
Right now we have various type conflicts between the json library and
newlib.  Until these are resolved only build the json test if newlib
isn't enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-08-13 09:06:10 -04:00
Michał Kruszewski 178191ce68 test: spi: Define asynchronous stack with K_THREAD_STACK_DEFINE.
Previous stack definition caused following warning: passing argument 2
of 'k_thread_create' from incompatible pointer type.

Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
2017-08-10 13:55:17 -04:00
Wayne Ren f8d061faf7 arch: arc: add nested interrupt support
* add nested interrupt support for interrupts
   + use a varibale exc_nest_count to trace nest interrupt and exception
   + regular interrupts can be nested by regular interrupts and fast
interrupts
   + fast interrupt's priority is the highest, cannot be nested
* remove the firq stack and exception stack
   + remove the coressponding kconfig option
   + all interrupts (normal and fast) and exceptions will be handled
     in the same stack (_interrupt stack)
   + the pros are, smaller memory footprint (no firq stack), simpler
     stack management, simpler codes, etc.. The cons are, possible
     10-15 instructions overhead for the case where fast irq nests
     regular irq
* add the case of ARC in test/kernel/gen_isr_table

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-10 12:47:15 -04:00
Youvedeep Singh 1c856d2b10 tests: kernel: Stress test for preemptive scheduling.
Tests if preemptive threads are picked up as per priority.
This creates 10 threads with priority in increasing order
from 1 to N and each thread prints an Alphabet.
This test fails when threads are picked up out of order.

Jira: ZEP-2370

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-09 21:44:53 -04:00
Youvedeep Singh ee5d84ca9a tests: kernel: Stress test for round robin scheduling.
This creates 10 threads with equal priority and tests predictibility
of picking all threads in round robin fashion. Test fails when any
thread consumes more time than time slice allocated to it or threads
are not scheduled in round robin fashion.

Jira: ZEP-2371

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-09 21:44:53 -04:00
Punit Vara 3251b9036a tests: neighbor: convert normal test to use ztest
This patch convert net test cases to use ztest framework APIs
which makes output unified to other test cases.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-09 21:42:29 -04:00
Punit Vara 2acf077a3a tests: dhcpv4: convert normal test to use ztest
This patch convert net test cases to use ztest framework APIs
which makes output unified to other test cases.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-09 21:42:29 -04:00
Niranjhana N 49d2dea875 tests: utils: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in config file, reduced size to 1024

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N e17ed87729 tests: udp: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in config file

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N 9f182e07b1 tests: http_header_fields: convert to ztest
- replaced test points with ztest APIs wherever possible
- added CONFIG_ZTEST_STACKSIZE=320

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N 0ac077af60 tests: mqtt_packet: convert to ztest
- replaced test points with ztest APIs wherever possible

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N be8a106cb3 tests: mgmt: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in config file, reduced size to 896

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N 7d1c9184a8 tests: arp: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in config file

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N fbb6cb4fdd tests: ip-addr: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in config file, reduced the size by half

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Niranjhana N 456f7a4d90 tests: icmpv6: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in config file, reduced size by half

JIRA: ZEP-2249

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-09 21:41:30 -04:00
Johann Fischer afedfa95ee tests: dma: cleanup and add loglevel configuration
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-08-09 16:04:46 -05:00
Luiz Augusto von Dentz 035d7cf871 tests: shell: Fix string not null-terminated
shell_exec expects a string that is null-terminated but if line passed
to strncpy is equal or bigger than the buffer it will not produce a
null-terminated command.

Jira: ZEP-2474

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-09 10:10:45 -04:00
Johan Hedberg 2975ca0754 Bluetooth: Kconfig: Rename CONFIG_BLUETOOTH_* to CONFIG_BT_*
The API name space for Bluetooth is bt_* and BT_* so it makes sense to
align the Kconfig name space with this. The additional benefit is that
this also makes the names shorter. It is also in line with what Linux
uses for Bluetooth Kconfig entries.

Some Bluetooth-related Networking Kconfig defines are renamed as well
in order to be consistent, such as NET_L2_BLUETOOTH.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-09 11:14:19 +03:00
Marti Bolivar 86f23c8877 tests: spi_loopback: improve error logging
Print the entire memory areas of interest on error, instead of
stopping at the first null character.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar f95632a14e tests: spi_loopback: log start/end of test at INF level
This makes it easier to distinguish which lines come from which tests.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar b147c8f61b tests: spi_loopback: add 96b_carbon support
This includes files for both polled and IRQ-driven I/O. The log level
is deliberately kept to ERROR to try to shake out any timing-dependent
bugs which go away with extra logging.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar 30ae3cb9b7 tests: spi_loopback: fix typos
Trivial fixups.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Michał Kruszewski 062360b596 test: spi: Use k_thread_abort to end asynchronous thread.
k_thread_cancel() is replaced with k_thread_abort() because
k_thread_cancel() is used to cancel threads that have not started yet.
Canceling asynchronous thread was returning an error.

Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
2017-08-08 07:44:21 -04:00
Niranjhana N fef5ef74fa tests: sha256: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - sha256.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 4e40b843e4 tests: mbedtls: convert to ztest
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - mbedtls.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 26bacab162 tests: hmac_prng: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - hmac_prng.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N af3cd3bb62 tests: hmac: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - hmac.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 712e2a4dc0 tests: ecc_dsa: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - ecc_dsa.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 763384bdb2 tests: ecc_dh: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - ecc_dh.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 83f77de779 tests: ctr_prng: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - ctr_prng.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N a1e98b01a8 tests: ctr_mode: convert to ztest
- replaced test points with ztest APIs wherever possible
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - ctr_mode.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N c47d5fcee1 tests: cmac_mode: convert to ztest
- replaced test points with ztest APIs wherever possible
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - cmac_mode.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 98f69e1de5 tests: ccm_mode: convert to ztest
- replaced test points with ztest APIs wherever possible
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - ccm_mode.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 0e53345b74 tests: cbc_mode: convert to ztest
- replaced test points with ztest APIs wherever possible
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - cbc_mode.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 851314ba8e tests: aes: convert to ztest
- replaced test points with ztest APIs wherever possible
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - aes.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Niranjhana N 50f112cdc1 tests: xip: convert to ztest
- replaced a test point with ztest API
- separated the main file into two:
    - main.c, which has ztest entry
    - xip.c, which has the original routine

JIRA: ZEP-2382

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:31:27 -04:00
Niranjhana N 7e5baf0495 tests: multilib: convert to ztest
- added a ztest test point
- separated the main file into two files:
    - main.c, which has ztest entry
    - multilib.c, which has the original routine

JIRA: ZEP-2382

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:31:27 -04:00
Niranjhana N 502c7c0c83 tests: libs: convert to ztest
- file already had ztest functions
- separated the main file into two:
    - main.c, which has the ztest entry
    - libraries.c, which has the original routines

JIRA: ZEP-2382

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:31:27 -04:00
Niranjhana N c235ff4959 tests: arm_runtime_nmi: convert to ztest
- file does not use ztest asserts
- separated the main file into two files:
    - main.c, which has ztest entry
    - arm_runtime_nmi.c, which has the original routine

JIRA: ZEP-2382

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:31:27 -04:00
Niranjhana N 8dc47d6a3b tests: arm_irq_vector_table: convert to ztest
- file already had ztest functions
- separated the main file into two:
    - main.c, which has the ztest entry
    - arm_irq_vector_table.c, which has the original routines

JIRA: ZEP-2382

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:31:27 -04:00
Johan Hedberg bf8e504588 Bluetooth: Mesh: Fix duplicate const declarations
Remvoe duplicate const declarations which may cause compiler warnings.

Jira: ZEP-2442

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-07 19:18:02 +03:00
Luiz Augusto von Dentz c4f632bd09 net: bt: app: Add NET_APP_BLUETOOTH_NODE option
This enables IPSP node role which requires IPSS GATT service to be
registered.

Jira: ZEP-2451

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-04 18:18:40 +03:00
Aska Wu e7acafd967 net: sockets: Fix a link error if CONFIG_NET_TCP is not enabled
Always support net_pkt_sent() and net_pkt_set_sent().

Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-08-04 16:50:37 +03:00
Anas Nashif 3ac7b3a229 doc: qemu target was deprecated, use 'run'
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-03 11:48:55 -04:00
Andrew Boie 80e82e7205 x86: stack overflow improvements
As luck would have it, the TSS for the main IA task has
all the information we need, populate an exception stack
frame with it.

The double-fault handler just stashes data and makes the main
hardware thread runnable again, and processing of the
exception continues from there.

We check the first byte before the faulting ESP value to see
if the stack pointer had run up to a non-present page, a sign
that this is a stack overflow and not a double fault for
some other reason.

Stack overflows in kernel mode are now recoverable for non-
essential threads, with the caveat that we hope we weren't in
a critical section updating kernel data structures when it
happened.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-03 11:46:26 -04:00
Anas Nashif abb4b09a08 build: remove unused Kconfig variables
Removed unused variables
- CONFIG_NUM_TASK_PRIORITIES
- CONFIG_NUM_COMMAND_PACKETS
- CONFIG_NUM_TIMER_PACKETS

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-03 07:19:29 -05:00
Andrew Boie 507852a4ad kernel: introduce opaque data type for stacks
Historically, stacks were just character buffers and could be treated
as such if the user wanted to look inside the stack data, and also
declared as an array of the desired stack size.

This is no longer the case. Certain architectures will create a memory
region much larger to account for MPU/MMU guard pages. Unfortunately,
the kernel interfaces treat both the declared stack, and the valid
stack buffer within it as the same char * data type, even though these
absolutely cannot be used interchangeably.

We introduce an opaque k_thread_stack_t which gets instantiated by
K_THREAD_STACK_DECLARE(), this is no longer treated by the compiler
as a character pointer, even though it really is.

To access the real stack buffer within, the result of
K_THREAD_STACK_BUFFER() can be used, which will return a char * type.

This should catch a bunch of programming mistakes at build time:

- Declaring a character array outside of K_THREAD_STACK_DECLARE() and
  passing it to K_THREAD_CREATE
- Directly examining the stack created by K_THREAD_STACK_DECLARE()
  which is not actually the memory desired and may trigger a CPU
  exception

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-01 16:43:15 -07:00
Leandro Pereira e2ad85b696 tests: crypto: Update ECC Diffie-Hellman and DSA tests
These tests have been copied over from TinyCrypt and modified slightly
so that they compile on a non-POSIX system, with a minimal C library:
that's why it doesn't comply with Zephyr's coding style.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-01 10:35:06 -04:00
Leandro Pereira c0e9519d2e tests: crypto: Fix ccm_mode test after updating TinyCrypt to 0.2.7
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-01 10:35:06 -04:00
Punit Vara e379aed0f2 tests: irq_offload: Convert test case to use ztest
This patch reduces unnecessary output on console. Those things
are replaced by ztest framework APIs

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-01 08:46:48 -04:00
Punit Vara cbf40bc6d3 tests: errno: convert test case to use ztest
This patch convert normal test case to use ztest framework
APIs and remove unnecessary output.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-01 08:46:48 -04:00
Punit Vara a0fb3b4d67 tests: critical: Convert testcase into ztest
This commit uses ztest framework APIS to make ouput unified
with other test cases.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-01 08:46:48 -04:00
Anas Nashif b4598c19e3 tests: disable building of FXOS8700 sensor for all boards
This sensor was made dependent on certain boards, so building it with
all boards fails now. Disable until proper fix exists.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-28 09:40:38 -05:00
Aska Wu 545b17a03e tests: mqtt: Add a mqtt tls test case
This adds a "build-only" test case to check if any compile error
when CONFIG_MQTT_LIB_TLS is enabled.

Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-07-28 11:25:43 +03:00
Aska Wu fb79837862 net/mqtt: Convert mqtt lib to use net app API
Use net app API since we want to enable MQTT with TLS.
mqtt_connect() and mqtt_close() are added to build and close the
connection to the broker. The caller doesn't need to deal with
the net context anymore and the most of network setup code in
mqtt_publisher is removed.

Signed-off-by: Aska Wu <aska.wu@linaro.org>
2017-07-28 11:25:43 +03:00
Leandro Pereira 732424f065 drivers, net: Clean up semaphore initialization
Change the common "init with 0" + "give" idiom to "init with 1".  This
won't change the behavior or performance, but should decrease the size
ever so slightly.

This change has been performed mechanically with the following
Coccinelle script:

    @@
    expression SEM;
    expression LIMIT;
    expression TIMEOUT;
    @@

    - k_sem_init(SEM, 0, LIMIT);
    - k_sem_give(SEM);
    + k_sem_init(SEM, 1, LIMIT);

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-07-27 15:23:07 -04:00
Inaky Perez-Gonzalez 3d498dd10c build: workaround build bug in tests
When an app uses a construct such as:

obj-y = main.o ../../../../samples/bluetooth/gatt/hrs.o

in its makefile, it causes said object module to be built in the
source tree, not in the object tree.

When building massively parallel, this usually resuls on the files
getting corrupted, leading to bugs such as:

https://jira.zephyrproject.org/browse/ZEP-2316
https://jira.zephyrproject.org/browse/ZEP-2317

src/../../../../samples/bluetooth/gatt/.gap.o.cmd:3: warning: NUL character seen; rest of line ignored
src/../../../../samples/bluetooth/gatt/.gap.o.cmd:4: warning: NUL character seen; rest of line ignored
src/../../../../samples/bluetooth/gatt/.gap.o.cmd:5: *** missing separator.  Stop.

as multiple build are trying to touch the same file in the source tree
and of course, race and causes a build bug.

We have known about this issue for a long time, but it requires
modifications in the build system that there is no time to tackle.

A suggested workaround is to include the source files into a local .c
file, so this is what this patch does, to remove the random noise.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-07-27 14:09:40 -04:00
Anas Nashif 85684d1737 tests: net: limit builds in a catch all test
This is a configuration that is unrealistic and used only to verify
Kconfig dependencies, trying to build this for every board fails due to
size limitations and due to unavailable device support on some of those
boards, building for qemu targets should be good enough.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-26 18:17:01 -04:00
Anas Nashif 52e7cdae57 tests: mqtt_subscriber: unify prj.conf
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-26 10:57:48 -04:00
Anas Nashif 80010b04cb tests: mqtt_publisher: unify prj.conf
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-26 10:57:48 -04:00
Anas Nashif ca0ad13a61 net: enable SLIP only on QEMU targets
In many networking tests we had to configure SLIP in the prj.conf
leaving those configurations Qemu specific. This change enables SLIP for
QEMU targets automatically and allows reuse of prj.conf for multiple
boards.

Additionally, the TUN options is removed. This option was not used
anywhere.

To enable self-contained networking tests that do not depend on SLIP, we
introduce the new option NET_TEST which disables TAP and allows testing
in QEMU without the need for a host interface.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-26 10:57:48 -04:00
Jukka Rissanen cb7b96bcc7 tests: net: trickle: Fix the Trickle parameters
The Imax doublings value was too large which caused overflow
of Imax_abs value, which then could cause Trickle test to fail.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-26 07:56:51 -05:00
Andrew Boie 5bcf3e97df timing_info: fix how stacks are referenced
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-26 05:53:14 -04:00
Kumar Gala dd6d34e7dc tests: net: second pass at cleanup tests to build on all platforms
The majority of these fixes adjust the memory limit needed to build the
various tests on systems with and without BLE support.  We also fixup
one test case that was able to run on platforms with 16k of memory.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-26 11:47:14 +03:00
Anas Nashif 1f9d8a9fd8 tests: trickle: exclude qemu_cortex_m3
Fails in CI, exclude while we investigate the issue.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-25 17:39:37 -05:00
Kumar Gala ebc948d818 tests: net: limit tests to boards with enough memory to build them
A number of the network tests have minimal memory requirements that not
all boards are able to meet.  Add in those memory requirements so we
don't attempt to build these tests for those platforms.  Utilized the
frdm_kl25z (with 16K of memory) and cc2650_sensortag (with 20K) to test
the limits.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-25 15:51:18 -05:00
Andrew Boie 416eca5b13 tests: fatal: enable x86 MMU stack protection
Show that this mechanism can detect stack overflows with the
guard page. We only do it once since are are in an alternate
IA HW task after it happens.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-25 11:32:36 -04:00
Andrew Boie 861b269128 sys_kernel: fix stack declaration
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-25 11:32:36 -04:00
Andrew Boie c3fce81d13 tests: fatal: fix stack size to k_thread_create
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-25 11:32:36 -04:00
Jukka Rissanen 45eac217a2 net: tests: Enable net tests for all suitable platforms
Instead of only running net tests in qemu_x86, enable those
tests in all suitable platforms. The tests are disabled for
bbc_microbit as that platform does not have enough memory.

The tests/net/arp and tests/net/ieee802154/l2 are disabled
for qemu_xtensa as the qemu crashed when running the tests.
For tests/net/all there was a weird build error for qemu_xtensa
so that test is also disabled for that platform.

Increased the trickle timeout to 3 secs in tests/net/trickle as
occacionally there was timeout error in qemu_cortex_m3 when the
test was run.

Jira: ZEP-2398

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-25 10:46:44 -04:00
Jukka Rissanen c99bc8cf53 tests: net: LLVM build warning from tests/net/dhcpv4
Duplicate config option in prj.conf file.

Jira: ZEP-2374

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-20 10:16:44 -05:00
Jukka Rissanen 5871fda709 tests: net: LLVM build warning from tests/net/udp
Missing (u8_t *) cast.

Jira: ZEP-2375

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-20 10:16:44 -05:00
Johan Hedberg 0ec2630882 Bluetooth: Mesh: Add initial implementation
Add an initial implementation for the Bluetooth Mesh Profile
Specification. The main code resides in subsys/bluetooth/host/mesh and
the public API can be found in include/bluetooth/mesh.h. There are a
couple of samples provided as well under samples/bluetooth and
tests/bluetooth.

The implementation covers all layers of the Bluetooth Mesh stack and
most optional features as well. The following is a list of some of
these features and the c-files where the implementation can be found:

 - GATT & Advertising bearers (proxy.c & adv.c)
 - Network Layer (net.c)
 - Lower and Upper Transport Layers (transport.c)
 - Access Layer (access.c)
 - Foundation Models, Server role (health.c & cfg.c)
 - Both PB-ADV and PB-GATT based provisioning (prov.c)
 - Low Power Node support (lpn.c)
 - Relay support (net.c)
 - GATT Proxy (proxy.c)

Notable features that are *not* part of the implementation:

 - Friend support (initial bits are in place in friend.c)
 - Provisioner support (low-value for typical Zephyr devices)
 - GATT Client (low-value for typical Zephyr devices)

Jira: ZEP-2360

Change-Id: Ic773113dbfd84878ff8cee7fe2bb948f0ace19ed
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-20 09:30:44 +03:00
Maureen Helm 719f1dac07 tests: adc: Add support for freedom and hexiwear boards
Adds support for freedom and hexiwear boards to the adc_api test.

Jira: ZEP-1396

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-07-19 14:28:08 -05:00
Savinay Dharmappa cc48d40c5f tests: kernel: sprintf: Fix build warning.
As there is no suffix to represent a literal as unsigned short
it is typecasted. It is fix for Jira ZEP-2156

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-07-19 11:16:52 -04:00
Robert Chou 33c54ee6fd net: zoap: advance block context by checking M bit from block option
According to RFC7959 page 30, "The end of a block-wise transfer is
governed by the M bits in the Block options, _not_ by exhausting the
size estimates exchanges."

Therefore, we should check the M bit instead of total size (which
is not always available, too)

Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
2017-07-14 11:06:54 +03:00
David B. Kinder eeed8ce179 doc: fix wiki board references in non .rst files
Some README files referenced wiki articles that have been
moved to the doc area on the website.

Fixes #668

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-07-11 12:45:35 -05:00
Jukka Rissanen ee989be286 net: tcp: Fix sequence number validator
The sequence number validator was checking the seq numbers
incorrectly. This caused some valid RST packets to be dropped
and the TCP stream to hang.

Added also a TCP test case that tests the seq validator.

Jira: ZEP-2289

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-11 10:35:19 +03:00
Jukka Rissanen 0c5ef71c07 tests: net: 6lo: Remove CONFIG_MAIN_STACK_SIZE setting
No need to set the main stack size as the test runs just fine
without it.

Jira: ZEP-2341

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-11 10:31:11 +03:00
Andrew Boie e55fd562ec tests: protection: don't do exec tests on x86
The IA32 MMU has no concept of a "no execute" flag, this is
unfortunately only implemented in x86_64.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-10 11:44:56 -07:00
Andrew Boie ed1962a65c tests: net: remove overriden RAM size
The QEMU targets have plenty of RAM now and the current value
specified wasn't a multiple of a 4K page.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-10 11:44:56 -07:00
Andrew Boie 304f91c4cb tests: net: route: fix semaphore usage
A network stack thread was trying to use a semaphore before it was
initialized. Set it up at toplevel so it is ready to go.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-10 11:44:56 -07:00
Andrew Boie 65a9d2a94a kernel: make K_.*_INITIALIZER private to kernel
Upcoming memory protection features will be placing some additional
constraints on kernel objects:

- They need to reside in memory owned by the kernel and not the
application
- Certain kernel object validation schemes will require some run-time
initialization of all kernel objects before they can be used.

Per Ben these initializer macros were never intended to be public. It is
not forbidden to use them, but doing so requires care: the memory being
initialized must reside in kernel space, and extra runtime
initialization steps may need to be peformed before they are fully
usable as kernel objects. In particular, kernel subsystems or drivers
whose objects are already in kernel memory may still need to use these
macros if they define kernel objects as members of a larger data
structure.

It is intended that application developers instead use the
K_<object>_DEFINE macros, which will automatically put the object in the
right memory and add them to a section which can be iterated over at
boot to complete initiailization.

There was no K_WORK_DEFINE() macro for creating struct k_work objects,
this is now added.

k_poll_event and k_poll_signal are intended to be instatiated from
application memory and have not been changed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-10 11:44:56 -07:00
Tomasz Bursztyka dc33d8f49e tests/ieee802154: Fix accessing unmapped memory area
commit-id b07f20c143 had wrong fix.

Jira: ZEP-2331

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-07-10 09:25:32 -07:00
Geoff Gustafson 1405627c37 net: context: Use K_NO_WAIT instead of 0 for timeout
Signed-off-by: Geoff Gustafson <geoff@linux.intel.com>
2017-07-10 10:59:28 +03:00
Kumar Gala 9eddc82be3 i2c: remove I2C Slave Read config
The I2C Slave Read support isn't well defined and not actually supported
by any i2c driver at this point.  We can add this back when slave mode
is more thought out.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-07 10:01:38 -05:00
Jukka Rissanen 9c907fca43 net: tcp: Remove NET_TCP_HDR() macro and direct access to net_buf
Remove NET_TCP_HDR() macro as we cannot safely access TCP header
via it if the network packet header spans over multiple net_buf
fragments.

Fixed also the TCP unit tests so that they pass correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-07 15:24:00 +03:00
Jukka Rissanen 3604c391e6 net: udp: Remove NET_UDP_HDR() macro and direct access to net_buf
Remove NET_UDP_HDR() macro as we cannot safely access UDP header
via it if the network packet header spans over multiple net_buf
fragments.

Fixed also the UDP unit tests so that they pass correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-07 15:24:00 +03:00
Jukka Rissanen 8476da9d9b net: icmp: Remove NET_ICMP_HDR() macro and direct access to net_buf
Remove NET_ICMP_HDR() macro as we cannot safely access ICMP header
via it if the network packet header spans over multiple net_buf
fragments.

Jira: ZEP-2306

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-07 15:24:00 +03:00
Tomasz Bursztyka b07f20c143 tests/ieee802154: Fix a null pointer deferencing
Jira: ZEP-2331

Reported-by Andrew Boie <andrew.p.boie@intel.com>

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-07-07 12:41:41 +03:00
Jukka Rissanen 90fc27e652 tests: net: ip-addr: Fix null pointer access in the test
IP-address test was accessing NULL pointer.

Jira: ZEP-2332

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-06 09:17:53 -07:00
Anas Nashif 5f63386c34 tests: crypto: fix coding style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-06 10:34:41 -05:00
Kumar Gala 8f77cddc77 tests: crypto: sha256: limit to systems with >48k of memory
We fail to build this test on stm32f3_disco which has 40k of SRAM.
Bump up the min_ram requirement to 48k.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-06 09:53:00 -05:00
Anas Nashif 8d108c9d59 tests: mbedtls: cleanup prj.conf
Remove platform specific option CONFIG_ARC_INIT and a copy/pasted
comment with "#nothing here".

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif 52a4916cab tests: crypto: do not build when DEBUG is enabled
The external mbedTLS library seems to have some issues when DEBUG is
enabled, so disable this here becauase we will not change external 3rd
party code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif 882c19ddbc tests: remove build_only tag
build_only is set to false by default, so remove it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif c364e06ccb tests: move spi test under tests/
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif d7e15aa415 benchmark: footprint: fixed testcase
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif 68d7a207ae ethernet: fix Kconfig option for ETHERNET
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif c01c074b5b net: fix wrong Kconfig
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT should be used instead of
CONFIG_NET_IFACE_UNICAST_IPV6_ADDR_COUNT.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Johan Hedberg 30beef9419 Bluetooth: GATT Introduce BT_GATT_CCC_MAX helper define
The worst-case maximum number of CCC entries we need is actually
MAX_CONN + MAX_PAIRED. Provide a helper define for it and use it
whenever appropriate.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-04 17:30:40 +03:00
Tomasz Bursztyka 37af7b5096 tests/ieee802154: Fix how is initialized the driver lock in l2 test
The test starts the last one: after the driver and the net stack.
However, the net stack (due to DAD and else) will already try to send
some packet, resulting it giving a uninitialized semaphore. But once
properly initialized, this semaphore will end up with a non-zero count
when the test will start: thus reseting it to 0 before running the
tests.

Jira: ZEP-2319

Reported-by Andrew Boie <andrew.p.boie@intel.com>

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-07-03 20:58:57 -04:00
Johan Hedberg 7a79101fd5 Bluetooth: tests: Remove unused prj_nimble.conf files
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-03 08:22:58 -04:00
Jean-Paul Etienne b31b41604e tests: crypto: include back riscv32 arch for ecc_dh, ecc_dsa and mbedtls
Issue fixed by commit "riscv32: fixed context restore upon exiting ISR"

Jira: ZEP-2020

Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-06-30 06:31:51 -04:00
Kumar Gala 8953db8008 tests: tickless: fix building of test
Build issues caused by commit fe882f407d
which missed camel case conversion of _TimestampOpen, _TimestampRead,
and _TimestampClose.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-29 13:14:18 -05:00
Kumar Gala 534beb34c9 tests: boot_time: cleanup boot_time test to work on ARM
Enabled the boot_time test on ARM SoCs, set __start_time_stamp on ARM
since we don't have a free running counter similar to TSC on x86.
Also moved to printing the values out as %u to increase the range of
values.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-29 07:08:59 -04:00
Kumar Gala d3d9abadbe tests: shell: Filter on UART_CONSOLE support to enable more boards
The shell tests were limited to running on just qemu_x86 platform, we
can run them on any platform with UART_CONSOLE support so move to using
a filter.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-29 07:07:31 -04:00
Punit Vara fe882f407d tests: Remove camel case and fix coding style
Test whichever had Camel case defined for functions and variables have
been replaced.

Following warnings have been fixed in test cases as well.
- line over 80 characters
- Macros with flow control statements should be avoided
- Macros with complex values should be enclosed in parentheses
- break quoted strings at a space character
- do not add new typedefs
- Comparisons should place the constant on the right
  side of the test
- suspect code indent for conditional statements
- Missing a blank line after declarations
- macros should not use a trailing semicolon
- Macros with multiple statements should be
  enclosed in a do - while loop
- do not use C99 // comments

JIRA: ZEP-2249

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-06-29 07:00:50 -04:00
Anas Nashif b3ae274a62 tests: fix PCI test using 'supported' keyword
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-28 09:51:40 -05:00
Anas Nashif d1e562c924 tests: replace filters in testcase files
Where possible, replace the use of filter with newly added keywords.
This will speed things up and in some cases add more coverage due to bad
filters.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-28 09:51:40 -05:00
Anas Nashif 6c05ccb226 tests: convert testcase.ini to new format
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-28 09:20:36 -05:00
Paul Sokolovsky b650fa8a72 tests: net: Add test for Sockets API UDP socket/bind/connect/send/recv
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-06-28 16:07:55 +03:00
Andrzej Puzdrowski 8b7a8448ab Drivers: flash: NRF5x: synchronous mode for co-operation with BLE radio
In added mode flash operation are performed in timeslice
(in radio idle time).
Kconfig for mode enabling CONFIG_SOC_FLASH_NRF5_RADIO_SYNC.

Erase and write API implementations were rewritten and preserved against
concurrent execution.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-06-28 12:29:50 +02:00
Johan Hedberg e094560dbc Bluetooth: tests: Fix left-over issues from bt_gatt_service() removal
The new GATT service registration API is bt_gatt_service_register(),
which takes a bt_gatt_service object pointer.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-06-27 19:10:43 -04:00
Anas Nashif 6ff291a174 tests: do not exclude quark_d2000_crb
quark_d2000_crb does not build net/bluetooth tests by default now.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-27 17:44:23 -04:00
Anas Nashif 3c50f7aa12 tests: samples: remove duplicate filtering
We have many testcases doing filtering both on the architecture level
and the platform level, which is redundant. Also many testcases are
running the same test twice on the same SoC for no good reason, cleanup
the tests and cleanup the filtering.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-27 17:44:23 -04:00
Johann Fischer 6dbe738d0e tests: dma: fix chan_blen_transfer
Use sizeof instead of strlen to get the correct buffer
length and initialize rx buffer with zeros before the dma
transfer.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-06-23 15:56:08 -04:00
Stephen Smalley 0ed343070c tests: protection: add testcase.yaml
commit d859295be9 ("tests: protection: convert to testcase.yaml")
removed testcase.ini but did not add an equivalent testcase.yaml.
Add it.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2017-06-22 16:15:32 -04:00
Vinayak Kariappa Chettimada 46f9489704 Bluetooth: controller: Add radio fast ramp feature
Added implementation to use nRF radio's fast ramp up mode.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-22 18:48:15 +03:00
Anas Nashif d859295be9 tests: protection: convert to testcase.yaml
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 22:25:14 -04:00
Stephen Smalley c997577670 tests: Add a self-protection test suite
Add a self-protection test suite with a set of tests
to check whether one can overwrite read-only data
and text, and whether one can execute from data,
stack, or heap buffers.  These tests are modeled after
a subset of the lkdtm tests in the Linux kernel.

These tests have twice caught bugs in the Zephyr NXP MPU
driver, once during initial testing/review of the code
(in its earliest forms on gerrit, reported to the original
author there) and most recently the regression introduced
by commit bacbea6e21 ("arm: nxp: mpu: Rework handling
of region descriptor 0"), which was fixed by
commit a8aa9d4f3dbbe8 ("arm: nxp: mpu: Fix region descriptor
0 attributes") after being reported.

This is intended to be a testsuite of self-protection features
rather than just a test of MPU functionality.  It is envisioned
that these tests will be expanded to cover a wider range of
protection features beyond just memory protection, and the
current tests are independent of any particular enforcement
mechanism (e.g. MPU, MMU, or other).

The tests are intended to be cross-platform, and have been
built and run on both x86- and ARM-based boards.  The tests
currently fail on x86-based boards, but this is an accurate
reflection of current protections and should change as MMU
support arrives.

The tests leverage the ztest framework, making them suitable
for incorporation into automated regression testing for Zephyr.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2017-06-21 21:52:50 -04:00
Stephen Smalley 083fdf352b tests/ztest: Add ztest_test_pass()
ztest provides a ztest_test_fail() interface to fail the currently
running test, but does not provide an equivalent ztest_test_pass().
Normally a test passes just by returning without an assertion failure
or other call to ztest_test_fail().  However, if the correct behavior
for a test is to trigger a fatal fault (as with tests/kernel/fatal or
protection or MPU tests), then we need a way for the test to pass the
currently running test before aborting the current thread.
Otherwise, ztest hangs forever in run_test() on the
k_sem_take(&test_end_signal, K_FOREVER) call.  Add
a ztest_test_pass() interface and implement it for kernel and
userspace variants of ztest.  This interface will be used in the
protection tests.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2017-06-21 21:52:50 -04:00
Anas Nashif 60e752a9f9 tests: dns: do not set as slow test
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 21:38:12 -04:00
Jukka Rissanen cc3cee0017 tests: net: context: Do not print error for passed test
It is confusing if we print timeout error when expecting
a timeout to happen. So for timeout test, do not print
an error message as the timeout is suppose to happen.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-21 21:38:12 -04:00
Jukka Rissanen 269e53609b tests: net: tcp: Fix tests and run them automatically
The TCP tests had several failures because of unnecessary
Kconfig options. These are now fixed and the TCP tests are
also run automatically by CI.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-21 21:38:12 -04:00
Jukka Rissanen dcbe20dcb0 tests: net: mld: Fix tests and run them automatically
The MLD (Multicast Listener Discovery) tests had a failure.
This is now fixed and the MLD tests are also run automatically by CI.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-21 21:38:12 -04:00
Jukka Rissanen e5337672e1 tests: net: ipv6: Fix tests and run them automatically
The IPv6 tests had failures and the tests did not pass
properly. These are now fixed and the tests are also
run automatically by CI.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-21 21:38:12 -04:00
Jukka Rissanen e9368af1b4 tests: net: buf: Run the net_buf tests automatically
The test app works so it can be run automatically.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-21 21:38:12 -04:00
Anas Nashif 470c5f3189 tests: remove testcase.ini files
We now use yaml files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 20:56:53 -04:00
Anas Nashif cc24f4b03c tests: samples: convert testcase files to yaml
This will prepare test cases and samples with metadata and information
that will be consumed by the sanitycheck script which will be changed to
parse YAML files instead of ini.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 20:56:53 -04:00
Carles Cufi 4053470f62 Bluetooth: controller: Add inital support for Controller-based privacy
This initial commit adds the following:

* Handling of privacy HCI commands
* New Link Layer filter module for both whitelist and resolving list
* Advertising RPA generation with timeouts

Follow-up commits will expand the functionality.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-06-20 15:20:09 +03:00
Andrew Boie 0f669132a0 kernel: remove gdb_server
This is unmaintained and currently has no known users. It was
added to support a Wind River project. If in the future we need it
again, we should re-introduce it with an exception-based mechanism
for catching out-of-bounds memory queries from the debugger.

The mem_safe subsystem is also removed, it is only used by the
GDB server. If its functionality is needed in the future, it
shoudl be replaced with an exception-based mechanism.

The _image_{ram, rom, text}_{start, end} linker variables have
been left in place, they will be re-purposed and expanded to
support memory protection.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-19 14:29:40 -04:00
Anas Nashif af416a98b0 tests: pipe: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif dc57fa61bf tests: pipe: rename test directory
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif f6775bc67b tests: timer_monotonic: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 1a1ae2f929 tests: timer_api: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 00b55663f1 tests: schedule_api: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif b593d35762 tests: thread_init: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 115ce02a3d tests: rename cdata -> custom_data
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif c49dbe4e22 tests: threads_scheduling -> threads/scheduling
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 204e782c15 tests: threads_lifecycle/ -> threads/lifecycle
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 47e115a4b1 tests: threads_customdata/ -> threads/customdata
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif cff71db53b tests: queue: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 85cc533247 tests: profiling_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 183f045755 tests: poll: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 3521e2e5e7 tests: pending: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 93bcc957da tests: obj_tracing: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 3ad53365d6 tests: mutex_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif fbe4f16bc7 tests: mutex: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 0f4329780a tests: mbox: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 31ff9f2ad5 tests: move ipm test to drivers
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 73195eb196 tests: ipm: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif b778ec3604 tests: fp_sharing: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 1a93489935 tests: fifo: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 52a38ffd8d tests: critical: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 072c3d110a tests: common: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 99b39a6ff3 tests: bitfield: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif adc4889afe tests: arm_runtime_nmi: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif e4a963c5d1 tests: arm_irq_vector_table: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 1a0875111c tests: alert_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif c7cd5d260a tests: sleep: rename test directory
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 5a0842d5d2 tests: put tickless tests together
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif ffa850d86f tests: workq_api: rename test directory
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif c31a11c591 tests: work_queue: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 520d3c0fbf tests: workq_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif f268b6acf2 tests: mem_heap: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 27f32b9d56 tests: mem_pool_threadsafe: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif b787eff65b tests: mem_pool_api: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 16cfaac754 tests: mem_pool: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 26c7ac1f4f tests: mslab_threadsafe: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif a9da45a200 tests: mslab_concept: fix code style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif d744a2709e tests: mslab_api: fix style
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 9541ebc7a3 tests: rename test directory for mem_pool
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif c51e80e3b7 tests: rename test directory for mem_slab
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 1803009eb5 tests: rename test directory for fifo
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif a9fe253422 tests: rename test directory for lifo
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif a6292a1615 tests: rename test directory for alert
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-19 09:01:14 -04:00
Anas Nashif 397d29db42 linker: move all linker headers to include/linker
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-18 09:24:04 -05:00
David B. Kinder ddbf1255a9 test: fix misspellings
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-06-17 22:34:45 -04:00
Anas Nashif 2d970a2cbd tests: rename test directory test_bluetooth -> bluetooth
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif ea1addbb3c tests: rename test directory test_loop_transfer -> loop_transfer
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif fcb1d175e6 tests: rename test directory test_chan_blen_transfer
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 2d1ac45f01 tests: rename test directory test_sha256 -> sha256
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 0772abff24 tests: rename test directory test_mbedtls -> mbedtls
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 38fca5cb5d tests: rename test directory test_hmac_prng -> hmac_prng
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif abaa5cb42f tests: rename test directory test_hmac -> hmac
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 4ce66b728f tests: rename test directory test_ecc_dh -> ecc_dh
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif dfe3195db8 tests: rename test directory test_ecc_dsa -> ecc_dsa
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif d8dfdceb65 tests: rename test directory test_ctr_prng -> ctr_prng
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 3c3aac9e44 tests: rename test directory test_ctr_mode -> ctr_mode
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif e10e013082 tests: rename test directory test_cmac_mode -> cmac_mode
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 99b8dc0534 tests: rename test directory test_ccm_mode -> ccm_mode
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif 2d1a4a1284 tests: rename test directory test_cbc_mode -> cbc_mode
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Anas Nashif f18ef22824 tests: rename test directory test_aes -> aes
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Johan Hedberg 9703927f84 net: buf: Move net_buf_pool objects to dedicated linker area
Moving the net_buf_pool objects to a dedicated area lets us access
them by array offset into this area instead of directly by pointer.
This helps reduce the size of net_buf objects by 4 bytes.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-06-16 17:05:06 +03:00
Jukka Rissanen 72567677e7 net: pkt: Fix net_pkt_split()
The net_pkt_split() was incorrectly checking fragA pointer
even before it was allocated.

The unit test is fixed and converted to ztest.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-16 17:05:06 +03:00
Jukka Rissanen 096a9984b2 tests: net: ipv6_fragment: Fix llvm compiler warning
llvm complains about char* -> u8_t* type conversion.

tests/net/ipv6_fragment/src/main.c:645:52: warning:
  passing 'char [11]' to parameter of type 'const u8_t *' (aka
  'const unsigned char *') converts between pointers to integer
  types with different sign [-Wpointer-sign]
        bool written = net_pkt_append_all(pkt, data_len, data,

Jira: ZEP-2274

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-06-16 16:07:08 +03:00
Adithya Baglody be1cb961ad tests: benchmark: boot_time: Reading time stamps made arch agnostic
1. Changed _tsc_read() to k_cycles_get_32(). Thus reading the
time stamp will be agnostic of the architecutre used.
2. Changed the variable names from *_tsc to *_time_stamp.

JIRA: ZEP-1426

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-06-16 07:37:37 -05:00
Kumar Gala 276794b0d7 tests: benchmarks: footprint: really enable floating point on arm
Update the arm.conf to enable CONFIG_FLOAT for the float test and use a
filter on that so we only run/build the test on SoCs/boards that support
floating point hardware.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-15 17:28:35 -04:00
Kumar Gala 2970ffff53 tests: benchmarks: footprint: build on ARM
Enable all footprint tests to build on ARM.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-15 17:28:35 -04:00
Kumar Gala 2f9478614a tests: benchmarks: footprint: fix tag typo
testcase.ini had a typo for footprint-float test.  tag was 'ootprint'
should have been 'footprint'.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-15 17:28:35 -04:00
Luiz Augusto von Dentz 79af35991b Bluetooth: GATT: Add bt_gatt_register_service
This adds bt_gatt_register_service using bt_gatt_service which contains
the attribute array that is then added to the database saving a pointer
in each and every attribute declared.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Luiz Augusto von Dentz d837a6ec4b Bluetooth: GATT: Add GAP service by default
GAP is mandatory service and now that the db can only be build
dynamically there is no reason to keep the applications registering it.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Luiz Augusto von Dentz b3cfabab63 Bluetooth: Remove CONFIG_BLUETOOTH_GATT_DYNAMIC_DB
Removes CONFIG_BLUETOOTH_GATT_DYNAMIC_DB in preparation to the
introduction of bt_gatt_unregister.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Vinayak Kariappa Chettimada 51d6bdb2ff Bluetooth: controller: LE Advertising Extensions PDU structs
Add Bluetooth v5.0 LE Advertising Extensions air interface
packet structures.

Jira: ZEP-2073

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-14 18:40:40 +03:00
Luiz Augusto von Dentz aac4f488be tests: Add shell tests
This adds the following tests:

help tests:
shell_exec(help): 0
shell_exec(help dummy): 0
shell_exec(help invalid): -22

select tests:
shell_exec(select): 0
shell_exec(select dummy): 0
shell_exec(select invalid): -22

module tests:
shell_exec(dummy cmd1): 0
shell_exec(dummy cmd1 arg1): -22
shell_exec(dummy cmd2 arg1): 0
shell_exec(dummy cmd2 arg1 arg2): -22
shell_exec(dummy cmd3 arg1 arg2): 0
shell_exec(dummy cmd3 arg1 arg2 arg3): -22
shell_exec(dummy cmd4 arg1 arg2 arg3): -22
shell_exec(cmd1): 0
shell_exec(cmd1 arg1): -22
shell_exec(cmd2 arg1): 0
shell_exec(cmd2 arg1 arg2): -22
shell_exec(cmd3 arg1 arg2): 0
shell_exec(cmd3 arg1 arg2 arg3): -22
shell_exec(cmd4 arg1 arg2 arg3): -22

app handler tests:
shell_exec(cmd4 arg1 arg2 arg3): 0

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-09 18:54:27 -04:00
Andrew Boie 15ed8ec7ea tests: use K_THREAD_STACK_DEFINE macros
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Andrew Boie bcb4cfe9e4 tests: net: use main thread for test
The main thread was doing nothing but spawning another thread to perform
the test. Delete the alternate thread, and just do the test on the main
thread, adjusting stack size and priority as necessary.

Issue: ZEP-2236
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Andrew Boie 0b9f9f3023 tests: context: move idle test to the end
On some devices, when k_cpu_idle() was called we were getting
interrupts that were not the timer interrupt. On bbc_micro
a power clock control driver interrupt was happening instead
and k_cpu_idle() was returning without the system tick advancing,
failing the test.

The clock control interrupts seem to only happen early in device
boot; moving the idle test much later lets the test pass on this
board (and likely all other NRF5 based boards).

Issue: ZEP-2257
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 15:12:03 -04:00
Marti Bolivar 2a29bed8bb tests: json: add tests for arrays of objects
Add tests for the newly-added JSON_OBJ_DESCR_OBJ_ARRAY. These pass.

Note that this also adds test coverage for decoding an array of
maximum length, to avoid regressing the recently-introduced fix for
this edge case.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-06-08 15:11:23 -04:00
Anas Nashif 6e78701392 tests: remove obsolete usage of defrag
Also increase ISR stack to make it run on Quark D2000 CRB.

Jira: ZEP-2224
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-08 14:53:49 -04:00
Andrew Boie 000429c069 tests: fatal: increase coverage
- _SysFatalErrorHandler is supposed to be user-overridable.
The test case now installs its own handler to show that this
has happened properly.

- Use TC_PRINT() TC_ERROR() macros

- Since we have out own _SysFatalErrorHandler, show that
k_panic() works

- Show that _SysFatalErrorHandler gets invoked with the expected
reason code for some of the scenarios.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 13:49:36 -05:00
Anas Nashif 3405607d9e license: add missing licenses and copyright
We were missing license boilerplate in many files, add them

Jira: ZEP-1464

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-08 10:41:56 -04:00
Andrew Boie 68e8813896 tests: context: allow 2 ticks of slop
The hard-coded value of 10ms doesn't take the system configured
amount of ticks per second, nor does it account for an unlucky
tick advance which causes the test to fail very intermittently
in QEMU.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 08:02:32 -04:00
Andrew Boie 7a5150cd9f tests: context: make some failures less ambiguous
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-08 08:02:32 -04:00
Ravi kumar Veeramally 7a01988c64 net: 6lo: Fix source address uncompression
When src and dst addresses are compressed based on context
information, uncompression method should verify CID bit,
SAC and DAC bits and context ID's. But it has missed some
cases which resulted in invalid uncompressed IPv6 header.

e.g. CID is set, SAC is 0 and DAC is 1 and context id's provided.
Uncompression method assumed that src address is compressed based
on context information but it is not.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-06-06 09:06:01 -04:00
Andrew Boie 7b7504e2b9 schedule_api: don't exclude Nios II
Nothing about this test requires tickless idle and it's not even
turned on in prj.conf.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-02 14:47:01 -04:00
Anas Nashif 70b2a57d7a quark_d2000_crb: increase default stack size
Increase to 1024 to get more tests and sample running on this device
with only 8K of SRAM.

Change thread stack size in the mslab test to make it fit into this
board.

Jira: ZEP-2079
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-01 10:27:34 -04:00
Marti Bolivar 7a7bc707d1 tests: json: test JSON_OBJ_DESCR_*_NAMED
Add tests for new macro helpers that allow JSON field names to differ
from their corresponding C struct field names. These pass.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-31 14:53:26 -04:00
Marti Bolivar a8e08ecdad tests: json: fix sense of test result string
The other test strings are worded in the positive sense; keep things
consistent.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-31 14:53:26 -04:00
Adithya Baglody bee2b8499b tests: benchmark: Fixed build error from icx toolchain.
The error was generated by a piece of code that is
not currently being used. This piece of code was kept to measure
the overhead caused by the benchmarking code on x86.

JIRA:ZEP-2160

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-05-31 12:51:42 -04:00
Andrew Boie 5963904e4c printk: fix printing of long long types
64-bit types were not being handled properly and depending on the
calling convention could result in garbage values being printed.

We still truncate these to 32-bit values, the predominant use-case
is printing timestamp delta values which generally fit in a 32-bit
value. However we are no longer printing random stuff.

Test case for printk() updated appripriately to catch this regression.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-30 19:42:22 -04:00
Jukka Rissanen 3f46248bb5 tests: net: ipv6: Test IPv6 fragmentation sending
These tests make sure that the IPv6 fragments are build correctly
when a large IPv6 packet is being sent.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-05-30 11:21:51 +03:00
Luiz Augusto von Dentz e1a062e28b Bluetooth: shell: Use CONFIG_BLUETOOTH_SHELL
Remove existing commands supported by CONFIG_BLUETOOTH_SHELL and make
sure all .conf select it.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-29 10:42:21 +03:00
Sharron LIU 189aa475e1 tests: kernel: added tests for k_mem_pool_alloc from isr
Added tests to invoke k_mem_pool_alloc() from isr context

Jira: ZEP-1631

Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-05-27 10:22:14 -04:00
Sharron LIU ab6d4c1a42 tests: kernel: added tests for timeslice reset
Added test cases to verify timeslice reset among thread context
switching.

Jira: ZEP-948

Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-05-27 10:22:14 -04:00
Adithya Baglody c0549aae75 tests: benchmark: app_kernel: Return values from kernel APIs are read.
Static code analysis reported some kernel APIs were used without
reading the return value. Since the benchmark doesn't need error
conditions, a simple read of the values followed by a ARG_UNUSED
is used to handle static code analysis errors.

JIRA: ZEP-2134

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-05-27 10:20:14 -04:00
Leandro Pereira 90a2d2fcba tests: clock: Initialize d64 value
CID: 167149
Jira: ZEP-2130
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-05-27 09:54:31 -04:00
Johan Hedberg 9516d63836 Bluetooth: Remove support for NBLE
NBLE has been deprecated for a few releases now and can be removed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-25 09:03:16 -07:00
Paul Sokolovsky cc47918166 tests: net: ipv6: Fix possible NULL pointer dereference behind a macro
As this is a test, it's minor issue, but let's keep Coverity report
clean.

Coverity-CID: 169303

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-25 18:54:22 +03:00
Jukka Rissanen 3677caa37e tests: net: zoap: Add path uri matching tests
Test the match_path_uri() function that was fixed by previous
commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-05-25 18:49:56 +03:00
Inaky Perez-Gonzalez 13617b943d tc: remove */defaults.tc
These files are no longer used and can be removed.

Change-Id: I781256ab93b5364346d99cd4aac488762c437151
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-05-22 20:17:02 -04:00
Justin Watson 44f09663f9 tests: kernel: Fixed tickless test for Arduino Due.
Arduino Due now uses ASF. The timestamps.c file was still
using old register definitions.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2017-05-20 13:25:32 -04:00
Andrew Boie b1b58dc5ce bluetooth: at: enable CONFIG_SERIAL
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-19 16:33:16 -04:00
Michael Scott 5ace805097 tests/zoap: fix net_pkt leak in test_observer_client()
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-05-19 09:59:07 +03:00
Anas Nashif e9a7fa7fd7 tests: net: increase RAM for test
This tests enables all networking features and requires lots of RAM, so
increase the available RAM to avoid failures due to not enough RAM when
building.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-18 22:23:31 -04:00
Youvedeep Singh ff5b3249f4 tests: aio: Change reference voltage for AIO
Change reference voltage for Analog comparator to Internal reference
voltage.

Currently AIO is using External reference voltage (Reference A) and
external reference is set at 3.3V. In this usecase both reference
Voltage and AIO IP are set at 3.3V. So rising edge interrupt behaviour
will be unpredictable.

So by changing internal reference voltage to Internal (set at 1.09V)
interrupt will be generated as soon as Voltage on I/P will exceed it.

Jira: ZEP-1927

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-18 20:26:56 -04:00
Qiu Peiyang b0962e3bac tests: aio: port AIO cases to run on more platforms
AIO should be supported on more platforms. Adapt
this case to make it run on more platforms.
Also keep reference voltage for comprator as internal.

Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2017-05-18 20:26:56 -04:00
Maciek Borzecki fed96bf1bc misc: _char_out can be a static symbol
Fixes sparse warning:
<snip>/zephyr/zephyr/misc/printk.c:50:5: warning: symbol '_char_out' was not declared. Should it be static?

Change-Id: I5af0860e9f8f827002ae9a142b5924d3de8d51b6
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
2017-05-18 12:41:56 -05:00
Jukka Rissanen 69b25c0788 net: conn: Check UDP and TCP checksum before accepting packet
We did not check UDP or TCP checksum to be valid after receiving
the packet. Fix this so that the checksum is validated when
packet is received in connection handler. As the checksum validation
can be resource intensive, do it after we have verified that
there is a connection handler for this connection.

The checksum calculation can be turned OFF if needed, but it is
ON by default.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-05-18 10:53:39 +03:00
Andrew Boie 2596daa4ae tests: fifo: extend cancel timeout limit
A non-tickless system with 10ms granularity was occasionally
taking up to 70ms for the cancellation to be propagated back.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-17 12:04:10 -04:00
Anas Nashif 876334c699 tests: net: reduce timeout of testcase
Use a reasonable timeout for the testcase.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-17 16:35:26 +03:00
Vinayak Kariappa Chettimada a7afc75c8a Bluetooth: shell: Add GATT write cmd throughput measurement
Add shell command to test GATT write cmd throughput between
two test shell peers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-16 15:30:51 +03:00
Luiz Augusto von Dentz 4f019eab26 Bluetooth: shell: Remove forward declaration
It is possible to remove the forward declaration of l2cap_alloc_buf as
the recv pointer can be compared directly with chan pointer avoiding
using l2cap_ops directly.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-14 17:54:46 +03:00
Vinayak Kariappa Chettimada 9fd04ea272 Bluetooth: shell: Add L2CAP throughput measurement
Added l2cap-metrics command to shell application which will
collect the rx-ed L2CAP CoC throughput.

Usage (local shell):
> l2cap-register <chan>
> l2cap-metrics on

  From peer shell:
  > l2cap-connect <chan>
  > l2cap-send 10

> l2cap-metrics
l2cap rate: 119225 bps.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-14 11:19:27 +03:00
Andrew Boie 636f609d66 tests: kernel: fatal: check stack overflow
For all arches except ARC, enable stack sentinel and test that
some common stack violations trigger exceptions.

For ARC, use the hardware stack checking feature.

Additional testcase.ini blocks may be added to do stack bounds checking
for MMU/MPU-based stack protection schemes.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-13 15:14:41 -04:00
Andy Ross 73cb9586ce k_mem_pool: Complete rework
This patch amounts to a mostly complete rewrite of the k_mem_pool
allocator, which had been the source of historical complaints vs. the
one easily available in newlib.  The basic design of the allocator is
unchanged (it's still a 4-way buddy allocator), but the implementation
has made different choices throughout.  Major changes:

Space efficiency: The old implementation required ~2.66 bytes per
"smallest block" in overhead, plus 16 bytes per log4 "level" of the
allocation tree, plus a global tracking struct of 32 bytes and a very
surprising 12 byte overhead (in struct k_mem_block) per active
allocation on top of the returned data pointer.  This new allocator
uses a simple bit array as the only per-block storage and places the
free list into the freed blocks themselves, requiring only ~1.33 bits
per smallest block, 12 bytes per level, 32 byte globally and only 4
bytes of per-allocation bookeeping.  And it puts more of the generated
tree into BSS, slightly reducing binary sizes for non-trivial pool
sizes (even as the code size itself has increased a tiny bit).

IRQ safe: atomic operations on the store have been cut down to be at
most "4 bit sets and dlist operations" (i.e. a few dozen
instructions), reducing latency significantly and allowing us to lock
against interrupts cleanly from all APIs.  Allocations and frees can
be done from ISRs now without limitation (well, obviously you can't
sleep, so "timeout" must be K_NO_WAIT).

Deterministic performance: there is no more "defragmentation" step
that must be manually managed.  Block coalescing is done synchronously
at free time and takes constant time (strictly log4(num_levels)), as
the detection of four free "partner bits" is just a simple shift and
mask operation.

Cleaner behavior with odd sizes.  The old code assumed that the
specified maximum size would be a power of four multiple of the
minimum size, making use of non-standard buffer sizes problematic.
This implementation re-aligns the sub-blocks at each level and can
handle situations wehre alignment restrictions mean fewer than 4x will
be available.  If you want precise layout control, you can still
specify the sizes rigorously.  It just doesn't break if you don't.

More portable: the original implementation made use of GNU assembler
macros embedded inline within C __asm__ statements.  Not all
toolchains are actually backed by a GNU assembler even when the
support the GNU assembly syntax.  This is pure C, albeit with some
hairy macros to expand the compile-time-computed values.

Related changes that had to be rolled into this patch for bisectability:

* The new allocator has a firm minimum block size of 8 bytes (to store
  the dlist_node_t).  It will "work" with smaller requested min_size
  values, but obviously makes no firm promises about layout or how
  many will be available.  Unfortunately many of the tests were
  written with very small 4-byte minimum sizes and to assume exactly
  how many they could allocate.  Bump the sizes to match the allocator
  minimum.

* The mbox and pipes API made use of the internals of k_mem_block and
  had to be ported to the new scheme.  Blocks no longer store a
  backpointer to the pool that allocated them (it's an integer ID in a
  bitfield) , so if you want to "nullify" them you have to use the
  data pointer.

* test_mbox_api had a bug were it was prematurely freeing k_mem_blocks
  that it sent through the mailbox.  This worked in the old allocator
  because the memory wouldn't be touched when freed, but now we stuff
  list pointers in there and the bug was exposed.

* Remove test_mpool_options: the options (related to defragmentation
  behavior) tested no longer exist.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-05-13 14:39:41 -04:00
Vinayak Kariappa Chettimada 5effd68a9d Bluetooth: controller: Fix tests conf file to cover new features
Updated tests conf file with coverage for new feature Kconfig
options in the Controller. This is required to catch compile/
build regression.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-12 13:55:39 +03:00
Andrew Boie 68d3678abb tests: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Andrew Boie 86468fc9a5 tests: kernel: common: adjust stack size
Use Kconfig for extra test case stack size, needed for Xtensa.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 12:47:23 -04:00
Paul Sokolovsky 2ddd620617 tests: kernel: errno: Add Newlib test config.
Added because previously, Zephyr used API incompatible with Newlib
for errno handling. Even with Newlib compatibility changes, we
override the function which is defined in Zephyr SDK libc.a, so
makes sense to ensure thsi works as expected.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-10 20:54:56 -04:00
Andrew Boie b1dd5ea50d tests: kernel: fatal: fix on ARC
Issue: ZEP-2114
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-10 20:13:07 -04:00
Paul Sokolovsky 3f50707672 kernel: queue, fifo: Add cancel_wait operation.
Currently, a queue/fifo getter chooses how long to wait for an
element. But there are scenarios when putter would know better,
there should be a way to expire getter's timeout to make it run
again. k_queue_cancel_wait() and k_fifo_cancel_wait() functions
do just that. They cause corresponding *_get() functions to return
with NULL value, as if timeout expired on getter's side (even
K_FOREVER).

This can be used to signal out of band conditions from putter to
getter, e.g. end of processing, error, configuration change, etc.
A specific event would be communicated to getter by other means
(e.g. using existing shared context structures).

Without this call, achieving the same effect would require e.g.
calling k_fifo_put() with a pointer to a special sentinal memory
structure - such structure would need to be allocated somewhere
and somehow, and getter would need to recognize it from a normal
data item. Having cancel_wait() functions offers an elegant
alternative. From this perspective, these calls can be seen as
an equivalent to e.g. k_fifo_put(fifo, NULL), except that such
call won't work in practice.

Change-Id: I47b7f690dc325a80943082bcf5345c41649e7024
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-10 09:40:33 -04:00
Sharron LIU 6c6182dba5 tests:kernel: added tests for printk left justifier
Added test case for printk the '-' indicator in format string
(left justifier).

Jira: ZEP-1599

Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-05-08 09:43:37 -04:00
Marti Bolivar 88f33dcc1b tests: json: add json_escape() tests
These all pass.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-08 08:52:52 -04:00
Vinayak Chettimada fc6d8d1bc4 Bluetooth: controller: Scan Request Notifications
Implement the framework for LE Scan Request Received Event.
The feature is available under the Controller's advanced
features and will be selected implcitly when Bluetooth v5.0
LE Advertising Extensions feature is implemented.

Jira: ZEP-2073

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-05 15:56:04 +03:00
Carles Cufi a1ff1a0933 Bluetooth: Consolidate flow control Kconfig
Since Controller to Host flow control is a feature that affects both
sides equally, move it to the top-level Kconfig file and consolidate its
use in both Controller and Host.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-04 18:09:31 +03:00
Luiz Augusto von Dentz ad4bb37b17 Bluetooth: shell: Fix deadlock when receiving L2CAP packet
The TX and RX pool needs to be split otherwise the TX code path may
consume all buffers causing the RX thread to deadlock which will
possible deadlock the TX thread as well in case it needs more credits.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-04 08:36:12 +03:00
Carles Cufi 7ebe7da736 Bluetooth: controller: Controller to Host flow control
The Bluetooth Specification allows for optional Controller to Host flow
control based on the same credit-based mechanism as the Host to
Controller one. This is particularly useful in 2-chip solutions where
the Host and the Controller are connected via a physical link (UART, SPI
or similar) where the Host is sometimes required to ask the Controller
to throttle its data traffic while still making sure that relevant
events get through the line.

This implementation is based on a simple queue of pending events and
data that is populated whenever the Controller detects that the Host is
out of buffers and then emptied whenever the Host notifies the
Controller that is ready to receive data again. Events relevant to the
connections are also queued to preserve the order of arrival.

At this point the Controller ignores the connection handle sent by the
Host and treats all connections equally, and it also queues events even
for connections that have no data pending in the queue. Both this items
can be improved if necessity arises.

Note that Number of Completed Packets will still flow freely from the
Controller to the Host regardless of the pending ACL data packets, which
might lead to inconsistencies in the sequential order of certain
operations that include bi-directional data transfer.

Jira: ZEP-1735

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-03 22:23:42 +03:00
Marti Bolivar 7e7a045fa9 tests: json: use JSON_OBJ_DESCR_PRIM
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-05-03 13:52:57 -04:00
Justin Watson 558281b096 arch: sam3x: update Kconfig options after move to SAM SoC family tree
The files for the Arduino Due needed to be updated to use the new
configuration when the SoC moved from the atmel_sam3 directory to
the atmel_sam/sam3x directory.

Jira: ZEP-2067

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2017-05-03 13:51:37 -04:00
Adithya Baglody d03b2496cd test: benchmarking: Timing metrics for the kernel
JIRA: ZEP-1822, ZEP-1823, ZEP-1825

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-05-03 08:46:30 -04:00
Rishi Khare f6f8fb0f47 kernel tests: fatal: added "ignore_faults" tag
This test generates a fault as part of the test,hence make the
 test-suite aware of that by tagging it.

Signed-off-by: Rishi Khare <rishi.khare@intel.com>
2017-05-03 08:16:38 -04:00
Paul Sokolovsky b7f6aaaa72 tests: uart_basic_api: Don't assume we can drink from IRQ firehose.
There're (at least) 2 UART TX interrupt causes: "tx fifo has more
room" and "transmission of tx fifo complete". Zephyr API has only
one function to enable TX interrupts, uart_irq_tx_enable(), so it's
fair to assume it enables interrupt for both conditions. But then
immediately after enabling TX IRQ, it will be fired with "tx fifo
has more room" cause. If ISR doesn't do anything to fill FIFO, on
some architectures, immediately after return from ISR, it will be
fired again (with no instruction progress in the main application
thread). That's exactly the situation with this test, and on ARM,
it leads to inifnite IRQ loop.

So, instead move call to uart_fifo_fill() inside ISR, and be sure
to disable TX IRQ after we transmitted enough characters.

Change-Id: Ibbd05acf96b01fdb128f08054819fd104d6dfae8
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-02 09:31:36 -04:00
Anas Nashif 1084bd5ed3 tests: crypto: reduce high timeout value
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-01 09:37:34 -04:00
Anas Nashif e40bd685f6 tests: net: set reasonable timeout on dns test
This test has been slowing daily tests for no good reason, timeout of
10800 is way too high.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-01 09:37:34 -04:00
Luiz Augusto von Dentz a03e068b03 Bluetooth: shell: Don't attempt to reuse channel
If the channel is already in use don't attempt to connect it a second
time.

Change-Id: I87bdaeadbe866b59c1a7975002699d9ef7a90c61
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-04-29 11:39:13 -04:00
Gil Pitney 70040f0e11 boards: Add support for the CC3220SF_LAUNCHXL board
CC3220SF_LAUNCHXL effectively replaces the CC3200_LAUNCHXL,
with support for the CC3220SF SoC, which is an update for
the CC3200 SoC.

This is supported by the Texas Instruments CC3220 SDK.

Jira: ZEP-1958

Change-Id: I2484d3ee87b7f909c783597d95128f2b45db36f2
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-04-28 15:06:41 -05:00
Paul Sokolovsky 25307d5331 net: net_pkt_append: Refactor to return length of data actually added
For stream-based protocols (TCP), adding less data than requested
("short write") is generally not a problem - the rest of data can
be sent in the next packet. So, make net_pkt_append() return length
of written data instead of just bool flag, which makes it closer
to the behavior of POSIX send()/write() calls.

There're many users of older net_pkt_append() in the codebase
however, so net_pkt_append_all() convenience function is added which
keeps returning a boolean flag. All current users were converted to
this function, except for two:

samples/net/http_server/src/ssl_utils.c
samples/net/mbedtls_sslclient/src/tcp.c

Both are related to TLS and implement mbedTLS "tx callback", which
follows POSIX short-write semantics. Both cases also had a code to
workaround previous boolean-only behavior of net_pkt_append() - after
calling it, they measured length of the actual data added (but only
in case of successful return of net_pkt_append(), so that didn't
really help). So, these 2 cases are already improved.

Jira: ZEP-1984

Change-Id: Ibaf7c029b15e91b516d73dab3612eed190ee982b
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-04-28 15:01:09 +03:00
Ramesh Thomas c759ed1f94 samples: power: Time is passed as milliseconds in tickless kernel
In tickless kernel mode, time parameter of _sys_soc_suspend is in
milliseconds. Based on the kernel mode use the correct
mulitplier to convert to seconds.

Jira:1821
Change-Id: Idf156f56ece79a82729ebb124d1552a5eeb69e25
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-04-27 13:46:35 +00:00
Ramesh Thomas 700712f869 samples: tickless: Enables tickless kernel option in some apps
Adds changes to enable existing kernel and timer tests and samples to
be used to test the tickless kernel feature.

Updated samples/philosophers and tests/kernel/timer/timer_api apps

Run the tests using following commands
make pristine && make BOARD=<board> CONF_FILE=prj_tickless.conf qemu
Board could be any of the following
qemu_x86
quark_se_c1000_devboard

Jira: ZEP-339 ZEP-1812
Change-Id: I1530b19b79ddeb0e2181594caf15f3ac28ff51f4
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2017-04-27 13:46:33 +00:00
Andrew Boie 73abd32a7d kernel: expose struct k_thread implementation
Historically, space for struct k_thread was always carved out of the
thread's stack region. However, we want more control on where this data
will reside; in memory protection scenarios the stack may only be used
for actual stack data and nothing else.

On some platforms (particularly ARM), including kernel_arch_data.h from
the toplevel kernel.h exposes intractable circular dependency issues.
We create a new per-arch header "kernel_arch_thread.h" with very limited
scope; it only defines the three data structures necessary to instantiate
the arch-specific bits of a struct k_thread.

Change-Id: I3a55b4ed4270512e58cf671f327bb033ad7f4a4f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-26 16:29:06 +00:00
Andrew Boie ca441162a7 tests: add fatal test case
We want to show that if a non-essential thread gets a fatal exception,
that thread gets aborted but the rest of the system works properly.

We also test that k_oops() does the same.

Issue: ZEP-2052
Change-Id: I0f88bcae865bf12bb91bb55e50e8ac9721672434
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-22 10:31:49 -04:00
Andrew Boie 7827b7bf4a x86: exception-assisted panic/oops support
We reserve a specific vector in the IDT to trigger when we want to
enter a fatal exception state from software.

Disabled for drivers/build_all tests as we were up to the ROM limit
on Quark D2000.

Issue: ZEP-843
Change-Id: I4de7f025fba0691d07bcc3b3f0925973834496a0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-22 10:31:49 -04:00
Kumar Gala eaaa175b92 tests: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I6c676bc6c5e850a8725785554cd535e32067f33e
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:53:49 -05:00
Kumar Gala a509441210 net: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I4ec03eb2183d59ef86ea2c20d956e5d272656837
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:30:38 -05:00
Jukka Rissanen f498a90b77 net: pkt: Make the debug print eye friendly
Print "pkt" instead of "Pkt" when printing network packet
pointer value.

Change-Id: Id4225be9c55807def3d892d372cdfc5c79c871fc
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka f3ff4f7bd3 net_pkt: Let's make all IPv6 related attributes prefixed with ipv6_
Only 2 attributes lacked this prefix, which makes sense to have, so
applying it accordingly and changing the helpers as well.

Change-Id: I095b2729f977f8fb1624eff8801a4a4e21416693
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka e5896906f6 net: Rename all *_BUF() macros to *_HDR()
Most of these macros are not exactly exposing a buffer, but a specific
header pointer (ipv6, ivp4, ethernet and so on), so it relevant to
rename them accordingly.

Change-Id: I66e32f7c3f2bc75994befb28d823e24299a53f5c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka db11fcd174 net/net_pkt: Fully separate struct net_pkt from struct net_buf
- net_pkt becomes a stand-alone structure with network packet meta
  information.
- network packet data is still managed through net_buf, mostly named
  'frag'.
- net_pkt memory management is done through k_mem_slab
- function got introduced or relevantly renamed to target eithe net_pkt
  or net_buf fragments.
- net_buf's sent_list ends up in net_pkt now, and thus helps to save
  memory when TCP is enabled.

Change-Id: Ibd5c17df4f75891dec79db723a4c9fc704eb843d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Tomasz Bursztyka bf964cdd4c net: Renaming net nbuf API to net pkt API
There have been long lasting confusion between net_buf and net_nbuf.
While the first is actually a buffer, the second one is not. It's a
network buffer descriptor. More precisely it provides meta data about a
network packet, and holds the chain of buffer fragments made of net_buf.

Thus renaming net_nbuf to net_pkt and all names around it as well
(function, Kconfig option, ..).

Though net_pkt if the new name, it still inherit its logic from net_buf.
'
This patch is the first of a serie that will separate completely net_pkt
from net_buf.

Change-Id: Iecb32d2a0d8f4647692e5328e54b5c35454194cd
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Kumar Gala 3c454017b4 Merge "Merge bluetooth branch into master" 2017-04-20 16:55:36 +00:00
Kumar Gala 789081673f Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t.  This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.

We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.

We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.

Jira: ZEP-2051

Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 16:07:08 +00:00
Johan Hedberg c52fa3c424 Merge bluetooth branch into master
- newlib related fixes for the AT parser
 - Channel Selection Algorithm #2 support (Bluetooth 5.0 feature)
 - Better tracking of outgoing data (with callback support)
 - Various smaller cleanups & fixes

----------------------------------------------------------------
Carles Cufi (3):
      Bluetooth: HCI: Add Bluetooth 5.0 LE commands and events
      Bluetooth: HCI: Naming consistency tweaks
      Bluetooth: Use event masks instead of bits in controller and host

Johan Hedberg (8):
      Bluetooth: hci_raw: Fix ECC support
      Bluetooth: Add support for tracking transmitted packets
      Bluetooth: ATT: Enforce flow for incoming requests & indications
      Bluetooth: SMP: Track when last key distribution PDU has been sent
      Bluetooth: Introduce a timeout for synchronous HCI command sending
      Bluetooth: ATT: Fix bogus CONTAINER_OF() usage
      Bluetooth: Introduce flow control for outgoing ATT packets
      Bluetooth: ATT: Start response timer only after actual transmission

Kumar Gala (3):
      Bluetooth: AT: use explicit unsigned char to avoid array subscript error
      Bluetooth: AT: Fix building with newlib
      Bluetooth: AT: Unit: Fixup include search path

Luiz Augusto von Dentz (4):
      Bluetooth: ipsp: Add TX pools for TCP
      Bluetooth: L2CAP: Try to allocate segment from the original pool
      net: buf: Add net_buf_reset
      Bluetooth: L2CAP: Reuse request buffer to respond

Vinayak Chettimada (5):
      Bluetooth: controller: Rename channel/chnl to chan
      Bluetooth: HCI: Add Bluetooth 5.0 FeatureSet field's bit mapping
      Bluetooth: Fix missing LE conn param req bit in set LE evt mask
      Bluetooth: controller: Support BT 5.0 feature set bit fields
      Bluetooth: controller: Channel Selection Algorithm #2

 include/bluetooth/hci.h                           | 495 +++++++++++++++--
 include/bluetooth/l2cap.h                         |   2 +-
 include/net/buf.h                                 |   9 +
 samples/bluetooth/ipsp/src/main.c                 |  15 +
 subsys/bluetooth/controller/Kconfig               |   7 +
 subsys/bluetooth/controller/hal/nrf5/radio.c      |   4 +-
 subsys/bluetooth/controller/hal/radio.h           |   2 +-
 subsys/bluetooth/controller/hci/hci.c             |  95 ++--
 subsys/bluetooth/controller/ll_sw/ctrl.c          | 622 ++++++++++++++++------
 subsys/bluetooth/controller/ll_sw/ctrl.h          |  71 ++-
 subsys/bluetooth/controller/ll_sw/ctrl_internal.h |  25 +-
 subsys/bluetooth/controller/ll_sw/ll.c            |  24 +-
 subsys/bluetooth/controller/ll_sw/pdu.h           |  12 +-
 subsys/bluetooth/host/Kconfig                     |  31 ++
 subsys/bluetooth/host/at.c                        |   2 +-
 subsys/bluetooth/host/at.h                        |   2 +-
 subsys/bluetooth/host/att.c                       | 230 ++++++--
 subsys/bluetooth/host/conn.c                      | 111 +++-
 subsys/bluetooth/host/conn_internal.h             |  23 +-
 subsys/bluetooth/host/hci_core.c                  | 163 +++---
 subsys/bluetooth/host/hci_core.h                  |   3 +-
 subsys/bluetooth/host/hci_ecc.c                   |   2 +-
 subsys/bluetooth/host/hci_raw.c                   |   4 +
 subsys/bluetooth/host/hfp_hf.c                    |   2 +
 subsys/bluetooth/host/l2cap.c                     |  79 ++-
 subsys/bluetooth/host/l2cap_internal.h            |  12 +-
 subsys/bluetooth/host/sdp.c                       |   2 +
 subsys/bluetooth/host/smp.c                       | 117 +++-
 subsys/net/buf.c                                  |  12 +-
 tests/bluetooth/init/prj_controller_4_0.conf      |   1 +
 tests/unit/bluetooth/at/src/Makefile              |   2 +-
 tests/unit/bluetooth/at/src/main.c                |   2 +-
 32 files changed, 1695 insertions(+), 488 deletions(-)

Change-Id: I17f9e49e1347a38bc78be3bdcaa596e41d83da56
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-20 18:45:15 +03:00
Anas Nashif 0b1d41d31d kernel: remove mentions of obsolete CONFIG_NANO_TIMERS
Change-Id: I0a2d6caae6d37b45968e61be8eaf7c4ebb6fdc46
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-20 12:27:36 +00:00
Vinayak Chettimada 392b5deacb Bluetooth: controller: Channel Selection Algorithm #2
Add Bluetooth 5.0 LE Channel Selection Algorithm #2 feature

Jira: ZEP-2033

Change-id: Ic1155b4399882b89cab33cac78b08b7b39ff6f9d
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-20 08:58:09 +03:00
Kumar Gala a87e6e1cce Bluetooth: AT: Unit: Fixup include search path
Because of the way we build we can't expect relative paths back into the
Zephyr code base to work properlly.  This just happens to work on some
systems because of the various -I that exist and one hits the right
number of subdirs between it and where the "at.h" lives.  Lets instead
add the Zephyr root as a include path and explicit do a relative path
from the root to get the header.

We end up with a build failure with newlib enabled on galileo because it
ends up not having an include path that gets us to the proper spot with
the various ../../.. ...

Change-Id: I48b4dc2dffb76314f380efbcbbe25957ff5e9e07
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 08:58:09 +03:00
Anas Nashif 45a7e5d076 kernel: remove legacy.h and MDEF support
Change-Id: I953797f6965354c5b599f4ad91d63901401d2632
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-19 10:59:35 -05:00
Anas Nashif 306e15e0a1 kernel: remove legacy kernel support
Change-Id: Iac1e21677d74f81a93cd29d64cce261676ae78a6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-19 15:48:37 +00:00
Andrew Boie 2d9a559df8 tests: crypto: enable on other arches
Some tests have large RAM requirements, appropriate filters added.
Redundant 'build_only = false' removed.

Issue: ZEP-1721
Change-Id: Id8b06b2ea8a63cf19cf155a75f1513810c383521
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-18 20:51:39 +00:00
Youvedeep Singh 76fc2f92df test_tickless: Change test_tickless location to tests/kernel/test_tickless/
Tickless test dependency on legacy API is resolved, Changing
test directory from tests/legacy/kernel/test_tickless to
tests/kernel/test_tickless/.

Jira: ZEP-2008

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
Change-Id: I0b53ae6eff3a915d988d3234592eb5f8b425b371
2017-04-18 22:25:01 +05:30
Youvedeep Singh 576cfd9e74 test_tickless: replacing depreciated APIs with new one.
As part of Zephyr release 1.9 some APIs will be depreciated. This patch
replaces two of such APIs (task_sleep(ticks), sys_tick_get_32()) with
new ones (k_sleep(ms), k_uptime_get_32()).

Jira: ZEP-2008

Change-Id: Ic0e05906dadfb2ddaea9d0a8b738294dc81430f9
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-04-18 22:08:19 +05:30
Youvedeep Singh 9031c55566 test_sleep: move test_sleep from tests/legacy/kernel to tests/kernel
As test_sleep does not have dependency over legacy APIs.
So moving files from tests/legacy/kernel to tests/kernel.

Jira: ZEP-2009

Change-Id: I2439391ba6d0a194d07a0d1b48911d37b2f493b0
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-04-18 09:39:15 +05:30
Youvedeep Singh d353800879 test_sleep: replacing depreciated APIs with new one.
As part of Zephyr Release 1.9 some APIs will be depreciated.
This patch replaces APIs related to semophore init, kernel sleep,
task spawn etc.

Jira: ZEP-2009

Change-Id: I1fe09e9592f503c3413d51857fd740703173c042
Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-04-18 09:26:58 +05:30
Sharron LIU eea12f6f14 tests: kernel: add tickless test
Added test cases to verify tickless idle concepts defined in
https://www.zephyrproject.org/doc/subsystems/power_management.html#tickless-idle

Test points:
verify system clock recovery after exiting tickless idle;
verify slicing scheduler behaves as expected

Jira: ZEP-339

Change-Id: Ic0a86d725e9692aa217375cedc7396372a026a88
Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-04-18 01:50:47 +00:00
Kumar Gala 7fb0e36060 tests: sprintf: cleanup to work with newlib
newlib doesn't implement the internal buffer the same way that minimal
libc does, so only run that check with min libc (ie !CONFIG_NEWLIB_LIBC).
Also, reported the length we did get if the buffer is to big.  Finally
include <stdarg.h> since we are dealing with va_lists and such.

Change-Id: I6b23e448e5785df978ac8c2757099e2b8aaace54
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-18 00:27:33 +00:00
Kumar Gala ab8a3b2c0d tests: app_kernel: limit to systems with >32K of memory
We need a bit over 32k of memory to build/run the app_kernel benchmarks.

Change-Id: Iddfeb073f8ea87dc6323775a288b83efa88fdaea
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-14 16:12:57 -05:00
Anas Nashif 4c80a2fb71 tests: crypto: disable 2 tests that are ridiculously slow
Change-Id: I54194c06a1f3dfe1412dbfff50e9866134cf881a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-14 10:42:29 -04:00
Anas Nashif e8abb973e1 tests: app_kernel: enable ARM for this benchmark
Change-Id: I7d45bd5e84f174a951170c7b4ab464110976a00f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-14 10:42:29 -04:00
Anas Nashif e521d6e888 tests: remove legacy tag from ported tests
Change-Id: I77484a704062013577417e7d05ad65cf268d74b2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-14 10:42:29 -04:00
Kumar Gala 4ada031fb5 unit: Fixup crc unit test for zassert change
We renamed ztest's assert to zassert and the crc test case wasn't
updated to match so it doesn't build.

Change-Id: I67cd5bb6eef0875f31b8825d5c3aa5e1fa46af04
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-14 06:08:27 -05:00
Anas Nashif 0ac3a231f1 tests: rename ztests' assert > zassert
Change-Id: Ibccc5da75ad42bc035052e5946f977a49f6a7d2f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-14 00:07:06 -04:00
Anas Nashif d3af7f75c9 Merge "Merge net branch into master" 2017-04-14 01:43:34 +00:00
Kumar Gala c7bc909914 tests/ztest: rename assert macros to be zephyr specific
ztest has a number of assert style macros and used a baseline assert()
that varies from the system definition of assert() so lets rename
everything as zassert to be clear.

Change-Id: I7f176b3bae94d1045054d665be8b5bda947e5bb0
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-13 21:17:33 +00:00
Andrew Boie b53145c6bc ztest: apply extra stack size to ztest stack
The directive exists for platforms that require more stack space than
usual. However, it wasn't being applied to the ztest thread stack
which ztest-enabled cases are run on.

Fixes numerous failures on xtensa simulator targets.

Change-Id: Iafa84de002421f03729c0f0cdeefdea51842ae32
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 12:45:36 -07:00
Andrew Boie a883722fb6 tests: test_pipe_api: increase stack size
A recent patch added some new tests here. Unfortunately,
the current stack size value of 512 was too small for Xtensa.
Increase it to 1024.

Change-Id: I16c52b74412cbd7665e774ce3baed260885ddb9b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 18:58:51 +00:00
Andrew Boie d75fa6bc13 tests: sprintf: increase stack size
A recent patch pinned the stack size for this test at 1024
instead of the platform default. This value wasn't sufficient
on Xtensa. Set to 2048, which was the default on most platforms.

Change-Id: I9a9d5fd448d2377aaf782c2c093a16147f31886a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-04-13 18:58:24 +00:00
Jukka Rissanen bed1117423 net: tests: Enables all net kconfig options in one test case
This creates a test case that enables all the currently known
network related Kconfig options. This is useful so that we can
compile test various Kconfig options. Note that the result binary
is not meant to be run anywhere and it will probably not run as
some of the enabled options do not make sense in real life.

Change-Id: Iede36131b43d95acb78b4094004626e1b86e0f95
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-13 15:21:44 +03:00