Bug 1294417 - add gyp builds to linux64-debug TC, r=ttaubert
authorFranziskus Kiefer <franziskuskiefer@gmail.com>
Wed, 12 Oct 2016 12:09:29 +0200
changeset 12709 0891cd3881db564673c1027a2b6b0e48b3cad7e3
parent 12708 21dacf6b07fee05fd2ea3541d5e8899077c31325
child 12710 84b5417c3db88795e3501a732fd240e2a70ff8fe
push id1660
push userfranziskuskiefer@gmail.com
push dateThu, 13 Oct 2016 08:28:50 +0000
reviewersttaubert
bugs1294417
Bug 1294417 - add gyp builds to linux64-debug TC, r=ttaubert
Makefile
automation/taskcluster/graph/src/extend.js
automation/taskcluster/graph/src/try_syntax.js
automation/taskcluster/scripts/build_gyp.sh
build.sh
external_tests/ssl_gtest/ssl_auth_unittest.cc
tests/all.sh
--- a/Makefile
+++ b/Makefile
@@ -111,27 +111,39 @@ USEABSPATH="NO"
 endif
 endif
 ifeq ($(USEABSPATH),"YES")
 NSPR_PREFIX = $(shell pwd)/../dist/$(OBJDIR_NAME)
 else
 NSPR_PREFIX = $$(topsrcdir)/../dist/$(OBJDIR_NAME)
 endif
 
+ifndef NSS_GYP
 $(NSPR_CONFIG_STATUS): $(NSPR_CONFIGURE)
 	mkdir -p $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)
 	cd $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) ; \
 	$(NSPR_CONFIGURE_ENV) sh ../configure \
 	$(NSPR_CONFIGURE_OPTS) \
 	--with-dist-prefix='$(NSPR_PREFIX)' \
 	--with-dist-includedir='$(NSPR_PREFIX)/include'
+else
+$(NSPR_CONFIG_STATUS): $(NSPR_CONFIGURE)
+	mkdir -p $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)
+	cd $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) ; \
+	$(NSPR_CONFIGURE_ENV) sh ../configure \
+	$(NSPR_CONFIGURE_OPTS) \
+	--prefix='$(NSPR_PREFIX)'
+endif
 
 build_nspr: $(NSPR_CONFIG_STATUS)
 	$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)
 
+install_nspr: build_nspr
+	$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) install
+
 clobber_nspr: $(NSPR_CONFIG_STATUS)
 	$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) clobber
 
 build_docs:
 	$(MAKE) -C $(CORE_DEPTH)/doc
 
 clean_docs:
 	$(MAKE) -C $(CORE_DEPTH)/doc clean
--- a/automation/taskcluster/graph/src/extend.js
+++ b/automation/taskcluster/graph/src/extend.js
@@ -93,16 +93,28 @@ export default async function main() {
 
   await scheduleLinux("Linux 64 (debug)", {
     env: {USE_64: "1"},
     platform: "linux64",
     collection: "debug",
     image: LINUX_IMAGE
   });
 
+  await scheduleLinux("Linux 64 (debug, gyp)", {
+    command: [
+      "/bin/bash",
+      "-c",
+      "bin/checkout.sh && nss/automation/taskcluster/scripts/build_gyp.sh"
+    ],
+    env: {USE_64: "1"},
+    platform: "linux64",
+    collection: "gyp",
+    image: LINUX_IMAGE
+  });
+
   await scheduleLinux("Linux 64 (ASan, debug)", {
     env: {
       NSS_DISABLE_ARENA_FREE_LIST: "1",
       NSS_DISABLE_UNLOAD: "1",
       GCC_VERSION: "clang",
       GXX_VERSION: "clang++",
       USE_ASAN: "1",
       USE_64: "1"
@@ -132,32 +144,32 @@ export default async function main() {
     tier: 3
   });
 }
 
 /*****************************************************************************/
 
 async function scheduleLinux(name, base) {
   // Build base definition.
-  let build_base = merge(base, {
+  let build_base = merge({
     command: [
       "/bin/bash",
       "-c",
       "bin/checkout.sh && nss/automation/taskcluster/scripts/build.sh"
     ],
     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}));
 
   // The task that generates certificates.
   let task_cert = queue.scheduleTask(merge(build_base, {
     name: "Certificates",
     command: [
--- a/automation/taskcluster/graph/src/try_syntax.js
+++ b/automation/taskcluster/graph/src/try_syntax.js
@@ -17,17 +17,17 @@ function parseOptions(opts) {
   let builds = intersect(opts.build.split(""), ["d", "o"]);
 
   // If the given value is nonsense default to debug and opt builds.
   if (builds.length == 0) {
     builds = ["d", "o"];
   }
 
   // Parse platforms.
-  let allPlatforms = ["linux", "linux64", "linux64-asan", "win64", "arm"];
+  let allPlatforms = ["linux", "linux64", "linux64-asan", "win64", "arm", "linux64-gyp"];
   let platforms = intersect(opts.platform.split(/\s*,\s*/), allPlatforms);
 
   // If the given value is nonsense or "none" default to all platforms.
   if (platforms.length == 0 && opts.platform != "none") {
     platforms = allPlatforms;
   }
 
   // Parse unit tests.
@@ -96,41 +96,44 @@ function filter(opts) {
 
     let coll = name => name == (task.collection || "opt");
 
     // Filter by platform.
     let found = opts.platforms.some(platform => {
       let aliases = {
         "linux": "linux32",
         "linux64-asan": "linux64",
+        "linux64-gyp": "linux64",
         "win64": "windows2012-64",
         "arm": "linux32"
       };
 
       // Check the platform name.
       let keep = (task.platform == (aliases[platform] || platform));
 
       // Additional checks.
       if (platform == "linux64-asan") {
         keep &= coll("asan");
       } else if (platform == "arm") {
         keep &= coll("arm-opt") || coll("arm-debug");
+      } else if (platform == "linux64-gyp") {
+        keep &= coll("gyp");
       } else {
         keep &= coll("opt") || coll("debug");
       }
 
       return keep;
     });
 
     if (!found) {
       return false;
     }
 
     // Finally, filter by build type.
-    let isDebug = coll("debug") || coll("asan") || coll("arm-debug");
+    let isDebug = coll("debug") || coll("asan") || coll("arm-debug") || coll("gyp");
     return (isDebug && opts.builds.includes("d")) ||
            (!isDebug && opts.builds.includes("o"));
   }
 }
 
 export function initFilter() {
   let comment = process.env.TC_COMMENT || "";
 
new file mode 100755
--- /dev/null
+++ b/automation/taskcluster/scripts/build_gyp.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+source $(dirname $0)/tools.sh
+
+if [[ $(id -u) -eq 0 ]]; then
+    # Set compiler.
+    switch_compilers
+
+    # Drop privileges by re-running this script.
+    exec su worker $0
+fi
+
+# Clone NSPR if needed.
+hg_clone https://hg.mozilla.org/projects/nspr nspr default
+
+# Build.
+cd nss && NSS_GYP_GEN=1 ./build.sh
+if [ $? != 0 ]; then
+    exit 1
+fi
+
+# Package.
+cd .. && mkdir artifacts
+tar cvfjh artifacts/dist.tar.bz2 dist
new file mode 100755
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+CWD="$PWD/$(dirname $0)"
+OBJ_DIR="$(make platform)"
+DIST_DIR="$CWD/../dist/$OBJ_DIR"
+
+# do NSPR things
+NSS_GYP=1 make install_nspr
+
+if [ -z "${USE_64}" ]; then
+    GYP_PARAMS="-Dtarget_arch=ia32"
+fi
+
+# generate NSS build files only if asked for it
+if [ -n "${NSS_GYP_GEN}" -o ! -d out/Debug ]; then
+    PKG_CONFIG_PATH="$CWD/../nspr/$OBJ_DIR/config" gyp -f ninja $GYP_PARAMS --depth=. nss.gyp
+fi
+# build NSS
+# TODO: only doing this for debug build for now
+ninja -C out/Debug/
+if [ $? != 0 ]; then
+    exit 1
+fi
+
+# sign libs
+# TODO: this is done every time at the moment.
+cd out/Debug/
+LD_LIBRARY_PATH=$DIST_DIR/lib/ ./shlibsign -v -i lib/libfreebl3.so
+LD_LIBRARY_PATH=$DIST_DIR/lib/ ./shlibsign -v -i lib/libfreeblpriv3.so
+LD_LIBRARY_PATH=$DIST_DIR/lib/ ./shlibsign -v -i lib/libnssdbm3.so
+LD_LIBRARY_PATH=$DIST_DIR/lib/ ./shlibsign -v -i lib/libsoftokn3.so
+
+# copy files over to the right directory
+cp * "$DIST_DIR/bin/"
+cp lib/* "$DIST_DIR/lib/"
+find . -name "*.a" | xargs cp -t "$DIST_DIR/lib/"
--- a/external_tests/ssl_gtest/ssl_auth_unittest.cc
+++ b/external_tests/ssl_gtest/ssl_auth_unittest.cc
@@ -196,17 +196,17 @@ TEST_P(TlsConnectTls12, SignatureSchemeC
                                   PR_ARRAY_SIZE(SignatureEcdsaSha384));
   Connect();
   // The scheme is reported as using secp384r1, but this is just the generic
   // ECDSA + SHA-384 codepoint as defined in TLS 1.2.
   CheckKeys(ssl_kea_ecdh, ssl_grp_ec_secp256r1, ssl_auth_ecdsa,
             ssl_sig_ecdsa_secp384r1_sha384);
 }
 
-#ifdef NSS_ENABLE_TLS_1_3
+#ifndef NSS_DISABLE_TLS_1_3
 TEST_P(TlsConnectTls13, SignatureAlgorithmServerUnsupported) {
   Reset(TlsAgent::kServerEcdsa256);  // P-256 cert
   server_->SetSignatureAlgorithms(SignatureEcdsaSha384,
                                   PR_ARRAY_SIZE(SignatureEcdsaSha384));
   ConnectExpectFail();
   server_->CheckErrorCode(SSL_ERROR_UNSUPPORTED_SIGNATURE_ALGORITHM);
   client_->CheckErrorCode(SSL_ERROR_NO_CYPHER_OVERLAP);
 }
--- a/tests/all.sh
+++ b/tests/all.sh
@@ -290,42 +290,16 @@ cd `dirname $0`
 
 # all.sh should be the first one to try to source the init
 if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
     cd common
     . ./init.sh
 fi
 
 # NOTE:
-# Since in make at the top level, modutil is the last file
-# created, we check for modutil to know whether the build
-# is complete. If a new file is created after that, the
-# following test for modutil should check for that instead.
-# Exception: when building softoken only, shlibsign is the
-# last file created.
-if [ "${NSS_BUILD_SOFTOKEN_ONLY}" = "1" ]; then
-  LAST_FILE_BUILT=shlibsign
-else
-  LAST_FILE_BUILT=modutil
-fi
-
-if [ ! -f ${DIST}/${OBJDIR}/bin/${LAST_FILE_BUILT}${PROG_SUFFIX} ]; then
-  if [ "${NSS_BUILD_UTIL_ONLY}" = "1" ]; then
-    # Currently no tests are run or built when building util only.
-    # This may change in the future, atob and bota are
-    # possible candidates.
-    echo "No tests were built"
-  else
-    echo "Build Incomplete. Aborting test." >> ${LOGFILE}
-    html_head "Testing Initialization"
-    Exit "Checking for build"
-  fi
-fi
-
-# NOTE:
 # Lists of enabled tests and other settings are stored to ${ENV_BACKUP}
 # file and are are restored after every test cycle.
 
 ENV_BACKUP=${HOSTDIR}/env.sh
 env_backup > ${ENV_BACKUP}
 
 if [ "${O_CRON}" = "ON" ]; then
     run_cycles >> ${LOGFILE}