Skip to content

Commit

Permalink
Merge pull request #57 from AnyDSL/ctest
Browse files Browse the repository at this point in the history
* Revision of impala regression tests
* use cmake -DBUILD_TESTING=ON to enable ctest
* then run ctest -R codegen
  • Loading branch information
stlemme authored Feb 28, 2019
2 parents fc89366 + ea9ce09 commit f3ca3c2
Show file tree
Hide file tree
Showing 7 changed files with 474 additions and 115 deletions.
13 changes: 2 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
*.bc
*.out
*.cl
*.cu
*.ll
*.nvvm
*.pyc
*.vcg
CMakeCache.txt
CMakeFiles/
build*
html
test/impala
test/lib.o
test/config*
test/__pycache__
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ endif()

export(TARGETS libimpala impala FILE ${CMAKE_BINARY_DIR}/share/anydsl/cmake/impala-exports.cmake)
configure_file(cmake/impala-config.cmake.in ${CMAKE_BINARY_DIR}/share/anydsl/cmake/impala-config.cmake @ONLY)

if (BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif(BUILD_TESTING)
34 changes: 34 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)

find_package(PythonInterp 3.0 REQUIRED)
set(PYTHON_BIN ${PYTHON_EXECUTABLE})

find_path(LLVM_DIR LLVMConfig.cmake PATHS ${LLVM_DIR} $ENV{LLVM_DIR})
find_package(LLVM QUIET)
find_path(Clang_DIR ClangConfig.cmake PATHS ${Clang_DIR} ${LLVM_DIR} PATH_SUFFIXES ../clang)
find_package(Clang QUIET)
if(TARGET clang AND NOT Clang_BIN)
get_target_property(Clang_BIN clang LOCATION)
set(Clang_BIN ${Clang_BIN} CACHE FILEPATH "path to clang executable")
endif()
find_program(Clang_BIN clang
PATHS ${LLVM_TOOLS_BINARY_DIR} ${LLVM_INSTALL_PREFIX}/bin
PATH_SUFFIXES Release ${CMAKE_CONFIGURATION_TYPES}
)

# add_library(rtmock STATIC rtmock.cpp)

set(TEST_SCRIPT perform.py)
set(TEST_ARGS --impala $<TARGET_FILE:impala> --clang ${Clang_BIN} --temp ${CMAKE_CURRENT_BINARY_DIR} --rtmock "${CMAKE_CURRENT_SOURCE_DIR}/rtmock.cpp")

file(GLOB_RECURSE _testcases RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.impala")

foreach(_test ${_testcases})
add_test(NAME ${_test} COMMAND ${PYTHON_BIN} ${TEST_SCRIPT} ${TEST_ARGS} ${_test} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set_tests_properties(${_test} PROPERTIES SKIP_RETURN_CODE 77)
endforeach()

set(_content
"CONFIGURATION = \"$<CONFIG>\"\nIMPALA_BIN = \"$<TARGET_FILE:impala>\"\nCLANG_BIN = \"${Clang_BIN}\"\nLIBRTMOCK = \"${CMAKE_CURRENT_SOURCE_DIR}/rtmock.cpp\"\nTEMP_DIR = \"${CMAKE_CURRENT_BINARY_DIR}\"\n")
file(GENERATE OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/config$<CONFIG>.py CONTENT ${_content})

103 changes: 0 additions & 103 deletions test/lib.c

This file was deleted.

Loading

0 comments on commit f3ca3c2

Please sign in to comment.