add test cases for r_68k_pc32
This commit is contained in:
parent
5fdd7b411f
commit
0b120a722e
|
@ -75,6 +75,10 @@ if(CMAKE_SYSTEM_NAME MATCHES Retro68)
|
||||||
LINK_FLAGS "-Wl,-gc-sections -Wl,--mac-segments -Wl,${CMAKE_CURRENT_SOURCE_DIR}/Segments.segmap")
|
LINK_FLAGS "-Wl,-gc-sections -Wl,--mac-segments -Wl,${CMAKE_CURRENT_SOURCE_DIR}/Segments.segmap")
|
||||||
add_test(NAME ${TESTCASE_PREFIX}Segments COMMAND ${LAUNCH_APPL}
|
add_test(NAME ${TESTCASE_PREFIX}Segments COMMAND ${LAUNCH_APPL}
|
||||||
${LAUNCH_METHOD_FLAG} ${RETRO68_TEST_CONFIG} Segments.bin)
|
${LAUNCH_METHOD_FLAG} ${RETRO68_TEST_CONFIG} Segments.bin)
|
||||||
|
|
||||||
|
|
||||||
|
test(PCRel32.c PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
||||||
|
target_compile_options(PCRel32 PRIVATE -march=68020)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
test(Exceptions.cc PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
test(Exceptions.cc PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
#include "Test.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
__attribute__((noinline)) static void* foo(size_t x)
|
||||||
|
{
|
||||||
|
return malloc(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
if(*(short*)&foo != 0x60FF)
|
||||||
|
{
|
||||||
|
TEST_LOG_NO();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t offset = *(uint32_t*) ((char*)&foo + 2);
|
||||||
|
if(((char*)&foo + 2) + offset != (char*)&malloc)
|
||||||
|
{
|
||||||
|
TEST_LOG_NO();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *p = foo(42);
|
||||||
|
strcpy(p, "OK");
|
||||||
|
TestLog(p);
|
||||||
|
free(p);
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -87,8 +87,8 @@ void TestLog(const char *str);
|
||||||
#define TEST_LOG_NO() \
|
#define TEST_LOG_NO() \
|
||||||
do { \
|
do { \
|
||||||
char no[3]; \
|
char no[3]; \
|
||||||
no[0] = 'O'; \
|
no[0] = 'N'; \
|
||||||
no[1] = 'K'; \
|
no[1] = 'O'; \
|
||||||
no[2] = '\0'; \
|
no[2] = '\0'; \
|
||||||
TEST_LOG_SIZED(no, 2); \
|
TEST_LOG_SIZED(no, 2); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
Loading…
Reference in New Issue