1 /*
2 * Copyright (c) 2018 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 /** @file
8 * @brief Interactive shell test suite
9 *
10 */
11
12 #include <zephyr/kernel.h>
13 #include <zephyr/ztest.h>
14
15 #include "test_fs_shell.h"
16 #include <zephyr/shell/shell.h>
17
test_shell_exec(const char * line,int result)18 static void test_shell_exec(const char *line, int result)
19 {
20 int ret;
21
22 ret = shell_execute_cmd(NULL, line);
23
24 TC_PRINT("shell_execute_cmd(%s): %d\n", line, ret);
25
26 zassert_true(ret == result, line);
27 }
28
ZTEST(multi_fs_help,test_fs_help)29 ZTEST(multi_fs_help, test_fs_help)
30 {
31 #ifdef CONFIG_FILE_SYSTEM_SHELL
32 test_shell_exec("help", 0);
33 test_shell_exec("help fs", -EINVAL);
34 test_shell_exec("fs mount fat", -EINVAL);
35 test_shell_exec("fs mount littlefs", -EINVAL);
36 #else
37 ztest_test_skip();
38 #endif
39 }
40
test_fs_fat_mount(void)41 void test_fs_fat_mount(void)
42 {
43 test_shell_exec("fs mount fat /RAM:", 0);
44 }
test_fs_littlefs_mount(void)45 void test_fs_littlefs_mount(void)
46 {
47 test_shell_exec("fs mount littlefs /littlefs", 0);
48 }
49 ZTEST_SUITE(multi_fs_help, NULL, NULL, NULL, NULL, NULL);
50