Skip to content

Commit

Permalink
Fill out test.
Browse files Browse the repository at this point in the history
  • Loading branch information
mysterymath committed Nov 4, 2022
1 parent 6537b38 commit ce22745
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ cmake_minimum_required(VERSION 3.18)
set(LLVM_MOS_PLATFORM sim)
find_package(llvm-mos-sdk REQUIRED)
project(smoke-test)
include(CTest)

add_executable(hello hello.c)

find_program(SIM mos-sim REQUIRED)
add_test(NAME test
COMMAND ${CMAKE_COMMAND}
-DSIM=${SIM}
-DHELLO=$<TARGET_FILE:hello>
-P test.cmake
-DEXPECTED=${CMAKE_CURRENT_SOURCE_DIR}/expected
-P ${CMAKE_CURRENT_SOURCE_DIR}/test.cmake
)
1 change: 1 addition & 0 deletions expected
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello, world!
12 changes: 11 additions & 1 deletion test.cmake
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
find_program(SIM mos-sim REQUIRED)
execute_process(COMMAND ${SIM} ${HELLO}
OUTPUT_FILE output RESULT_VARIABLE RESULT)
if (RESULT)
message(FATAL_ERROR "Error running simulated test.")
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol output ${EXPECTED}
RESULT_VARIABLE RESULT)
if (RESULT)
message(FATAL_ERROR "Incorrect output.")
endif()

0 comments on commit ce22745

Please sign in to comment.