Bug 1683613 - For `non-unified` build have a task that runs checks when merging to mozilla-central r=mhentges
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Tue, 05 Jan 2021 19:40:23 +0000
changeset 562145 bc5b4375fa4686cddfd9bf02ca2f22238fb4b55f
parent 562144 64221164f9edb638d2d9284e8fc2269f12e0abd7
child 562146 a26ac12daeb010dab396e2870f858676c0859800
push id38083
push usercsabou@mozilla.com
push dateThu, 07 Jan 2021 04:07:15 +0000
treeherdermozilla-central@958d142c083c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhentges
bugs1683613
milestone86.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1683613 - For `non-unified` build have a task that runs checks when merging to mozilla-central r=mhentges Differential Revision: https://phabricator.services.mozilla.com/D100796
python/mozbuild/mozbuild/code_analysis/mach_commands.py
taskcluster/ci/source-test/clang.yml
taskcluster/scripts/misc/source-test-clang-non-unified.sh
taskcluster/scripts/misc/source-test-clang-setup.sh
--- a/python/mozbuild/mozbuild/code_analysis/mach_commands.py
+++ b/python/mozbuild/mozbuild/code_analysis/mach_commands.py
@@ -2157,28 +2157,34 @@ class StaticAnalysis(MachCommandBase):
                 command.append("-fsyntax-only")
                 command = [
                     re.sub(r'\'-D(.*)="(.*)"\'', r'-D\1="\2"', arg) for arg in command
                 ]
                 commands.append(command)
 
         max_workers = multiprocessing.cpu_count()
 
+        rc = 0
         with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
             futures = []
             for command in commands:
                 futures.append(
                     executor.submit(
                         self.run_process,
                         args=command,
                         cwd=self.topsrcdir,
                         pass_thru=True,
                         ensure_exit_code=False,
                     )
                 )
+            for thread in concurrent.futures.as_completed(futures):
+                if thread.result() != 0:
+                    rc = thread.result()
+
+        return rc
 
     @Command(
         "clang-format",
         category="misc",
         description="Run clang-format on current changes",
     )
     @CommandArgument(
         "--show",
--- a/taskcluster/ci/source-test/clang.yml
+++ b/taskcluster/ci/source-test/clang.yml
@@ -94,8 +94,24 @@ external:
     fetches:
         toolchain:
             - linux64-clang-tidy-external
     worker:
         artifacts:
             - type: file
               name: public/code-review/clang-tidy.json
               path: /builds/worker/clang-tidy.json
+
+non-unified:
+    description: Run syntax test for non-unified build on C/C++ files.
+    treeherder:
+        symbol: cpp(non-unified)
+    attributes:
+        code-review: false
+    run-on-projects: [mozilla-central]
+    run:
+        cwd: '{checkout}'
+        command: >-
+            source taskcluster/scripts/misc/source-test-clang-setup.sh &&
+            taskcluster/scripts/misc/source-test-clang-non-unified.sh
+    fetches:
+        toolchain:
+            - linux64-clang-tidy
new file mode 100755
--- /dev/null
+++ b/taskcluster/scripts/misc/source-test-clang-non-unified.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+NON_UNIFIED_CFG=$GECKO_PATH/build/non-unified-compat
+
+while IFS= read -r directory
+do
+  echo "Running non-unified compile test for: $directory"
+  ./mach static-analysis check-syntax $directory
+  if [ $? -ne 0 ]; then
+    # If failure do not continue with the rest of the directories
+    exit 1
+  fi
+done < $NON_UNIFIED_CFG
--- a/taskcluster/scripts/misc/source-test-clang-setup.sh
+++ b/taskcluster/scripts/misc/source-test-clang-setup.sh
@@ -11,13 +11,15 @@ export LD_LIBRARY_PATH=$MOZ_FETCHES_DIR/
 export MOZCONFIG=$GECKO_PATH/mozconfig
 
 # Add to mozconfig all the appropriate options
 cat <<EOT >> $MOZCONFIG
 # Enable debug mode
 ac_add_options --enable-debug
 # Enable GC zeal, a testing and debugging feature that helps find GC-related bugs in JSAPI applications.
 ac_add_options --enable-gczeal
+# Do not treat warnings as errors
+ac_add_options --disable-warnings-as-errors
 EOT
 
 # Mach lookup clang-tidy in clang-tools
 mkdir -p $MOZBUILD_STATE_PATH/clang-tools
 ln -s $MOZ_FETCHES_DIR/clang-tidy $MOZBUILD_STATE_PATH/clang-tools/clang-tidy