# QEMU functional tests:
# Tests that are put in the 'quick' category are run by default during
# 'make check'. Everything that should not be run during 'make check'
# (e.g. tests that fetch assets from the internet) should be put into
# the 'thorough' category instead.

# Most tests run too slow with TCI enabled, so skip the functional tests there
if get_option('tcg_interpreter')
  subdir_done()
endif

# Timeouts for individual tests that can be slow e.g. with debugging enabled
test_timeouts = {
  'aarch64_sbsaref' : 600,
  'aarch64_virt' : 360,
  'acpi_bits' : 240,
  'netdev_ethtool' : 180,
  'ppc_40p' : 240,
  'ppc64_hv' : 1000,
  'ppc64_powernv' : 120,
  'ppc64_pseries' : 120,
  's390x_ccw_virtio' : 180,
}

tests_generic_system = [
  'empty_cpu_model',
  'info_usernet',
  'version',
]

tests_generic_linuxuser = [
]

tests_generic_bsduser = [
]

tests_aarch64_system_thorough = [
  'aarch64_raspi3',
  'aarch64_raspi4',
  'aarch64_sbsaref',
  'aarch64_virt',
  'multiprocess',
]

tests_alpha_system_thorough = [
  'alpha_clipper',
]

tests_arm_system_thorough = [
  'arm_canona1100',
  'arm_integratorcp',
  'arm_raspi2',
]

tests_arm_linuxuser_thorough = [
  'arm_bflt',
]

tests_avr_system_thorough = [
  'avr_mega2560',
]

tests_loongarch64_system_thorough = [
  'loongarch64_virt',
]

tests_m68k_system_thorough = [
  'm68k_mcf5208evb',
  'm68k_nextcube',
  'm68k_q800',
]

tests_microblaze_system_thorough = [
  'microblaze_s3adsp1800'
]

tests_microblazeel_system_thorough = [
  'microblazeel_s3adsp1800'
]

tests_mips_system_thorough = [
  'mips_malta',
]

tests_mipsel_system_thorough = [
  'mipsel_malta',
]

tests_mips64el_system_thorough = [
  'mips64el_fuloong2e',
  'mips64el_loongson3v',
  'mips64el_malta',
]

tests_or1k_system_thorough = [
  'or1k_sim',
]

tests_ppc_system_quick = [
  'ppc_74xx',
]

tests_ppc_system_thorough = [
  'ppc_405',
  'ppc_40p',
  'ppc_amiga',
  'ppc_bamboo',
  'ppc_mpc8544ds',
  'ppc_virtex_ml507',
]

tests_ppc64_system_thorough = [
  'ppc64_hv',
  'ppc64_powernv',
  'ppc64_pseries',
]

tests_rx_system_thorough = [
  'rx_gdbsim',
]

tests_s390x_system_thorough = [
  's390x_ccw_virtio',
  's390x_topology',
]

tests_sparc64_system_thorough = [
  'sparc64_sun4u',
]

tests_x86_64_system_quick = [
  'cpu_queries',
  'mem_addr_space',
  'pc_cpu_hotplug_props',
  'virtio_version',
  'x86_cpu_model_versions',
]

tests_x86_64_system_thorough = [
  'acpi_bits',
  'linux_initrd',
  'multiprocess',
  'netdev_ethtool',
  'virtio_gpu',
]

precache_all = []
foreach speed : ['quick', 'thorough']
  foreach dir : target_dirs

    target_base = dir.split('-')[0]

    if dir.endswith('-softmmu')
      sysmode = 'system'
      test_emulator = emulators['qemu-system-' + target_base]
    elif dir.endswith('-linux-user')
      sysmode = 'linuxuser'
      test_emulator = emulators['qemu-' + target_base]
    elif dir.endswith('-bsd-user')
      sysmode = 'bsduser'
      test_emulator = emulators['qemu-' + target_base]
    else
      continue
    endif

    if speed == 'quick'
      suites = ['func-quick', 'func-' + target_base]
      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
                     + get_variable('tests_generic_' + sysmode)
    else
      suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
      target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
    endif

    test_deps = roms
    test_env = environment()
    if have_tools
      test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
      test_deps += [qemu_img]
    endif
    test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path())
    test_env.set('QEMU_BUILD_ROOT', meson.project_build_root())
    test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
                               meson.current_source_dir())

    foreach test : target_tests
      testname = '@0@-@1@'.format(target_base, test)
      testfile = 'test_' + test + '.py'
      testpath = meson.current_source_dir() / testfile
      teststamp = testname + '.tstamp'
      test_precache_env = environment()
      test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir() / teststamp)
      test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'python:' +
                                          meson.current_source_dir())
      precache = custom_target('func-precache-' + testname,
                               output: teststamp,
                               command: [python, testpath],
                               depend_files: files(testpath),
                               build_by_default: false,
                               env: test_precache_env)
      precache_all += precache

      # Ideally we would add 'precache' to 'depends' here, such that
      # 'build_by_default: false' lets the pre-caching automatically
      # run immediately before the test runs. In practice this is
      # broken in meson, with it running the pre-caching in the normal
      # compile phase https://github.com/mesonbuild/meson/issues/2518
      # If the above bug ever gets fixed, when QEMU changes the min
      # meson version, add the 'depends' and remove the custom
      # 'run_target' logic below & in Makefile.include
      test('func-' + testname,
           python,
           depends: [test_deps, test_emulator, emulator_modules],
           env: test_env,
           args: [testpath],
           protocol: 'tap',
           timeout: test_timeouts.get(test, 60),
           priority: test_timeouts.get(test, 60),
           suite: suites)
    endforeach
  endforeach
endforeach

run_target('precache-functional',
           depends: precache_all,
           command: ['true'])
