Skip to content

Commit

Permalink
Sort fuzz files when finding
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
tcharding committed May 13, 2024
1 parent 73d81e5 commit bd1df30
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/cron-daily-fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
6 changes: 5 additions & 1 deletion fuzz/fuzz-util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit bd1df30

Please sign in to comment.