Browse Source

Merge pull request #2486 from nbrady-techempower/travis-tfb-command

Travis Update & tfb command
Mike Smith 8 years ago
parent
commit
20c23323cc

+ 0 - 1
.gitignore

@@ -42,7 +42,6 @@ php-kohana/application/logs/
 php-fuel/fuel/app/logs/
 results/
 benchmark.cfg
-current_benchmark.txt
 
 # Mac filesystem dust
 .DS_Store

+ 12 - 9
toolset/benchmark/benchmarker.py

@@ -255,7 +255,7 @@ class Benchmarker:
   # full_results_directory
   ############################################################
   def full_results_directory(self):
-    path = os.path.join(self.result_directory, self.timestamp)
+    path = os.path.join(self.fwroot, self.result_directory, self.timestamp)
     try:
       os.makedirs(path)
     except OSError:
@@ -319,8 +319,8 @@ class Benchmarker:
 
     # If the tests have been interrupted somehow, then we want to resume them where we left
     # off, rather than starting from the beginning
-    if os.path.isfile('current_benchmark.txt'):
-        with open('current_benchmark.txt', 'r') as interrupted_benchmark:
+    if os.path.isfile(self.current_benchmark):
+        with open(self.current_benchmark, 'r') as interrupted_benchmark:
             interrupt_bench = interrupted_benchmark.read().strip()
             for index, atest in enumerate(tests):
                 if atest.name == interrupt_bench:
@@ -441,7 +441,7 @@ class Benchmarker:
     if self.os.lower() == 'windows':
       logging.debug("Executing __run_tests on Windows")
       for test in tests:
-        with open('current_benchmark.txt', 'w') as benchmark_resume_file:
+        with open(self.current_benchmark, 'w') as benchmark_resume_file:
           benchmark_resume_file.write(test.name)
         if self.__run_test(test) != 0:
           error_happened = True
@@ -461,7 +461,7 @@ class Benchmarker:
         pbar_test = pbar_test + 1
         if __name__ == 'benchmark.benchmarker':
           print header("Running Test: %s" % test.name)
-          with open('current_benchmark.txt', 'w') as benchmark_resume_file:
+          with open(self.current_benchmark, 'w') as benchmark_resume_file:
             benchmark_resume_file.write(test.name)
           test_process = Process(target=self.__run_test, name="Test Runner (%s)" % test.name, args=(test,))
           test_process.start()
@@ -475,8 +475,8 @@ class Benchmarker:
           if test_process.exitcode != 0:
             error_happened = True
       pbar.finish()
-    if os.path.isfile('current_benchmark.txt'):
-      os.remove('current_benchmark.txt')
+    if os.path.isfile(self.current_benchmark):
+      os.remove(self.current_benchmark)
     logging.debug("End __run_tests.")
 
     if error_happened:
@@ -986,9 +986,12 @@ class Benchmarker:
     # Remember root directory
     self.fwroot = setup_util.get_fwroot()
 
+    # setup current_benchmark.txt location
+    self.current_benchmark = "/tmp/current_benchmark.txt"
+
     # setup results and latest_results directories
-    self.result_directory = os.path.join("results")
-    self.logs_directory = os.path.join("logs")
+    self.result_directory = os.path.join(self.fwroot, "results")
+    self.logs_directory = os.path.join(self.result_directory, "logs")
     if (args['clean'] or args['clean_all']) and os.path.exists(os.path.join(self.fwroot, "results")):
         shutil.rmtree(os.path.join(self.fwroot, "results"))
 

+ 0 - 8
toolset/setup/linux/bash_functions.sh

@@ -102,14 +102,6 @@ fw_depends() {
     wd=$(pwd)
     relative_wd=\$FWROOT${wd#$FWROOT}
 
-    # Check that the prerequisites have been loaded
-    RETCODE=$(fw_exists ${IROOT}/prerequisites.installed)
-    [ "$RETCODE" == 0 ] || { \
-      # Load environment variables
-      echo Installing prerequisites
-      source $FWROOT/toolset/setup/linux/prerequisites.sh
-      touch $IROOT/prerequisites.installed; }
-
     # Find and run the installer.sh file for this dependency
     # Turn on some bash options before sourcing: 
     #   - (x) errtrace : Print commands before they are run

+ 9 - 22
toolset/setup/linux/prerequisites.sh

@@ -3,13 +3,6 @@
 set -x
 export DEBIAN_FRONTEND=noninteractive
 
-source $FWROOT/toolset/setup/linux/bash_functions.sh
-
-RETCODE=$(fw_exists fwbm_prereqs_installed)
-[ ! "$RETCODE" == 0 ] || { \
-  echo "Prerequisites installed!"; 
-  return 0; }
-
 # One -q produces output suitable for logging (mostly hides
 # progress indicators)
 sudo apt-get -yq update
@@ -42,22 +35,16 @@ sudo pip install colorama==0.3.1
 sudo pip install progressbar==2.2
 sudo pip install requests
 
-# Stop permanently overwriting people's files just
-# for trying out our software!
-RETCODE=$(fw_exists ~/.bash_profile.bak)
-[ ! "$RETCODE" == 0 ] || { \
-  echo "Backing up your original ~/.bash_profile, ~/.profile, ~/.bashrc"
-  mv ~/.bash_profile ~/.bash_profile.bak || true
-  mv ~/.profile ~/.profile.bak || true
-  mv ~/.bashrc ~/.bashrc.bak || true
-}
-
 sudo sh -c "echo '*               -    nofile          65535' >> /etc/security/limits.conf"
 sudo sh -c "echo '*            hard    rtprio             99' >> /etc/security/limits.conf"
 sudo sh -c "echo '*            soft    rtprio             99' >> /etc/security/limits.conf"
 
-# Sudo in case we don't have permissions on IROOT
-sudo touch fwbm_prereqs_installed
-
-# Ensure everyone can see the file
-sudo chmod 775 fwbm_prereqs_installed
+# Create a tfb command alias for running the toolset
+# For now, this still ensures you have to be in the framework root to run it
+sudo tee /etc/profile.d/tfb.sh <<EOF
+#!/bin/bash
+tfb() {
+  $(pwd)/toolset/run-tests.py "\$@"
+}
+EOF
+source /etc/profile.d/tfb.sh

+ 1 - 12
toolset/travis/travis_setup.sh

@@ -2,18 +2,6 @@
 
 export DEBIAN_FRONTEND=noninteractive
 
-sudo apt-get update
-sudo apt-get install python-dev
-sudo pip install pyopenssl --upgrade
-sudo pip install ndg-httpsclient --upgrade
-sudo pip install pyasn1 --upgrade
-sudo pip install colorama
-# Version 2.3 has a nice Counter() and other features
-# but it requires —-allow-external and -—allow-unverified
-sudo pip install progressbar
-echo "127.0.0.1 " `hostname` | sudo tee /etc/hosts
-echo "127.0.0.1 localhost" | sudo tee /etc/hosts
-
 # Turn on command tracing
 set -x
 
@@ -41,3 +29,4 @@ echo 127.0.0.1 TFB-database | sudo tee --append /etc/hosts
 echo 127.0.0.1 TFB-client   | sudo tee --append /etc/hosts
 echo 127.0.0.1 TFB-server   | sudo tee --append /etc/hosts
 
+source ./toolset/setup/linux/prerequisites.sh