orhun / binsider

Analyze ELF binaries like a boss πŸ˜ΌπŸ•΅οΈβ€β™‚οΈ
https://binsider.dev/
Apache License 2.0
1.62k stars 35 forks source link

Nix test failure (test_extract_strings) #27

Closed Titaniumtown closed 1 week ago

Titaniumtown commented 1 week ago

Describe the bug

The test_extract_strings test fails when building from nix.

To reproduce

  1. Have nix installed
  2. run nix run "github:orhun/binsider"

Expected behavior

It should build and pass all tests

Screenshots / Logs

running 2 tests
test test_init ... ok
test test_extract_strings ... FAILED

failures:

---- test_extract_strings stdout ----
thread 'test_extract_strings' panicked at tests/app.rs:41:9:
assertion failed: strings?.iter().map(|(s, _)| s).any(|v| v == ".debug_str")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    test_extract_strings

test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.09s

Software information

Titaniumtown commented 1 week ago

Initial inspection, it works if I clone the repo manually and run cargo test (on 1.83.0-nightly (adaff5368 2024-09-12))

orhun commented 1 week ago

Hello, thanks for the report! πŸ‘‹πŸΌ

First of all I really hate that test - we need a better test suite (#5)

Secondly, is there a chance that you are running tests in --release mode and that's why .debug_str does not exist in the binary?

ch4og commented 1 week ago

I had the same issue. Nix by default runs test in release mode, but after switching to debug mode it still didn't pass checks.

I don't know how cargo and rust work but doing https://github.com/orhun/binsider/pull/30 fixed building for me.

Titaniumtown commented 1 week ago

Hello, thanks for the report! πŸ‘‹πŸΌ

First of all I really hate that test - we need a better test suite (#5)

Secondly, is there a chance that you are running tests in --release mode and that's why .debug_str does not exist in the binary?

Thank you for your response. I believe nix runs it in release mode. I'll test @ch4og's PR and report back :)