Browse Source

Use --install-only inside run-ci

Also add some documentation
Hamilton Turner 11 years ago
parent
commit
f7c571bd19
2 changed files with 27 additions and 13 deletions
  1. 2 2
      .travis.yml
  2. 25 11
      toolset/run-ci.py

+ 2 - 2
.travis.yml

@@ -177,12 +177,12 @@ addons:
   postgresql: "9.3" 
   postgresql: "9.3" 
 
 
 install:
 install:
-  # Install server prerequisites
   - time ./toolset/run-ci.py prereq $TESTDIR
   - time ./toolset/run-ci.py prereq $TESTDIR
+  - time ./toolset/run-ci.py install $TESTDIR
    
    
 script: 
 script: 
   # Run test verification 
   # Run test verification 
-  - time ./toolset/run-ci.py test $TESTDIR
+  - time ./toolset/run-ci.py verify $TESTDIR
 
 
 notifications:
 notifications:
   irc:
   irc:

+ 25 - 11
toolset/run-ci.py

@@ -30,7 +30,7 @@ class CIRunnner:
   
   
   def __init__(self, mode, test_directory):
   def __init__(self, mode, test_directory):
     '''
     '''
-    mode = [prereq|install|test] for what we want TFB to do
+    mode = [prereq|install|verify] for what we want TFB to do
     dir  = directory we are running
     dir  = directory we are running
     '''
     '''
 
 
@@ -77,7 +77,7 @@ class CIRunnner:
     except KeyError:
     except KeyError:
       log.warning("Run-ci.py should only be used for automated integration tests")
       log.warning("Run-ci.py should only be used for automated integration tests")
       last_commit = subprocess.check_output("git rev-parse HEAD^", shell=True).rstrip('\n')
       last_commit = subprocess.check_output("git rev-parse HEAD^", shell=True).rstrip('\n')
-      self.commit_range = "master...%s" % last_commit
+      self.commit_range = "%s...master" % last_commit
 
 
     log.info("Using commit range %s", self.commit_range)
     log.info("Using commit range %s", self.commit_range)
     log.info("Running `git diff --name-only %s`" % self.commit_range)
     log.info("Running `git diff --name-only %s`" % self.commit_range)
@@ -124,14 +124,11 @@ class CIRunnner:
     
     
     command = 'toolset/run-tests.py '
     command = 'toolset/run-tests.py '
     if mode == 'prereq':
     if mode == 'prereq':
-      command = command + "--install server --test ''"
+      command = command + "--install server --install-only --test ''"
     elif mode == 'install':
     elif mode == 'install':
-      # Just a note that having an install-only mode would integrate nicely with 
-      # Travis-CI's line-folding
-      log.warning('Currently there is no install-only mode available')
-      return 1
-    elif mode == 'test':
-      command = command + "--install server --mode verify --test %s" % self.name
+      command = command + "--install server --install-only --test %s" % self.name
+    elif mode == 'verify':
+      command = command + "--mode verify --test %s" % self.name
     else:
     else:
       log.critical('Unknown mode passed')
       log.critical('Unknown mode passed')
       return 1
       return 1
@@ -245,8 +242,21 @@ class Travis():
 if __name__ == "__main__":
 if __name__ == "__main__":
   args = sys.argv[1:]
   args = sys.argv[1:]
 
 
-  if len(args) != 2 or not (args[0] == "prereq" or args[0] == "install" or args[0] == "test"):
-    print "Usage: toolset/run-ci.py [prereq|install|test] test-name"
+  if len(args) != 2 or not (args[0] == "prereq" or args[0] == "install" or args[0] == "verify"):
+    print '''Usage: toolset/run-ci.py [prereq|install|verify] framework-directory
+    run-ci.py selects one test from <framework-directory>/benchark_config, and 
+    automates a number of calls into run-tests.py specific to the selected test. 
+
+    It is guaranteed to always select the same test from the benchark_config, so 
+    multiple runs with the same <framework-directory> reference the same test. 
+    The name of the selected test will be printed to standard output. 
+
+    prereq  - trigger standard prerequisite installation
+    install - trigger server installation for the selected test_directory
+    verify  - run a verification on the selected test using `--mode verify`
+
+    run-ci.py expects to be run inside the Travis-CI build environment, and 
+    will expect environment variables such as $TRAVIS_BUILD'''
     sys.exit(1)
     sys.exit(1)
 
 
   mode = args[0]
   mode = args[0]
@@ -278,6 +288,10 @@ if __name__ == "__main__":
     log.critical("Unknown error")
     log.critical("Unknown error")
     print traceback.format_exc()
     print traceback.format_exc()
   finally:
   finally:
+    # Only print logs if we ran a verify
+    if mode != "verify":
+      sys.exit(retcode)          
+
     log.error("Running inside travis, so I will print err and out to console")
     log.error("Running inside travis, so I will print err and out to console")
     log.error("Here is ERR:")
     log.error("Here is ERR:")