Bug 1416199 - Don't try to set signal handlers in Windows coverage build. r=froydnj
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Fri, 10 Nov 2017 12:50:14 +0100
changeset 391409 353999bc9b738d67bd532d6008f5104e567182ac
parent 391408 7e898dddf58bf75cb24e449e5f4df7e7cb058d44
child 391410 257e004c31f2d53ce760ba149c541a85bdf59d30
push id32878
push userccoroiu@mozilla.com
push dateSat, 11 Nov 2017 22:05:38 +0000
treeherdermozilla-central@f2eacbcd8f3d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1416199
milestone58.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 1416199 - Don't try to set signal handlers in Windows coverage build. r=froydnj
js/src/shell/js.cpp
tools/code-coverage/CodeCoverageHandler.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -176,31 +176,33 @@ void counters_dump(int) {
 void counters_reset(int) {
     /* Do nothing */
 }
 #endif
 
 static void
 InstallCoverageSignalHandlers()
 {
+#ifndef XP_WIN
     fprintf(stderr, "[CodeCoverage] Setting handlers for process %d.\n", getpid());
 
     struct sigaction dump_sa;
     dump_sa.sa_handler = counters_dump;
     dump_sa.sa_flags = SA_RESTART;
     sigemptyset(&dump_sa.sa_mask);
     mozilla::DebugOnly<int> r1 = sigaction(SIGUSR1, &dump_sa, nullptr);
     MOZ_ASSERT(r1 == 0, "Failed to install GCOV SIGUSR1 handler");
 
     struct sigaction reset_sa;
     reset_sa.sa_handler = counters_reset;
     reset_sa.sa_flags = SA_RESTART;
     sigemptyset(&reset_sa.sa_mask);
     mozilla::DebugOnly<int> r2 = sigaction(SIGUSR2, &reset_sa, nullptr);
     MOZ_ASSERT(r2 == 0, "Failed to install GCOV SIGUSR2 handler");
+#endif
 }
 #endif
 
 class OffThreadState {
     enum State {
         IDLE,           /* ready to work; no token, no source */
         COMPILING,      /* working; no token, have source */
         DONE            /* compilation done: have token and source */
--- a/tools/code-coverage/CodeCoverageHandler.cpp
+++ b/tools/code-coverage/CodeCoverageHandler.cpp
@@ -1,16 +1,18 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#include <stdio.h>
+#ifndef XP_WIN
 #include <signal.h>
-#include <stdio.h>
 #include <unistd.h>
+#endif
 #include "mozilla/CodeCoverageHandler.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/DebugOnly.h"
 #include "nsAppRunner.h"
 
 using namespace mozilla;
 
 // The __gcov_dump function writes the coverage counters to gcda files.
@@ -57,31 +59,33 @@ void CodeCoverageHandler::ResetCounters(
 
   printf_stderr("[CodeCoverage] Requested reset.\n");
   counters_reset();
   printf_stderr("[CodeCoverage] Reset completed.\n");
 }
 
 void CodeCoverageHandler::SetSignalHandlers()
 {
+#ifndef XP_WIN
   printf_stderr("[CodeCoverage] Setting handlers for process %d.\n", getpid());
 
   struct sigaction dump_sa;
   dump_sa.sa_handler = CodeCoverageHandler::DumpCounters;
   dump_sa.sa_flags = SA_RESTART;
   sigemptyset(&dump_sa.sa_mask);
   DebugOnly<int> r1 = sigaction(SIGUSR1, &dump_sa, nullptr);
   MOZ_ASSERT(r1 == 0, "Failed to install GCOV SIGUSR1 handler");
 
   struct sigaction reset_sa;
   reset_sa.sa_handler = CodeCoverageHandler::ResetCounters;
   reset_sa.sa_flags = SA_RESTART;
   sigemptyset(&reset_sa.sa_mask);
   DebugOnly<int> r2 = sigaction(SIGUSR2, &reset_sa, nullptr);
   MOZ_ASSERT(r2 == 0, "Failed to install GCOV SIGUSR2 handler");
+#endif
 }
 
 CodeCoverageHandler::CodeCoverageHandler()
   : mGcovLock("GcovLock")
 {
   SetSignalHandlers();
 }