{
  pkgs,
  lib,
  ...
}: let
  common = pkgs.callPackage ./common.nix {};
in
  pkgs.writeShellScriptBin "run-extended-tests" ''

    ${common}

    echo_header "Running extended tests"

    download_test_images
    setup_go_env
    cd_working_dir

    echo_step "Running tests"
    if ! ${pkgs.go}/bin/go test -tags "runOnTask" -cover ./...
    then
      echo_fail "Failed to run tests"
      exit 1
    fi
    echo_ok "All tests passed"

    echo_step "Running benchmarks"
    if ! ${pkgs.go}/bin/go test -tags "runOnTask,bench" -bench ./...
    then
      echo_fail "Failed to run benchmarks"
      exit 1
    fi
    echo_ok "Benchmarks passed"

    echo_step "Running race tests"
    if ! ${pkgs.go}/bin/go test -tags "runOnTask,race" -race ./...
    then
      echo_fail "Failed to run race tests"
      exit 1
    fi
    echo_ok "race tests passed"

    echo_step "Running fuzz tests"
    if ! ${pkgs.go}/bin/go test -tags "runOnTask,fuzz" -fuzz ./...
    then
      echo_fail "Failed to run fuzz tests"
      exit 1
    fi

    echo_ok "Fuzz tests passed"
    echo_ok "All tests passed"


  ''