code: def run_recipe_tests(
      recipe_folder="tests/recipes",
      script_field="Script_file",
      hparam_field="Hparam_file",
      test_field="test_debug_flags",
      check_field="test_debug_checks",
      run_opts="--device=cpu",
      output_folder="tests/tmp/",
      filters_fields=[],
      filters=[],
      do_checks=True,
      download_only=False,
      run_tests_with_checks_only=False,
  ):
      """Runs the recipes tests.
  
      Arguments
      ---------
      recipe_folder: path
          Path of the folder containing csv recipe files summarizing all the recipes in the repo.
      script_field: str
          Field of the csv recipe file containing the path of the script to run.
      hparam_field: str
          Field of the csv recipe file containing the path of the hparam file.
      test_field: string
          Field of the csv recipe file containing the test flags.
      check_field: string
          Field of the csv recipe file containing the checks to perform.
      run_opts: string
          Additional flags to add for the tests (see run_opts of speechbrain/core.py).
      output_folder: string
          Folder where the output of the tests are saved.
      filters_fields: list
          This can be used with the "filter" variable
          to run only some tests. For instance, filters_fileds=['Task'] and filters=['ASR'])
          will only run tests for ASR recipes.
      filters: list
          See above.
      do_checks: bool (default: True)
          If True performs the checks on the output folder (when the check_field is not empty).
      download_only: bool (default: False)
          If True skips running/checking tests after downloading relevant pre-trained data (prepare for offline testing).
      run_tests_with_checks_only: bool (default: False)
          If True skips all tests that do not have performance check criteria defined.
  
      Returns
      -------
      check: True
          True if all the recipe tests pass, False otherwise.
  
      Example
      -------
      python -c 'from speechbrain.utils.recipe_tests import run_recipe_tests; print("TEST FAILED!") if not(run_recipe_tests(filters_fields=["Dataset", "Task"], filters=[["AISHELL-1", "CommonVoice"], "SSL"])) else print("TEST PASSED")'
      """
      # Create the output folder (where the tests results will be saved)
      os.makedirs(output_folder, exist_ok=True)
      print("Test ouputs will be put in %s" % (output_folder))
  
      # Read the csv recipe file and detect which tests we have to run
      (
          test_script,
          test_hparam,
          test_flag,
          test_check,
          test_download,
          test_message,
      ) = prepare_test(
          recipe_folder,
          script_field,
          hparam_field,
          test_field=test_field,
          check_field=check_field,
          filters_fields=filters_fields,
          filters=filters,
      )
  
      # Early stop if there are no recipes to test
      if len(test_script) == 0:
          print(
              "No recipes found for testing (please check recipe filters)."
          )
          return False
  
      # Download all upfront
      if download_only:
          download_only_test(
              test_script,
              test_hparam,
              test_flag,
              test_check,
              run_opts,
              run_tests_with_checks_only,
              output_folder,
          )
          return False
  
      # Run  script (check how to get std out, std err and save them in files)
      check = True
      for i, recipe_id in enumerate(sorted(test_script.keys())):
          # Check if the output folder is specified in test_field
          spec_outfold = False
          if "--output_folder" in test_flag[recipe_id]:
              pattern = r"--output_folder\s*=?\s*([^\s']+|'[^']*')"
              match = re.search(pattern, test_flag[recipe_id])
              output_fold = match.group(1).strip("'")
              spec_outfold = True
          else:
              output_fold = os.path.join(output_folder, recipe_id)
              os.makedirs(output_fold, exist_ok=True)
  
          # Create files for storing standard input and standard output
          stdout_file = os.path.join(output_fold, "stdout.txt")
          stderr_file = os.path.join(output_fold, "stderr.txt")
  
          # If we are interested in performance checks only, skip
          check_str = test_check[recipe_id].strip()
          if run_tests_with_checks_only:
              if len(check_str) == 0:
                  continue
  
          print(
              "(%i/%i) Running test for %s..."
              % (i + 1, len(test_script.keys()), recipe_id)
          )
  
          if recipe_id in test_download:
              download_cmds = test_download[recipe_id].split(";")
              for download_cmd in download_cmds:
                  print("\t" + download_cmd)
                  eval(download_cmd)
  
          # Check for setup scripts
          setup_script = os.path.join(
              "tests/recipes/setup",
              test_script[recipe_id][:-3].replace("/", "_"),
              test_hparam[recipe_id]
              .replace(os.path.dirname(test_script[recipe_id]), "")[
                  1:-5
              ]
              .replace("/", "_"),
          )
          if os.path.exists(setup_script):
              os.system(setup_script)
  
          # Composing command to run
          cmd = (
              f"PYTHONPATH={os.getcwd() + '/' + os.path.dirname(test_script[recipe_id])} python "
              + test_script[recipe_id]
              + " "
              + test_hparam[recipe_id]
              + " "
              + test_flag[recipe_id]
              + " "
              + run_opts
          )
  
          if not spec_outfold:
              cmd = cmd + " --output_folder=" + output_fold
  
          # add --debug if no do_checks to save testing time
          if not do_checks:
              cmd += " --debug --debug_persistently"
  
          # Print message (if any)
          if recipe_id in test_message:
              print("\t\t" + test_message[recipe_id])
  
          # Running the test
          time_start = time()
          return_code = run_test_cmd(cmd, stdout_file, stderr_file)
          test_duration = time() - time_start
          print("\t... %.2fs" % test_duration)
  
          # Tear down
          td_script = os.path.join(
              os.path.dirname(setup_script), "tear_down"
          )
          if os.path.exists(td_script):
              os.system(td_script)
  
          # Check return code
          if return_code != 0:
              print(
                  "\tERROR: Error in %s (%s). Check %s and %s for more info."
                  % (
                      recipe_id,
                      test_hparam[recipe_id],
                      stderr_file,
                      stdout_file,
                  )
              )
              check = False
  
          # Checks
          if do_checks and len(check_str) > 0:
              print("\t...checking files & performance...")
  
              # Check if the expected files exist
              check &= check_files(check_str, output_fold, recipe_id)
              check &= check_performance(
                  check_str, output_fold, recipe_id
              )
  
      return check
  
file_path: speechbrain/tests/utils/recipe_tests.py
imports: import os
  import re
  import csv
  import sys
  import pydoc
  from time import time
  import subprocess
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.data_utils import download_file
label_desc: Use image node_id 8 for calling a global function with example usage: run_recipe_tests(recipe_folder, script_field, hparam_field, test_field, check_field, run_opts, output_folder, filters_fields, filters, do_checks, download_only, run_tests_with_checks_only) and returns: check, False, False