# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
---
loader: taskgraph.loader.transform:loader

transforms:
    - gecko_taskgraph.transforms.source_test:transforms
    - taskgraph.transforms.task_context
    - gecko_taskgraph.transforms.job:transforms
    - gecko_taskgraph.transforms.task:transforms

kind-dependencies:
    - fetch
    - toolchain
    - build

task-defaults:
    run-on-repo-type: [hg]
    worker-type: b-linux
    description: Python Fuzzing Smoke Tests
    worker:
        max-run-time: 1800
    use-python: default
    attributes:
        retrigger: true
    treeherder:
        symbol: fuzzing-python
        kind: test
        tier: 3
    task-context:
        from-object: {}
        substitution-fields: []
    if-dependencies: [build]

tasks:
    simple:
        platform: linux64/opt
        require-build:
            linux64/opt: build-linux64/opt
        description: Simple Fuzzing Test
        treeherder:
            symbol: simple-fuzzing
        fetches:
            build:
                - target.jsshell.zip
                - target.fuzztest.tests.tar.zst
        worker:
            docker-image: {in-tree: ubuntu2404-test}
            env:
                LD_LIBRARY_PATH: /builds/worker/fetches
                JSSHELL: ./js
        run:
            using: run-task
            command: >-
                cd $MOZ_FETCHES_DIR &&
                python3 tools/fuzzing/smoke/smoke.py

    grizzly-linux64-opt:
        platform: linux64/asan
        worker:
            docker-image: {in-tree: ubuntu2404-test}
            env:
                GECKO_BINARY_PATH: "$MOZ_FETCHES_DIR/firefox/firefox"
        require-build:
            linux64/asan: build-linux64-asan-fuzzing/opt
        run:
            using: python-test
            subsuite: fuzzing
        fetches:
            build:
                - artifact: target.tar.xz
                - artifact: target.gtest.tests.tar.zst
                - artifact: target.mozinfo.json

    grizzly-linux64-debug:
        platform: linux64/debug
        worker:
            docker-image: {in-tree: ubuntu2404-test}
            env:
                GECKO_BINARY_PATH: "$MOZ_FETCHES_DIR/firefox/firefox"
        require-build:
            linux64/debug: build-linux64-fuzzing/debug
        run:
            using: python-test
            subsuite: fuzzing
        fetches:
            build:
                - artifact: target.tar.xz
                - artifact: target.gtest.tests.tar.zst
                - artifact: target.mozinfo.json

    grizzly-linux64-tsan:
        platform: linux64/tsan
        worker:
            docker-image: {in-tree: ubuntu2404-test}
            env:
                GECKO_BINARY_PATH: "$MOZ_FETCHES_DIR/firefox/firefox"
        require-build:
            linux64/tsan: build-linux64-tsan-fuzzing/opt
        run:
            using: python-test
            subsuite: fuzzing
        fetches:
            build:
                - artifact: target.tar.xz
                - artifact: target.gtest.tests.tar.zst
                - artifact: target.mozinfo.json

    grizzly-windows-debug:
        platform: windows2012-32/debug
        worker-type: win11-64-24h2-source
        worker:
            env:
                GECKO_BINARY_PATH: "$MOZ_FETCHES_DIR/firefox/firefox.exe"
        require-build:
            windows2012-32/debug: build-win32-fuzzing/debug
        run:
            using: python-test
            subsuite: fuzzing
        run-on-projects: []
        fetches:
            build:
                - target.zip
                - artifact: target.crashreporter-symbols.zip
                  dest: firefox/symbols
            toolchain:
                - win32-minidump-stackwalk

    grizzly-windows64-opt:
        platform: windows2012-64/asan
        worker-type: win11-64-24h2-source
        worker:
            env:
                GECKO_BINARY_PATH: "$MOZ_FETCHES_DIR/firefox/firefox.exe"
        require-build:
            windows2012-64/asan: build-win64-asan-fuzzing/opt
        run:
            using: python-test
            subsuite: fuzzing
        run-on-projects: []
        fetches:
            build:
                - target.zip

    grizzly-windows64-debug:
        platform: windows2012-64/debug
        worker-type: win11-64-24h2-source
        worker:
            env:
                GECKO_BINARY_PATH: "$MOZ_FETCHES_DIR/firefox/firefox.exe"
        require-build:
            windows2012-64/debug: build-win64-fuzzing/debug
        run:
            using: python-test
            subsuite: fuzzing
        run-on-projects: []
        fetches:
            build:
                - target.zip
                - artifact: target.crashreporter-symbols.zip
                  dest: firefox/symbols
            toolchain:
                - win64-minidump-stackwalk

    grizzly-windows64-ccov:
        platform: windows2012-64/ccov
        worker-type: win11-64-24h2-source
        worker:
            env:
                GECKO_BINARY_PATH: "$MOZ_FETCHES_DIR/firefox/firefox.exe"
        require-build:
            windows2012-64/ccov: build-win64-fuzzing-ccov/opt
        run:
            using: python-test
            subsuite: fuzzing
        run-on-projects: []
        fetches:
            build:
                - target.zip

    grizzly-osx-opt:
        platform: osx-cross/asan
        worker-type: t-osx-1015-r8
        worker:
            env:
                GECKO_BINARY_PATH: "$MOZ_FETCHES_DIR/Nightly.app/Contents/MacOS/firefox"
        require-build:
            osx-cross/asan: build-macosx64-asan-fuzzing/opt
        run:
            using: python-test
            subsuite: fuzzing
        run-on-projects: []
        fetches:
            build:
                - target.dmg

    grizzly-osx-debug:
        platform: osx-cross/debug
        worker-type: t-osx-1015-r8
        worker:
            env:
                GECKO_BINARY_PATH: '"$MOZ_FETCHES_DIR/Firefox NightlyDebug.app/Contents/MacOS/firefox"'
        require-build:
            osx-cross/debug: build-macosx64-fuzzing/debug
        run:
            using: python-test
            subsuite: fuzzing
        run-on-projects: []
        fetches:
            build:
                - target.dmg

    grizzly-osx-aarch64-opt:
        platform: osx-cross-aarch64/asan
        worker-type: t-osx-1500-m4
        worker:
            env:
                GECKO_BINARY_PATH: "$MOZ_FETCHES_DIR/Nightly.app/Contents/MacOS/firefox"
        require-build:
            osx-cross-aarch64/asan: build-macosx64-aarch64-asan-fuzzing/opt
        run:
            using: python-test
            subsuite: fuzzing
        run-on-projects: []
        fetches:
            build:
                - target.dmg

    grizzly-osx-aarch64-debug:
        platform: osx-cross-aarch64/debug
        worker-type: t-osx-1500-m4
        worker:
            env:
                GECKO_BINARY_PATH: '"$MOZ_FETCHES_DIR/Firefox NightlyDebug.app/Contents/MacOS/firefox"'
        require-build:
            osx-cross-aarch64/debug: build-macosx64-aarch64-fuzzing/debug
        run:
            using: python-test
            subsuite: fuzzing
        run-on-projects: []
        fetches:
            build:
                - target.dmg
