Port old "check" target and update CI

Use "make test" to run the old target. Only works for Debug and
RelWithDebInfo, since coz requires debug symbols in the program under
profile.
This commit is contained in:
Alexey Klimkin 2021-01-08 09:59:15 -08:00 committed by Alexey Klimkin
parent 3d9f3b9107
commit 0659e3ab1d
4 changed files with 29 additions and 7 deletions

View File

@ -17,16 +17,17 @@ branches:
# Install dependencies # Install dependencies
before_install: before_install:
- sudo apt-get update - 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 # Make and install
install: install:
- make - mkdir build && cd build
- sudo make install - conan install ..
- cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_BENCHMARKS=ON -G Ninja
# Run the make check target (add tests later) - ninja
script: - CTEST_OUTPUT_ON_FAILURE=1 ninja test
- make check USE_SYSTEM_COZ=1 - sudo ninja install
# Test the Rust support as well # Test the Rust support as well
matrix: matrix:

View File

@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.1) cmake_minimum_required(VERSION 3.1)
project(coz C CXX) project(coz C CXX)
enable_testing()
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -20,6 +22,9 @@ add_subdirectory(libcoz)
option(BUILD_BENCHMARKS "Build benchmarks" OFF) option(BUILD_BENCHMARKS "Build benchmarks" OFF)
if(BUILD_BENCHMARKS) 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(SQLite3 REQUIRED)
find_package(BZip2 REQUIRED) find_package(BZip2 REQUIRED)
add_subdirectory(benchmarks) add_subdirectory(benchmarks)

11
benchmarks/check-output.sh Executable file
View File

@ -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

View File

@ -3,3 +3,8 @@ target_link_libraries(kmeans PRIVATE coz-instrumentation pthread)
add_coz_run_target(run_kmeans_small COMMAND $<TARGET_FILE:kmeans> -d 3 -c 100 -p 10000 -s 100) add_coz_run_target(run_kmeans_small COMMAND $<TARGET_FILE:kmeans> -d 3 -c 100 -p 10000 -s 100)
add_coz_run_target(run_kmeans_large COMMAND $<TARGET_FILE:kmeans> -d 3 -c 100 -p 100000 -s 1000) add_coz_run_target(run_kmeans_large COMMAND $<TARGET_FILE:kmeans> -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 --- $<TARGET_FILE:kmeans>
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})