zephyr/tests/subsys/fs/fat_fs_api
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
..
src
CMakeLists.txt tests: make find_package(Zephyr...) REQUIRED 2020-05-29 10:47:25 +02:00
README.txt
prj.conf
prj_native_posix.conf
prj_native_posix_64.conf
testcase.yaml

README.txt

Title: Zephyr File System Demo

Description:

Demonstrates basic file and dir operations using the Zephyr file system.
--------------------------------------------------------------------------------

Building and Running Project:

The demo will run on native_posix and will use the on-board SPI flash.

       mkdir build; cd build
       cmake -DBOARD=native_posix ..
       make run

--------------------------------------------------------------------------------

Sample Output:

***** BOOTING ZEPHYR OS v1.6.99 - BUILD: Feb  8 2017 07:33:07 *****
Running test suite fat_fs_basic_test
tc_start() - test_fat_file

Open tests:
Creating new file testfile.txt
Opened file testfile.txt

Write tests:
Data written:"hello world!"

Data successfully written!

Sync tests:

Read tests:
Data read:"hello world!"

Data read matches data written

Truncate tests:

Testing shrink to 0 size
Testing write after truncating

Write tests:
Data written:"hello world!"

Data successfully written!
Original size of file = 12

Testing shrinking
File size after shrinking by 5 bytes = 7

Testing expanding
File size after expanding by 10 bytes = 17
Testing for zeroes in expanded region

Close tests:
Closed file testfile.txt

Delete tests:
File (testfile.txt) deleted successfully!
===================================================================
PASS - test_fat_file.
tc_start() - test_fat_dir

mkdir tests:
Creating new dir testdir

Write tests:
Data written:"hello world!"

Data successfully written!
Created dir testdir!

lsdir tests:

Listing dir /:
[DIR ] FATFILE
[FILE] TEST.C (size = 10)
[DIR ] TESTDIR
[DIR ] 1

lsdir tests:

Listing dir testdir:
[FILE] TESTFILE.TXT (size = 12)

rmdir tests:

Removing testdir/TESTFILE.TXT
Removed dir testdir!

lsdir tests:

Listing dir /:
[DIR ] FATFILE
[FILE] TEST.C (size = 10)
[DIR ] 1

===================================================================
PASS - test_fat_dir.
tc_start() - test_fat_fs

Optimal transfer block size   = 512
Allocation unit size          = 1024
Volume size in f_frsize units = 2028
Free space in f_frsize units  = 2025
===================================================================
PASS - test_fat_fs.
===================================================================
PROJECT EXECUTION SUCCESSFUL