Skip to content
Permalink
Branch: master
Commits on Jul 17, 2019
  1. tests: force stack canaries off for two user tests

    andrewboie committed Jul 17, 2019
    Stack canaries require that the z_libc_partition be added to
    the memory domain, otherwise user thread access to the
    stack canary value will result in an MPU/MMU fault.
    
    These tests define their own domains to test specific userspace
    features. Adding another partition to them would be invasive,
    would potentially break some platforms with a limited number
    of MPU regions, and these tests are not designed to validate
    stack canaries anyway, we have other tests for that.
    
    Fixes: #17595
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  2. x86: allow user mode to induce kernel oops

    andrewboie committed Jul 16, 2019
    Before, attempting to induce a kernel oops would instead
    lead to a general protection fault as the interrupt vector
    was at DPL=0.
    
    Now we allow by setting DPL=3. We restrict the allowable
    reason codes to either stack overflows or kernel oops; we
    don't want user mode to be able to create a kernel panic,
    or fake some other kind of exception.
    
    Fixes an issue where the stack canary test case was triggering
    a GPF instead of a stack check exception on x86.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Commits on Jul 9, 2019
  1. sanitycheck: select gcov tool based on target

    andrewboie authored and aescolar committed Jul 8, 2019
    Use PATH gcov if no SDK in use, or native-posix derived
    targets are in use.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  2. doc: update coverage documentation

    andrewboie authored and aescolar committed Jul 4, 2019
    The sanitycheck defaults have changed, and the same options
    work for emulators and native_posix.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Commits on Jul 5, 2019
  1. tests: crc: convert to regular test case

    andrewboie authored and ioannisg committed Jul 2, 2019
    The special 'unittest' target has largely been supersesed by
    native_posix, and converting this to a regular test will allow
    us to see code coverage for the CRC functions in our coverage
    reports.
    
    Fixes: #16943
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Commits on Jul 4, 2019
  1. tests: ipm: remove superfluous configs

    andrewboie authored and nashif committed Jul 4, 2019
    These weren't needed, and in some cases counter-
    productive.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  2. drivers: ipm_console: increase coverage stack size

    andrewboie authored and nashif committed Jul 4, 2019
    Code coverage requires significantly more stack space.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Commits on Jul 3, 2019
  1. sanitycheck: workaround file limits

    andrewboie authored and nashif committed Jul 3, 2019
    sanitycheck is opening an insane number of file descriptors
    simultaneously as it opens up communication pipes with
    every test that supports emulation, on every emulated
    board target.
    
    Increase the resource limit on open files until this code
    can be properly refactored.
    
    Workaround for: #17239
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  2. tests: fp_sharing: properly dump coverage data

    andrewboie committed Jul 2, 2019
    This was dumping coverage before the test code even ran.
    Ideally, this gets re-written to use ztest, but meanwhile
    place a dummy main thread which sleeps forever, and dump
    coverage once the test succeeds.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  3. include: gcov: fix compilation error

    andrewboie committed Jul 2, 2019
    These empty functions needed to be declared static inline
    or we get build errors if the header is included by more
    than one C file.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  4. tests: fatal: test failed assertion

    andrewboie authored and nashif committed Jul 2, 2019
    Covers assert_post_action() which was previously uncovered.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  5. tests: json: improve code coverage

    andrewboie authored and nashif committed Jul 2, 2019
    Adds coverage for the uncovered json_calc_encoded_len()
    and covers a bunch more error cases.
    
    This gets us up to 90.1% line coverage and 100% function
    coverage.
    
    Fixes: #16944
    Partial fix for: #16011
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  6. sanitycheck: make coverage reports easier to do

    andrewboie authored and nashif committed Jul 2, 2019
    - The --gcov-tool argument now has a reasonable default
      if the Zephyr SDK is in use.
    - --coverage-platform, if unspecified, defaults to what
      was passed to --platform
    - --coverage implies --enable-slow, so that tests with
      the 'slow' tag are built and run.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  7. sanitycheck: correct timeout extension comment

    andrewboie authored and nashif committed Jul 3, 2019
    This wasn't discussing why there is extra time for when
    code coverage is enabled.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  8. sanitycheck: don't multiply CPU count

    andrewboie authored and nashif committed Jul 3, 2019
    We have a number of timing sensitive tests which run
    correctly on a much more frequent basis if the system
    is not so heavily loaded. Instead of squeezing a few
    more crumbs of performance by doubling the CPU count,
    just use the number of CPUs reported by the system.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  9. sanitycheck: extend coverage timeout

    andrewboie authored and nashif committed Jul 1, 2019
    If GCOV coverage is enabled, the coverage dump happens after
    "PROJECT EXECUTION SUCCESSFUL" is printed. In some cases,
    the additional time added was not enough to capture all the
    GCOV output on a heavily loaded system before the emulator
    gets killed.
    
    Ideally, the decision to kill the emulator needs to be smarter
    and less race-prone, but that can wait for a future
    enhancement.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Commits on Jul 2, 2019
  1. tests: schedule_api: cover priority checks

    andrewboie authored and nashif committed Jul 2, 2019
    Some cases, such as for the idle thread, were uncovered.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Commits on Jul 1, 2019
  1. kernel: fix CONFIG_THREAD_NAME from user mode.

    andrewboie committed Jun 25, 2019
    This mechanism had multiple problems:
    
    - Missing parameter documentation strings.
    - Multiple calls to k_thread_name_set() from user
      mode would leak memory, since the copied string was never
      freed
    - k_thread_name_get() returns memory to user mode
      with no guarantees on whether user mode can actually
      read it; in the case where the string was in thread
      resource pool memory (which happens when k_thread_name_set()
      is called from user mode) it would never be readable.
    - There was no test case coverage for these functions
      from user mode.
    
    To properly fix this, thread objects now have a buffer region
    reserved specifically for the thread name. Setting the thread
    name copies the string into the buffer. Getting the thread name
    with k_thread_name_get() still returns a pointer, but the
    system call has been removed. A new API k_thread_name_copy()
    is introduced to copy the thread name into a destination buffer,
    and a system call has been provided for that instead.
    
    We now have full test case coverge for these APIs in both user
    and supervisor mode.
    
    Some of the code has been cleaned up to place system call
    handler functions in proximity with their implementations.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  2. arc: use different load instruction

    andrewboie committed Jun 29, 2019
    If the offset within the thread struct to the
    ARC arch-specific 'relinquish_cause' member is too
    large, ld_s instructions referencing it will not
    compile. This happens easily if CONFIG_THREAD_NAME
    reserves a name buffer within the thread struct, since
    all the arch-specific members come last.
    
    Use the regular 'ld' instruction instead.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  3. tests: mem_alloc: don't set main thread size

    andrewboie committed Jul 1, 2019
    This test uses ztest, there is no need to set this and it
    was breaking builds with CONFIG_COVERAGE=y
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  4. tests: common: add tests for extra sflist APIs

    andrewboie committed Jun 30, 2019
    sflists have a couple APIs related to sfnodes that aren't
    present for slists. There were uncovered, write some tests
    for them.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  5. kernel: test coverage for sflist

    andrewboie committed Jun 30, 2019
    We were testing all the slist APIs, but not the sflist
    variant. Make a copy of the slist tests for sflist,
    with the names properly changed.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  6. lib: os: fix slist code coverage

    andrewboie committed Jun 30, 2019
    Some of the slist APIs were only being indirectly exercised;
    add to the slist test case to cover everything explicitly.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  7. kernel: delete k_futex_init()

    andrewboie committed Jun 28, 2019
    There's no need for a system call for this; futexes live in
    user memory and the initialization bit is ignored.
    
    It's sufficient to just do an atomic_set().
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Commits on Jun 30, 2019
  1. kernel: cover k_array_index_sanitize()

    andrewboie authored and nashif committed Jun 30, 2019
    Needed an explicit test for this function for code
    coverage purposes; we were relying indirectly on
    other code using it.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  2. x86: only use lfence if x86 bcb config enabled

    andrewboie authored and nashif committed Jun 30, 2019
    Work around a testcase problem, where we want to check some
    logic for the bounds check bypass mitigation in the common
    kernel code. By changing the ifdef to the x86-specific option
    for these lfence instructions, we avoid IAMCU build errors
    but still test the common code.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  3. tests: futex: improve coverage

    andrewboie authored and nashif committed Jun 30, 2019
    Error cases weren't being tested; bring up coverage for
    kernel/futex.c up to 100% file/function/branch.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  4. kernel: cover k_usleep() from user mode

    andrewboie committed Jun 30, 2019
    No test was exercising the k_usleep() system call, run
    the test case as a user thread to fix code coverage.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Commits on Jun 29, 2019
  1. tests: sys_mutex: improve code coverage

    andrewboie committed Jun 28, 2019
    Test error cases and alternative implementation to bring code
    coverage up to 100% file / 100% line.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  2. lib: os: exclude z_arch_printk_char_out()

    andrewboie committed Jun 28, 2019
    This function doesn't do anything, and only exists so that
    it can be overridden later, exclude from coverage reports.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  3. lib: os: fix vsnprintk coverage

    andrewboie committed Jun 28, 2019
    vsnprintk() was uncovered. Simply adjust snprintk() to use
    it, instead of duplicating logic.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  4. kernel: exclude stubs from code coverage

    andrewboie committed Jun 28, 2019
    These are stub functions that do nothing. Exclude from
    coverage reports.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Commits on Jun 26, 2019
  1. tests: thread_apis: exercise some system calls

    andrewboie authored and nashif committed Jun 25, 2019
    We had no system call coverage for k_thread_suspend
    and k_thread_resume.
    
    Some unnecessary cleanup tasks in the test case have
    been removed.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  2. tests: device: cover device_get_binding()

    andrewboie authored and nashif committed Jun 25, 2019
    We had no coverage for invoking this from a system call.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  3. tests: userspace: cover z_object_recycle()

    andrewboie committed Jun 24, 2019
    We didn't have code coverage for this function anywhere
    except indirectly through some network tests; exercise it
    in the suite of userspace tests.
    
    Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Older
You can’t perform that action at this time.