ci: replace fuzz toolchain

old: `actions-rs/toolchain`
new: `dtolnay/rust-toolchain`

fix

ci(fuzz): change runner to ubuntu-latest

ci: update run syntax in fuzz job

ci: update and run fuzz/generate-files.sh
This commit is contained in:
Einherjar 2023-10-08 06:19:06 -03:00
parent 2095faed71
commit 20f3a05d2a
No known key found for this signature in database
GPG Key ID: E7ED7E35F072CA83
4 changed files with 78 additions and 81 deletions

View File

@ -11,29 +11,29 @@ on:
jobs: jobs:
fuzz: fuzz:
if: ${{ !github.event.act }} if: ${{ !github.event.act }}
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
fuzz_target: [ fuzz_target: [
bitcoin_outpoint_string,
bitcoin_deserialize_amount,
bitcoin_deserialize_transaction,
bitcoin_deser_net_msg, bitcoin_deser_net_msg,
bitcoin_deserialize_address, bitcoin_deserialize_address,
bitcoin_script_bytes_to_asm_fmt, bitcoin_deserialize_amount,
bitcoin_deserialize_prefilled_transaction,
bitcoin_deserialize_witness,
bitcoin_deserialize_psbt,
bitcoin_deserialize_block, bitcoin_deserialize_block,
bitcoin_deserialize_prefilled_transaction,
bitcoin_deserialize_psbt,
bitcoin_deserialize_script, bitcoin_deserialize_script,
hashes_json, bitcoin_deserialize_transaction,
bitcoin_deserialize_witness,
bitcoin_outpoint_string,
bitcoin_script_bytes_to_asm_fmt,
hashes_cbor, hashes_cbor,
hashes_sha256, hashes_json,
hashes_ripemd160, hashes_ripemd160,
hashes_sha512_256,
hashes_sha512,
hashes_sha1, hashes_sha1,
hashes_sha256,
hashes_sha512,
hashes_sha512_256,
] ]
steps: steps:
- name: Install test dependencies - name: Install test dependencies
@ -47,11 +47,9 @@ hashes_sha1,
fuzz/target fuzz/target
target target
key: cache-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} key: cache-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1 - uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: "1.65.0" toolchain: '1.65.0'
override: true
profile: minimal
- name: fuzz - name: fuzz
run: | run: |
if [[ "${{ matrix.fuzz_target }}" =~ ^bitcoin ]]; then if [[ "${{ matrix.fuzz_target }}" =~ ^bitcoin ]]; then

View File

@ -16,74 +16,74 @@ serde = { version = "1.0.103", features = [ "derive" ] }
serde_json = "1.0" serde_json = "1.0"
serde_cbor = "0.9" serde_cbor = "0.9"
[[bin]]
name = "bitcoin_outpoint_string"
path = "fuzz_targets/bitcoin/outpoint_string.rs"
[[bin]]
name = "bitcoin_deserialize_amount"
path = "fuzz_targets/bitcoin/deserialize_amount.rs"
[[bin]]
name = "bitcoin_deserialize_transaction"
path = "fuzz_targets/bitcoin/deserialize_transaction.rs"
[[bin]] [[bin]]
name = "bitcoin_deser_net_msg" name = "bitcoin_deser_net_msg"
path = "fuzz_targets/bitcoin/deser_net_msg.rs" path = "fuzz_targets//bitcoin/deser_net_msg.rs"
[[bin]] [[bin]]
name = "bitcoin_deserialize_address" name = "bitcoin_deserialize_address"
path = "fuzz_targets/bitcoin/deserialize_address.rs" path = "fuzz_targets//bitcoin/deserialize_address.rs"
[[bin]] [[bin]]
name = "bitcoin_script_bytes_to_asm_fmt" name = "bitcoin_deserialize_amount"
path = "fuzz_targets/bitcoin/script_bytes_to_asm_fmt.rs" path = "fuzz_targets//bitcoin/deserialize_amount.rs"
[[bin]]
name = "bitcoin_deserialize_prefilled_transaction"
path = "fuzz_targets/bitcoin/deserialize_prefilled_transaction.rs"
[[bin]]
name = "bitcoin_deserialize_witness"
path = "fuzz_targets/bitcoin/deserialize_witness.rs"
[[bin]]
name = "bitcoin_deserialize_psbt"
path = "fuzz_targets/bitcoin/deserialize_psbt.rs"
[[bin]] [[bin]]
name = "bitcoin_deserialize_block" name = "bitcoin_deserialize_block"
path = "fuzz_targets/bitcoin/deserialize_block.rs" path = "fuzz_targets//bitcoin/deserialize_block.rs"
[[bin]]
name = "bitcoin_deserialize_prefilled_transaction"
path = "fuzz_targets//bitcoin/deserialize_prefilled_transaction.rs"
[[bin]]
name = "bitcoin_deserialize_psbt"
path = "fuzz_targets//bitcoin/deserialize_psbt.rs"
[[bin]] [[bin]]
name = "bitcoin_deserialize_script" name = "bitcoin_deserialize_script"
path = "fuzz_targets/bitcoin/deserialize_script.rs" path = "fuzz_targets//bitcoin/deserialize_script.rs"
[[bin]] [[bin]]
name = "hashes_json" name = "bitcoin_deserialize_transaction"
path = "fuzz_targets/hashes/json.rs" path = "fuzz_targets//bitcoin/deserialize_transaction.rs"
[[bin]]
name = "bitcoin_deserialize_witness"
path = "fuzz_targets//bitcoin/deserialize_witness.rs"
[[bin]]
name = "bitcoin_outpoint_string"
path = "fuzz_targets//bitcoin/outpoint_string.rs"
[[bin]]
name = "bitcoin_script_bytes_to_asm_fmt"
path = "fuzz_targets//bitcoin/script_bytes_to_asm_fmt.rs"
[[bin]] [[bin]]
name = "hashes_cbor" name = "hashes_cbor"
path = "fuzz_targets/hashes/cbor.rs" path = "fuzz_targets//hashes/cbor.rs"
[[bin]] [[bin]]
name = "hashes_sha256" name = "hashes_json"
path = "fuzz_targets/hashes/sha256.rs" path = "fuzz_targets//hashes/json.rs"
[[bin]] [[bin]]
name = "hashes_ripemd160" name = "hashes_ripemd160"
path = "fuzz_targets/hashes/ripemd160.rs" path = "fuzz_targets//hashes/ripemd160.rs"
[[bin]]
name = "hashes_sha512_256"
path = "fuzz_targets/hashes/sha512_256.rs"
[[bin]]
name = "hashes_sha512"
path = "fuzz_targets/hashes/sha512.rs"
[[bin]] [[bin]]
name = "hashes_sha1" name = "hashes_sha1"
path = "fuzz_targets/hashes/sha1.rs" path = "fuzz_targets//hashes/sha1.rs"
[[bin]]
name = "hashes_sha256"
path = "fuzz_targets//hashes/sha256.rs"
[[bin]]
name = "hashes_sha512"
path = "fuzz_targets//hashes/sha512.rs"
[[bin]]
name = "hashes_sha512_256"
path = "fuzz_targets//hashes/sha512_256.rs"

View File

@ -4,7 +4,7 @@ REPO_DIR=$(git rev-parse --show-toplevel)
listTargetFiles() { listTargetFiles() {
pushd "$REPO_DIR/fuzz" > /dev/null || exit 1 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 popd > /dev/null || exit 1
} }
@ -12,7 +12,8 @@ targetFileToName() {
echo "$1" \ echo "$1" \
| sed 's/^fuzz_targets\///' \ | sed 's/^fuzz_targets\///' \
| sed 's/\.rs$//' \ | sed 's/\.rs$//' \
| sed 's/\//_/g' | sed 's/\//_/g' \
| sed 's/^_//g'
} }
targetFileToHFuzzInputArg() { targetFileToHFuzzInputArg() {

View File

@ -53,7 +53,7 @@ on:
jobs: jobs:
fuzz: fuzz:
if: \${{ !github.event.act }} if: \${{ !github.event.act }}
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -63,8 +63,8 @@ $(for name in $(listTargetNames); do echo "$name,"; done)
steps: steps:
- name: Install test dependencies - 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 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/checkout@v4
- uses: actions/cache@v2 - uses: actions/cache@v3
id: cache-fuzz id: cache-fuzz
with: with:
path: | path: |
@ -72,11 +72,9 @@ $(for name in $(listTargetNames); do echo "$name,"; done)
fuzz/target fuzz/target
target target
key: cache-\${{ matrix.target }}-\${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} key: cache-\${{ matrix.target }}-\${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1 - uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: 1.58 toolchain: '1.65.0'
override: true
profile: minimal
- name: fuzz - name: fuzz
run: | run: |
if [[ "\${{ matrix.fuzz_target }}" =~ ^bitcoin ]]; then if [[ "\${{ matrix.fuzz_target }}" =~ ^bitcoin ]]; then
@ -85,7 +83,7 @@ $(for name in $(listTargetNames); do echo "$name,"; done)
echo "Using RUSTFLAGS \$RUSTFLAGS" echo "Using RUSTFLAGS \$RUSTFLAGS"
cd fuzz && ./fuzz.sh "\${{ matrix.fuzz_target }}" cd fuzz && ./fuzz.sh "\${{ matrix.fuzz_target }}"
- run: echo "\${{ matrix.fuzz_target }}" >executed_\${{ matrix.fuzz_target }} - run: echo "\${{ matrix.fuzz_target }}" >executed_\${{ matrix.fuzz_target }}
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v3
with: with:
name: executed_\${{ matrix.fuzz_target }} name: executed_\${{ matrix.fuzz_target }}
path: executed_\${{ matrix.fuzz_target }} path: executed_\${{ matrix.fuzz_target }}
@ -95,8 +93,8 @@ $(for name in $(listTargetNames); do echo "$name,"; done)
needs: fuzz needs: fuzz
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v3
- name: Display structure of downloaded files - name: Display structure of downloaded files
run: ls -R run: ls -R
- run: find executed_* -type f -exec cat {} + | sort > executed - run: find executed_* -type f -exec cat {} + | sort > executed