1 /*
2  * Copyright (c) 2016 Intel Corporation.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /*
8  * @filesystem
9  * @brief test Zephyr file system generic features
10  * to demonstrates the ZEPHYR File System APIs
11  */
12 
13 #include "test_fat.h"
14 
test_statvfs(const char * path)15 static int test_statvfs(const char *path)
16 {
17 	struct fs_statvfs stat;
18 	int res;
19 
20 	/* Verify fs_statvfs() */
21 	res = fs_statvfs(path, &stat);
22 	if (res) {
23 		TC_PRINT("Error getting volume stats [%d]\n", res);
24 		return res;
25 	}
26 
27 	TC_PRINT("Optimal transfer block size   = %lu\n", stat.f_bsize);
28 	TC_PRINT("Allocation unit size          = %lu\n", stat.f_frsize);
29 	TC_PRINT("Volume size in f_frsize units = %lu\n", stat.f_blocks);
30 	TC_PRINT("Free space in f_frsize units  = %lu\n", stat.f_bfree);
31 
32 	return TC_PASS;
33 }
34 
ZTEST(fat_fs_dual_drive,test_fat_fs)35 ZTEST(fat_fs_dual_drive, test_fat_fs)
36 {
37 	TC_PRINT("\nTesting statvfs operation on %s\n", FATFS_MNTP);
38 	zassert_true(test_statvfs(FATFS_MNTP) == TC_PASS);
39 
40 	TC_PRINT("\nTesting statvfs operation on %s\n", FATFS_MNTP1);
41 	zassert_true(test_statvfs(FATFS_MNTP1) == TC_PASS);
42 }
43