Skip to content

Commit

Permalink
Move addr2line from examples to src/bin (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipc authored Apr 12, 2024
1 parent e95b34b commit 274a90c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ jobs:
rustup install ${{matrix.rust_channel}}
rustup default ${{matrix.rust_channel}}
- name: Test debug
run: cargo test --verbose
run: |
cargo test --verbose
cargo test --verbose --features bin
- name: Test release
run: cargo test --verbose --release
run: |
cargo test --verbose --release
cargo test --verbose --release --features bin
features:
runs-on: ubuntu-latest
Expand All @@ -49,6 +53,7 @@ jobs:
- run: cargo build --no-default-features --features std-object
- run: cargo build --no-default-features --features fallible-iterator
- run: cargo build --no-default-features --features smallvec
- run: cargo build --no-default-features --features bin

bench:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -98,7 +103,7 @@ jobs:
rustup install stable
rustup default stable
- name: Build addr2line
run: cargo build --example addr2line
run: cargo build --features bin
- name: Run cargo-tarpaulin
run: cargo tarpaulin --skip-clean --ignore-tests --out Lcov --implicit-test-threads
- name: Upload to Coveralls
Expand Down
13 changes: 8 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,21 @@ smallvec = { version = "1", default-features = false, optional = true }
rustc-demangle = { version = "0.1", optional = true }
cpp_demangle = { version = "0.4", default-features = false, features = ["alloc"], optional = true }

# bin dependencies
clap = { version = "4.3.21", features = ["wrap_help"], optional = true }
typed-arena = { version = "2", optional = true }

# Internal feature, only used when building as part of libstd, not part of the
# stable interface of this crate.
core = { version = '1.0.0', optional = true, package = 'rustc-std-workspace-core' }
alloc = { version = '1.0.0', optional = true, package = 'rustc-std-workspace-alloc' }
compiler_builtins = { version = '0.1.2', optional = true }

[dev-dependencies]
clap = { version = "4.3.21", features = ["wrap_help"] }
backtrace = "0.3.13"
findshlibs = "0.10"
libtest-mimic = "0.7.2"
auxiliary = { path = "tests/auxiliary" }
typed-arena = "2"

[profile.release]
debug = true
Expand All @@ -46,6 +48,7 @@ codegen-units = 1
default = ["rustc-demangle", "cpp_demangle", "std-object", "fallible-iterator", "smallvec", "memmap2"]
std = ["gimli/std"]
std-object = ["std", "object", "object/std", "object/compression", "gimli/endian-reader"]
bin = ["default", "dep:clap", "dep:typed-arena"]

# Internal feature, only used when building as part of libstd, not part of the
# stable interface of this crate.
Expand All @@ -54,7 +57,7 @@ rustc-dep-of-std = ['core', 'alloc', 'compiler_builtins', 'gimli/rustc-dep-of-st
[[test]]
name = "output_equivalence"
harness = false
required-features = ["default"]
required-features = ["bin"]

[[test]]
name = "correctness"
Expand All @@ -64,6 +67,6 @@ required-features = ["default"]
name = "parse"
required-features = ["std-object"]

[[example]]
[[bin]]
name = "addr2line"
required-features = ["default"]
required-features = ["bin"]
2 changes: 1 addition & 1 deletion benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dirname=$(perl -e 'use Cwd "abs_path";print abs_path(shift)' "$(dirname "$0")")
fn="target/release/addr2line-$commit"
if [[ ! -e "$fn" ]]; then
cargo build --release --example addr2line
cp target/release/examples/addr2line "$fn"
cp target/release/addr2line "$fn"
fi
if [[ "$ref" != "$commit" ]]; then
ln -sfn "addr2line-$commit" target/release/addr2line-"$ref"
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion tests/output_equivalence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ fn run_test(flags: Option<&str>) -> Result<(), Failed> {
if exe.file_name().unwrap().to_str().unwrap() == "deps" {
assert!(exe.pop());
}
exe.push("examples");
exe.push("addr2line");

assert!(exe.is_file());
Expand Down

0 comments on commit 274a90c

Please sign in to comment.