diff options
| author | zhuzhuzhu <[email protected]> | 2024-06-13 08:54:02 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-06-13 08:54:02 +0800 |
| commit | 1869c543a60b7d05df4dd69d9eb08f6df6ae3d2e (patch) | |
| tree | 297bc5dc45e95ebb13f71fc0e82b9e24dd607155 /examples | |
| parent | 58e42caea7f8b5145841327cff02fb4f3ebfeeb0 (diff) | |
[fix]fix tmpfs bug (#8970)
* first
* second
* thrid
* Update SConscript
* tmpfs testcase default n
* Update dfs_tmpfs.c
* format document
---------
Co-authored-by: zhujiale <[email protected]>
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/utest/testcases/Kconfig | 2 | ||||
| -rw-r--r-- | examples/utest/testcases/tmpfs/Kconfig | 6 | ||||
| -rw-r--r-- | examples/utest/testcases/tmpfs/SConscript | 13 | ||||
| -rw-r--r-- | examples/utest/testcases/tmpfs/tmpfs.c | 68 |
4 files changed, 88 insertions, 1 deletions
diff --git a/examples/utest/testcases/Kconfig b/examples/utest/testcases/Kconfig index 248dbd8d3c..a0c068edf5 100644 --- a/examples/utest/testcases/Kconfig +++ b/examples/utest/testcases/Kconfig @@ -14,7 +14,7 @@ source "$RTT_DIR/examples/utest/testcases/drivers/serial_v2/Kconfig" source "$RTT_DIR/examples/utest/testcases/drivers/ipc/Kconfig" source "$RTT_DIR/examples/utest/testcases/posix/Kconfig" source "$RTT_DIR/examples/utest/testcases/mm/Kconfig" - +source "$RTT_DIR/examples/utest/testcases/tmpfs/Kconfig" endif endmenu diff --git a/examples/utest/testcases/tmpfs/Kconfig b/examples/utest/testcases/tmpfs/Kconfig new file mode 100644 index 0000000000..b3a0637950 --- /dev/null +++ b/examples/utest/testcases/tmpfs/Kconfig @@ -0,0 +1,6 @@ +menu "Tmpfs Testcase" + +config UTEST_TMPFS_CP + bool "tmpfs cp test" + default n +endmenu diff --git a/examples/utest/testcases/tmpfs/SConscript b/examples/utest/testcases/tmpfs/SConscript new file mode 100644 index 0000000000..1467931a76 --- /dev/null +++ b/examples/utest/testcases/tmpfs/SConscript @@ -0,0 +1,13 @@ +Import('rtconfig') +from building import * + +cwd = GetCurrentDir() +src = [] +CPPPATH = [cwd] + +if GetDepend(['RT_USING_SMART','UTEST_TMPFS_CP']): + src += ['tmpfs.c'] + +group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES'], CPPPATH = CPPPATH) + +Return('group') diff --git a/examples/utest/testcases/tmpfs/tmpfs.c b/examples/utest/testcases/tmpfs/tmpfs.c new file mode 100644 index 0000000000..6eaa973907 --- /dev/null +++ b/examples/utest/testcases/tmpfs/tmpfs.c @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2006-2019, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-5-20 Zhujiale the first version + */ +#include <rtthread.h> +#include <stdlib.h> +#include <msh.h> +#include "utest.h" +#include "utest_assert.h" +#include "common.h" + +void run_copy() +{ + int ret = 0; + ret = msh_exec("cd /tmp", 7); + if (ret != 0) + { + LOG_E("errno=%d, ret=%d\n", errno, ret); + LOG_E("cd /tmp error"); + uassert_false(1); + } + uassert_true(1); + ret = msh_exec("touch test", 10); + if (ret != 0) + { + LOG_E("errno=%d, ret=%d\n", errno, ret); + LOG_E("touch test error"); + uassert_false(1); + } + uassert_true(1); + ret = msh_exec("echo this_is_a_test_file test", 29); + if (ret != 0) + { + LOG_E("errno=%d, ret=%d\n", errno, ret); + LOG_E("echo this_is_a_test_file test error"); + uassert_false(1); + } + uassert_true(1); + ret = msh_exec("cp test test1", 13); + if (ret != 0) + { + LOG_E("errno=%d, ret=%d\n", errno, ret); + LOG_E("cp test test1 error"); + uassert_false(1); + } + + uassert_true(1); +} + +static rt_err_t utest_tc_init(void) +{ + return RT_EOK; +} + +static rt_err_t utest_tc_cleanup(void) +{ + return RT_EOK; +} +static void testcase(void) +{ + UTEST_UNIT_RUN(run_copy); +} +UTEST_TC_EXPORT(testcase, "testcase.tfs.tmpfs", utest_tc_init, utest_tc_cleanup, 10); |
