Skip to content

Commit

Permalink
Enable framework-specific install directories and environment
Browse files Browse the repository at this point in the history
This commit is my proof-of concept, only the 'go' test works right now.
You can look at go/ to see the changes required on a per-framework
basis - essentially I've modified go/setup.py to move the declaration
of the environment into go/bash_profile.sh

Each framework now gets a personal <framework>/installs directory, and
can declare any needed environment variables in
<framework>/bash_profile.sh, such as modifications to the PATH.

The FwBm code now provides an FWROOT environment variable to
*all* shell scripts (instead of ~/Frameworks being assumed).
Also, an IROOT environment variable is provided to any framework-specific
files (e.g. install.sh and bash_profile.sh) for the location of the install directory
for that framework. See go/bash_profile.sh to see me using both IROOT and
FWROOT.

By using IROOT, the strategy for installation is still controlled by python code and
the frameworks just reference IROOT and FWROOT in their scripts. These
variables are a nice step towards solving TechEmpower#448

The new function replace_environ in setup_util.py goes a long way towards
addressing TechEmpower#899 - as you can see I've removed all the changes to the ~/.bash_profile
from prerequisites.sh (and this commit serves as proof that everything still works) and
most of the changes from config/benchmark_profile
  • Loading branch information
hamiltont committed Jul 9, 2014
1 parent cbb6220 commit 684a072
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
5 changes: 2 additions & 3 deletions go/bash_profile.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Set the root of our go installation
export GOROOT=${IROOT}/go
# IROOT=${FWROOT}/go/installs

# Where to find the go executable
export GOROOT=${IROOT}/go
export PATH="$GOROOT/bin:$PATH"

export GOPATH=${FWROOT}/go
1 change: 0 additions & 1 deletion toolset/benchmark/framework_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ def start(self, out, err):

set_iroot="export IROOT=%s" % self.install_root
setup_util.replace_environ(config=profile, command=set_iroot)

return self.setup_module.start(self.benchmarker, out, err)
############################################################
# End start
Expand Down
2 changes: 1 addition & 1 deletion toolset/run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def main(argv=None):
fwroot = setup_util.get_fwroot()
if not fwroot:
fwroot = os.getcwd()
setup_util.replace_environ(config='config/benchmark_profile', root=fwroot)
setup_util.replace_environ(config='config/benchmark_profile', root=os.getcwd())
print "FWROOT is %s"%setup_util.get_fwroot()

conf_parser = argparse.ArgumentParser(
Expand Down
15 changes: 15 additions & 0 deletions toolset/setup/linux/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def __install_server_software(self):
if self.strategy is 'pertest':
test_install_dir="%s/pertest/%s" % (test_install_dir, test_name)
test_rel_install_dir=setup_util.path_relative_to_root(test_install_dir)

if not os.path.exists(test_install_dir):
os.makedirs(test_install_dir)

Expand Down Expand Up @@ -338,6 +339,20 @@ def __bash_from_string(self, command):
# End __bash_from_string
############################################################

############################################################
# __path_relative_to_root
# Returns path minus the FWROOT prefix. Useful for clean
# presentation of paths
# e.g. /foo/bar/benchmarks/go/bash_profile.sh
# v.s. FWROOT/go/bash_profile.sh
############################################################
def __path_relative_to_root(self, path):
# Requires bash shell parameter expansion
return subprocess.check_output("D=%s && printf ${D#%s}"%(path, self.root), shell=True, executable='/bin/bash')
############################################################
# End __path_relative_to_root
############################################################

############################################################
# __download
# Downloads a file from a URI.
Expand Down

0 comments on commit 684a072

Please sign in to comment.