Home | History | Annotate | Download | only in test
      1 # Copyright (C) 2018 The Android Open Source Project
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
      4 # you may not use this file except in compliance with the License.
      5 # You may obtain a copy of the License at
      6 #
      7 #      http://www.apache.org/licenses/LICENSE-2.0
      8 #
      9 # Unless required by applicable law or agreed to in writing, software
     10 # distributed under the License is distributed on an "AS IS" BASIS,
     11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
     14 
     15 import("../gn/fuzzer.gni")
     16 import("../gn/perfetto.gni")
     17 import("//build_overrides/build.gni")
     18 
     19 source_set("end_to_end_integrationtests") {
     20   testonly = true
     21   deps = [
     22     ":task_runner_thread",
     23     ":task_runner_thread_delegates",
     24     ":test_helper",
     25     "../gn:default_deps",
     26     "../gn:gtest_deps",
     27     "../include/perfetto/traced",
     28     "../protos/perfetto/trace:lite",
     29     "../protos/perfetto/trace:zero",
     30     "../src/base:base",
     31     "../src/base:test_support",
     32     "../src/traced/probes/ftrace",
     33   ]
     34   sources = [
     35     "end_to_end_integrationtest.cc",
     36   ]
     37   if (is_android && (perfetto_build_standalone || perfetto_build_with_android)) {
     38     deps += [ "../src/base:android_task_runner" ]
     39   }
     40   if (start_daemons_for_testing) {
     41     cflags = [ "-DPERFETTO_START_DAEMONS_FOR_TESTING" ]
     42 
     43     # In CTS mode we use /syste/bin/perfetto for the cmdline tests and the
     44     # perfetto_cmd is not required. Outside of CTS mode, instead, we need to
     45     # build the cmdline code as part of the test executable.
     46     deps += [
     47       "../src/perfetto_cmd",
     48       "../src/perfetto_cmd:trigger_perfetto_cmd",
     49     ]
     50   }
     51 }
     52 
     53 perfetto_fuzzer_test("end_to_end_shared_memory_fuzzer") {
     54   sources = [
     55     "end_to_end_shared_memory_fuzzer.cc",
     56   ]
     57   testonly = true
     58   deps = [
     59     ":task_runner_thread",
     60     ":task_runner_thread_delegates",
     61     ":test_helper",
     62     "../gn:default_deps",
     63     "../protos/perfetto/trace:lite",
     64     "../src/base:test_support",
     65     "../src/protozero",
     66     "../src/tracing",
     67     "../src/tracing:ipc",
     68   ]
     69 }
     70 
     71 source_set("task_runner_thread") {
     72   testonly = true
     73   deps = [
     74     "../gn:default_deps",
     75     "../src/base",
     76     "../src/base:test_support",
     77   ]
     78   sources = [
     79     "task_runner_thread.cc",
     80     "task_runner_thread.h",
     81   ]
     82 }
     83 
     84 source_set("task_runner_thread_delegates") {
     85   testonly = true
     86   deps = [
     87     ":task_runner_thread",
     88     "../gn:default_deps",
     89     "../include/perfetto/traced",
     90     "../src/base:test_support",
     91     "../src/traced/probes:probes_src",
     92     "../src/tracing:ipc",
     93   ]
     94   sources = [
     95     "fake_producer.cc",
     96     "fake_producer.h",
     97     "task_runner_thread_delegates.h",
     98   ]
     99 }
    100 
    101 source_set("test_helper") {
    102   testonly = true
    103   public_deps = [
    104     "../src/tracing:ipc",
    105   ]
    106   deps = [
    107     ":task_runner_thread",
    108     ":task_runner_thread_delegates",
    109     "../gn:default_deps",
    110     "../include/perfetto/traced",
    111     "../protos/perfetto/trace:lite",
    112     "../protos/perfetto/trace:zero",
    113     "../src/base:test_support",
    114   ]
    115   sources = [
    116     "test_helper.cc",
    117     "test_helper.h",
    118   ]
    119   if (start_daemons_for_testing) {
    120     cflags = [ "-DPERFETTO_START_DAEMONS_FOR_TESTING" ]
    121   }
    122 }
    123 
    124 if (perfetto_build_standalone) {
    125   source_set("end_to_end_benchmarks") {
    126     testonly = true
    127     deps = [
    128       ":task_runner_thread",
    129       ":task_runner_thread_delegates",
    130       ":test_helper",
    131       "../../gn:default_deps",
    132       "../buildtools:benchmark",
    133       "../gn:gtest_deps",
    134       "../include/perfetto/traced",
    135       "../protos/perfetto/trace:lite",
    136       "../protos/perfetto/trace:zero",
    137       "../src/base:test_support",
    138     ]
    139     sources = [
    140       "end_to_end_benchmark.cc",
    141     ]
    142     if (is_android) {
    143       deps += [ "../src/base:android_task_runner" ]
    144     }
    145     if (start_daemons_for_testing) {
    146       cflags = [ "-DPERFETTO_START_DAEMONS_FOR_TESTING" ]
    147     }
    148   }
    149 
    150   source_set("benchmark_main") {
    151     testonly = true
    152     deps = [
    153       "../../gn:default_deps",
    154       "../buildtools:benchmark",
    155     ]
    156     sources = [
    157       "benchmark_main.cc",
    158     ]
    159   }
    160 }
    161