diff --git a/.travis.yml b/.travis.yml index a049d7a..b54ae2c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,16 +17,17 @@ branches: # Install dependencies before_install: - sudo apt-get update - - sudo apt-get install -y --install-recommends docutils-common libelfin-dev nodejs npm + - sudo apt-get install -y --install-recommends build-essential cmake ninja-build docutils-common nodejs npm + - sudo pip install conan # Make and install install: - - make - - sudo make install - -# Run the make check target (add tests later) -script: - - make check USE_SYSTEM_COZ=1 + - mkdir build && cd build + - conan install .. + - cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_BENCHMARKS=ON -G Ninja + - ninja + - CTEST_OUTPUT_ON_FAILURE=1 ninja test + - sudo ninja install # Test the Rust support as well matrix: diff --git a/CMakeLists.txt b/CMakeLists.txt index 07f3cf3..afd32d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.1) project(coz C CXX) +enable_testing() + set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -20,6 +22,9 @@ add_subdirectory(libcoz) option(BUILD_BENCHMARKS "Build benchmarks" OFF) if(BUILD_BENCHMARKS) + if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) + message(FATAL_ERROR "Build benchmarks with debug information - use Debug or RelWithDebInfo") + endif() find_package(SQLite3 REQUIRED) find_package(BZip2 REQUIRED) add_subdirectory(benchmarks) diff --git a/benchmarks/check-output.sh b/benchmarks/check-output.sh new file mode 100755 index 0000000..9d50b40 --- /dev/null +++ b/benchmarks/check-output.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e +rm -f profile.coz + +$@ + +grep -q "time=" profile.coz || { echo failure: valid profile.coz not generated; exit 1; } +grep -q "throughput-point" profile.coz || { echo failure: throughput-point not found in profile; exit 1; } +grep -q -P "samples\tlocation=" profile.coz || { echo failure: samples not found in profile; exit 1; } +echo success: benchmark generated valid profile.coz diff --git a/benchmarks/kmeans/CMakeLists.txt b/benchmarks/kmeans/CMakeLists.txt index cf4e9eb..5ffce05 100644 --- a/benchmarks/kmeans/CMakeLists.txt +++ b/benchmarks/kmeans/CMakeLists.txt @@ -3,3 +3,8 @@ target_link_libraries(kmeans PRIVATE coz-instrumentation pthread) add_coz_run_target(run_kmeans_small COMMAND $ -d 3 -c 100 -p 10000 -s 100) add_coz_run_target(run_kmeans_large COMMAND $ -d 3 -c 100 -p 100000 -s 1000) + +add_test( + NAME test_run_kmeans + COMMAND ${PROJECT_SOURCE_DIR}/benchmarks/check-output.sh ${PROJECT_SOURCE_DIR}/coz run --- $ + WORKING_DIRECTORY ${PROJECT_BINARY_DIR})