Skip to content

Commit

Permalink
Bug 1312964 - Add linux64-fuzz to TC and run *Fuzz* gtests r=franziskus
Browse files Browse the repository at this point in the history
Differential Revision: https://nss-dev.phacility.com/D122

--HG--
extra : amend_source : 997356ad17f255caa646a2498e20ea56f91cf9ea
  • Loading branch information
Tim Taubert committed Oct 26, 2016
1 parent f3a9299 commit e60e3b2
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 16 deletions.
61 changes: 61 additions & 0 deletions automation/taskcluster/graph/src/extend.js
Expand Up @@ -158,6 +158,8 @@ export default async function main() {
collection: "debug"
});

await scheduleFuzzing();

await scheduleTools();

await scheduleLinux("Linux 32 (ARM, debug)", {
Expand Down Expand Up @@ -256,6 +258,65 @@ async function scheduleLinux(name, base) {

/*****************************************************************************/

async function scheduleFuzzing() {
let base = {
env: {
ASAN_OPTIONS: "allocator_may_return_null=1",
UBSAN_OPTIONS: "print_stacktrace=1",
CC: "clang",
CCC: "clang++",
USE_64: "1"
},
platform: "linux64",
collection: "fuzz",
image: LINUX_IMAGE
};

// Build base definition.
let build_base = merge({
command: [
"/bin/bash",
"-c",
"bin/checkout.sh && " +
"nss/automation/taskcluster/scripts/build_gyp.sh -g -v --fuzz"
],
artifacts: {
public: {
expires: 24 * 7,
type: "directory",
path: "/home/worker/artifacts"
}
},
kind: "build",
symbol: "B"
}, base);

// The task that builds NSPR+NSS.
let task_build = queue.scheduleTask(merge(build_base, {
name: "Linux x64 (debug, fuzz)"
}));

// Schedule tests.
queue.scheduleTask(merge(base, {
parent: task_build,
name: "Gtests",
command: [
"/bin/bash",
"-c",
"bin/checkout.sh && nss/automation/taskcluster/scripts/run_tests.sh"
],
env: {GTESTFILTER: "*Fuzz*"},
symbol: "Gtest",
tests: "gtests",
cycle: "standard",
kind: "test"
}));

return queue.submit();
}

/*****************************************************************************/

async function scheduleWindows(name, base) {
base = merge(base, {
workerType: "nss-win2012r2",
Expand Down
9 changes: 7 additions & 2 deletions automation/taskcluster/graph/src/try_syntax.js
Expand Up @@ -22,7 +22,8 @@ function parseOptions(opts) {
}

// Parse platforms.
let allPlatforms = ["linux", "linux64", "linux64-asan", "win64", "arm", "linux64-gyp"];
let allPlatforms = ["linux", "linux64", "linux64-asan", "win64", "arm",
"linux64-gyp", "linux64-fuzz"];
let platforms = intersect(opts.platform.split(/\s*,\s*/), allPlatforms);

// If the given value is nonsense or "none" default to all platforms.
Expand Down Expand Up @@ -101,6 +102,7 @@ function filter(opts) {
let aliases = {
"linux": "linux32",
"linux64-asan": "linux64",
"linux64-fuzz": "linux64",
"linux64-gyp": "linux64",
"win64": "windows2012-64",
"arm": "linux32"
Expand All @@ -116,6 +118,8 @@ function filter(opts) {
keep &= coll("arm-opt") || coll("arm-debug");
} else if (platform == "linux64-gyp") {
keep &= coll("gyp");
} else if (platform == "linux64-fuzz") {
keep &= coll("fuzz");
} else {
keep &= coll("opt") || coll("debug");
}
Expand All @@ -128,7 +132,8 @@ function filter(opts) {
}

// Finally, filter by build type.
let isDebug = coll("debug") || coll("asan") || coll("ubsan") || coll("arm-debug") || coll("gyp");
let isDebug = coll("debug") || coll("asan") || coll("ubsan") ||
coll("arm-debug") || coll("gyp") || coll("fuzz");
return (isDebug && opts.builds.includes("d")) ||
(!isDebug && opts.builds.includes("o"));
}
Expand Down
4 changes: 2 additions & 2 deletions automation/taskcluster/scripts/build_gyp.sh
Expand Up @@ -4,14 +4,14 @@ source $(dirname $0)/tools.sh

if [[ $(id -u) -eq 0 ]]; then
# Drop privileges by re-running this script.
exec su worker $0
exec su worker -c "$0 $*"
fi

# Clone NSPR if needed.
hg_clone https://hg.mozilla.org/projects/nspr nspr default

# Build.
nss/build.sh -g -v
nss/build.sh ${*-"-g -v"}

# Package.
mkdir artifacts
Expand Down
5 changes: 0 additions & 5 deletions external_tests/der_gtest/der_gtest.gyp
Expand Up @@ -16,12 +16,7 @@
],
'dependencies': [
'<(DEPTH)/exports.gyp:nss_exports',
'<(DEPTH)/lib/nss/nss.gyp:nss3',
'<(DEPTH)/lib/util/util.gyp:nssutil3',
'<(DEPTH)/lib/smime/smime.gyp:smime3',
'<(DEPTH)/lib/ssl/ssl.gyp:ssl3',
'<(DEPTH)/external_tests/google_test/google_test.gyp:gtest',
'<(DEPTH)/cmd/lib/lib.gyp:sectool'
]
}
],
Expand Down
5 changes: 0 additions & 5 deletions external_tests/util_gtest/util_gtest.gyp
Expand Up @@ -16,13 +16,8 @@
],
'dependencies': [
'<(DEPTH)/exports.gyp:nss_exports',
'<(DEPTH)/lib/nss/nss.gyp:nss3',
'<(DEPTH)/lib/util/util.gyp:nssutil3',
'<(DEPTH)/lib/smime/smime.gyp:smime3',
'<(DEPTH)/lib/ssl/ssl.gyp:ssl3',
'<(DEPTH)/external_tests/google_test/google_test.gyp:gtest',
'<(DEPTH)/lib/util/util.gyp:nssutil',
'<(DEPTH)/cmd/lib/lib.gyp:sectool'
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion lib/freebl/loader.c
Expand Up @@ -814,7 +814,7 @@ BL_Unload(void)
char *disableUnload = NULL;
vector = NULL;
disableUnload = PR_GetEnvSecure("NSS_DISABLE_UNLOAD");
if (!disableUnload) {
if (blLib && !disableUnload) {
#ifdef DEBUG
PRStatus status = PR_UnloadLibrary(blLib);
PORT_Assert(PR_SUCCESS == status);
Expand Down
3 changes: 2 additions & 1 deletion tests/gtests/gtests.sh
Expand Up @@ -55,7 +55,8 @@ gtest_start()
GTESTREPORT="$GTESTDIR/report.xml"
PARSED_REPORT="$GTESTDIR/report.parsed"
echo "executing $i"
${BINDIR}/$i -d "$GTESTDIR" --gtest_output=xml:"${GTESTREPORT}"
${BINDIR}/$i -d "$GTESTDIR" --gtest_output=xml:"${GTESTREPORT}" \
--gtest_filter="${GTESTFILTER-*}"
html_msg $? 0 "$i run successfully"
echo "test output dir: ${GTESTREPORT}"
echo "executing sed to parse the xml report"
Expand Down

0 comments on commit e60e3b2

Please sign in to comment.