1 /*
2  * Copyright (c) 2018 Intel Corporation.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "test_fat.h"
8 #include <ff.h>
9 #include "test_common.h"
10 #include "test_fs_shell.h"
11 #include "test_fat.h"
12 #include "test_fat_priv.h"
13 
14 /* for mount using FS api */
15 #if !defined(CONFIG_FILE_SYSTEM_SHELL)
16 /* FatFs work area */
17 static FATFS fat_fs;
18 
19 /* mounting info */
20 static struct fs_mount_t fatfs_mnt = {
21 	.type = FS_FATFS,
22 	.mnt_point = FATFS_MNTP,
23 	.fs_data = &fat_fs,
24 };
25 
test_mount(void)26 static int test_mount(void)
27 {
28 	int res;
29 
30 	res = fs_mount(&fatfs_mnt);
31 	if (res < 0) {
32 		TC_PRINT("Error mounting fs [%d]\n", res);
33 		return TC_FAIL;
34 	}
35 
36 	return TC_PASS;
37 }
38 #endif
39 
test_fat_mount(void)40 void test_fat_mount(void)
41 {
42 #ifdef CONFIG_FILE_SYSTEM_SHELL
43 	test_fs_fat_mount();
44 #else
45 	zassert_true(test_mount() == TC_PASS);
46 #endif
47 }
48