forked from microsoft/ebpf-for-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bpf2c_plugin for use with bpf_conformance test suite (microsoft#1475
) * Add bpf2c_plugin Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * Fix CMake so that it builds correctly Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * Remove bpf_conformance as a submodule Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * Download bpf_conformance artifact Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * Extract bpf_conformance\ Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * Fix path Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * Execute bpf_conformance in CI/CD Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * Pickup latest artifacts" Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * PR feedback Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> Co-authored-by: Alan Jowett <alan.jowett@microsoft.com> Co-authored-by: Dave Thaler <dthaler@microsoft.com> Co-authored-by: saxena-anurag <43585259+saxena-anurag@users.noreply.github.com>
- Loading branch information
1 parent
c7c967b
commit b7deedc
Showing
13 changed files
with
743 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Copyright (c) Microsoft Corporation | ||
# SPDX-License-Identifier: MIT | ||
|
||
add_executable("bpf2c_plugin" | ||
bpf2c_plugin.cpp | ||
../../tools/bpf2c/bpf_code_generator.h | ||
../../tools/bpf2c/bpf_code_generator.cpp | ||
) | ||
|
||
target_include_directories("bpf2c_plugin" PRIVATE | ||
"${CMAKE_SOURCE_DIR}/include" | ||
"${CMAKE_SOURCE_DIR}/tools/bpf2c" | ||
"${CMAKE_SOURCE_DIR}/external/ubpf/vm" | ||
"${CMAKE_BINARY_DIR}/external/ubpf/vm" | ||
"${CMAKE_SOURCE_DIR}/external/ubpf/vm/inc" | ||
"${CMAKE_BINARY_DIR}/external/ubpf/vm/inc" | ||
"${CMAKE_SOURCE_DIR}/external/ebpf-verifier/src" | ||
) | ||
|
||
target_link_libraries("bpf2c_plugin" PRIVATE | ||
"ebpf_for_windows_cpp_settings" | ||
"common_tests" | ||
"EbpfApi" | ||
"rpc_interface" | ||
"test_util" | ||
"Catch2::Catch2WithMain" | ||
"ws2_32.lib" | ||
) | ||
|
||
target_compile_definitions("bpf2c_plugin" PRIVATE | ||
_WINSOCK_DEPRECATED_NO_WARNINGS | ||
_CONSOLE | ||
) | ||
|
||
function(generateTemplate source_file_name) | ||
find_program(powershell_path "powershell" REQUIRED) | ||
|
||
set(template_name "${source_file_name}.template") | ||
set(template_path "${CMAKE_CURRENT_BINARY_DIR}/${template_name}") | ||
|
||
add_custom_command( | ||
OUTPUT | ||
"${template_path}" | ||
|
||
COMMAND | ||
"${powershell_path}" -NonInteractive -ExecutionPolicy Unrestricted "${CMAKE_SOURCE_DIR}/scripts/escape_text.ps1" "${CMAKE_CURRENT_SOURCE_DIR}/${source_file_name}.cpp" "${template_path}" | ||
|
||
VERBATIM | ||
|
||
COMMENT | ||
"ebpf-for-windows - Generating: ${source_file_name}" | ||
|
||
WORKING_DIRECTORY | ||
"${CMAKE_CURRENT_BINARY_DIR}" | ||
) | ||
|
||
add_custom_target("${source_file_name}_builder" | ||
DEPENDS "${template_path}" | ||
) | ||
|
||
add_library("${source_file_name}" INTERFACE) | ||
target_include_directories("${source_file_name}" INTERFACE | ||
"${CMAKE_CURRENT_BINARY_DIR}" | ||
) | ||
|
||
add_dependencies("${source_file_name}" | ||
"${source_file_name}_builder" | ||
) | ||
endfunction() | ||
|
||
generateTemplate("bpf2c_test") | ||
target_link_libraries("bpf2c_plugin" PRIVATE | ||
"bpf2c_test" | ||
) |
Oops, something went wrong.