Browse Source

Move TFBReaper creation out of prerequisites

msmith-techempower 8 years ago
parent
commit
f3937492d5

+ 2 - 0
toolset/benchmark/framework_test.py

@@ -190,6 +190,8 @@ class FrameworkTest:
     # Always ensure that IROOT exists
     # Always ensure that IROOT exists
     if not os.path.exists(self.install_root):
     if not os.path.exists(self.install_root):
       os.mkdir(self.install_root)
       os.mkdir(self.install_root)
+      subprocess.check_call(['gcc', '-std=c99', '-oTFBReaper', 
+        os.path.join(self.fwroot,'toolset/setup/linux/TFBReaper.c')])
 
 
     # Run the module start inside parent of TROOT
     # Run the module start inside parent of TROOT
     #  - we use the parent as a historical accident, a number of tests
     #  - we use the parent as a historical accident, a number of tests

+ 9 - 0
toolset/setup/linux/TFBReaper.c

@@ -41,12 +41,21 @@ int main(int argc, char *argv[])
   // See: http://man7.org/linux/man-pages/man2/prctl.2.html
   // See: http://man7.org/linux/man-pages/man2/prctl.2.html
   prctl(PR_SET_CHILD_SUBREAPER,1);
   prctl(PR_SET_CHILD_SUBREAPER,1);
 
 
+  // This invokes whatever was passed as arguments to TFBReaper
+  // on the system. This program is merely a pass-through to
+  // a shell with the subreaper stuff enabled.
   int ret = system(result);
   int ret = system(result);
   free(result);
   free(result);
 
 
+  // This tells the application to wait until all the child 
+  // processes have completed.
   int status;
   int status;
   wait(&status);
   wait(&status);
 
 
+  // We still need to wait forever in order to properly clean
+  // existing processes started by us.
+  for(;;){}
+
   return ret;
   return ret;
 }
 }
 
 

+ 1 - 4
toolset/setup/linux/prerequisites.sh

@@ -9,10 +9,7 @@ RETCODE=$(fw_exists fwbm_prereqs_installed)
 [ ! "$RETCODE" == 0 ] || { \
 [ ! "$RETCODE" == 0 ] || { \
   echo "Prerequisites installed!"; 
   echo "Prerequisites installed!"; 
   return 0; }
   return 0; }
-
-# Create TFBReaper application
-gcc -std=c99 -oTFBReaper $FWROOT/toolset/setup/linux/TFBReaper.c
-
+  
 # Use a more recent version of Mongo shell
 # Use a more recent version of Mongo shell
 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
 echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
 echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list