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>
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>
... 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>
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>
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>