Skip to content

use depfile in integrationtests#1123

Merged
davidlattimore merged 4 commits into
wild-linker:mainfrom
YamasouA:ft/read_depfile
Sep 28, 2025
Merged

use depfile in integrationtests#1123
davidlattimore merged 4 commits into
wild-linker:mainfrom
YamasouA:ft/read_depfile

Conversation

@YamasouA

Copy link
Copy Markdown
Contributor

closes #649

This PR try to create dependencyfile and parse the file.

@YamasouA

Copy link
Copy Markdown
Contributor Author

check script

#!/usr/bin/env bash
set -euo pipefail

# Target to watch
LD_OUT="wild/tests/build/rust-integration.rs-llvm-dynamic-host.ld"
SRC="wild/tests/sources/rust-integration.rs"

# mtime (nanoseconds)
mtime_ns() { python3 - "$1" <<'PY'
import os,sys; print(os.stat(sys.argv[1]).st_mtime_ns)
PY
}

# 1st run: expect full link
cargo clean
cargo test --test integration_tests -- --nocapture
t1=$(mtime_ns "$LD_OUT"); echo "t1=$t1"

# 2nd run: no changes -> expect ld skip (mtime unchanged)
cargo test --test integration_tests -- --nocapture
t2=$(mtime_ns "$LD_OUT"); echo "t2=$t2"

if [[ "$t1" != "$t2" ]]; then
  echo "NG: mtime changed on 2nd run (= ld ran)"
  exit 1
else
  echo "OK: mtime unchanged on 2nd run (= ld skipped)"
fi

# 3rd run: touch only the relevant source -> expect relink (mtime changes)
sleep 1                       # cross the second boundary as a safety margin
touch "$SRC"
sleep 1                       # avoid running immediately

cargo test --test integration_tests -- --nocapture
t3=$(mtime_ns "$LD_OUT"); echo "t3=$t3"

if [[ "$t2" == "$t3" ]]; then
  echo "NG: mtime unchanged after touching source (= ld did not run)"
  exit 1
else
  echo "OK: mtime changed after touching source (= ld relinked)"
fi

@lapla-cogito lapla-cogito left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for working on this!

Comment thread wild/tests/integration_tests.rs
Comment thread wild/tests/integration_tests.rs Outdated
Comment thread wild/tests/integration_tests.rs Outdated
@YamasouA

Copy link
Copy Markdown
Contributor Author

@lapla-cogito
Thank you for your quick review.
I fix your comment.

@davidlattimore davidlattimore merged commit 852f064 into wild-linker:main Sep 28, 2025
19 checks passed
@davidlattimore

Copy link
Copy Markdown
Member

Thanks for doing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stale test build dir causes test failure after rustc update

3 participants