This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 105753340 ci: Add services fuzz test for read/write/range_read (#2710)
105753340 is described below

commit 105753340cacb3d185f982ebdda509a425d652b6
Author: dqhl76 <[email protected]>
AuthorDate: Wed Jul 26 22:07:35 2023 +0800

    ci: Add services fuzz test for read/write/range_read (#2710)
---
 .github/workflows/fuzz_test.yml | 159 ++++++++++++++++++++++++++++++++++++++++
 core/fuzz/utils.rs              |   1 +
 2 files changed, 160 insertions(+)

diff --git a/.github/workflows/fuzz_test.yml b/.github/workflows/fuzz_test.yml
new file mode 100644
index 000000000..1a11e06aa
--- /dev/null
+++ b/.github/workflows/fuzz_test.yml
@@ -0,0 +1,159 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+name: Fuzz Test
+
+on:
+  push:
+    branches:
+      - main
+  pull_request:
+    branches:
+      - main
+    paths:
+      - "core/src/**"
+      - "!core/src/docs/**"
+      - "!core/src/services/**"
+      - "core/src/services/fs/**"
+      - "core/src/services/memory/**"
+      - "core/src/services/s3/**"
+      - ".github/workflows/fuzz_test.yml"
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
+  cancel-in-progress: true
+
+jobs:
+  fuzz-test-build-target:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - name: Setup Rust toolchain
+        uses: ./.github/actions/setup
+      - name: Install cargo fuzz
+        shell: bash
+        run: rustup install nightly && cargo +nightly install cargo-fuzz
+      - name: Build Fuzz Targets
+        shell: bash
+        working-directory: core/fuzz
+        run: cargo +nightly fuzz build
+      - name: Upload build artifacts
+        uses: actions/upload-artifact@v3
+        with:
+          name: fuzz_targets
+          path: ./target/x86_64-unknown-linux-gnu/release/fuzz_*
+  fuzz-test-run-s3:
+    runs-on: ubuntu-latest
+    needs: fuzz-test-build-target
+    services:
+      minio:
+        image: wktk/minio-server
+        ports:
+          - 9000:9000
+        env:
+          MINIO_ACCESS_KEY: "minioadmin"
+          MINIO_SECRET_KEY: "minioadmin"
+    strategy:
+      fail-fast: true
+      matrix:
+        fuzz-targets: [ fuzz_reader, fuzz_range_reader, fuzz_writer ]
+    steps:
+      - name: Setup Test Bucket
+        env:
+          AWS_ACCESS_KEY_ID: "minioadmin"
+          AWS_SECRET_ACCESS_KEY: "minioadmin"
+          AWS_EC2_METADATA_DISABLED: "true"
+        run: aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test
+      - name: Download Fuzz Targets
+        uses: actions/download-artifact@v3
+        with:
+          name: fuzz_targets
+          path: ./target
+      - name: Grant Execute Permissions
+        shell: bash
+        run: chmod +x ./target/${{ matrix.fuzz-targets }}
+      - name: Run Fuzz Test
+        shell: bash
+        run: ./target/${{ matrix.fuzz-targets }} -max_total_time=120
+        env:
+          OPENDAL_S3_TEST: on
+          OPENDAL_S3_BUCKET: test
+          OPENDAL_S3_ENDPOINT: "http://127.0.0.1:9000";
+          OPENDAL_S3_ACCESS_KEY_ID: minioadmin
+          OPENDAL_S3_SECRET_ACCESS_KEY: minioadmin
+      - name: Upload Crash Files
+        if: ${{ failure() }}
+        uses: actions/upload-artifact@v3
+        with:
+          name: crash_s3_${{ matrix.fuzz-targets }}_${{ github.event_name 
}}_${{ github.run_attempt }}_${{ github.sha }}
+          path: ./crash*
+  fuzz-test-run-fs:
+    runs-on: ubuntu-latest
+    needs: fuzz-test-build-target
+    strategy:
+      fail-fast: true
+      matrix:
+        fuzz-targets: [ fuzz_reader, fuzz_range_reader, fuzz_writer ]
+    steps:
+      - name: Download Fuzz Targets
+        uses: actions/download-artifact@v3
+        with:
+          name: fuzz_targets
+          path: ./target
+      - name: Grant Execute Permissions
+        shell: bash
+        run: chmod +x ./target/${{ matrix.fuzz-targets }}
+      - name: Run Fuzz Test
+        shell: bash
+        run: ./target/${{ matrix.fuzz-targets }} -max_total_time=120
+        env:
+          OPENDAL_FS_TEST: on
+          OPENDAL_FS_ROOT: ${{ runner.temp }}/
+      - name: Upload Crash Files
+        uses: actions/upload-artifact@v3
+        if: ${{ failure() }}
+        with:
+          name: crash_fs_${{ matrix.fuzz-targets }}_${{ github.event_name 
}}_${{ github.run_attempt }}_${{ github.sha }}
+          path: ./crash*
+  fuzz-test-run-memory:
+    runs-on: ubuntu-latest
+    needs: fuzz-test-build-target
+    strategy:
+      fail-fast: true
+      matrix:
+        fuzz-targets: [ fuzz_reader, fuzz_range_reader, fuzz_writer ]
+    steps:
+      - name: Download Fuzz Targets
+        uses: actions/download-artifact@v3
+        with:
+          name: fuzz_targets
+          path: ./target
+      - name: Grant Execute Permissions
+        shell: bash
+        run: chmod +x ./target/${{ matrix.fuzz-targets }}
+      - name: Run Fuzz Test
+        shell: bash
+        run: ./target/${{ matrix.fuzz-targets }} -max_total_time=120
+        env:
+          OPENDAL_MEMORY_TEST: on
+      - name: Upload Crash Files
+        if: ${{ failure() }}
+        uses: actions/upload-artifact@v3
+        with:
+          name: crash_memory_${{ matrix.fuzz-targets }}_${{ github.event_name 
}}_${{ github.run_attempt }}_${{ github.sha }}
+          path: ./crash*
diff --git a/core/fuzz/utils.rs b/core/fuzz/utils.rs
index e17c3e2e8..83b708a9c 100644
--- a/core/fuzz/utils.rs
+++ b/core/fuzz/utils.rs
@@ -47,5 +47,6 @@ pub fn init_services() -> Vec<(&'static str, 
Option<Operator>)> {
     vec![
         ("fs", service::<services::Fs>()),
         ("memory", service::<services::Memory>()),
+        ("s3", service::<services::S3>()),
     ]
 }

Reply via email to