diff options
author | Stefan Radomski <sradomski@mintwerk.de> | 2016-01-15 13:42:06 (GMT) |
---|---|---|
committer | Stefan Radomski <sradomski@mintwerk.de> | 2016-01-15 13:42:06 (GMT) |
commit | 38da34e8ba7956bed2e4703289ed70e3f6aade52 (patch) | |
tree | baf0b424f395ae63fbf3f0d8123a3e59e1ef51d7 /test/w3c/run_generated_test.cmake | |
parent | 613cf9fb6fe4b24bc7852d5a31953f6ff419e43c (diff) | |
download | uscxml-38da34e8ba7956bed2e4703289ed70e3f6aade52.zip uscxml-38da34e8ba7956bed2e4703289ed70e3f6aade52.tar.gz uscxml-38da34e8ba7956bed2e4703289ed70e3f6aade52.tar.bz2 |
Working on C transformation
Diffstat (limited to 'test/w3c/run_generated_test.cmake')
-rw-r--r-- | test/w3c/run_generated_test.cmake | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/test/w3c/run_generated_test.cmake b/test/w3c/run_generated_test.cmake new file mode 100644 index 0000000..cf13fd9 --- /dev/null +++ b/test/w3c/run_generated_test.cmake @@ -0,0 +1,87 @@ +# convert given file to promela and run spin + +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/contrib/cmake) +include("${CMAKE_MODULE_PATH}/FileInformation.cmake") + +get_filename_component(TEST_FILE_NAME ${TESTFILE} NAME) +execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTDIR}) + +message(STATUS "${USCXML_TRANSFORM_BIN} -t${TARGETLANG} -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.machine.c") +execute_process(COMMAND time -p ${USCXML_TRANSFORM_BIN} -t${TARGETLANG} -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.machine.c RESULT_VARIABLE CMD_RESULT) +if(CMD_RESULT) + message(FATAL_ERROR "Error running ${USCXML_TRANSFORM_BIN}: ${CMD_RESULT}") +endif() +message(STATUS "time for transforming to c machine") + +# message(FATAL_ERROR "PROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR}") + +if (${TARGETLANG} STREQUAL "c") + + # set(COMPILE_CMD_OBJ + # "-c" "${OUTDIR}/${TEST_FILE_NAME}.machine.c" + # "-o" "${OUTDIR}/${TEST_FILE_NAME}.machine.c.o" + # "-Ofast") + # + # message(STATUS "${GPP_BIN} ${COMPILE_CMD_OBJ}") + # execute_process( + # COMMAND time -p ${GPP_BIN} ${COMPILE_CMD_OBJ} + # WORKING_DIRECTORY ${OUTDIR} RESULT_VARIABLE CMD_RESULT) + # if(CMD_RESULT) + # message(FATAL_ERROR "Error running g++ ${GPP_BIN}: ${CMD_RESULT}") + # endif() + # file (SIZE "${OUTDIR}/${TEST_FILE_NAME}.machine.c.o" BINARY_SIZE) + # message("Size of compiled unit optimized for speed: ${BINARY_SIZE}") + # + # set(COMPILE_CMD_OBJ + # "-c" "${OUTDIR}/${TEST_FILE_NAME}.machine.c" + # "-o" "${OUTDIR}/${TEST_FILE_NAME}.machine.c.o" + # "-Os") + # + # message(STATUS "${GPP_BIN} ${COMPILE_CMD_OBJ}") + # execute_process( + # COMMAND time -p ${GPP_BIN} ${COMPILE_CMD_OBJ} + # WORKING_DIRECTORY ${OUTDIR} RESULT_VARIABLE CMD_RESULT) + # if(CMD_RESULT) + # message(FATAL_ERROR "Error running g++ ${GPP_BIN}: ${CMD_RESULT}") + # endif() + # file (SIZE "${OUTDIR}/${TEST_FILE_NAME}.machine.c.o" BINARY_SIZE) + # message("Size of compiled unit optimized for size: ${BINARY_SIZE}") + + set(COMPILE_CMD_BIN + "-o" "${OUTDIR}/${TEST_FILE_NAME}" + "-Ofast" + "-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" + "-luscxml64" + "-include" "${OUTDIR}/${TEST_FILE_NAME}.machine.c" + "-I${PROJECT_SOURCE_DIR}/contrib/prebuilt/${USCXML_PLATFORM_ID}/include" + "-I${PROJECT_SOURCE_DIR}/contrib/prebuilt/${USCXML_PLATFORM_ID}/include/arabica" + "-I${PROJECT_SOURCE_DIR}/contrib/prebuilt/include" + "-I${CMAKE_BINARY_DIR}" + "-I${PROJECT_BINARY_DIR}" + "-I${PROJECT_SOURCE_DIR}/src" + "-Wl,-rpath,${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" + "-DAUTOINCLUDE_TEST=ON" + "${SCAFFOLDING_FOR_GENERATED_C}") + + message(STATUS "${GPP_BIN} ${COMPILE_CMD_BIN}") + execute_process( + COMMAND time -p ${GPP_BIN} ${COMPILE_CMD_BIN} + WORKING_DIRECTORY ${OUTDIR} RESULT_VARIABLE CMD_RESULT) + if(CMD_RESULT) + message(FATAL_ERROR "Error running g++ ${GPP_BIN}: ${CMD_RESULT}") + endif() + message(STATUS "time for transforming to binary") + + message(STATUS "${OUTDIR}/${TEST_FILE_NAME}") + execute_process( + COMMAND time -p ${OUTDIR}/${TEST_FILE_NAME} + WORKING_DIRECTORY ${OUTDIR} + RESULT_VARIABLE CMD_RESULT) + if(CMD_RESULT) + message(FATAL_ERROR "Error running generated c test: ${CMD_RESULT}") + endif() + message(STATUS "time for execution") +endif() + +# message(STATUS "${TEST_OUT}") +# file(WRITE ${OUTDIR}/${TEST_FILE_NAME}.pml.out ${TEST_OUT})
\ No newline at end of file |