diff --git a/listings/ch11-writing-automated-tests/listing-11-13/output.txt b/listings/ch11-writing-automated-tests/listing-11-13/output.txt index e213b9c38..1f926b578 100644 --- a/listings/ch11-writing-automated-tests/listing-11-13/output.txt +++ b/listings/ch11-writing-automated-tests/listing-11-13/output.txt @@ -8,7 +8,7 @@ test tests::internal ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out - Running target/debug/deps/integration_test-82e7799c1bc62298 + Running target/debug/deps/integration_test-92948b65e88960b4 running 1 test test it_adds_two ... ok diff --git a/listings/ch11-writing-automated-tests/no-listing-12-shared-test-code-problem/output.txt b/listings/ch11-writing-automated-tests/no-listing-12-shared-test-code-problem/output.txt index 0637a1068..7fd5f5ac5 100644 --- a/listings/ch11-writing-automated-tests/no-listing-12-shared-test-code-problem/output.txt +++ b/listings/ch11-writing-automated-tests/no-listing-12-shared-test-code-problem/output.txt @@ -8,13 +8,13 @@ test tests::internal ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out - Running target/debug/deps/common-7064e1b6d2e271be + Running target/debug/deps/common-92948b65e88960b4 running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out - Running target/debug/deps/integration_test-82e7799c1bc62298 + Running target/debug/deps/integration_test-92948b65e88960b4 running 1 test test it_adds_two ... ok diff --git a/listings/ch12-an-io-project/listing-12-19/output.txt b/listings/ch12-an-io-project/listing-12-19/output.txt index fa1490152..bf63e7352 100644 --- a/listings/ch12-an-io-project/listing-12-19/output.txt +++ b/listings/ch12-an-io-project/listing-12-19/output.txt @@ -8,7 +8,7 @@ test tests::one_result ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out - Running target/debug/deps/minigrep-caf9dbee196c78b9 + Running target/debug/deps/minigrep-4672b652f7794785 running 0 tests diff --git a/listings/ch12-an-io-project/listing-12-21/output.txt b/listings/ch12-an-io-project/listing-12-21/output.txt index 3d7cf26d1..f24c07583 100644 --- a/listings/ch12-an-io-project/listing-12-21/output.txt +++ b/listings/ch12-an-io-project/listing-12-21/output.txt @@ -9,7 +9,7 @@ test tests::case_sensitive ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out - Running target/debug/deps/minigrep-caf9dbee196c78b9 + Running target/debug/deps/minigrep-4672b652f7794785 running 0 tests diff --git a/tools/update-rustc.sh b/tools/update-rustc.sh index 201f076ff..179fa5b13 100755 --- a/tools/update-rustc.sh +++ b/tools/update-rustc.sh @@ -39,6 +39,9 @@ find -s listings -name output.txt -print0 | while IFS= read -r -d '' f; do # Save the previous compile time; we're going to keep it to minimize diff churn compile_time=$(sed -E -ne "s/.*Finished (dev|test) \[unoptimized \+ debuginfo] target\(s\) in ([0-9.]*).*/\2/p" ${full_output_path}) + # Save the hash from the first test binary; we're going to keep it to minimize diff churn + test_binary_hash=$(sed -E -ne "s/.*Running target\/debug\/deps\/[^-]*-([^\s]*)/\1/p" ${full_output_path} | head -n 1) + # Act like this is the first time this listing has been built cargo clean @@ -62,6 +65,11 @@ find -s listings -name output.txt -print0 | while IFS= read -r -d '' f; do sed -i '' -E -e "s/Finished (dev|test) \[unoptimized \+ debuginfo] target\(s\) in [0-9.]*/Finished \1 [unoptimized + debuginfo] target(s) in ${compile_time}/" ${full_output_path} fi + # Restore the previous test binary hash, if there is one + if [ -n "${test_binary_hash}" ]; then + sed -i '' -E -e "s/Running target\/debug\/deps\/([^-]*)-([^\s]*)$/Running target\/debug\/deps\/\1-${test_binary_hash}/g" ${full_output_path} + fi + cd - > /dev/null done