[build/infra] Build engines in alphabetical order. (#5987)

* [build/infra] Build engines in alphabetical order.

Previously, a project fuzz targets were usually built in the order:
libfuzzer, afl, honggfuzz. This can bias results if one is looking
at which engine finds bugs first.

* fix tests

* lnt
This commit is contained in:
jonathanmetzman 2021-07-01 11:17:18 -07:00 committed by GitHub
parent faea660c5e
commit 535597b038
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 101 additions and 98 deletions

View File

@ -155,7 +155,9 @@ def get_build_steps(project_name, project_yaml_file, dockerfile_lines,
],
})
for fuzzing_engine in project_yaml['fuzzing_engines']:
# Sort engines to make AFL first to test if libFuzzer has an advantage in
# finding bugs first since it is generally built first.
for fuzzing_engine in sorted(project_yaml['fuzzing_engines']):
for sanitizer in get_sanitizers(project_yaml):
for architecture in project_yaml['architectures']:
if not is_supported_configuration(fuzzing_engine, sanitizer,

View File

@ -36,103 +36,6 @@
"cp -r /msan /workspace"
]
},
{
"name": "gcr.io/oss-fuzz/test-project",
"env": [
"FUZZING_ENGINE=libfuzzer",
"SANITIZER=address",
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
],
"args": [
"bash",
"-c",
"rm -r /out && cd /src && cd /src && mkdir -p /workspace/out/address && compile || (echo \"********************************************************************************\nFailed to build.\nTo reproduce, run:\npython infra/helper.py build_image test-project\npython infra/helper.py build_fuzzers --sanitizer address --engine libfuzzer --architecture x86_64 test-project\n********************************************************************************\" && false)"
]
},
{
"name": "gcr.io/oss-fuzz-base/base-runner",
"env": [
"FUZZING_ENGINE=libfuzzer",
"SANITIZER=address",
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
],
"args": [
"bash",
"-c",
"test_all.py || (echo \"********************************************************************************\nBuild checks failed.\nTo reproduce, run:\npython infra/helper.py build_image test-project\npython infra/helper.py build_fuzzers --sanitizer address --engine libfuzzer --architecture x86_64 test-project\npython infra/helper.py check_build --sanitizer address --engine libfuzzer --architecture x86_64 test-project\n********************************************************************************\" && false)"
]
},
{
"name": "gcr.io/oss-fuzz-base/base-runner",
"env": [
"FUZZING_ENGINE=libfuzzer",
"SANITIZER=address",
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
],
"args": [
"bash",
"-c",
"targets_list > /workspace/targets.list.address"
]
},
{
"name": "gcr.io/oss-fuzz/test-project",
"args": [
"bash",
"-c",
"cd /workspace/out/address && zip -r test-project-address-202001010000.zip *"
]
},
{
"name": "gcr.io/oss-fuzz-base/uploader",
"args": [
"/workspace/srcmap.json",
"test_url"
]
},
{
"name": "gcr.io/oss-fuzz-base/uploader",
"args": [
"/workspace/out/address/test-project-address-202001010000.zip",
"test_url"
]
},
{
"name": "gcr.io/oss-fuzz-base/uploader",
"args": [
"/workspace/targets.list.address",
"test_url"
]
},
{
"name": "gcr.io/cloud-builders/curl",
"args": [
"-H",
"Content-Type: text/plain",
"-X",
"PUT",
"-d",
"test-project-address-202001010000.zip",
"test_url"
]
},
{
"name": "gcr.io/oss-fuzz/test-project",
"args": [
"bash",
"-c",
"rm -r /workspace/out/address"
]
},
{
"name": "gcr.io/oss-fuzz/test-project",
"env": [
@ -319,6 +222,103 @@
"test_url"
]
},
{
"name": "gcr.io/oss-fuzz/test-project",
"args": [
"bash",
"-c",
"rm -r /workspace/out/address"
]
},
{
"name": "gcr.io/oss-fuzz/test-project",
"env": [
"FUZZING_ENGINE=libfuzzer",
"SANITIZER=address",
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
],
"args": [
"bash",
"-c",
"rm -r /out && cd /src && cd /src && mkdir -p /workspace/out/address && compile || (echo \"********************************************************************************\nFailed to build.\nTo reproduce, run:\npython infra/helper.py build_image test-project\npython infra/helper.py build_fuzzers --sanitizer address --engine libfuzzer --architecture x86_64 test-project\n********************************************************************************\" && false)"
]
},
{
"name": "gcr.io/oss-fuzz-base/base-runner",
"env": [
"FUZZING_ENGINE=libfuzzer",
"SANITIZER=address",
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
],
"args": [
"bash",
"-c",
"test_all.py || (echo \"********************************************************************************\nBuild checks failed.\nTo reproduce, run:\npython infra/helper.py build_image test-project\npython infra/helper.py build_fuzzers --sanitizer address --engine libfuzzer --architecture x86_64 test-project\npython infra/helper.py check_build --sanitizer address --engine libfuzzer --architecture x86_64 test-project\n********************************************************************************\" && false)"
]
},
{
"name": "gcr.io/oss-fuzz-base/base-runner",
"env": [
"FUZZING_ENGINE=libfuzzer",
"SANITIZER=address",
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
],
"args": [
"bash",
"-c",
"targets_list > /workspace/targets.list.address"
]
},
{
"name": "gcr.io/oss-fuzz/test-project",
"args": [
"bash",
"-c",
"cd /workspace/out/address && zip -r test-project-address-202001010000.zip *"
]
},
{
"name": "gcr.io/oss-fuzz-base/uploader",
"args": [
"/workspace/srcmap.json",
"test_url"
]
},
{
"name": "gcr.io/oss-fuzz-base/uploader",
"args": [
"/workspace/out/address/test-project-address-202001010000.zip",
"test_url"
]
},
{
"name": "gcr.io/oss-fuzz-base/uploader",
"args": [
"/workspace/targets.list.address",
"test_url"
]
},
{
"name": "gcr.io/cloud-builders/curl",
"args": [
"-H",
"Content-Type: text/plain",
"-X",
"PUT",
"-d",
"test-project-address-202001010000.zip",
"test_url"
]
},
{
"name": "gcr.io/oss-fuzz/test-project",
"args": [

View File

@ -48,6 +48,7 @@ class TestRequestBuilds(unittest.TestCase):
def setUp(self):
test_utils.reset_ds_emulator()
self.maxDiff = None # pylint: disable=invalid-name
@mock.patch('build_lib.get_signed_url', return_value='test_url')
@mock.patch('datetime.datetime')