Skip to content

Commit e3fbe36

Browse files
committed
Enable MacOS eBPF tests.
Signed-off-by: fruffy <[email protected]>
1 parent 57c5ac0 commit e3fbe36

File tree

2 files changed

+24
-26
lines changed

2 files changed

+24
-26
lines changed

.github/workflows/ci-test-mac.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
- name: Run tests (MacOS)
5959
run: |
6060
source ~/.bash_profile
61-
ctest --output-on-failure --schedule-random -E "bpf|ubpf|testgen|smith"
61+
ctest --output-on-failure --schedule-random -E "ubpf|testgen|smith"
6262
working-directory: ./build
6363

6464
# Build and test p4c on MacOS 13 on x86.
@@ -105,5 +105,5 @@ jobs:
105105
- name: Run tests (MacOS)
106106
run: |
107107
source ~/.bash_profile
108-
ctest --output-on-failure --schedule-random -E "bpf|ubpf|testgen|smith"
108+
ctest --output-on-failure --schedule-random -E "ubpf|testgen|smith"
109109
working-directory: ./build

backends/ebpf/CMakeLists.txt

+22-24
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,30 @@
1515
# CMakefile for the EBPF P4-16 back-end.
1616
message(STATUS "Start configuring the eBPF back end")
1717

18-
if(NOT APPLE)
19-
# Fetch and declare the libbpf library. Print out download state while setting up libbpf.
20-
set(FETCHCONTENT_QUIET_PREV ${FETCHCONTENT_QUIET})
21-
set(FETCHCONTENT_QUIET OFF)
22-
fetchcontent_declare(
23-
bpfrepo
24-
URL https://github.com/libbpf/libbpf/archive/refs/tags/v1.4.1.tar.gz
25-
URL_HASH SHA256=cc01a3a05d25e5978c20be7656f14eb8b6fcb120bb1c7e8041e497814fc273cb
26-
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/runtime/contrib/libbpf
27-
USES_TERMINAL_DOWNLOAD TRUE
28-
GIT_PROGRESS TRUE
29-
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
18+
# Fetch and declare the libbpf library. Print out download state while setting up libbpf.
19+
set(FETCHCONTENT_QUIET_PREV ${FETCHCONTENT_QUIET})
20+
set(FETCHCONTENT_QUIET OFF)
21+
fetchcontent_declare(
22+
bpfrepo
23+
URL https://github.com/libbpf/libbpf/archive/refs/tags/v1.4.1.tar.gz
24+
URL_HASH SHA256=cc01a3a05d25e5978c20be7656f14eb8b6fcb120bb1c7e8041e497814fc273cb
25+
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/runtime/contrib/libbpf
26+
USES_TERMINAL_DOWNLOAD TRUE
27+
GIT_PROGRESS TRUE
28+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
29+
)
30+
fetchcontent_makeavailable(bpfrepo)
31+
set(FETCHCONTENT_QUIET ${FETCHCONTENT_QUIET_PREV})
32+
# Check if we have already built the libbpf library.
33+
find_library(LIBBPF NAMES bpf HINTS "${CMAKE_CURRENT_SOURCE_DIR}/runtime/usr/lib64/")
34+
if (NOT LIBBPF)
35+
message("Building libbpf...")
36+
execute_process(
37+
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_libbpf
38+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
3039
)
31-
fetchcontent_makeavailable(bpfrepo)
32-
set(FETCHCONTENT_QUIET ${FETCHCONTENT_QUIET_PREV})
33-
# Check if we have already built the libbpf library.
34-
find_library(LIBBPF NAMES bpf HINTS "${CMAKE_CURRENT_SOURCE_DIR}/runtime/usr/lib64/")
35-
if (NOT LIBBPF)
36-
message("Building libbpf...")
37-
execute_process(
38-
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_libbpf
39-
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
40-
)
41-
endif()
42-
message("Done with setting up libbpf for P4C.")
4340
endif()
41+
message("Done with setting up libbpf for P4C.")
4442

4543

4644

0 commit comments

Comments
 (0)