From 73d81e5f145f8ff8c107602a337eb7c0d31dec11 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 3 May 2024 06:52:04 +1000 Subject: [PATCH 1/2] Follow up from cron-daily-fuzz PR I royally botched up PR #683 which changed fuzzing to run daily, fix it up by doing: - Use the correct yaml file name in `generate-files.sh`. - Actually run `generate-files.sh` to generate the yaml file. - Fix the time UTC comment (the other times were correctly set). --- .github/workflows/cron-daily-fuzz.yml | 24 ++++++++++++------------ fuzz/generate-files.sh | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cron-daily-fuzz.yml b/.github/workflows/cron-daily-fuzz.yml index b00e258da..3f62d894f 100644 --- a/.github/workflows/cron-daily-fuzz.yml +++ b/.github/workflows/cron-daily-fuzz.yml @@ -1,12 +1,12 @@ # Automatically generated by fuzz/generate-files.sh name: Fuzz - on: - push: - branches: - - master - - 'test-ci/**' - pull_request: + schedule: + # 6am every day UTC, this correlates to: + # - 11pm PDT + # - 7am CET + # - 5pm AEDT + - cron: '00 06 * * *' jobs: fuzz: @@ -15,6 +15,8 @@ jobs: strategy: fail-fast: false matrix: + # 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, parse_descriptor, @@ -28,8 +30,8 @@ compile_descriptor, steps: - name: Install test dependencies run: sudo apt-get update -y && sudo apt-get install -y binutils-dev libunwind8-dev libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc libiberty-dev - - uses: actions/checkout@v2 - - uses: actions/cache@v2 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 id: cache-fuzz with: path: | @@ -37,11 +39,9 @@ compile_descriptor, fuzz/target target key: cache-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - toolchain: '1.65' - override: true - profile: minimal + toolchain: '1.65.0' - name: fuzz run: cd fuzz && ./fuzz.sh "${{ matrix.fuzz_target }}" - run: echo "${{ matrix.fuzz_target }}" >executed_${{ matrix.fuzz_target }} diff --git a/fuzz/generate-files.sh b/fuzz/generate-files.sh index 395472218..b2bec2159 100755 --- a/fuzz/generate-files.sh +++ b/fuzz/generate-files.sh @@ -38,12 +38,12 @@ EOF done # 2. Generate .github/workflows/fuzz.yml -cat > "$REPO_DIR/.github/workflows/fuzz.yml" < "$REPO_DIR/.github/workflows/cron-daily-fuzz.yml" < Date: Wed, 8 May 2024 07:50:22 +1000 Subject: [PATCH 2/2] 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 }