Ver código fonte

Merge pull request #1276 from hamiltont/fix-travis

Travis-CI: Fix Postgres setup
Hamilton Turner 10 anos atrás
pai
commit
92bbf92d1d

+ 0 - 9
.travis.yml

@@ -3,15 +3,6 @@ python:
   - "2.7"
 
 env:
-  global:
-    - TFB_SERVER_HOST=127.0.0.1
-    - TFB_CLIENT_HOST=127.0.0.1
-    - TFB_DATABASE_HOST=127.0.0.1
-    - TFB_CLIENT_USER=travis
-    - TFB_DATABASE_USER=travis
-    - TFB_CLIENT_IDENTITY_FILE=/home/travis/.ssh/id_rsa
-    - TFB_DATABASE_IDENTITY_FILE=/home/travis/.ssh/id_rsa
-
   matrix:
 
     # Group tests by directory to logically break up travis-CI build. Otherwise

+ 2 - 20
toolset/benchmark/framework_test.py

@@ -164,7 +164,6 @@ class FrameworkTest:
     # Load profile for this installation
     profile="%s/bash_profile.sh" % self.directory
     if not os.path.exists(profile):
-      logging.warning("Directory %s does not have a bash_profile.sh" % self.directory)
       profile="$FWROOT/config/benchmark_profile"
 
     # Setup variables for TROOT and IROOT
@@ -587,7 +586,7 @@ class FrameworkTest:
 
   def __getattr__(self, name):
     """For backwards compatibility, we used to pass benchmarker 
-    as the argument to the setup.py files"""
+    as the argument to the setup.sh files"""
     try:
       x = getattr(self.benchmarker, name)
     except AttributeError:
@@ -699,29 +698,12 @@ class FrameworkTest:
     if benchmarker.install_strategy is 'pertest':
       self.install_root="%s/pertest/%s" % (self.install_root, name)
 
-    # Used in setup.py scripts for consistency with 
+    # Used in setup.sh scripts for consistency with 
     # the bash environment variables
     self.troot = self.directory
     self.iroot = self.install_root
 
     self.__dict__.update(args)
-
-    # ensure directory has __init__.py file so that we can use it as a Python package
-    if not os.path.exists(os.path.join(directory, "__init__.py")):
-      logging.warning("Please add an empty __init__.py file to directory %s", directory)
-      open(os.path.join(directory, "__init__.py"), 'w').close()
-
-    # Import the module (TODO - consider using sys.meta_path)
-    # Note: You can see the log output if you really want to, but it's a *ton*
-    dir_rel_to_fwroot = os.path.relpath(os.path.dirname(directory), self.fwroot)
-    if dir_rel_to_fwroot != ".":
-      sys.path.append("%s/%s" % (self.fwroot, dir_rel_to_fwroot))
-      logging.log(0, "Adding %s to import %s.%s", dir_rel_to_fwroot, os.path.basename(directory), self.setup_file)
-      #self.setup_module = setup_module = importlib.import_module(os.path.basename(directory) + '.' + self.setup_file)
-      sys.path.remove("%s/%s" % (self.fwroot, dir_rel_to_fwroot))
-    else:
-      logging.log(0, "Importing %s.%s", directory, self.setup_file)
-      #self.setup_module = setup_module = importlib.import_module(os.path.basename(directory) + '.' + self.setup_file)
   ############################################################
   # End __init__
   ############################################################

+ 17 - 15
toolset/run-ci.py

@@ -305,7 +305,7 @@ class CIRunnner:
     names = ' '.join(self.names)
     command = 'toolset/run-tests.py '
     if self.mode == 'prereq':
-      command = command + "--install server --install-only --test ''"
+      command = command + "--install server --install-only --test '' --verbose"
     elif self.mode == 'install':
       command = command + "--install server --install-only --test %s" % names
     elif self.mode == 'verify':
@@ -362,20 +362,18 @@ class CIRunnner:
     cat /home/travis/.ssh/id_rsa.pub > /home/travis/.ssh/authorized_keys
     chmod 600 /home/travis/.ssh/authorized_keys
 
-    # Set up the benchmark.cfg to use (as the travis user)
-    cp benchmark.cfg.example benchmark.cfg
-    # These MAY not be necessary since we set the environment vars in .travis.yml, but
-    # the benchmark.cfg might trump those, so I duplicated them here.
-    sed -i 's|client_identity_file=None|client_identity_file=/home/travis/.ssh/id_rsa|g' benchmark.cfg
-    sed -i 's|database_identity_file=None|database_identity_file=/home/travis/.ssh/id_rsa|g' benchmark.cfg
-    sed -i 's|client_host=localhost|client_host=127.0.0.1|g' benchmark.cfg
-    sed -i 's|database_host=localhost|database_host=127.0.0.1|g' benchmark.cfg
-    sed -i 's|server_host=localhost|server_host=127.0.0.1|g' benchmark.cfg
-    sed -i 's|client_user=techempower|client_user=travis|g' benchmark.cfg
-    sed -i 's|database_user=techempower|database_user=travis|g' benchmark.cfg
-    # I realize the following line is redundant, but in case we decide/need to
-    # change the user in the future in the cfg but not in the example, it's here.
-    sed -i 's|runner_user=testrunner|runner_user=testrunner|g' benchmark.cfg
+    # Set up the benchmark.cfg for travis user
+    # NOTE: Please don't just copy the example config - it causes unexpected
+    #       issues when those example variables change
+    echo "[Defaults]"                                       > benchmark.cfg
+    echo "client_identity_file=/home/travis/.ssh/id_rsa"   >> benchmark.cfg
+    echo "database_identity_file=/home/travis/.ssh/id_rsa" >> benchmark.cfg
+    echo "client_host=127.0.0.1"                           >> benchmark.cfg
+    echo "database_host=127.0.0.1"                         >> benchmark.cfg
+    echo "server_host=127.0.0.1"                           >> benchmark.cfg
+    echo "client_user=travis"                              >> benchmark.cfg
+    echo "database_user=travis"                            >> benchmark.cfg
+    echo "runner_user=testrunner"                          >> benchmark.cfg
 
     # Create the new testrunner user
     sudo useradd testrunner
@@ -405,6 +403,10 @@ class CIRunnner:
     mysql -uroot < config/create.sql
 
     # Setup Postgres
+    echo "Removing Postgres 9.1 from Travis-CI"
+    sudo apt-get remove -qy postgresql postgresql-9.1 postgresql-client-9.1
+    sudo apt-get install -qy postgresql-9.3 postgresql-client-9.3
+
     echo "Populating Postgres database"
     psql --version
     sudo useradd benchmarkdbuser -p benchmarkdbpass

+ 3 - 3
toolset/setup/linux/bash_functions.sh

@@ -8,9 +8,9 @@
 # export http_proxy=http://10.0.1.0:3128
 
 fw_get () {
-  # Use dot-based progress bar as it's more friendly 
-  # towards non-TTY systems like travis-ci
-  wget --progress=dot --no-check-certificate \
+  # -no-verbose disables the big progress bars but keeps
+  # other basic info
+  wget --no-verbose --no-check-certificate \
     --trust-server-names "$@"
 }
 

+ 4 - 3
toolset/setup/linux/installer.py

@@ -55,10 +55,12 @@ class Installer:
   ############################################################
   def __install_server_software(self):
     print("\nINSTALL: Installing server software (strategy=%s)\n"%self.strategy)
-    # Install global prerequisites
+    # Install global prerequisites (requires sudo)
     bash_functions_path='$FWROOT/toolset/setup/linux/bash_functions.sh'
     prereq_path='$FWROOT/toolset/setup/linux/prerequisites.sh'
     self.__run_command(". %s && . %s" % (bash_functions_path, prereq_path))
+    self.__run_command("sudo chown -R %s:%s %s" % (self.benchmarker.runner_user,
+      self.benchmarker.runner_user, os.path.join(self.fwroot, self.install_dir)))
 
     tests = gather_tests(include=self.benchmarker.test, 
       exclude=self.benchmarker.exclude,
@@ -99,7 +101,6 @@ class Installer:
       # Load profile for this installation
       profile="%s/bash_profile.sh" % test_dir
       if not os.path.exists(profile):
-        logging.warning("Directory %s does not have a bash_profile"%test_dir)
         profile="$FWROOT/config/benchmark_profile"
       else:
         logging.info("Loading environment from %s (cwd=%s)", profile, test_dir)
@@ -121,7 +122,7 @@ class Installer:
       # Move back to previous directory
       os.chdir(previousDir)
 
-    self.__run_command("sudo apt-get -y autoremove");    
+    self.__run_command("sudo apt-get -yq autoremove");    
 
     print("\nINSTALL: Finished installing server software\n")
   ############################################################

+ 7 - 5
toolset/setup/linux/prerequisites.sh

@@ -14,11 +14,13 @@ RETCODE=$(fw_exists fwbm_prereqs_installed)
 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
 echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
 
-sudo apt-get -y update
-sudo apt-get -y upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
+# One -q produces output suitable for logging (mostly hides
+# progress indicators)
+sudo apt-get -yq update
+sudo apt-get -yq upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
 
 # WARNING: DONT PUT A SPACE AFTER ANY BACKSLASH OR APT WILL BREAK
-sudo apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
+sudo apt-get -yq install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
   cmake build-essential automake    `# Needed for building code` \
   curl wget unzip                   `# Common tools` \
   software-properties-common        `# Needed for add-apt-repository` \
@@ -42,8 +44,8 @@ sudo apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::=
 
 # Install gcc-4.8
 sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
-sudo apt-get -y update
-sudo apt-get install -y gcc-4.8 g++-4.8
+sudo apt-get -yq update
+sudo apt-get install -yq gcc-4.8 g++-4.8
 
 # Stop permanently overwriting people's files just for 
 # trying out our software!