From e1467b2e033832e849dc4aef3883da58e1e55758 Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Thu, 2 Mar 2017 21:24:00 -0800 Subject: [PATCH 1/4] Allow specifying experimental sanitizers. See #378. --- infra/libfuzzer-pipeline.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infra/libfuzzer-pipeline.groovy b/infra/libfuzzer-pipeline.groovy index 3760f12126fc..5588f889c1e3 100644 --- a/infra/libfuzzer-pipeline.groovy +++ b/infra/libfuzzer-pipeline.groovy @@ -84,7 +84,7 @@ def call(body) { } // stage("docker image") for (int i = 0; i < sanitizers.size(); i++) { - def sanitizer = sanitizers[i] + def sanitizer = sanitizers[i].replaceAll('_experimental$', '') dir(sanitizer) { for (int j = 0; j < fuzzingEngines.size(); j++) { def engine = fuzzingEngines[j] @@ -116,7 +116,7 @@ def call(body) { step([$class: 'JUnitResultArchiver', testResults: 'junit_reports/**/*.xml']) dir('out') { for (int i = 0; i < sanitizers.size(); i++) { - def sanitizer = sanitizers[i] + def sanitizer = sanitizers[i].replaceAll('_experimental$', '') dir (sanitizer) { for (int j = 0; j < fuzzingEngines.size(); j++) { def engine = fuzzingEngines[j] From 067125f3f5bb561cb1246c2ee1a9d87169b1c784 Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Fri, 3 Mar 2017 12:08:49 -0800 Subject: [PATCH 2/4] allwo more params --- infra/libfuzzer-pipeline.groovy | 36 ++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/infra/libfuzzer-pipeline.groovy b/infra/libfuzzer-pipeline.groovy index 5588f889c1e3..1081d258f93e 100644 --- a/infra/libfuzzer-pipeline.groovy +++ b/infra/libfuzzer-pipeline.groovy @@ -25,7 +25,35 @@ def call(body) { // Project configuration. def projectName = project["name"] ?: env.JOB_BASE_NAME - def sanitizers = project["sanitizers"] ?: ["address", "undefined"] + def sanitizers = [address: [:], undefined: [:]] + + if (project.containsKey("sanitizers")) { + def overridenSanitizers = project["sanitizers"] + if (overridenSanitizers instanceof java.util.Map) { + sanitizers = overridenSanitizers + } else if (overridenSanitizers instanceof java.util.List) { + overridenSanitizers.each { sanitizer -> + if (sanitizer instanceof String) { + sanitizers.put(sanitizer, [:]) + } else if (sanitizer instanceof java.util.Map) { + // Allow either: + // sanitizers: + // undefined: + // experimental: true + // ...: + // or: + // sanitizers: + // - undefined: + // experimental: true + // - ...: + sanitizer.each { entry -> + sanitizers.put(entry.key, entry.value) + } + } + } + } + } + def coverageFlags = project["coverage_flags"] def fuzzingEngines = project["fuzzing_engines"] ?: ["libfuzzer"] @@ -83,8 +111,7 @@ def call(body) { writeFile file: srcmapFile, text: groovy.json.JsonOutput.toJson(srcmap) } // stage("docker image") - for (int i = 0; i < sanitizers.size(); i++) { - def sanitizer = sanitizers[i].replaceAll('_experimental$', '') + sanitizers.keySet().each { sanitizer -> dir(sanitizer) { for (int j = 0; j < fuzzingEngines.size(); j++) { def engine = fuzzingEngines[j] @@ -115,8 +142,7 @@ def call(body) { stage("uploading") { step([$class: 'JUnitResultArchiver', testResults: 'junit_reports/**/*.xml']) dir('out') { - for (int i = 0; i < sanitizers.size(); i++) { - def sanitizer = sanitizers[i].replaceAll('_experimental$', '') + sanitizers.keySet().each { sanitizer -> dir (sanitizer) { for (int j = 0; j < fuzzingEngines.size(); j++) { def engine = fuzzingEngines[j] From 580016551a9baad3b6e5aa7dae4551b042f2047d Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Fri, 3 Mar 2017 13:24:05 -0800 Subject: [PATCH 3/4] fix bug --- infra/libfuzzer-pipeline.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/infra/libfuzzer-pipeline.groovy b/infra/libfuzzer-pipeline.groovy index 1081d258f93e..f23e79821cc5 100644 --- a/infra/libfuzzer-pipeline.groovy +++ b/infra/libfuzzer-pipeline.groovy @@ -32,6 +32,7 @@ def call(body) { if (overridenSanitizers instanceof java.util.Map) { sanitizers = overridenSanitizers } else if (overridenSanitizers instanceof java.util.List) { + sanitizers = [:] overridenSanitizers.each { sanitizer -> if (sanitizer instanceof String) { sanitizers.put(sanitizer, [:]) From f0cda07ed9d9ff465b2aa32952aa335775129c7c Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Fri, 3 Mar 2017 16:38:28 -0800 Subject: [PATCH 4/4] simplify --- infra/libfuzzer-pipeline.groovy | 34 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/infra/libfuzzer-pipeline.groovy b/infra/libfuzzer-pipeline.groovy index f23e79821cc5..e0a8e53ae6c9 100644 --- a/infra/libfuzzer-pipeline.groovy +++ b/infra/libfuzzer-pipeline.groovy @@ -29,27 +29,19 @@ def call(body) { if (project.containsKey("sanitizers")) { def overridenSanitizers = project["sanitizers"] - if (overridenSanitizers instanceof java.util.Map) { - sanitizers = overridenSanitizers - } else if (overridenSanitizers instanceof java.util.List) { - sanitizers = [:] - overridenSanitizers.each { sanitizer -> - if (sanitizer instanceof String) { - sanitizers.put(sanitizer, [:]) - } else if (sanitizer instanceof java.util.Map) { - // Allow either: - // sanitizers: - // undefined: - // experimental: true - // ...: - // or: - // sanitizers: - // - undefined: - // experimental: true - // - ...: - sanitizer.each { entry -> - sanitizers.put(entry.key, entry.value) - } + sanitizers = [:] + overridenSanitizers.each { sanitizer -> + // each field can either be a Map or a String: + // sanitizers: + // - undefined: + // experimental: true + // - address + // - memory + if (sanitizer instanceof String) { + sanitizers.put(sanitizer, [:]) + } else if (sanitizer instanceof java.util.Map) { + sanitizer.each { entry -> + sanitizers.put(entry.key, entry.value) } } }