Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
d-e-s-o committed Oct 18, 2024
1 parent faca4e1 commit 29463b1
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 18 deletions.
30 changes: 20 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, macos-latest]
runs-on: [ubuntu-latest]
rust: [stable]
profile: [dev, release]
# gsym-in-apk requires `blazesym-dev/generate-unit-test-files`
# feature, which requires `llvm-gsymutil` installed. We don't
# want that dependency in this large OS spanning matrix.
args: ["--workspace --exclude=gsym-in-apk"]
args: ["--workspace --exclude=blazesym-dev --exclude=gsym-in-apk"]
include:
- runs-on: ubuntu-latest
rust: stable
Expand All @@ -49,10 +49,10 @@ jobs:
rust: stable
profile: release
args: "--lib --no-default-features"
- runs-on: windows-latest
- runs-on: macos-latest
rust: stable
profile: dev
args: "--tests --features=blazesym-dev/dont-generate-unit-test-files"
profile: release
args: "--lib --no-default-features"
- runs-on: ubuntu-latest
rust: stable
profile: dev
Expand Down Expand Up @@ -135,10 +135,10 @@ jobs:
env:
LLVM_GSYMUTIL: /usr/bin/llvm-gsymutil-14
steps:
- name: Install required tools
run: sudo apt-get install -y llvm-14 libelf-dev zlib1g-dev
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Install required tools
run: sudo apt-get install -y llvm-14
- name: Check incremental rebuilds
env:
CARGO_OPTS: --workspace --quiet --tests
Expand All @@ -157,15 +157,15 @@ jobs:
env:
LLVM_GSYMUTIL: /usr/bin/llvm-gsymutil-14
steps:
- name: Install required tools
run: sudo apt-get install -y llvm-14 libelf-dev zlib1g-dev
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v5
id: py312
with:
python-version: '3.12'
- name: Install required tools
run: sudo apt-get install -y llvm-14
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install llvm-tools-preview
Expand Down Expand Up @@ -277,6 +277,8 @@ jobs:
env:
LLVM_GSYMUTIL: /usr/bin/llvm-gsymutil-14
steps:
- name: Install development dependencies
run: sudo apt-get install -y libelf-dev zlib1g-dev
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
Expand All @@ -303,6 +305,8 @@ jobs:
env:
LLVM_GSYMUTIL: /usr/bin/llvm-gsymutil-14
steps:
- name: Install development dependencies
run: sudo apt-get install -y libelf-dev zlib1g-dev
- uses: actions/checkout@v4
- name: Install required tools
run: sudo apt-get install -y llvm-14
Expand All @@ -316,6 +320,8 @@ jobs:
# Stack borrows are very experimental. Disable for now.
MIRIFLAGS: '-Zmiri-disable-stacked-borrows'
steps:
- name: Install development dependencies
run: sudo apt-get install -y libelf-dev zlib1g-dev
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
Expand All @@ -339,6 +345,8 @@ jobs:
env:
LLVM_GSYMUTIL: /usr/bin/llvm-gsymutil-14
steps:
- name: Install development dependencies
run: sudo apt-get install -y libelf-dev zlib1g-dev
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo run --example backtrace
Expand Down Expand Up @@ -387,6 +395,8 @@ jobs:
name: Lint with clippy
runs-on: ubuntu-latest
steps:
- name: Install development dependencies
run: sudo apt-get install -y libelf-dev zlib1g-dev
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo clippy --workspace --no-deps --all-targets --features=blazesym-dev/dont-generate-unit-test-files -- -A unknown_lints -D clippy::todo
Expand All @@ -408,4 +418,4 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo doc --workspace --no-deps
- run: cargo doc --workspace --exclude=gsym-in-apk --no-deps
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ members = [
"examples/sym-debuginfod",
"examples/gsym-in-apk",
]
# We don't want every Cargo command to operate on all members, unless
# --workspace is specified.
default-members = ["."]

[package]
name = "blazesym"
Expand Down Expand Up @@ -121,7 +124,7 @@ memmap2 = {version = "0.9", default-features = false}
miniz_oxide = {version = "0.8", default-features = false, features = ["simd", "with-alloc"], optional = true}
nom = {version = "7", optional = true}
rustc-demangle = {version = "0.1.4", optional = true}
tracing = {version = "0.1.27", default-features = false, features = ["attributes"], optional = true}
tracing = {version = "0.1.38", default-features = false, features = ["attributes"], optional = true}
zstd = {version = "0.13.1", default-features = false, optional = true}

[dev-dependencies]
Expand Down
8 changes: 8 additions & 0 deletions data/config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ CONFIG_KERNEL_ZSTD=y
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_WATCH_QUEUE=y
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT=y
CONFIG_BPF_JIT_ALWAYS_ON=y
CONFIG_CPU_ISOLATION=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
Expand Down Expand Up @@ -60,6 +63,7 @@ CONFIG_COMPAT_32=y
CONFIG_COMPAT=y
CONFIG_VIRTUALIZATION=y
CONFIG_JUMP_LABEL=y
CONFIG_MODULES=y
CONFIG_BLOCK=y
CONFIG_BINFMT_ELF=y
CONFIG_COMPAT_BINFMT_ELF=y
Expand Down Expand Up @@ -128,3 +132,7 @@ CONFIG_NLS=y
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ASCII=y
CONFIG_SYMBOLIC_ERRNAME=y
CONFIG_FTRACE=y
CONFIG_FTRACE_SYSCALLS=y
CONFIG_BLK_DEV_IO_TRACE=y
CONFIG_UPROBE_EVENTS=y
1 change: 0 additions & 1 deletion dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ zstd = ["dep:zstd"]
# Enable this feature to opt in to the generation of unit test files.
# Having these test files created is necessary for running tests.
generate-unit-test-files = [
"dep:libbpf-sys",
"dep:tempfile",
"dump_syms",
"libbpf-sys/vendored-libbpf",
Expand Down
7 changes: 1 addition & 6 deletions src/kernel/bpf/prog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::fmt::Display;
use std::fmt::Formatter;
use std::fmt::Result as FmtResult;
use std::iter;
use std::mem::size_of;
use std::os::fd::AsFd as _;
use std::os::fd::AsRawFd as _;
use std::os::fd::BorrowedFd;
Expand Down Expand Up @@ -276,7 +277,6 @@ impl BpfProg {
Some(prog)
}

#[cfg(feature = "bpf")]
fn retrieve_code_info(
&self,
addr: Addr,
Expand Down Expand Up @@ -330,11 +330,6 @@ impl BpfProg {
Ok(code_info)
}

#[cfg(not(feature = "bpf"))]
fn retrieve_code_info(&self, addr: Addr) -> Result<Option<CodeInfo<'_>>> {
Ok(None)
}

pub fn resolve(
&self,
addr: Addr,
Expand Down
2 changes: 2 additions & 0 deletions src/kernel/bpf/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
use std::ffi::c_long;
use std::ffi::c_uint;
use std::io;
use std::mem::size_of;
use std::mem::size_of_val;
use std::os::fd::FromRawFd as _;
use std::os::fd::OwnedFd;
use std::os::fd::RawFd;
Expand Down

0 comments on commit 29463b1

Please sign in to comment.