Loading...
testing/lib/test_support.cpp dyld-955 dyld-852.2
--- dyld/dyld-955/testing/lib/test_support.cpp
+++ dyld/dyld-852.2/testing/lib/test_support.cpp
@@ -226,7 +226,7 @@
 }
 
 _process::_process() :  executablePath(nullptr), args(nullptr), env(nullptr), stdoutHandler(nullptr), stderrHandler(nullptr),
-                        crashHandler(nullptr), exitHandler(nullptr), arch(currentArch), suspended(false) {}
+                        crashHandler(nullptr), exitHandler(nullptr), pid(0), arch(currentArch), suspended(false) {}
 _process::~_process() {
     if (stdoutHandler) { Block_release(stdoutHandler);}
     if (stderrHandler) { Block_release(stderrHandler);}
@@ -246,7 +246,6 @@
 
 pid_t _process::launch() {
     dispatch_queue_t queue = dispatch_queue_create("com.apple.dyld.test.launch", NULL);
-    dispatch_block_t oneShotSemaphoreBlock = dispatch_block_create(DISPATCH_BLOCK_INHERIT_QOS_CLASS, ^{});
     posix_spawn_file_actions_t fileActions = NULL;
     posix_spawnattr_t attr = NULL;
     dispatch_source_t stdoutSource = NULL;
@@ -360,7 +359,6 @@
         if (stderrSource) {
             dispatch_source_cancel(stderrSource);
         }
-        oneShotSemaphoreBlock();
         dispatch_source_cancel(exitSource);
     });
     dispatch_resume(exitSource);
@@ -378,7 +376,6 @@
     if (!suspended) {
         kill(pid, SIGCONT);
     }
-    Block_release(oneShotSemaphoreBlock);
     dispatch_release(queue);
     return pid;
 }
@@ -503,7 +500,7 @@
         if (checkForLeaks) {
             printf(" MallocStackLogging=1 MallocDebugReport=none");
         }
-        forEachEnvVar(environ, [](const char* env, const char* val) {
+        forEachEnvVar(environ, [this](const char* env, const char* val) {
             if ((strncmp(env, "DYLD_", 5) == 0) || (strncmp(env, "TEST_", 5) == 0)) {
                 printf(" %s=%s", env, val);
             }
@@ -551,18 +548,18 @@
                 }
             }
             sState.store(*state);
-            break; // don't print [BEGIN] if a second main executeable is dlopen()ed
         }
     }
     assert(sState != nullptr);
     return sState;
 }
+
 __attribute__((noreturn))
 void TestState::runLeaks(void) {
     auto testState = TestState::getState();
-    pid_t currentPid = getpid();
+    pid_t pid = getpid();
     char pidString[32];
-    sprintf(&pidString[0], "%d", currentPid);
+    sprintf(&pidString[0], "%d", pid);
     if (getuid() != 0) {
         printf("Insufficient priviledges, skipping Leak check: %s\n", testState->testName);
         exit(0);
@@ -616,7 +613,7 @@
     if (checkForLeaks) {
         runLeaks();
     } else {
-        _IOlock.withLock([this,&format,&args](){
+        _IOlock.withLock([this,&format,&args,&file,&line](){
             if (output == Console) {
                 printf("[\033[0;32mPASS\033[0m] %s: ", testName);
                 vprintf(format, args);