1 /*
2 * Copyright (c) 2006-2019, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date Author Notes
8 * 2024-5-20 Zhujiale the first version
9 */
10 #include <rtthread.h>
11 #include <stdlib.h>
12 #include <msh.h>
13 #include "utest.h"
14 #include "utest_assert.h"
15 #include "common.h"
16
run_copy()17 void run_copy()
18 {
19 int ret = 0;
20 ret = msh_exec("cd /tmp", 7);
21 if (ret != 0)
22 {
23 LOG_E("errno=%d, ret=%d\n", errno, ret);
24 LOG_E("cd /tmp error");
25 uassert_false(1);
26 }
27 uassert_true(1);
28 ret = msh_exec("touch test", 10);
29 if (ret != 0)
30 {
31 LOG_E("errno=%d, ret=%d\n", errno, ret);
32 LOG_E("touch test error");
33 uassert_false(1);
34 }
35 uassert_true(1);
36 ret = msh_exec("echo this_is_a_test_file test", 29);
37 if (ret != 0)
38 {
39 LOG_E("errno=%d, ret=%d\n", errno, ret);
40 LOG_E("echo this_is_a_test_file test error");
41 uassert_false(1);
42 }
43 uassert_true(1);
44 ret = msh_exec("cp test test1", 13);
45 if (ret != 0)
46 {
47 LOG_E("errno=%d, ret=%d\n", errno, ret);
48 LOG_E("cp test test1 error");
49 uassert_false(1);
50 }
51
52 uassert_true(1);
53 }
54
utest_tc_init(void)55 static rt_err_t utest_tc_init(void)
56 {
57 return RT_EOK;
58 }
59
utest_tc_cleanup(void)60 static rt_err_t utest_tc_cleanup(void)
61 {
62 return RT_EOK;
63 }
testcase(void)64 static void testcase(void)
65 {
66 UTEST_UNIT_RUN(run_copy);
67 }
68 UTEST_TC_EXPORT(testcase, "testcase.tfs.tmpfs", utest_tc_init, utest_tc_cleanup, 10);
69