Browse Source

Preserve TFB_ variables when replacing environment

Hamilton Turner 11 years ago
parent
commit
493b628cfe
2 changed files with 10 additions and 0 deletions
  1. 7 0
      toolset/run-tests.py
  2. 3 0
      toolset/setup/linux/setup_util.py

+ 7 - 0
toolset/run-tests.py

@@ -14,6 +14,13 @@ from setup.linux import setup_util
 # Main
 # Main
 ###################################################################################################
 ###################################################################################################
 def main(argv=None):
 def main(argv=None):
+    ''' Runs the program. There are three ways to pass arguments 
+    1) environment variables TFB_*
+    2) configuration file benchmark.cfg
+    3) command line flags
+    In terms of precedence, 3 > 2 > 1, so config file trumps environment variables
+    but command line flags have the final say
+    '''
     # Do argv default this way, as doing it in the functional declaration sets it at compile time
     # Do argv default this way, as doing it in the functional declaration sets it at compile time
     if argv is None:
     if argv is None:
         argv = sys.argv
         argv = sys.argv

+ 3 - 0
toolset/setup/linux/setup_util.py

@@ -25,6 +25,9 @@ def replace_environ(config=None, root=None, print_result=False, command='true'):
     for envname in ['HOME', 'PATH', 'USER', 'LD_LIBRARY_PATH', 'PYTHONPATH', 'FWROOT']:
     for envname in ['HOME', 'PATH', 'USER', 'LD_LIBRARY_PATH', 'PYTHONPATH', 'FWROOT']:
       if envname in os.environ:
       if envname in os.environ:
         mini_environ[envname] = os.environ[envname]
         mini_environ[envname] = os.environ[envname]
+    for key in os.environ:
+      if key.startswith('TFB_'):    # Any TFB_ variables are preserved
+        mini_environ[key] = os.environ[key]
     os.environ.clear()
     os.environ.clear()
 
 
     # Use FWROOT if explicitely provided
     # Use FWROOT if explicitely provided