~cypheon/rapid

f3d44af4a069e8b5ab575c3767a81526a74d0dab — Johann Rudloff 5 days ago d496bca
Add infrastructure for RTS tests
3 files changed, 46 insertions(+), 0 deletions(-)

M .gitignore
M rts/CMakeLists.txt
A rts/test/test_main.c
M .gitignore => .gitignore +1 -0
@@ 3,6 3,7 @@
/docs/build/
/rapid
/rts/build/
/rts/rapid_rts_test
/samples/build/
/src/build/
/tests/**/build/

M rts/CMakeLists.txt => rts/CMakeLists.txt +29 -0
@@ 61,3 61,32 @@ add_custom_command(
add_custom_target(rapid_rts
  DEPENDS "${RAPID_RTS_LIB}" "${RAPID_PLATFORM_LIB}"
  )

#######
# tests
#######

add_executable(rapid_rts_test
  test/test_main.c
  ${RTS_SOURCES}
  )
target_compile_options(rapid_rts_test PUBLIC ${RTS_CFLAGS})
target_include_directories(rapid_rts_test PUBLIC ${RTS_INCLUDES})
target_link_directories(rapid_rts_test PUBLIC
  "/usr/local/lib"
  )
target_link_libraries(rapid_rts_test PUBLIC
  gmp
  gc
  "${RAPID_PLATFORM_LIB}"
  )

add_custom_target(rapid_test_rts
                  COMMAND rapid_rts_test
                  WORKING_DIRECTORY .
                  DEPENDS rapid_rts_test)

if (NOT TARGET test)
  add_custom_target(test)
endif()
add_dependencies(test rapid_test_rts)

A rts/test/test_main.c => rts/test/test_main.c +16 -0
@@ 0,0 1,16 @@
#include <stdint.h>

#include "../rts.h"

// Some stubs that usually would be defined by the target program:
uint32_t rapid_gc_flavour;
void *get_stackmap() {
  return 0;
}
int64_t idris_enter(Idris_TSO *baseTSO) {
  return 0;
}

int main(int argc, char **argv) {
  return 0;
}