Skip to content

Commit

Permalink
GN configs for ipc fuzzer.
Browse files Browse the repository at this point in the history
Also removes an unneeded dep from message_lib.gyp.

BUG=605926

Review URL: https://codereview.chromium.org/1916493003

Cr-Commit-Position: refs/heads/master@{#389861}
  • Loading branch information
oliverchang authored and Commit bot committed Apr 26, 2016
1 parent 131c20c commit cc11d0e
Show file tree
Hide file tree
Showing 15 changed files with 193 additions and 2 deletions.
1 change: 1 addition & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ group("both_gn_and_gyp") {
"//skia:skia_unittests",
"//sql:sql_unittests",
"//sync:sync_unit_tests",
"//tools/ipc_fuzzer:ipc_fuzzer_all",
"//ui/base:ui_base_unittests",
"//ui/gfx:gfx_unittests",
"//url:url_unittests",
Expand Down
5 changes: 5 additions & 0 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import("//chrome/common/features.gni")
import("//media/media_options.gni")
import("//third_party/kasko/kasko.gni")
import("//third_party/protobuf/proto_library.gni")
import("//tools/ipc_fuzzer/ipc_fuzzer.gni")

# //build/config/android/rules.gni imports //tools/grit/grit_rule.gni, which
# produces a conflict for the "grit" template so we have to only include one.
Expand Down Expand Up @@ -970,6 +971,10 @@ source_set("browser") {
"chrome_browser_main_extra_parts_exo.h",
]
}

if (enable_ipc_fuzzer) {
configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ]
}
}

if (android_java_ui) {
Expand Down
13 changes: 13 additions & 0 deletions chrome/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import("//chrome/common/features.gni")
import("//chrome/version.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/ipc_fuzzer/ipc_fuzzer.gni")

gypi_values = exec_script("//build/gypi_to_gn.py",
[ rebase_path("../chrome_common.gypi") ],
Expand Down Expand Up @@ -281,6 +282,14 @@ static_library("common") {
".",
"//chrome")
}

if (enable_ipc_fuzzer) {
configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ]
sources += [
"external_ipc_dumper.cc",
"external_ipc_dumper.h",
]
}
}

# GYP version: chrome/common_constants.gyp:version_header
Expand Down Expand Up @@ -349,6 +358,10 @@ static_library("constants") {
# implemented in //ui/base, so we need that dependency.
deps += [ "//ui/base" ]
}

if (enable_ipc_fuzzer) {
configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ]
}
}

if (is_win) {
Expand Down
5 changes: 5 additions & 0 deletions chrome/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import("//build/config/features.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/ipc_fuzzer/ipc_fuzzer.gni")

gypi_values = exec_script("//build/gypi_to_gn.py",
[ rebase_path("../chrome_renderer.gypi") ],
Expand Down Expand Up @@ -181,6 +182,10 @@ static_library("renderer") {
"spellchecker/hunspell_engine.h",
]
}

if (enable_ipc_fuzzer) {
configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ]
}
}

# In GYP this is part of test_support_common.
Expand Down
1 change: 1 addition & 0 deletions content/child/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ source_set("child") {
"//content/public/child:child_sources",
"//content/renderer/*",
"//content/utility/*",
"//tools/ipc_fuzzer/*",
]

sources = rebase_path(content_child_gypi_values.private_child_sources,
Expand Down
3 changes: 2 additions & 1 deletion docs/ipc_fuzzer.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ contribute.

### Build instructions

* add `enable_ipc_fuzzer=1` to `GYP_DEFINES`
* Run `gn args` and add `enable_ipc_fuzzer = true` to your args.gn. If you use
GYP, add `enable_ipc_fuzzer=1` to `GYP_DEFINES`.
* build `ipc_fuzzer_all` target
* component builds are currently broken, sorry
* Debug builds are broken; only Release mode works.
Expand Down
5 changes: 5 additions & 0 deletions ipc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import("//build/config/nacl/config.gni")
import("//testing/test.gni")
import("//tools/ipc_fuzzer/ipc_fuzzer.gni")

assert(!is_ios)

Expand Down Expand Up @@ -141,6 +142,10 @@ component("ipc") {
# On Mac MachPortAttachmentMac needs to generate random IDs.
deps += [ "//crypto" ]
}

if (enable_ipc_fuzzer) {
public_configs = [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ]
}
}

# This is provided as a separate target so other targets can provide param
Expand Down
34 changes: 34 additions & 0 deletions tools/ipc_fuzzer/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//tools/ipc_fuzzer/ipc_fuzzer.gni")

config("ipc_fuzzer_config") {
defines = [ "ENABLE_IPC_FUZZER" ]
}

config("ipc_fuzzer_tool_config") {
defines = [
"ENABLE_IPC_FUZZER",
"USE_CUPS",
]
include_dirs = [ "." ]
}

if (enable_ipc_fuzzer && (is_linux || is_mac || is_win)) {
assert(!is_component_build, "IPC fuzzer does not support component builds.")

group("ipc_fuzzer_all") {
deps = [
"//tools/ipc_fuzzer/fuzzer:ipc_fuzzer",
"//tools/ipc_fuzzer/message_dump:ipc_message_dump",
"//tools/ipc_fuzzer/message_replay:ipc_fuzzer_replay",
"//tools/ipc_fuzzer/message_tools:ipc_message_list",
"//tools/ipc_fuzzer/message_tools:ipc_message_util",
]
}
} else {
group("ipc_fuzzer_all") {
}
}
28 changes: 28 additions & 0 deletions tools/ipc_fuzzer/fuzzer/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/sanitizers/sanitizers.gni")

executable("ipc_fuzzer") {
configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_tool_config" ]
sources = [
"fuzzer.cc",
"fuzzer.h",
"fuzzer_main.cc",
"generator.cc",
"generator.h",
"mutator.cc",
"mutator.h",
"rand_util.cc",
"rand_util.h",
]
deps = [
"//tools/ipc_fuzzer/message_lib:ipc_message_lib",
]
if (is_asan && is_chromeos) {
# Compiling fuzzer.cc with ASan takes too long, see
# http://crbug.com/360158.
config -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
}
}
8 changes: 8 additions & 0 deletions tools/ipc_fuzzer/ipc_fuzzer.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

declare_args() {
# Don't build IPC fuzzer by default.
enable_ipc_fuzzer = false
}
13 changes: 13 additions & 0 deletions tools/ipc_fuzzer/message_dump/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

loadable_module("ipc_message_dump") {
configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_tool_config" ]
deps = [
"//tools/ipc_fuzzer/message_lib:ipc_message_lib",
]
sources = [
"message_dump.cc",
]
}
37 changes: 37 additions & 0 deletions tools/ipc_fuzzer/message_lib/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

static_library("ipc_message_lib") {
configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_tool_config" ]
public_deps = [
"//base",
"//chrome/common",
"//chrome/common/safe_browsing:proto",
"//components/content_settings/content/common",
"//components/nacl/common",
"//components/network_hints/common",
"//components/pdf/common",
"//content/child",
"//content/public/child",
"//ipc",
"//media/cast:net",
"//ppapi/proxy:ipc",
"//skia",
"//third_party/WebKit/public:blink",
"//third_party/WebKit/public:blink_headers",
"//third_party/libjingle",
"//third_party/mt19937ar",
"//ui/accessibility:ax_gen",
]
sources = [
"all_messages.h",
"message_cracker.h",
"message_file.h",
"message_file_format.h",
"message_file_reader.cc",
"message_file_writer.cc",
"message_names.cc",
"message_names.h",
]
}
1 change: 0 additions & 1 deletion tools/ipc_fuzzer/message_lib/message_lib.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
'../../../ipc/ipc.gyp:ipc',
'../../../media/cast/cast.gyp:cast_net',
'../../../ppapi/ppapi_internal.gyp:ppapi_ipc',
'../../../remoting/remoting.gyp:remoting_host',
'../../../skia/skia.gyp:skia',
'../../../third_party/libjingle/libjingle.gyp:libjingle',
'../../../third_party/mt19937ar/mt19937ar.gyp:mt19937ar',
Expand Down
16 changes: 16 additions & 0 deletions tools/ipc_fuzzer/message_replay/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

executable("ipc_fuzzer_replay") {
configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_tool_config" ]
deps = [
"//ipc/mojo",
"//tools/ipc_fuzzer/message_lib:ipc_message_lib",
]
sources = [
"replay.cc",
"replay_process.cc",
"replay_process.h",
]
}
25 changes: 25 additions & 0 deletions tools/ipc_fuzzer/message_tools/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

executable("ipc_message_util") {
configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_tool_config" ]
deps = [
"//third_party/re2",
"//tools/ipc_fuzzer/message_lib:ipc_message_lib",
]
sources = [
"message_util.cc",
]
}

executable("ipc_message_list") {
configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_tool_config" ]
deps = [
"//chrome/common/safe_browsing:proto",
"//tools/ipc_fuzzer/message_lib:ipc_message_lib",
]
sources = [
"message_list.cc",
]
}

0 comments on commit cc11d0e

Please sign in to comment.