Browse Source

Run tests with powerset of features

Tamir Duberstein 1 year ago
parent
commit
8e9712a
2 changed files with 24 additions and 3 deletions
  1. 21 3
      .github/workflows/build-aya.yml
  2. 3 0
      aya-obj/src/lib.rs

+ 21 - 3
.github/workflows/build-aya.yml

@@ -34,11 +34,29 @@ jobs:
 
       - uses: Swatinem/rust-cache@v2
 
-      - uses: taiki-e/install-action@cross
+      - uses: taiki-e/install-action@cargo-hack
+
+      - uses: taiki-e/setup-cross-toolchain-action@v1
+        with:
+          target: ${{ matrix.arch }}
+
       - name: Build
-        run: cross build --verbose --target ${{ matrix.arch }}
+        run: |
+          cargo hack build --all-targets --feature-powerset \
+            --exclude aya-bpf \
+            --exclude aya-bpf-bindings \
+            --exclude aya-log-ebpf \
+            --exclude integration-ebpf \
+            --workspace
 
       - name: Test
         env:
           RUST_BACKTRACE: full
-        run: cross test --verbose --target ${{ matrix.arch }}
+        run: |
+          cargo hack test --all-targets --feature-powerset \
+            --exclude aya-bpf \
+            --exclude aya-bpf-bindings \
+            --exclude aya-log-ebpf \
+            --exclude integration-ebpf \
+            --exclude integration-test \
+            --workspace

+ 3 - 0
aya-obj/src/lib.rs

@@ -37,7 +37,10 @@
 //! let bytes = std::fs::read("program.o").unwrap();
 //! let mut object = Object::parse(&bytes).unwrap();
 //! // Relocate the programs
+//! #[cfg(feature = "std")]
 //! let text_sections = std::collections::HashSet::new();
+//! #[cfg(not(feature = "std"))]
+//! let text_sections = hashbrown::HashSet::new();
 //! object.relocate_calls(&text_sections).unwrap();
 //! object.relocate_maps(std::iter::empty(), &text_sections).unwrap();
 //!