@@ -109,10 +109,10 @@ void UT_os_symbol_lookup_test()
109109 UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_FAILURE );
110110
111111 /*-----------------------------------------------------*/
112- testDesc = "#4 Nominal" ;
112+ testDesc = "#4 Nominal, Global Symbols " ;
113113
114114 /* Setup */
115- res = OS_ModuleLoad (& module_id , "Mod1" , UT_OS_GENERIC_MODULE_NAME2 , OS_MODULE_FLAG_LOCAL_SYMBOLS );
115+ res = OS_ModuleLoad (& module_id , "Mod1" , UT_OS_GENERIC_MODULE_NAME2 , OS_MODULE_FLAG_GLOBAL_SYMBOLS );
116116 if (res != OS_SUCCESS )
117117 {
118118 UT_OS_TEST_RESULT ("#4 Nominal - Module Load failed" , UTASSERT_CASETYPE_TSF );
@@ -122,6 +122,8 @@ void UT_os_symbol_lookup_test()
122122 res = OS_SymbolLookup (& symbol_addr , "module1" );
123123 if (res == OS_SUCCESS )
124124 UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_PASS );
125+ else if (res == OS_ERR_NOT_IMPLEMENTED )
126+ UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_NA );
125127 else
126128 UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_FAILURE );
127129
@@ -133,6 +135,85 @@ void UT_os_symbol_lookup_test()
133135 return ;
134136}
135137
138+ /*--------------------------------------------------------------------------------*
139+ ** Syntax: OS_ModuleSymbolLookup
140+ ** Purpose: Returns the memory address of a symbol
141+ ** Parameters: To-be-filled-in
142+ ** Returns: OS_INVALID_POINTER if any of the pointers passed in is null
143+ ** OS_ERROR if the symbol name is not found
144+ ** OS_SUCCESS if succeeded
145+ **--------------------------------------------------------------------------------*/
146+
147+ void UT_os_module_symbol_lookup_test ()
148+ {
149+ int32 res = 0 ;
150+ const char * testDesc ;
151+ cpuaddr symbol_addr ;
152+ osal_id_t module_id ;
153+
154+ /*-----------------------------------------------------*/
155+ testDesc = "API Not implemented" ;
156+
157+ res = OS_ModuleSymbolLookup (OS_OBJECT_ID_UNDEFINED , & symbol_addr , "main" );
158+ if (res == OS_ERR_NOT_IMPLEMENTED )
159+ {
160+ UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_NA );
161+ goto UT_os_module_symbol_lookup_test_exit_tag ;
162+ }
163+
164+ /*-----------------------------------------------------*/
165+ testDesc = "#1 Invalid-pointer-arg-1" ;
166+
167+ res = OS_ModuleSymbolLookup (OS_OBJECT_ID_UNDEFINED , 0 , "main" );
168+ if (res == OS_INVALID_POINTER )
169+ UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_PASS );
170+ else
171+ UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_FAILURE );
172+
173+ /*-----------------------------------------------------*/
174+ testDesc = "#2 Invalid-pointer-arg-2" ;
175+
176+ res = OS_ModuleSymbolLookup (OS_OBJECT_ID_UNDEFINED , & symbol_addr , 0 );
177+ if (res == OS_INVALID_POINTER )
178+ UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_PASS );
179+ else
180+ UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_FAILURE );
181+
182+ /*-----------------------------------------------------*/
183+ /* Setup for remainder of tests */
184+ res = OS_ModuleLoad (& module_id , "Mod1" , UT_OS_GENERIC_MODULE_NAME2 , OS_MODULE_FLAG_LOCAL_SYMBOLS );
185+ if (res != OS_SUCCESS )
186+ {
187+ UT_OS_TEST_RESULT ("Module Load failed" , UTASSERT_CASETYPE_TSF );
188+ goto UT_os_module_symbol_lookup_test_exit_tag ;
189+ }
190+
191+ /*-----------------------------------------------------*/
192+ testDesc = "#3 Symbol-not-found" ;
193+
194+ res = OS_ModuleSymbolLookup (module_id , & symbol_addr , "ThisSymbolIsNotFound" );
195+ if (res == OS_ERROR )
196+ UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_PASS );
197+ else
198+ UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_FAILURE );
199+
200+ /*-----------------------------------------------------*/
201+ testDesc = "#4 Nominal, Local Symbols" ;
202+
203+ res = OS_ModuleSymbolLookup (module_id , & symbol_addr , "module1" );
204+ if (res == OS_SUCCESS )
205+ UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_PASS );
206+ else
207+ UT_OS_TEST_RESULT (testDesc , UTASSERT_CASETYPE_FAILURE );
208+
209+ /* Reset test environment */
210+ res = OS_ModuleUnload (module_id );
211+
212+ UT_os_module_symbol_lookup_test_exit_tag :
213+ return ;
214+ }
215+
216+
136217/*--------------------------------------------------------------------------------*
137218** Syntax: OS_SymbolTableDump
138219** Purpose: Dumps the system symbol table to the given filename
0 commit comments