Commit Graph

1270 Commits (f705eabe667d4abdfd0b895de586cc4145319cf0)
 

Author SHA1 Message Date
Dave Tucker 7ac808cf55
Merge pull request #671 from dave-tucker/misc-fixes
Clippy fixes for latest nightly
1 year ago
Andrew Werner af747f8caa test: update README.md
A checkout of libbpf is no longer required.
1 year ago
Dave Tucker 764eb309b0 Clippy fixes for latest nightly
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
1 year ago
ajwerner 78ede184bd
Merge pull request #664 from ajwerner/always-initialize-submodules
xtask: ensure libbpf submodule is initialized
1 year ago
vadorovsky 2755713cf0
Merge pull request #668 from aya-rs/invalidate-bpf-linker
integration-test: invalidate on bpf-linker
1 year ago
Tamir Duberstein 55b2010f19
integration-test: invalidate on bpf-linker
It turns out that cargo ignores rerun-if-changed directives that point
into $CARGO_HOME; use a symlink to trick cargo into respecting my
authoritah.
1 year ago
Andrew Werner d5259ce789 xtask: move libbpf submodule 1 year ago
Andrew Werner 15b3c459ae xtask: ensure libbpf submodule is initialized
Libbpf is used by xtasks, in the command, ensure that the submodules
are initialized. This eases the user-experience so that users don't
need to think about the submodule, while retaining all the benefits
of using a submodule vs forcing the user to manually check out libbpf
and stick it in some pre-defined place.

We use the symbol pointing to libbpf in xtask in the build script
to avoid repeating this constant.

Also, we install git in the vm so that we can init the submodule
when we build in the vm.
1 year ago
vadorovsky dc3b0b8730
Merge pull request #666 from aya-rs/toml-fmt
toml: add formatter and check in CI
1 year ago
Tamir Duberstein c8bf646ef0
toml: add formatter and check in CI 1 year ago
Andrew Werner 4306b222d8 .github: update codegen workflow to use submodule 1 year ago
Tamir Duberstein 893ab76afa
Merge pull request #665 from aya-rs/dead-code-rm
aya: avoid an allocation
1 year ago
Tamir Duberstein 6f2a8c8a5c
aya: avoid an allocation
str::rsplitn(2, c) is a special case that can be expressed as
str::rsplit_once(c).
1 year ago
Tamir Duberstein d71d1e1993
aya: remove dead code
This logic moved in bb595c4e69. The
mutation here prevented the compiler from noticing.
1 year ago
Tamir Duberstein af54a819a3
Merge pull request #660 from aya-rs/log-test
Make logging test output more legible
1 year ago
Tamir Duberstein 703e7108f2
Make logging test output more legible
Presently when this test fails you just get "5 items instead of 6" but
not which item was lost.
1 year ago
Tamir Duberstein bbc6a73f4b
Merge pull request #657 from aya-rs/build-rs-invalidate-deps
integration-test: better cache invalidation
1 year ago
Tamir Duberstein 232cd45e41
Merge pull request #656 from aya-rs/kernel-version-fml
Handle WSL kernel version strings
1 year ago
Tamir Duberstein 581d5c8f5f
integration-test: bust cache on bpf-linker
This is useful when iterating on bpf-linker locally, which is otherwise
an undeclared input to this build.

We could use an artifact dependency[0] here, but they are unstable and
bpf-linker requires gymnastics to build correctly (for now).

[0] https://doc.rust-lang.org/cargo/reference/unstable.html#artifact-dependencies-dependency-declarations
1 year ago
Tamir Duberstein 2a6d2a6402
integration-test: transitive dep on Rust ebpf
Emit "cargo:rerun-if-changed={}" for each transitive dependency on
integration-ebpf. In a normal world we'd just add integration-ebpf to
our build-dependencies, but cargo ignores this because integration-ebpf
has no library targets.
1 year ago
Tamir Duberstein 35ed85a87f
Handle WSL kernel version strings
Fixes #654.
1 year ago
Tamir Duberstein 961f45da37
Replace matches with assert_matches
The matches crate has been archived now that `matches!` is in std.
However `assert_matches!` is still unstable in std, and the
assert_matches crate provides a more expressive form:

```
assert_matches!(foo, Ok(bar) => {
  assert_eq!(bar, baz);
});
```
1 year ago
Tamir Duberstein b875f83f22
Remove duplicate entry 1 year ago
Tamir Duberstein 61608e6458
Merge pull request #650 from aya-rs/test-cleanup
Remove async feature; misc test cleanup
1 year ago
Alessandro Decina 0766e70548
Merge pull request #584 from marysaka/fix/btf-kern-optional
aya: Ignore embedded BTF error if not truely required
1 year ago
Tamir Duberstein 8e9712ac02
Run tests with powerset of features 1 year ago
Tamir Duberstein 6d06e2bf3a
Include ~all crates in default members
Several tests were not running due to being omitted from this list.
1 year ago
Tamir Duberstein 5407d4a9a1
Don't use env::tempdir
This can cause test pollution. Create a new temp directory on each run.
1 year ago
Tamir Duberstein fa91fb4f59
Remove "async" feature
This feature is equivalent to async_tokio || async_std; removing it
avoids warnings emitted during `cargo hack check --feature-powerset`
where async is selected without either of the other features.

Use cargo hack to ensure clippy runs on the powerset of features.
1 year ago
Tamir Duberstein dc38b7eff0
.github: fail-fast: false 1 year ago
Tamir Duberstein 464fb54b25
Merge pull request #655 from aya-rs/logs-docs
site: generate docs for logging crates
1 year ago
Tamir Duberstein 40f24fe8e1
site: generate docs for logging crates 1 year ago
Mary 74b546827c aya: Ignore embedded BTF error if not truely required
This allows fallback to BTF manual relocation when BTF loading fail when not truely required.
1 year ago
Tamir Duberstein 76ad93268f
Merge pull request #652 from aya-rs/docs
xtask: remove assumptions from docs command
1 year ago
ajwerner 28c4ad3e1a
Merge pull request #653 from aya-rs/rebuild-on-changed
integration-test: properly rebuild bpf on change
1 year ago
Tamir Duberstein c250c6c9db
integration-test: avoid cargo deadflock 1 year ago
Tamir Duberstein 38a2711720
integration-test: properly rebuild bpf on change 1 year ago
Tamir Duberstein b86d42d1b0
xtask: remove assumptions from docs command
This slightly changes the site layout: crate documentation is now flat
rather than being nested under "user" and  "bpf".

- Run `cargo clean --doc` before generating docs to ensure hermiticity.
- Generate header.html into a temporary directory.
- Remove "site" on each run to ensure hermiticity.
- Invoke cargo only once.
- Avoid editing sources.
1 year ago
Alessandro Decina e2b673eb41
Merge pull request #651 from alessandrod/bpf-cargo-config
Add back bpf/.cargo/config.toml
1 year ago
Alessandro Decina c64d8e2bb7 Add back bpf/.cargo/config.toml
So to build/check things using the bpf target one can:

    cd bpf && cargo check && cargo build

without having to manually pass --target=bpfel-unknown-none -Z
build-std=core.

It also fixes cargo xtask docs, since the command relies on bpf docs
being built with the bpfel-unknown-none target.
1 year ago
Alessandro Decina 242d8c33c4 Fix build 1 year ago
Alessandro Decina eb60d65613
Merge pull request #520 from astoycos/unsupported-map
Add Unsupported Map type
1 year ago
Andrew Stoycos edb7baf9a3
Merge pull request #560 from astoycos/fix-perf-link-pin
Implement FdLink conversions
1 year ago
Andrew Stoycos 94f554a52f
fix loaded_programs() race in int-tests
in the integration tests we recenctly switched to using
our internal api to list programs. I was seeing times when
this would race and panic internally (program fd was deleted
by aya WHILE we were trying to get it).  This ensures that
the list succeeded without panicking.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
1 year ago
Andrew Stoycos 80b371f6d1
add FdLink documentation and example
Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
1 year ago
Andrew Stoycos fb075636c1
Add integration test for perf link pin
Add integration testing for link pinning and
loading/unloading of tracepoint, kprobe, and
uprobe programs.

Redo how we utilize bpftool to verify that programs
are loaded to be explicit with names. Also add a helper
to verify that a program is loaded AND linked.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
1 year ago
Tamir Duberstein 7def6d7218
Merge pull request #644 from aya-rs/build-script
Steps toward hermetic integration tests
1 year ago
Andrew Stoycos e668ae0c1b
re-add bpftool to integration tests
We need bpftool to add tests for the link APIs since we don't yet have
and aya API for listing links.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
1 year ago
Andrew Stoycos 58895db9b4
Implement FdLink conversions
Implement TryFrom functions to convert Fdlink to PerfLink/TracePointLink/
KprobeLink, and UprobeLink and vice-versa.

This allows us to pin taken links for perf programs, ultimately
ensuring the link isn't dropped when the loading process exits.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
1 year ago
Tamir Duberstein 23bea22ac1
integration-test: build one binary instead of N
"integration tests" as defined by Cargo produce a binary per file in the
tests directory. This is really not what we want and has a number of
downsides, but the main one is binary size.

Before:
  tamird@pc:~/src/aya$ cargo xtask build-integration-test | xargs ls -lah
      Finished dev [unoptimized + debuginfo] target(s) in 0.05s
       Running `target/debug/xtask build-integration-test`
     Compiling integration-test v0.1.0 (/home/tamird/src/aya/test/integration-test)
      Finished dev [unoptimized + debuginfo] target(s) in 0.68s
  -rwxrwxr-x 1 tamird tamird  34M Jul 12 15:21 /home/tamird/src/aya/target/debug/deps/bpf_probe_read-e03eb905a5e6209c
  -rwxrwxr-x 1 tamird tamird  35M Jul 12 15:21 /home/tamird/src/aya/target/debug/deps/btf_relocations-57a4fbb38bf06064
  -rwxrwxr-x 1 tamird tamird  31M Jul 12 15:21 /home/tamird/src/aya/target/debug/deps/elf-98b7a32d6d04effb
  -rwxrwxr-x 1 tamird tamird 6.9M Jul 12 15:21 /home/tamird/src/aya/target/debug/deps/integration_test-0dd55ce96bfdad77
  -rwxrwxr-x 1 tamird tamird  34M Jul 12 15:21 /home/tamird/src/aya/target/debug/deps/load-0718562e85b86d03
  -rwxrwxr-x 1 tamird tamird  40M Jul 12 15:21 /home/tamird/src/aya/target/debug/deps/log-dbf355f9ea34068a
  -rwxrwxr-x 1 tamird tamird  36M Jul 12 15:21 /home/tamird/src/aya/target/debug/deps/rbpf-89a1bb848fa5cc3c
  -rwxrwxr-x 1 tamird tamird  34M Jul 12 15:21 /home/tamird/src/aya/target/debug/deps/relocations-cfe655c3bb413d8b
  -rwxrwxr-x 1 tamird tamird  34M Jul 12 15:21 /home/tamird/src/aya/target/debug/deps/smoke-ccd3974180a3fd29

After:
  tamird@pc:~/src/aya$ cargo xtask build-integration-test | xargs ls -lah
      Finished dev [unoptimized + debuginfo] target(s) in 0.05s
       Running `target/debug/xtask build-integration-test`
     Compiling integration-test v0.1.0 (/home/tamird/src/aya/test/integration-test)
      Finished dev [unoptimized + debuginfo] target(s) in 0.90s
  -rwxrwxr-x 1 tamird tamird 47M Jul 12 15:21 /home/tamird/src/aya/target/debug/deps/integration_test-0dd55ce96bfdad77

Since we plan to run these tests in a VM, copying 10x fewer bytes seems
like a win.
1 year ago