Skip to content
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

Fix bpf unit test build in dev VM #10735

Merged
merged 2 commits into from Mar 27, 2020
Merged

Conversation

tklauser
Copy link
Member

With the recent changes in #10703 the dev VM no longer ships a general
purpose clang with all targets, but only one with the bpf target.
This leads to the build in test/bpf to fail:

clang -I../../bpf/ -I../../bpf/include -I. -D__NR_CPUS__=2 -O2 -I../../bpf/ unit-test.c -o unit-test
error: unable to create target: 'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'

To fix this, use gcc to build non-bpf binaries. Also fix a GCC warning in bpf/lib/conntrack_test.h.

With the recent changes in #10703 the dev VM no longer ships a general
purpose `clang` with all targets, but only one with the `bpf` target.
This leads to the build in `test/bpf` to fail:

```
clang -I../../bpf/ -I../../bpf/include -I. -D__NR_CPUS__=2 -O2 -I../../bpf/ unit-test.c -o unit-test
error: unable to create target: 'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'
```

To fix this, use `gcc` to build non-bpf binaries.

Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Fix the following warning:

```
gcc -I../../bpf/ -I../../bpf/include -I. -D__NR_CPUS__=2 -O2 -I../../bpf/ unit-test.c -o unit-test
In file included from unit-test.c:20:0:
../../bpf/lib/conntrack_test.h: In function ‘test___ct_lookup’:
../../bpf/lib/conntrack_test.h:88:31: warning: dereferencing ‘void *’ pointer
  struct ct_entry *entry = &map[0];
                               ^
```

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
@tklauser tklauser added pending-review release-note/misc This PR makes changes that have no direct user impact. labels Mar 27, 2020
@tklauser tklauser requested review from borkmann and a team March 27, 2020 10:43
@tklauser tklauser requested a review from a team as a code owner March 27, 2020 10:43
@maintainer-s-little-helper maintainer-s-little-helper bot added this to In progress in 1.8.0 Mar 27, 2020
@tklauser
Copy link
Member Author

test-me-please

@tklauser tklauser changed the title Fix bpf unit test build Fix bpf unit test build in dev VM Mar 27, 2020
Copy link
Member

@borkmann borkmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 45.52% when pulling 11237dd on pr/tklauser/test-bpf-fix-build into 88f11f4 on master.

@borkmann borkmann merged commit 0b5e263 into master Mar 27, 2020
1.8.0 automation moved this from In progress to Merged Mar 27, 2020
@borkmann borkmann deleted the pr/tklauser/test-bpf-fix-build branch March 27, 2020 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
1.8.0
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

4 participants