# Copyright 2020 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This include iterates through a list of tests and rebases the files so they
# can be consumed by tests/BUILD.gn for use with TracePerfTest.cpp.

import("../../../../gni/angle.gni")

_tests = [
  "trex_200_210",
  "trex_800_810",
  "trex_900_910",
  "trex_1300_1310",
]

angle_trace_perf_sources = [ "perf_tests/TracePerfTest.cpp" ]
angle_trace_perf_data =
    [ "${angle_root}/src/tests/perf_tests/restricted_traces" ]
angle_trace_perf_defines = []

foreach(_test, _tests) {
  _test_dir = "${_test}"
  _test_ctx = "${_test_dir}/${_test}_capture_context1"

  # Similar to capture replay sample, use the file index for sources
  angle_trace_perf_sources +=
      rebase_path(read_file("${_test_ctx}_files.txt", "list lines"),
                  ".",
                  "perf_tests/restricted_traces/${_test_dir}") +
      [
        "perf_tests/restricted_traces/${_test_ctx}.cpp",
        "perf_tests/restricted_traces/${_test_ctx}.h",
      ]

  if (is_android) {
    _test_data_path = "/sdcard/chromium_tests_root/third_party/angle/src/tests/perf_tests/restricted_traces/${_test}"
  } else {
    _test_data_path = rebase_path("${_test_dir}")
  }

  angle_trace_perf_defines +=
      [ "ANGLE_TRACE_DATA_DIR_${_test}=\"${_test_data_path}\"" ]
}
