Skip to content

Commit

Permalink
Create option BPF_CONFORMANCE_ENABLE_TESTS
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
  • Loading branch information
Alan-Jowett committed May 25, 2023
1 parent 0b55492 commit 0ee1324
Show file tree
Hide file tree
Showing 3 changed files with 309 additions and 303 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ jobs:
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_CXX_FLAGS="${SANITIZER_FLAGS}" \
-DCMAKE_C_FLAGS="${SANITIZER_FLAGS}" \
${COVERAGE_FLAGS}
${COVERAGE_FLAGS} \
-DBPF_CONFORMANCE_ENABLE_TESTS=ON
- name: Build
# Build your program with the given configuration
Expand Down
17 changes: 10 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@
project("bpf_conformance")
cmake_minimum_required(VERSION 3.16)

if (IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git")
if(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git")
# Install Git pre-commit hook
file(COPY scripts/pre-commit scripts/commit-msg
DESTINATION "${PROJECT_SOURCE_DIR}/.git/hooks")
endif ()
DESTINATION "${PROJECT_SOURCE_DIR}/.git/hooks")
endif()

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/ZH:SHA_256 /guard:cf /Qspectre /sdl)
add_link_options(/guard:cf /CETCOMPAT)
endif()

option(BPF_CONFORMANCE_ENABLE_TESTS "Enable tests")

include("cmake/FindLibBpf.cmake")
include(CTest)

Expand All @@ -34,7 +36,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
file(COPY Docker/Linux/Dockerfile DESTINATION .)
endif()


if (LIBBPF_FOUND)
if(BPF_CONFORMANCE_ENABLE_TESTS)
if(LIBBPF_FOUND)
add_subdirectory("libbpf_plugin")
endif()
endif()
endif()
Loading

0 comments on commit 0ee1324

Please sign in to comment.