Skip to content

Commit

Permalink
Merge #1565
Browse files Browse the repository at this point in the history
1565: fix(io-engine/rebuild): read asan options and backtrace at runtime r=tiagolobocastro a=tiagolobocastro

    refactor(io-engine): tidy up print asan vars

    Use macro to avoid repeating var name.

    Signed-off-by: Tiago Castro <[email protected]>

---

    fix(io-engine/rebuild): read asan options and backtrace at runtime

    ASAN_OPTIONS and RUST_BACKTRACE were mistakenly read at compile time.
    Specifically RUST_BACKTRACE was causing rebuilds when read at compile time as
    it seems its value changes.

    Signed-off-by: Tiago Castro <[email protected]>

Co-authored-by: Tiago Castro <[email protected]>
  • Loading branch information
mayastor-bors and tiagolobocastro committed Dec 21, 2023
2 parents 551abe7 + 671d301 commit 5d698d7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
32 changes: 16 additions & 16 deletions io-engine/src/core/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,23 +1070,23 @@ fn make_hostnqn(node_name: Option<&String>) -> Option<String> {
}

fn print_asan_env() {
fn print_var(s: &str, v: Option<&str>) {
let v = v.unwrap_or_default();
info!(" {s:25} = {v}");
macro_rules! print_compile_var {
($name:literal) => {
let value = option_env!($name).unwrap_or_default();
info!(" {:25} = {value}", $name);
};
}
fn print_run_var(name: &str) {
let value = std::env::var(name).unwrap_or_default();
info!(" {name:25} = {value}");
}

warn!("Compiled with Address Sanitizer enabled");
print_var("ASAN_OPTIONS", option_env!("ASAN_OPTIONS"));
print_var("ASAN_BUILD_ENV", option_env!("ASAN_BUILD_ENV"));
print_var("RUSTFLAGS", option_env!("RUSTFLAGS"));
print_var(
"CARGO_BUILD_RUSTFLAGS",
option_env!("CARGO_BUILD_RUSTFLAGS"),
);
print_var("CARGO_BUILD_TARGET", option_env!("CARGO_BUILD_TARGET"));
print_var(
"CARGO_PROFILE_DEV_PANIC",
option_env!("CARGO_PROFILE_DEV_PANIC"),
);
print_var("RUST_BACKTRACE", option_env!("RUST_BACKTRACE"));
print_run_var("ASAN_OPTIONS");
print_compile_var!("ASAN_BUILD_ENV");
print_compile_var!("RUSTFLAGS");
print_compile_var!("CARGO_BUILD_RUSTFLAGS");
print_compile_var!("CARGO_BUILD_TARGET");
print_compile_var!("CARGO_PROFILE_DEV_PANIC");
print_run_var("RUST_BACKTRACE");
}
13 changes: 11 additions & 2 deletions scripts/pytest-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ then
exit 1
fi

cd "$SRCDIR/test/python" && source ./venv/bin/activate
pushd "$SRCDIR/test/python" >/dev/null && source ./venv/bin/activate && popd >/dev/null

TEST_LIST=
while [ "$#" -gt 0 ]; do
Expand All @@ -81,12 +81,21 @@ while [ "$#" -gt 0 ]; do
exit 0
;;
*)
TEST_LIST="$TEST_LIST \n$1"
set +e
real_1="$(realpath $1 2>/dev/null)"
set -e
param="$1"
if [ -d "$real_1" ] || [ -f "$real_1" ] || [ -f "${real_1%::*}" ]; then
param="$real_1"
fi
TEST_LIST="$TEST_LIST \n$param"
;;
esac
shift
done

cd "$SRCDIR/test/python"

# Ensure we cleanup when terminated
trap_setup

Expand Down

0 comments on commit 5d698d7

Please sign in to comment.