aboutsummaryrefslogtreecommitdiff
path: root/infra/cifuzz
diff options
context:
space:
mode:
authorjonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>2021-08-03 17:59:17 -0700
committerGitHub <noreply@github.com>2021-08-03 17:59:17 -0700
commit0ea44bb3557f3f70479404c8027566bb33cc12a1 (patch)
treeec1b8175f6a4d48cb01c2ac9033f96fc711267c3 /infra/cifuzz
parent432105a31af3f7bfbcf2c0d1a26d4e65f8e98571 (diff)
downloadoss-fuzz-0ea44bb3557f3f70479404c8027566bb33cc12a1.tar.gz
[cifuzz][NFC] Move default configs to config_utils.py (#6157)
Diffstat (limited to 'infra/cifuzz')
-rw-r--r--infra/cifuzz/config_utils.py2
-rw-r--r--infra/cifuzz/docker.py17
2 files changed, 12 insertions, 7 deletions
diff --git a/infra/cifuzz/config_utils.py b/infra/cifuzz/config_utils.py
index 0b244a1f4..0e9928bff 100644
--- a/infra/cifuzz/config_utils.py
+++ b/infra/cifuzz/config_utils.py
@@ -20,6 +20,8 @@ import json
import environment
+DEFAULT_ENGINE = 'libfuzzer'
+DEFAULT_ARCHITECTURE = 'x86_64'
DEFAULT_LANGUAGE = 'c++'
DEFAULT_SANITIZER = 'address'
diff --git a/infra/cifuzz/docker.py b/infra/cifuzz/docker.py
index ab6c34df1..6397fa874 100644
--- a/infra/cifuzz/docker.py
+++ b/infra/cifuzz/docker.py
@@ -16,6 +16,7 @@ import logging
import os
import sys
+import config_utils
# pylint: disable=wrong-import-position,import-error
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -26,12 +27,10 @@ BASE_RUNNER_TAG = 'gcr.io/oss-fuzz-base/base-runner'
MSAN_LIBS_BUILDER_TAG = 'gcr.io/oss-fuzz-base/msan-libs-builder'
PROJECT_TAG_PREFIX = 'gcr.io/oss-fuzz/'
-# Default fuzz configuration.
-DEFAULT_ENGINE = 'libfuzzer'
-DEFAULT_ARCHITECTURE = 'x86_64'
_DEFAULT_DOCKER_RUN_ARGS = [
- '--cap-add', 'SYS_PTRACE', '-e', 'FUZZING_ENGINE=' + DEFAULT_ENGINE, '-e',
- 'ARCHITECTURE=' + DEFAULT_ARCHITECTURE, '-e', 'CIFUZZ=True'
+ '--cap-add', 'SYS_PTRACE', '-e',
+ 'FUZZING_ENGINE=' + config_utils.DEFAULT_ENGINE, '-e',
+ 'ARCHITECTURE=' + config_utils.DEFAULT_ARCHITECTURE, '-e', 'CIFUZZ=True'
]
EXTERNAL_PROJECT_IMAGE = 'external-project'
@@ -60,7 +59,9 @@ def delete_images(images):
utils.execute(['docker', 'builder', 'prune', '-f'])
-def get_base_docker_run_args(workspace, sanitizer='address', language='c++'):
+def get_base_docker_run_args(workspace,
+ sanitizer=config_utils.DEFAULT_SANITIZER,
+ language=config_utils.DEFAULT_LANGUAGE):
"""Returns arguments that should be passed to every invocation of 'docker
run'."""
docker_args = _DEFAULT_DOCKER_RUN_ARGS.copy()
@@ -79,7 +80,9 @@ def get_base_docker_run_args(workspace, sanitizer='address', language='c++'):
return docker_args, docker_container
-def get_base_docker_run_command(workspace, sanitizer='address', language='c++'):
+def get_base_docker_run_command(workspace,
+ sanitizer=config_utils.DEFAULT_SANITIZER,
+ language=config_utils.DEFAULT_LANGUAGE):
"""Returns part of the command that should be used everytime 'docker run' is
invoked."""
docker_args, docker_container = get_base_docker_run_args(