Skip to content

Commit 967bd82

Browse files
nopsledderCQ Bot
authored andcommitted
[realm][fuzzing] Clean up manifests and shards
This CL streamlines the component manifests and manifest shard files used by realmfuzzer. It removes extraneous definitions and deduplicates as much as possible. Change-Id: Ifa859150dc95106ea1a2cf0956b305ecdf44c203 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/907727 Reviewed-by: Dzmitry Yatsushkevich <[email protected]> Commit-Queue: Aaron Green <[email protected]>
1 parent 47f6f48 commit 967bd82

File tree

11 files changed

+77
-162
lines changed

11 files changed

+77
-162
lines changed

src/sys/fuzzing/realmfuzzer/adapters/llvm.shard.cml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@
44

55
// This manifest shard corresponds to the fuzz target adapter component, which
66
// maps test inputs from the engine to the target component(s) being fuzzed.
7+
//
8+
// To create a realm fuzzer adapter component, include this shard and specify
9+
// the program name, arguments, and capability routes.
10+
//
11+
// Example:
12+
// {
13+
// include: [ "//src/sys/fuzzing/realmfuzzer/adapter/llvm.shard.cml" ],
14+
// program: {
15+
// name: "adapter",
16+
// },
17+
// use: [
18+
// { protocol: "foo.bar.Baz" },
19+
// ],
20+
// }
21+
//
22+
// See also //src/sys/fuzzing/realmfuzzer/fuzzer.shard.cml.
723
{
8-
include: [
9-
"//sdk/lib/inspect/client.shard.cml",
10-
"syslog/client.shard.cml",
11-
],
24+
include: [ "//src/sys/fuzzing/realmfuzzer/target/default.shard.cml" ],
1225
program: {
1326
runner: "elf",
1427
},
1528
capabilities: [
16-
{
17-
protocol: [ "fuchsia.fuzzer.TargetAdapter" ],
18-
},
29+
{ protocol: "fuchsia.fuzzer.TargetAdapter" },
1930
],
2031
expose: [
2132
{
22-
protocol: [ "fuchsia.fuzzer.TargetAdapter" ],
33+
protocol: "fuchsia.fuzzer.TargetAdapter",
2334
from: "self",
2435
},
2536
],

src/sys/fuzzing/realmfuzzer/coverage/tests/meta/adapter.cml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44
{
5-
include: [ "syslog/client.shard.cml" ],
5+
include: [ "//src/sys/fuzzing/realmfuzzer/adapters/llvm.shard.cml" ],
66
program: {
7-
runner: "elf",
87
binary: "bin/realmfuzzer_coverage_test_adapter",
98
},
10-
capabilities: [
11-
{ protocol: "fuchsia.fuzzer.TargetAdapter" },
12-
],
13-
use: [
14-
{
15-
protocol: "fuchsia.fuzzer.CoverageDataCollector",
16-
from: "debug",
17-
},
18-
],
19-
expose: [
20-
{
21-
protocol: "fuchsia.fuzzer.TargetAdapter",
22-
from: "self",
23-
},
24-
],
259
}

src/sys/fuzzing/realmfuzzer/engine/default.shard.cml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,35 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// This manifest shard corresponds to both the "real" and "test" engines used in
6-
// fuzzers and fuzzer tests, respectively.
5+
// This manifest shard provides the portions of the engine component description
6+
// shared between both the fuzzing engine and the integration tests.
77
{
88
include: [
9-
"//sdk/lib/inspect/client.shard.cml",
9+
"inspect/client.shard.cml",
1010
"syslog/client.shard.cml",
1111
],
1212
children: [
1313
{
14-
name: "fuzzer",
15-
url: "#meta/fuzzer.cm",
14+
name: "coverage",
15+
url: "#meta/coverage.cm",
1616
},
1717
],
1818
use: [
1919
{
2020
protocol: "fuchsia.fuzzer.TargetAdapter",
21-
from: "#fuzzer",
21+
from: "#adapter",
2222
},
23+
{
24+
protocol: "fuchsia.fuzzer.CoverageDataProvider",
25+
from: "#coverage",
26+
},
27+
{ protocol: "fuchsia.process.Launcher" },
2328
],
2429
offer: [
2530
{
2631
protocol: [ "fuchsia.process.Launcher" ],
2732
from: "parent",
28-
to: "#fuzzer",
33+
to: "#adapter",
2934
},
3035
],
3136
}

src/sys/fuzzing/realmfuzzer/engine/meta/engine.cml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2022 The Fuchsia Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// This manifest corresponds to a realm fuzzing engine component.
6+
//
7+
// To create a realm fuzzer engine component manifest file, include this shard
8+
// and define a child named "adapter" that uses the "fuzzed-env" environment.
9+
//
10+
// Example:
11+
// {
12+
// include: [ "//src/sys/fuzzing/realmfuzzer/fuzzer.shard.cml" ],
13+
// children: [
14+
// {
15+
// name: "adapter",
16+
// url: "#meta/foo_fuzz_adapter.cm",
17+
// environment: "#fuzzed-env",
18+
// },
19+
// ],
20+
// }
21+
//
22+
// See also //src/sys/fuzzing/realmfuzzer/adapters/llvm.shard.cml.
23+
{
24+
include: [
25+
"//src/sys/fuzzing/realmfuzzer/coverage/fuzzed-env.shard.cml",
26+
"//src/sys/fuzzing/realmfuzzer/engine/default.shard.cml",
27+
"//src/sys/test_runners/fuzz/default.shard.cml",
28+
],
29+
program: {
30+
binary: "bin/realmfuzzer_engine",
31+
},
32+
}

src/sys/fuzzing/realmfuzzer/target/default.shard.cml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
// This manifest shard corresponds to a component being fuzzed, which produces
66
// coverage data as a result of actions taken by the adapter component.
77
{
8+
include: [
9+
"inspect/client.shard.cml",
10+
"syslog/client.shard.cml",
11+
],
812
use: [
913
{
1014
protocol: "fuchsia.fuzzer.CoverageDataCollector",

src/sys/fuzzing/realmfuzzer/tests/BUILD.gn

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ group("tests") {
1414
]
1515
}
1616

17-
executable("fuzzer-bin") {
17+
executable("adapter") {
1818
testonly = true
1919
output_name = "realmfuzzer_test_fuzzer"
2020
deps = [
@@ -26,10 +26,11 @@ executable("fuzzer-bin") {
2626
exclude_toolchain_tags = [ "instrumented" ]
2727
}
2828

29-
fuchsia_test_component("fuzzer") {
30-
manifest = "meta/fuzzer.cml"
29+
fuchsia_test_component("adapter-component") {
30+
component_name = "adapter"
31+
manifest = "meta/adapter.cml"
3132
deps = [
32-
":fuzzer-bin",
33+
":adapter",
3334
"//src/sys/fuzzing/common/testing/data:corpus",
3435
]
3536
}
@@ -56,7 +57,7 @@ fuchsia_test_package("integration-tests-pkg") {
5657
package_name = "realmfuzzer-integration-tests"
5758
test_components = [ ":integration-tests" ]
5859
deps = [
59-
":fuzzer",
60+
":adapter-component",
6061
"//src/sys/fuzzing/realmfuzzer/coverage",
6162
]
6263
}
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
// Copyright 2022 The Fuchsia Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4-
5-
// This manifest corresponds to the fuzzer used by the integration tests.
64
{
75
include: [ "//src/sys/fuzzing/realmfuzzer/adapters/llvm.shard.cml" ],
86
program: {
9-
runner: "elf",
107
binary: "bin/realmfuzzer_test_fuzzer",
118
args: [ "data/corpus" ],
129
},
13-
use: [
14-
{
15-
protocol: "fuchsia.fuzzer.CoverageDataCollector",
16-
from: "debug",
17-
},
18-
],
1910
}

src/sys/fuzzing/realmfuzzer/tests/meta/engine.cml

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/sys/fuzzing/realmfuzzer/tests/meta/integration-tests.cml

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,18 @@
66
// tests.
77
{
88
include: [
9-
"//sdk/lib/inspect/client.shard.cml",
109
"//src/sys/fuzzing/realmfuzzer/coverage/fuzzed-env.shard.cml",
10+
"//src/sys/fuzzing/realmfuzzer/engine/default.shard.cml",
1111
"//src/sys/test_runners/gtest/default.shard.cml",
12-
"inspect/offer.shard.cml",
13-
"syslog/client.shard.cml",
1412
],
1513
program: {
1614
binary: "test/realmfuzzer_integration_tests",
1715
},
1816
children: [
1917
{
20-
name: "coverage",
21-
url: "#meta/coverage.cm",
22-
},
23-
{
24-
name: "engine",
25-
url: "#meta/engine.cm",
26-
},
27-
{
28-
name: "fuzzer",
29-
url: "#meta/fuzzer.cm",
18+
name: "adapter",
19+
url: "#meta/adapter.cm",
3020
environment: "#fuzzed-env",
3121
},
3222
],
33-
use: [
34-
{
35-
protocol: "fuchsia.fuzzer.TargetAdapter",
36-
from: "#fuzzer",
37-
},
38-
{
39-
protocol: "fuchsia.fuzzer.CoverageDataProvider",
40-
from: "#coverage",
41-
},
42-
{
43-
protocol: [ "fuchsia.process.Launcher" ],
44-
from: "parent",
45-
},
46-
],
47-
offer: [
48-
{
49-
protocol: [ "fuchsia.process.Launcher" ],
50-
from: "parent",
51-
to: [
52-
"#coverage",
53-
"#fuzzer",
54-
],
55-
},
56-
],
5723
}

0 commit comments

Comments
 (0)