Skip to content

Commit

Permalink
Fix nasa#1148, Enable symbol api test and MIR dump too large
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Sep 15, 2021
1 parent 2a2defb commit 0531bca
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions src/tests/symbol-api-test/symbol-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

void TestSymbolApi(void)
{
#ifdef OS_INCLUDE_MODULE_LOADER
int32 status;
cpuaddr SymAddress;

Expand All @@ -50,7 +49,11 @@ void TestSymbolApi(void)
status = OS_SymbolTableDump("/ram/SymbolTable32k.dat", 32768);
if (status == OS_ERR_NOT_IMPLEMENTED)
{
UtAssert_NA("Module API not implemented");
UtAssert_NA("OS_SymbolTableDump API not implemented");
}
else if (status == OS_ERR_OUTPUT_TOO_LARGE)
{
UtAssert_MIR("32k too small for OS_SymbolTableDump");
}
else
{
Expand All @@ -64,7 +67,11 @@ void TestSymbolApi(void)
status = OS_SymbolTableDump("/ram/SymbolTable128k.dat", 131072);
if (status == OS_ERR_NOT_IMPLEMENTED)
{
UtAssert_NA("Module API not implemented");
UtAssert_NA("OS_SymbolTableDump API not implemented");
}
else if (status == OS_ERR_OUTPUT_TOO_LARGE)
{
UtAssert_MIR("128k too small for OS_SymbolTableDump");
}
else
{
Expand All @@ -78,7 +85,11 @@ void TestSymbolApi(void)
status = OS_SymbolTableDump("/ram/SymbolTable512k.dat", 524288);
if (status == OS_ERR_NOT_IMPLEMENTED)
{
UtAssert_NA("Module API not implemented");
UtAssert_NA("OS_SymbolTableDump API not implemented");
}
else if (status == OS_ERR_OUTPUT_TOO_LARGE)
{
UtAssert_MIR("512k too small for OS_SymbolTableDump");
}
else
{
Expand All @@ -89,20 +100,29 @@ void TestSymbolApi(void)
** Test the symbol lookup
*/
status = OS_SymbolLookup(&SymAddress, "OS_Application_Startup");
UtAssert_True(status == OS_SUCCESS, "OS_SymbolLookup(OS_Application_Startup) = %d, Addr = %lx", (int)status,
(unsigned long)SymAddress);
if (status == OS_ERR_NOT_IMPLEMENTED)
{
UtAssert_NA("OS_SymbolLookup API not implemented");
}
else
{
UtAssert_True(status == OS_SUCCESS, "OS_SymbolLookup(OS_Application_Startup) = %d, Addr = %lx", (int)status,
(unsigned long)SymAddress);
}

/*
** Test a symbol lookup that does not exist
*/
status = OS_SymbolLookup(&SymAddress, "ShouldNotExist");
UtAssert_True(status != OS_SUCCESS, "OS_SymbolLookup(ShouldNotExist) = %d, Addr = %lx", (int)status,
(unsigned long)SymAddress);

#else
/* If the module loader is not present, generate an N/A test case just to indicate that the test ran */
UtAssert_True(1, "Module loader not present");
#endif
if (status == OS_ERR_NOT_IMPLEMENTED)
{
UtAssert_NA("OS_SymbolLookup API not implemented");
}
else
{
UtAssert_True(status != OS_SUCCESS, "OS_SymbolLookup(ShouldNotExist) = %d, Addr = %lx", (int)status,
(unsigned long)SymAddress);
}
} /* end TestSymbolApi */

void UtTest_Setup(void)
Expand Down

0 comments on commit 0531bca

Please sign in to comment.