-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move cc/*py tests to python subdir and introduce c standalone test binary #426
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
This creates a new static library target for bcc. Add one trivial c test case that links against it. Signed-off-by: Brenden Blanco <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
# Copyright (c) PLUMgrid, Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License") | ||
|
||
include_directories(${CMAKE_SOURCE_DIR}/src/cc) | ||
|
||
add_executable(test_static test_static.c) | ||
target_link_libraries(test_static bcc-static) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that only works for .c that are part of the bcc build unfortunately. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Of course, the next step will be to include libbcc.a in the list of installed targets. Some packaging and further testing required there. I would plan to do that in a followup independent change. |
||
|
||
add_test(NAME c_test_static COMMAND ${TEST_WRAPPER} c_test_static sudo ${CMAKE_CURRENT_BINARY_DIR}/test_static) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "bpf_common.h" | ||
|
||
int main(int argc, char **argv) { | ||
void *mod = bpf_module_create_c_from_string("BPF_TABLE(\"array\", int, int, stats, 10);\n", 4, NULL, 0); | ||
return !(mod != NULL); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why split it into another lib?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a dependency (bpf_map_create) required by both bcc and clang_frontend. This gets resolved at final link-time.