Browse Source

Ensure TROOT, IROOT, FWROOT variables available to bash_profile, start, stop

Thanks #920 for bringing this to my attention

[ci skip]
Hamilton Turner 11 years ago
parent
commit
d5d3ffd6a6
2 changed files with 20 additions and 3 deletions
  1. 15 2
      toolset/benchmark/framework_test.py
  2. 5 1
      toolset/setup/linux/installer.py

+ 15 - 2
toolset/benchmark/framework_test.py

@@ -447,8 +447,10 @@ class FrameworkTest:
       logging.warning("Framework %s does not have a bash_profile" % self.name)
       logging.warning("Framework %s does not have a bash_profile" % self.name)
       profile="$FWROOT/config/benchmark_profile"
       profile="$FWROOT/config/benchmark_profile"
     
     
-    set_iroot="export IROOT=%s" % self.install_root
-    setup_util.replace_environ(config=profile, command=set_iroot)
+    test_rel_dir = setup_util.path_relative_to_root(self.directory)
+    setup_util.replace_environ(config=profile, 
+              command='export TROOT=$FWROOT%s && export IROOT=%s' %
+              (test_rel_dir, self.install_root))
 
 
     return self.setup_module.start(self.benchmarker, out, err)
     return self.setup_module.start(self.benchmarker, out, err)
   ############################################################
   ############################################################
@@ -460,6 +462,17 @@ class FrameworkTest:
   # Stops the test using it's setup file
   # Stops the test using it's setup file
   ############################################################
   ############################################################
   def stop(self, out, err):
   def stop(self, out, err):
+    # Load profile for this installation
+    profile="%s/bash_profile.sh" % self.directory
+    if not os.path.exists(profile):
+      logging.warning("Framework %s does not have a bash_profile" % self.name)
+      profile="$FWROOT/config/benchmark_profile"
+    
+    test_rel_dir = setup_util.path_relative_to_root(self.directory)
+    setup_util.replace_environ(config=profile, 
+              command='export TROOT=$FWROOT%s && export IROOT=%s' %
+              (test_rel_dir, self.install_root))
+
     return self.setup_module.stop(out, err)
     return self.setup_module.stop(out, err)
   ############################################################
   ############################################################
   # End stop
   # End stop

+ 5 - 1
toolset/setup/linux/installer.py

@@ -75,7 +75,11 @@ class Installer:
             if not os.path.exists(profile):
             if not os.path.exists(profile):
               logging.warning("Framework %s does not have a bash_profile"%test_name)
               logging.warning("Framework %s does not have a bash_profile"%test_name)
               profile="$FWROOT/config/benchmark_profile"
               profile="$FWROOT/config/benchmark_profile"
-            setup_util.replace_environ(config=profile)
+            else:
+              logging.info("Loading environment from %s", profile)
+            setup_util.replace_environ(config=profile, 
+              command='export TROOT=$FWROOT%s && export IROOT=$FWROOT%s' %
+              (test_rel_dir, test_rel_install_dir))
 
 
             # Find relative installation file
             # Find relative installation file
             test_rel_install_file = "$FWROOT%s" % setup_util.path_relative_to_root(test_install_file)
             test_rel_install_file = "$FWROOT%s" % setup_util.path_relative_to_root(test_install_file)