From bd1df30a7944133374c4696f652515a8cdd1fba2 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 8 May 2024 07:50:22 +1000 Subject: [PATCH] Sort fuzz files when finding Currently we don't sort the output of fuzz file names when finding them, this can lead to different output from `generate-files.sh` on different machines. Set the locale first because it effects sort order then sort the output of `find`. --- .github/workflows/cron-daily-fuzz.yml | 8 ++++---- fuzz/Cargo.toml | 24 ++++++++++++------------ fuzz/fuzz-util.sh | 6 +++++- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cron-daily-fuzz.yml b/.github/workflows/cron-daily-fuzz.yml index 3f62d894f..95582e797 100644 --- a/.github/workflows/cron-daily-fuzz.yml +++ b/.github/workflows/cron-daily-fuzz.yml @@ -18,14 +18,14 @@ jobs: # We only get 20 jobs at a time, we probably don't want to go # over that limit with fuzzing because of the hour run time. fuzz_target: [ -roundtrip_semantic, +compile_descriptor, parse_descriptor, parse_descriptor_secret, +roundtrip_concrete, +roundtrip_descriptor, roundtrip_miniscript_script, roundtrip_miniscript_str, -roundtrip_descriptor, -roundtrip_concrete, -compile_descriptor, +roundtrip_semantic, ] steps: - name: Install test dependencies diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 2e2a071c5..334350f21 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -16,8 +16,8 @@ miniscript = { path = "..", features = [ "compiler" ] } regex = "1.0" [[bin]] -name = "roundtrip_semantic" -path = "fuzz_targets/roundtrip_semantic.rs" +name = "compile_descriptor" +path = "fuzz_targets/compile_descriptor.rs" [[bin]] name = "parse_descriptor" @@ -28,21 +28,21 @@ name = "parse_descriptor_secret" path = "fuzz_targets/parse_descriptor_secret.rs" [[bin]] -name = "roundtrip_miniscript_script" -path = "fuzz_targets/roundtrip_miniscript_script.rs" - -[[bin]] -name = "roundtrip_miniscript_str" -path = "fuzz_targets/roundtrip_miniscript_str.rs" +name = "roundtrip_concrete" +path = "fuzz_targets/roundtrip_concrete.rs" [[bin]] name = "roundtrip_descriptor" path = "fuzz_targets/roundtrip_descriptor.rs" [[bin]] -name = "roundtrip_concrete" -path = "fuzz_targets/roundtrip_concrete.rs" +name = "roundtrip_miniscript_script" +path = "fuzz_targets/roundtrip_miniscript_script.rs" [[bin]] -name = "compile_descriptor" -path = "fuzz_targets/compile_descriptor.rs" +name = "roundtrip_miniscript_str" +path = "fuzz_targets/roundtrip_miniscript_str.rs" + +[[bin]] +name = "roundtrip_semantic" +path = "fuzz_targets/roundtrip_semantic.rs" diff --git a/fuzz/fuzz-util.sh b/fuzz/fuzz-util.sh index 804e0da92..dcce45256 100755 --- a/fuzz/fuzz-util.sh +++ b/fuzz/fuzz-util.sh @@ -2,9 +2,13 @@ REPO_DIR=$(git rev-parse --show-toplevel) +# Sort order is effected by locale. See `man sort`. +# > Set LC_ALL=C to get the traditional sort order that uses native byte values. +export LC_ALL=C + listTargetFiles() { pushd "$REPO_DIR/fuzz" > /dev/null || exit 1 - find fuzz_targets/ -type f -name "*.rs" + find fuzz_targets/ -type f -name "*.rs" | sort popd > /dev/null || exit 1 }