Преглед изворни кода

Update run-ci to use static method

Hamilton Turner пре 11 година
родитељ
комит
4a20fc5470
2 измењених фајлова са 4 додато и 22 уклоњено
  1. 2 21
      toolset/run-ci.py
  2. 2 1
      toolset/setup/linux/setup_util.py

+ 2 - 21
toolset/run-ci.py

@@ -4,6 +4,7 @@ import subprocess
 import os
 import sys
 from benchmark import framework_test
+from benchmark.utils import gather_tests
 import glob
 import json
 import traceback
@@ -36,7 +37,7 @@ class CIRunnner:
     logging.basicConfig(level=logging.INFO)
     
     if not test_directory == 'jobcleaner':
-      tests = self.gather_tests()
+      tests = gather_tests()
       
       # Run the first linux-only test in this directory
       # At the moment, travis only supports mysql or none!
@@ -149,26 +150,6 @@ class CIRunnner:
       log.error(err.child_traceback)
       return 1
 
-  def gather_tests(self):
-    ''' Returns all available tests as FrameworkTest list '''
-
-    # Fake benchmarker fields that are used
-    class bench_shim():
-      def __init__(self):
-        self.type = 'all'
-        self.fwroot = os.getcwd()
-        self.install_strategy='pertest'
-
-    # Gather all tests
-    tests = []
-    for config_file_name in glob.glob('*/benchmark_config'):
-      with open(config_file_name, 'r') as config_file:
-        config = json.load(config_file)
-        test = framework_test.parse_config(config, os.path.dirname(config_file_name), bench_shim())
-        tests = tests + test
-    tests.sort(key=lambda x: x.name)
-    return tests
-
   def cancel_unneeded_jobs(self):
     log.info("I am jobcleaner")
 

+ 2 - 1
toolset/setup/linux/setup_util.py

@@ -80,7 +80,8 @@ def get_fwroot():
             fwroot = subprocess.check_output('printf $FWROOT 2> /dev/null', shell=True, executable='/bin/bash')
             return fwroot
         except subprocess.CalledProcessError:
-            return "";
+            # Make a last-guess effort ;-)
+            return os.getcwd();
 
 # Turns absolute path into path relative to FWROOT
 # Assumes path is underneath FWROOT, not above