Commit Graph

110 Commits (47b0dde395b349ed24869651f454ed3adada5a03)

Author SHA1 Message Date
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 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 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 6ac1320707
integration-test: build "fake" by default
Use the environment variable AYA_BUILD_INTEGRATION_BPF to indicate to
the build script that it should *actually* build bpf, otherwise emitting
empty files.

This allows metadata builds to skip costly build steps without
sacrificing ergonomics; all compile-time tools such as cargo clippy work
out of the box.

Cargo even gives each of these builds (depending on the value of the
environment variable) its own cache key, so they do not invalidate each
other when the user alternates between metadata and real builds.

This allows the lint action to move out of the VM.
1 year ago
Tamir Duberstein 8c61fc9ea6
integration-test: compile C probes using build.rs
- Add libbpf as a submodule. This prevents having to plumb its location
  around (which can't be passed to Cargo build scripts) and also
  controls the version against which codegen has run.
- Move bpf written in C to the integration-test crate and define
  constants for each probe.
- Remove magic; each C source file must be directly enumerated in the
  build script and in lib.rs.
1 year ago
Tamir Duberstein e621a09181
Clippy over tests and integration-ebpf
Replace all `assert!(matches!(..))` with `assert_matches!(..)`.

Remove the now-unused build-integration-test xtask command whose logic
doesn't match that of the build-and-run command.
1 year ago
Kenjiro Nakayama 7dfabd07a7 Add pt_regs handling in aya-bpf/args.rs for riscv64
This patch introduces `pt_regs` handling in aya-bpf/args.rs
for the riscv64 architecture. The current CI is disabled
for riscv64 because this implementation is missing.
1 year ago
dependabot[bot] 4f85ff8a7b
build(deps): bump mikepenz/release-changelog-builder-action from 3 to 4 (#624)
Bumps [mikepenz/release-changelog-builder-action](https://github.com/mikepenz/release-changelog-builder-action) from 3 to 4.
- [Release notes](https://github.com/mikepenz/release-changelog-builder-action/releases)
- [Commits](https://github.com/mikepenz/release-changelog-builder-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: mikepenz/release-changelog-builder-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 year ago
Tamir Duberstein 6f286f1d4d
github: update Swatinem/rust-cache@{v1,v2}
I don't understand why, but dependabot isn't updating this. See
https://github.com/dependabot/dependabot-core/issues/7384.
1 year ago
Tamir Duberstein 4e2f8322cc
Build tests with all features
Remove mem::forget::<HashMap>() calls in tests which fail to compile when
HashMap is provided by hashbrown:

  info: running `cargo check --all-targets --no-default-features` on aya-obj (11/23)
      Checking aya-obj v0.1.0 (/home/tamird/src/aya/aya-obj)
  error[E0505]: cannot move out of `map` because it is borrowed
     --> aya-obj/src/relocation.rs:594:21
      |
  578 |         let map = fake_legacy_map(1);
      |             --- binding `map` declared here
  579 |         let maps_by_symbol = HashMap::from([(1, ("test_map", Some(1), &map))]);
      |                                                                       ---- borrow of `map` occurs here
  ...
  594 |         mem::forget(map);
      |                     ^^^ move out of `map` occurs here
  595 |     }
      |     - borrow might be used here, when `maps_by_symbol` is dropped and runs the destructor for type `hashbrown::HashMap<usize, (&str, Option<i32>, &maps::Map)>`

  error[E0505]: cannot move out of `map_1` because it is borrowed
     --> aya-obj/src/relocation.rs:655:21
      |
  632 |         let map_1 = fake_legacy_map(1);
      |             ----- binding `map_1` declared here
  ...
  635 |             (1, ("test_map_1", Some(1), &map_1)),
      |                                         ------ borrow of `map_1` occurs here
  ...
  655 |         mem::forget(map_1);
      |                     ^^^^^ move out of `map_1` occurs here
  656 |         mem::forget(map_2);
  657 |     }
      |     - borrow might be used here, when `maps_by_symbol` is dropped and runs the destructor for type `hashbrown::HashMap<usize, (&str, Option<i32>, &maps::Map)>`

  error[E0505]: cannot move out of `map_2` because it is borrowed
     --> aya-obj/src/relocation.rs:656:21
      |
  633 |         let map_2 = fake_legacy_map(2);
      |             ----- binding `map_2` declared here
  ...
  636 |             (2, ("test_map_2", Some(2), &map_2)),
      |                                         ------ borrow of `map_2` occurs here
  ...
  656 |         mem::forget(map_2);
      |                     ^^^^^ move out of `map_2` occurs here
  657 |     }
      |     - borrow might be used here, when `maps_by_symbol` is dropped and runs the destructor for type `hashbrown::HashMap<usize, (&str, Option<i32>, &maps::Map)>`

  error[E0505]: cannot move out of `map` because it is borrowed
     --> aya-obj/src/relocation.rs:694:21
      |
  678 |         let map = fake_btf_map(1);
      |             --- binding `map` declared here
  679 |         let maps_by_symbol = HashMap::from([(1, ("test_map", Some(1), &map))]);
      |                                                                       ---- borrow of `map` occurs here
  ...
  694 |         mem::forget(map);
      |                     ^^^ move out of `map` occurs here
  695 |     }
      |     - borrow might be used here, when `maps_by_symbol` is dropped and runs the destructor for type `hashbrown::HashMap<usize, (&str, Option<i32>, &maps::Map)>`

  error[E0505]: cannot move out of `map_1` because it is borrowed
     --> aya-obj/src/relocation.rs:755:21
      |
  732 |         let map_1 = fake_btf_map(1);
      |             ----- binding `map_1` declared here
  ...
  735 |             (1, ("test_map_1", Some(1), &map_1)),
      |                                         ------ borrow of `map_1` occurs here
  ...
  755 |         mem::forget(map_1);
      |                     ^^^^^ move out of `map_1` occurs here
  756 |         mem::forget(map_2);
  757 |     }
      |     - borrow might be used here, when `maps_by_symbol` is dropped and runs the destructor for type `hashbrown::HashMap<usize, (&str, Option<i32>, &maps::Map)>`

  error[E0505]: cannot move out of `map_2` because it is borrowed
     --> aya-obj/src/relocation.rs:756:21
      |
  733 |         let map_2 = fake_btf_map(2);
      |             ----- binding `map_2` declared here
  ...
  736 |             (2, ("test_map_2", Some(2), &map_2)),
      |                                         ------ borrow of `map_2` occurs here
  ...
  756 |         mem::forget(map_2);
      |                     ^^^^^ move out of `map_2` occurs here
  757 |     }
      |     - borrow might be used here, when `maps_by_symbol` is dropped and runs the destructor for type `hashbrown::HashMap<usize, (&str, Option<i32>, &maps::Map)>`

  For more information about this error, try `rustc --explain E0505`.
  error: could not compile `aya-obj` due to 6 previous errors
  warning: build failed, waiting for other jobs to finish...
  error: process didn't exit successfully: `/home/tamird/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo check --all-targets --manifest-path aya-obj/Cargo.toml --no-default-features` (exit status: 101)
1 year ago
Tamir Duberstein d5d6a95de6
Replace actions-rs/toolchain with dtolnay/rust-toolchain
See https://github.com/actions-rs/toolchain/issues/216; actions-rs seems
to be unmaintained.
1 year ago
Alessandro Decina 0a1f1a2898
Merge pull request #594 from aya-rs/dependabot/github_actions/mikepenz/release-changelog-builder-action-3
build(deps): bump mikepenz/release-changelog-builder-action from 2 to 3
1 year ago
dependabot[bot] 31301e4f51
build(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
1 year ago
dependabot[bot] 53fb408b02
build(deps): bump mikepenz/release-changelog-builder-action from 2 to 3
Bumps [mikepenz/release-changelog-builder-action](https://github.com/mikepenz/release-changelog-builder-action) from 2 to 3.
- [Release notes](https://github.com/mikepenz/release-changelog-builder-action/releases)
- [Commits](https://github.com/mikepenz/release-changelog-builder-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: mikepenz/release-changelog-builder-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
1 year ago
Tamir Duberstein 8e41cf6f5a
Add github-actions dependabot config 1 year ago
Tamir Duberstein 33a0a2b604
aya: flip feature "no_std" to feature "std"
This fixes `cargo build --all-features` by sidestepping the feature
unification problem described in The Cargo Book[0].

Add `cargo hack --feature-powerset` to CI to enforce that this doesn't
regress (and that all combinations of features work).

Since error_in_core is nightly-only, use core-error and a fake std
module to allow aya-obj to build without std on stable.

[0] https://doc.rust-lang.org/cargo/reference/features.html#feature-unification
1 year ago
Alessandro Decina 455cc95e8f integration-tests: run on macos to get nested virtualization
Switch integration-test host to macos as only macos runners support nested
virtualization. Adjust integration test runner accordingly.
2 years ago
Michal Rostecki 7d19bde66b Unpin Rust nightly
The issues with core::sync::atomic got fixed.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina d33ed21fc4 Pin nightly to nightly-2023-01-10
This until https://github.com/rust-lang/rust/pull/106796 gets fixed
2 years ago
Matteo Nardi 34e040b8e9 tests: use libtest-mimic and fix CI 2 years ago
Michal Rostecki d2b44c1e0f github: Refresh package cache before installing pre-requisites
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Dave Tucker 6ab7148731 bpf: Only use never type with rust nightly
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker dc31e11691 Re-organize into a single workspace
This commit moves the aya-log projects from the subtree and adds them to
the main cargo workspace. It also brings the BPF crates into the
workspace and moves the macro crates up a level since they aren't BPF
code.

Miri was disabled for aya-bpf as the previous config wasn't actually
checking anything.

CI, clippy, fmt and release configurations have all been adjusted
appropriately.

CI was not properly running for other supported arches which was also
ixed here.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 79101e748a test: Replace RTF with Rust
This commit replaces the existing RTF test runner with a simple rust
binary package called - integration-test.

integration-test depends on integration-ebpf, which contains test eBPF
code written in Rust and C. `cargo xtask build-integration-test-ebpf`
can be used to build this code and supress rust-analyzer warnings. It
does require `bpf-linker`, but that is highly likely to be available to
developers of Aya. It also requires a checkout of `libbpf` to extract
headers like bpf-helpers.h.

Since everything is compiled into a single binary, it can be run
be run locally using `cargo xtask integration-test` or remotely using
`./run.sh` which re-uses the bash script from the old test framework
to spawn a VM in which to run the tests.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker cf3c8f355e ci: test aya-bpf-macros on nightly
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 88834c497d ci: Skip riscv64 for bpf
There is a missing pt_regs implementation in args.rs

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 1d06b41e57 ci: Test all architectures
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker ce7a8b7dc1
.github: gen - add rustfmt to toolchain 2 years ago
Dave Tucker 8b7950bb0f .github: use nightly for codegen
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
gianluigi d35680f30c Add riscv64 architecture support to xtask/codegen 2 years ago
Dave Tucker 7e6530ff1e readme: Add unreleased docs link
This rearranges the README to use fancy badges!
And adds links to the docs published on netlify.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 3d820ee473 ci: lint: aya: Skip doctests with miri
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 1f047f0dbe ci: Fix aya-bpf workflow
This was testing the aya crate with the nightly toolchain which wasn't
what was intented

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker d55a47fb3d ci: Fix image build workflow
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker ce93774e0a ci: try running regression tests in a container
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 74ae8ce271 test: Add regression tests
This uses a mix of rust-script, bash, qemu and a test runner called RTF
to add a regression test suite... and wires it into GitHub Actions

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker d2449ca292 ci: add docs to release notes
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker fbed584f78 ci: Add dependencies/codegen to rel notes
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker dc16739b06 ci: Add autogenerated release notes
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker ef42739c65 .github: force push to codegen branch
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker facb01f34b ci: Use crabby-the-crab
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 7e7314ff2b github: Set toolchain override
This ensures that the cache action uses the correct Rust version

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Alessandro Decina ab0d08910d ci: gen: fix workflow 3 years ago
Alessandro Decina f372a4cd5f ci: gen: install cross headers 3 years ago
Dave Tucker 1a4c76e3c4 ci: Update codgen workflow commit message
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker dc4b928ec5 miri: Disable Stacked Borrows and skip some tests
The perf_buffer code fails due to stacked borrows, skip this for now.
munmap isn't supported by miri.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 93e9cd0e00 ci: Add miri
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 16b89fbe72 ci: Add CI for aya-bpf
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 544efdd4d7 ci: Add action for xtask codegen
This commit adds a github action that will
- check out aya and libbpf
- run xtask codegen
- if there is a diff, open commit changes to the codegen branch
- if changes were comitted, open a pull-request

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Alessandro Decina a678f3b38e Add dependabot conf 3 years ago
Dave Tucker 8acb92d61c Remove docs. Update URLs to aya-rs
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 07a21e5822
docs: Initial Commit of Aya Book (#42)
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Alessandro Decina 12ea9f3500 CI: enable clippy for aya, aya-gen and xtask 3 years ago
Alessandro Decina be035bf42c CI: add lint workflow 3 years ago
Alessandro Decina 1d294ba34c CI: don't install bpf-linker
The bpf code isn't tested in CI yet
3 years ago
Sean Young 1196ba1dcc Fix doctest and run them during CI
Signed-off-by: Sean Young <sean@mess.org>
3 years ago
Alessandro Decina d085bdb89f CI: add build-test github action 3 years ago