Commit Graph

9 Commits

Author SHA1 Message Date
Vincent Wan bc90cf0d0a tests: lib: fdtable: fix tests after modifying reference counting
Tests need to be adjusted to do the correct checks now that reference
count is incremented in z_reserve_fd() instead of z_finalize_fd().

test_z_fd_multiple_access in particular has been simplified to
reserving an fd in one thread and freeing it in the other.

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-08-27 11:42:19 +03:00
Dominik Ermel 602fc2c3d4 tests: lib: fdtable: Fix missing check on returned fd
Missing check on returned descriptor.

Fixes #27644
Coverity-CID: 212141

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-08-19 09:32:34 +02:00
Jukka Rissanen 9df168b535 tests: lib: fdtable: Add tests for checking refcounting
Add tests that will make sure that refcounting works as expected.

Also fixed two tests that were using the object values before
the fdtable contained proper values. After reserving a fd by
z_reserve_fd(), we can only call z_finalize_fd() or z_free_fd(),
and only after those calls can fetch obj and vtable values.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-10 14:56:08 -07:00
Anas Nashif eee3ffc7b9 tests/samples: enable for integration testing
Limit execution in CI when using --integration option of sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-30 08:00:03 -04:00
Marc Herbert debade9121 tests: make find_package(Zephyr...) REQUIRED
... because it is (required).

This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.

In this particular case, REQUIRED turns this harmless looking log
statement:

-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
  Cannot specify sources for target "app" which is not built by
  this project.

... into this louder, clearer, faster and (last but not least) final
error:

CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a package configuration file provided by "Zephyr" with
  any of the following names:

    ZephyrConfig.cmake
    zephyr-config.cmake

  Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
  "Zephyr_DIR" to a directory containing one of the above files.  If
  "Zephyr" provides a separate development package or SDK, be sure it
  has been installed.

-- Configuring incomplete, errors occurred!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Torsten Rasmussen 407b49b35c cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Anas Nashif afe5b2598d tests: fdtable: check for negative fd
Check for negative file descriptor.

Fixes #18448
Fixes #18450
Fixes #18449
Fixes #18451

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-12-02 07:32:41 -05:00
Marc Herbert fb4b932b72 tests/lib/fdtable/prj.conf: remove hardcoded CONFIG_COVERAGE=y
There is absolutely no other test in the entire codebase that hardcodes
this setting. I found no comment or any other explanation why this test
should be unique. So it really looks like just a glitch introduced when
this test was added by PR #17618 / commit f1afb4c24d.

This was discovered in three different ways:

- COVERAGE=y adds the absolute and non-deterministic source path in
  .rodata sections
- it adds .gnco files in the build directory
- it makes (some) tests run 10 times slower:

qemu_x86_64   lib/fdtable/libraries.os.fdtable PASSED (qemu 2.086s)
qemu_x86_long lib/fdtable/libraries.os.fdtable PASSED (qemu 2.316s)
qemu_xtensa   lib/fdtable/libraries.os.fdtable PASSED (qemu 2.033s)
mps2_an385    lib/fdtable/libraries.os.fdtable PASSED (qemu *31.286s*)
qemu_x86      lib/fdtable/libraries.os.fdtable PASSED (qemu *31.862s*)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-09-25 05:04:30 -04:00
Cami Carballo f1afb4c24d tests: fdtable: add tests
added tests for lib/os/fdtable.c

Signed-off-by: Cami Carballo <cami.carballo@intel.com>
2019-07-22 16:36:15 -07:00