Browse Source

Merge pull request #971 from hamiltont/postgresql

Add postgre support to Travis-CI setup
Hamilton Turner 11 years ago
parent
commit
a3d2977693
7 changed files with 26 additions and 19 deletions
  1. 9 3
      .travis.yml
  2. 3 3
      dart-redstone/setup.py
  3. 3 3
      dart-start/setup.py
  4. 3 3
      dart-stream/setup.py
  5. 3 3
      dart/setup.py
  6. 2 2
      toolset/benchmark/framework_test.py
  7. 3 2
      toolset/run-ci.py

+ 9 - 3
.travis.yml

@@ -168,12 +168,18 @@ before_install:
   # configuration and will break travis's mysql setup
   - mysql -uroot < config/create.sql
   
-  # Doesn't work yet
-  # - alias run_tfb="coverage run --parallel-mode --omit installs,results"
+  # Setup Postgres
+  - psql --version
+  - sudo useradd benchmarkdbuser -p benchmarkdbpass
+  - sudo -u postgres psql template1 < config/create-postgres-database.sql
+  - sudo -u benchmarkdbuser psql hello_world < config/create-postgres.sql
+addons:
+  postgresql: "9.3" 
+
 install:
   # Install server prerequisites
   - time ./toolset/run-ci.py prereq $TESTDIR
-
+   
 script: 
   # Run test verification 
   - time ./toolset/run-ci.py test $TESTDIR

+ 3 - 3
dart-redstone/setup.py

@@ -53,7 +53,7 @@ def start(args, logfile, errfile):
     #
     # start nginx
     #
-    subprocess.Popen('sudo /usr/local/nginx/sbin/nginx -c `pwd`/nginx.conf', shell=True, cwd='dart-redstone', stderr=errfile, stdout=logfile);
+    subprocess.Popen('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf', shell=True, cwd='dart-redstone', stderr=errfile, stdout=logfile);
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -62,7 +62,7 @@ def stop(logfile, errfile):
   #
   # stop nginx
   #
-  subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c `pwd`/nginx.conf -s stop', shell=True, cwd='dart-redstone', stderr=errfile, stdout=logfile)
+  subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf -s stop', shell=True, cwd='dart-redstone', stderr=errfile, stdout=logfile)
   os.remove('dart-redstone/nginx.conf')
   #
   # stop dart servers
@@ -70,7 +70,7 @@ def stop(logfile, errfile):
   p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
   out, err = p.communicate()
   for line in out.splitlines():
-    if 'dart' in line and 'run-tests' not in line:
+    if 'dart' in line and 'run-tests' not in line and 'run-ci' not in line:
       pid = int(line.split(None, 2)[1])
       os.kill(pid, 15)
   return 0

+ 3 - 3
dart-start/setup.py

@@ -52,7 +52,7 @@ def start(args, logfile, errfile):
     #
     # start nginx
     #
-    subprocess.Popen('sudo /usr/local/nginx/sbin/nginx -c `pwd`/nginx.conf', shell=True, cwd='dart-start', stderr=errfile, stdout=logfile);
+    subprocess.Popen('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf', shell=True, cwd='dart-start', stderr=errfile, stdout=logfile);
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -61,7 +61,7 @@ def stop(logfile, errfile):
   #
   # stop nginx
   #
-  subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c `pwd`/nginx.conf -s stop', shell=True, cwd='dart-start', stderr=errfile, stdout=logfile)
+  subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf -s stop', shell=True, cwd='dart-start', stderr=errfile, stdout=logfile)
   os.remove('dart-start/nginx.conf')
   #
   # stop dart servers
@@ -69,7 +69,7 @@ def stop(logfile, errfile):
   p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
   out, err = p.communicate()
   for line in out.splitlines():
-    if 'dart' in line and 'run-tests' not in line:
+    if 'dart' in line and 'run-tests' not in line and 'run-ci' not in line:
       pid = int(line.split(None, 2)[1])
       os.kill(pid, 15)
   return 0

+ 3 - 3
dart-stream/setup.py

@@ -52,7 +52,7 @@ def start(args, logfile, errfile):
     #
     # start nginx
     #
-    subprocess.Popen('sudo /usr/local/nginx/sbin/nginx -c `pwd`/nginx.conf', shell=True, cwd='dart-stream', stderr=errfile, stdout=logfile);
+    subprocess.Popen('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf', shell=True, cwd='dart-stream', stderr=errfile, stdout=logfile);
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -61,7 +61,7 @@ def stop(logfile, errfile):
   #
   # stop nginx
   #
-  subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c `pwd`/nginx.conf -s stop', shell=True, cwd='dart-stream', stderr=errfile, stdout=logfile)
+  subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf -s stop', shell=True, cwd='dart-stream', stderr=errfile, stdout=logfile)
   os.remove('dart-stream/nginx.conf')
   #
   # stop dart servers
@@ -69,7 +69,7 @@ def stop(logfile, errfile):
   p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
   out, err = p.communicate()
   for line in out.splitlines():
-    if 'dart' in line and 'run-tests' not in line:
+    if 'dart' in line and 'run-tests' not in line and 'run-ci' not in line:
       pid = int(line.split(None, 2)[1])
       os.kill(pid, 15)
   return 0

+ 3 - 3
dart/setup.py

@@ -51,7 +51,7 @@ def start(args, logfile, errfile):
     #
     # start nginx
     #
-    subprocess.Popen('sudo /usr/local/nginx/sbin/nginx -c `pwd`/nginx.conf', shell=True, cwd='dart', stderr=errfile, stdout=logfile);
+    subprocess.Popen('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf', shell=True, cwd='dart', stderr=errfile, stdout=logfile);
     return 0
   except subprocess.CalledProcessError:
     return 1
@@ -60,7 +60,7 @@ def stop(logfile, errfile):
   #
   # stop nginx
   #
-  subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c `pwd`/nginx.conf -s stop', shell=True, cwd='dart', stderr=errfile, stdout=logfile)
+  subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf -s stop', shell=True, cwd='dart', stderr=errfile, stdout=logfile)
   os.remove('dart/nginx.conf')
   #
   # stop dart servers
@@ -68,7 +68,7 @@ def stop(logfile, errfile):
   p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
   out, err = p.communicate()
   for line in out.splitlines():
-    if 'dart' in line and 'run-tests' not in line:
+    if 'dart' in line and 'run-tests' not in line and 'run-ci' not in line:
       pid = int(line.split(None, 2)[1])
       os.kill(pid, 15)
   return 0

+ 2 - 2
toolset/benchmark/framework_test.py

@@ -443,7 +443,7 @@ class FrameworkTest:
     # 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)
+      logging.warning("Directory %s does not have a bash_profile.sh" % self.directory)
       profile="$FWROOT/config/benchmark_profile"
 
     setup_util.replace_environ(config=profile, 
@@ -463,7 +463,7 @@ class FrameworkTest:
     # 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)
+      logging.warning("Directory %s does not have a bash_profile.sh" % self.directory)
       profile="$FWROOT/config/benchmark_profile"
     
     setup_util.replace_environ(config=profile, 

+ 3 - 2
toolset/run-ci.py

@@ -45,6 +45,7 @@ class CIRunnner:
       osvalidtests = [t for t in dirtests if t.os.lower() == "linux"
                     and (t.database_os.lower() == "linux" or t.database_os.lower() == "none")]
       validtests = [t for t in osvalidtests if t.database.lower() == "mysql"
+                    or t.database.lower() == "postgres"
                     or t.database.lower() == "none"]
       log.info("Found %s tests (%s for linux, %s for linux and mysql) in directory '%s'", 
         len(dirtests), len(osvalidtests), len(validtests), test_directory)
@@ -54,8 +55,8 @@ class CIRunnner:
           log.critical("Note: Found tests that could run in Travis-CI if more databases were supported")
         sys.exit(1)
       
-      # Prefer mysql tests over 'none' if we have both
-      preferred = [t for t in validtests if t.database.lower() == "mysql"]
+      # Prefer database tests over 'none' if we have both
+      preferred = [t for t in validtests if t.database.lower() != "none"]
       if len(preferred) > 0:
         self.test = preferred[0]
       else: