1 | /* |
---|
2 | * Copyright (c) 2018 Chris Johns <chrisj@rtems.org>. All rights reserved. |
---|
3 | * |
---|
4 | * The license and distribution terms for this file may be |
---|
5 | * found in the file LICENSE in this distribution or at |
---|
6 | * http://www.rtems.org/license/LICENSE. |
---|
7 | */ |
---|
8 | |
---|
9 | #ifdef HAVE_CONFIG_H |
---|
10 | #include "config.h" |
---|
11 | #endif |
---|
12 | |
---|
13 | #include "tmacros.h" |
---|
14 | |
---|
15 | #include <errno.h> |
---|
16 | #include <string.h> |
---|
17 | #include <stdint.h> |
---|
18 | #include <unistd.h> |
---|
19 | |
---|
20 | #include <rtems/rtl/dlfcn-shell.h> |
---|
21 | #include <rtems/rtl/rtl.h> |
---|
22 | #include <rtems/rtl/rtl-shell.h> |
---|
23 | #include <rtems/shell.h> |
---|
24 | #include <rtems/imfs.h> |
---|
25 | |
---|
26 | #include "dl-load.h" |
---|
27 | |
---|
28 | const char rtems_test_name[] = "libdl (RTL) 10"; |
---|
29 | |
---|
30 | /* forward declarations to avoid warnings */ |
---|
31 | static rtems_task Init(rtems_task_argument argument); |
---|
32 | |
---|
33 | #include "dl10-tar.h" |
---|
34 | |
---|
35 | #define TARFILE_START dl10_tar |
---|
36 | #define TARFILE_SIZE dl10_tar_size |
---|
37 | |
---|
38 | static int test(void) |
---|
39 | { |
---|
40 | #if USE_SHELL_CMD |
---|
41 | int ret; |
---|
42 | ret = dl_load_test(); |
---|
43 | if (ret) |
---|
44 | rtems_test_exit(ret); |
---|
45 | #endif |
---|
46 | return 0; |
---|
47 | } |
---|
48 | |
---|
49 | static void Init(rtems_task_argument arg) |
---|
50 | { |
---|
51 | int e; |
---|
52 | |
---|
53 | TEST_BEGIN(); |
---|
54 | |
---|
55 | e = rtems_tarfs_load("/", (void *)TARFILE_START, (size_t)TARFILE_SIZE); |
---|
56 | if (e != 0) |
---|
57 | { |
---|
58 | printf ("error: untar failed: %d\n", e); |
---|
59 | rtems_test_exit (1); |
---|
60 | exit (1); |
---|
61 | } |
---|
62 | |
---|
63 | test(); |
---|
64 | |
---|
65 | rtems_shell_init_environment (); |
---|
66 | |
---|
67 | printf ("RTL (libdl) commands: dl, rtl\n\n"); |
---|
68 | |
---|
69 | if (rtems_shell_add_cmd ("rtl", |
---|
70 | "rtl", |
---|
71 | "rtl -l", |
---|
72 | rtems_rtl_shell_command) == NULL) |
---|
73 | { |
---|
74 | printf("command add failed\n"); |
---|
75 | rtems_test_exit(1); |
---|
76 | exit (1); |
---|
77 | } |
---|
78 | |
---|
79 | rtems_shell_init ("SHLL", |
---|
80 | RTEMS_MINIMUM_STACK_SIZE * 4, |
---|
81 | 100, |
---|
82 | "/dev/foobar", |
---|
83 | false, |
---|
84 | true, |
---|
85 | NULL); |
---|
86 | |
---|
87 | TEST_END(); |
---|
88 | |
---|
89 | rtems_test_exit(0); |
---|
90 | } |
---|
91 | |
---|
92 | #define CONFIGURE_SHELL_COMMANDS_INIT |
---|
93 | #define CONFIGURE_SHELL_COMMANDS_ALL |
---|
94 | |
---|
95 | /* |
---|
96 | * Remove the commands that pull in libblock. |
---|
97 | */ |
---|
98 | #define CONFIGURE_SHELL_NO_COMMAND_BLKSYNC |
---|
99 | #define CONFIGURE_SHELL_NO_COMMAND_BLKSTATS |
---|
100 | #define CONFIGURE_SHELL_NO_COMMAND_FDISK |
---|
101 | #define CONFIGURE_SHELL_NO_COMMAND_MKRFS |
---|
102 | #define CONFIGURE_SHELL_NO_COMMAND_DEBUGRFS |
---|
103 | |
---|
104 | #include <rtems/shellconfig.h> |
---|
105 | |
---|
106 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
107 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
108 | |
---|
109 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 10 |
---|
110 | |
---|
111 | #define CONFIGURE_MAXIMUM_TASKS 4 |
---|
112 | |
---|
113 | #define CONFIGURE_MAXIMUM_SEMAPHORES 4 |
---|
114 | |
---|
115 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
116 | |
---|
117 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
118 | |
---|
119 | #define CONFIGURE_INIT_TASK_STACK_SIZE (8U * 1024U) |
---|
120 | |
---|
121 | #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT) |
---|
122 | |
---|
123 | #define CONFIGURE_UNIFIED_WORK_AREAS |
---|
124 | |
---|
125 | #define CONFIGURE_UNLIMITED_OBJECTS |
---|
126 | |
---|
127 | #define CONFIGURE_INIT |
---|
128 | |
---|
129 | #include <rtems/confdefs.h> |
---|