Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts/pdg.sh: also run analysis #974

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions scripts/pdg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ main() {
local event_log="${test_dir}/log.bc"
local runtime="analysis/runtime"

local crate_name="$(cargo pkgid --manifest-path "${test_dir}/Cargo.toml" | grep -P -o '(?<=#)[^@]+(?=@)' | tr '-' '_')"
(
unset RUSTFLAGS # transpiled code has tons of warnings; don't allow `-D warnings`
export RUST_BACKTRACE=1
Expand Down Expand Up @@ -77,6 +78,26 @@ main() {
--output "${pdg}" \
> "${test_dir}/pdg.log"
)
(
export RUST_BACKTRACE=full # print sources w/ color-eyre
export RUST_LOG=error
export PDG_FILE="${pdg}"
local deps_dir="${CARGO_TARGET_DIR:-target}/${profile_dir_name}/deps"
local libc_dep="$(ls -1 --sort=time -r ${deps_dir}/liblibc-*.rlib | head -n1)"
cargo run \
--bin c2rust-analyze \
"${profile_args[@]}" \
-- \
--crate-name "${crate_name}" \
--edition 2021 \
--crate-type bin \
--sysroot "$(rustc --print sysroot)" \
"-C" \
"metadata=4095517b1921578c" \
Comment on lines +95 to +96
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? What's that hash for? It looks fragile.

"-L" "dependency=${deps_dir}" \
"--extern" "libc=${libc_dep}" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"${test_dir}/src/main.rs"
)
}

main "${@}"
Loading