Parcourir la source

Added more support to the suite

msmith-techempower il y a 10 ans
Parent
commit
bc30d4b787

+ 3 - 8
frameworks/Java/play2-java/setup_java_ebean_bonecp.sh

@@ -1,15 +1,10 @@
 #!/bin/bash
 
-# load java environment variables
-source $IROOT/java7.installed
+fw_depends java7 sbt
 
 cd play2-java-ebean-bonecp
 
-# If application is running, clear old running app.
-if [ -f ${TROOT}/play2-java-ebean-bonecp/target/universal/stage/RUNNING_PID ]
-then
-  rm -f -r ${TROOT}/play2-java-ebean-bonecp/target/universal/stage/RUNNING_PID
-fi
+rm -rf target/universal/stage/RUNNING_PID
 
-${IROOT}/sbt/bin/sbt stage
+sbt stage
 target/universal/stage/bin/play2-java-ebean-bonecp &

+ 3 - 8
frameworks/Java/play2-java/setup_java_ebean_hikaricp.sh

@@ -1,15 +1,10 @@
 #!/bin/bash
 
-# load java environment variables
-source $IROOT/java7.installed
+fw_depends java7 sbt
 
 cd play2-java-ebean-hikaricp
 
-# If application is running, clear old running app.
-if [ -f ${TROOT}/play2-java-ebean-hikaricp/target/universal/stage/RUNNING_PID ]
-then
-  rm -f -r ${TROOT}/play2-java-ebean-hikaricp/target/universal/stage/RUNNING_PID
-fi
+rm -rf target/universal/stage/RUNNING_PID
 
-${IROOT}/sbt/bin/sbt stage
+sbt stage
 target/universal/stage/bin/play2-java-ebean-hikaricp &

+ 3 - 8
frameworks/Java/play2-java/setup_java_jpa_bonecp.sh

@@ -1,15 +1,10 @@
 #!/bin/bash
 
-# load java environment variables
-source $IROOT/java7.installed
+fw_depends java7 sbt
 
 cd play2-java-jpa-bonecp
 
-# If application is running, clear old running app.
-if [ -f ${TROOT}/play2-java-jpa-bonecp/target/universal/stage/RUNNING_PID ]
-then
-  rm -f -r ${TROOT}/play2-java-jpa-bonecp/target/universal/stage/RUNNING_PID
-fi
+rm -rf target/universal/stage/RUNNING_PID
 
-${IROOT}/sbt/bin/sbt stage
+sbt stage
 target/universal/stage/bin/play2-java-jpa-bonecp &

+ 3 - 8
frameworks/Java/play2-java/setup_java_jpa_hikaricp.sh

@@ -1,15 +1,10 @@
 #!/bin/bash
 
-# load java environment variables
-source $IROOT/java7.installed
+fw_depends java7 sbt
 
 cd play2-java-jpa-hikaricp
 
-# If application is running, clear old running app.
-if [ -f ${TROOT}/play2-java-jpa-hikaricp/target/universal/stage/RUNNING_PID ]
-then
-  rm -f -r ${TROOT}/play2-java-jpa-hikaricp/target/universal/stage/RUNNING_PID
-fi
+rm -rf target/universal/stage/RUNNING_PID
 
-${IROOT}/sbt/bin/sbt stage
+sbt stage
 target/universal/stage/bin/play2-java-jpa-hikaricp &

+ 0 - 3
frameworks/Java/restexpress/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends java7 maven

+ 3 - 4
frameworks/Java/restexpress/setup.sh

@@ -1,14 +1,13 @@
 #!/bin/bash
 
-# load java environment variables
-source $IROOT/java7.installed
-
 sed -i 's|mongodb://.*/hello_world|mongodb://'"${DBHOST}"'/hello_world|g' config/dev/environment.properties
 sed -i 's|mysql://.*:3306|mysql://'"${DBHOST}"':3306|g' config/dev/environment.properties
 
+fw_depends java7 maven
+
 mvn clean package
 mvn assembly:single
 cd target
 unzip world-1.0-SNAPSHOT-zip-with-dependencies.zip
 cd world-1.0-SNAPSHOT
-java -jar world-1.0-SNAPSHOT.jar &
+java -jar world-1.0-SNAPSHOT.jar &

+ 0 - 3
frameworks/Java/sabina/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends java8 maven

+ 2 - 3
frameworks/Java/sabina/setup.sh

@@ -1,7 +1,6 @@
 #!/bin/bash
 
-# load java environment variables
-source $IROOT/java8.installed
+fw_depends java8 maven
 
 mvn clean package -DskipTests -Ddb.host=${DBHOST}
-${JAVA_HOME}/bin/java -jar target/sabina-1.0.0.jar &
+$JAVA_HOME/bin/java -jar target/sabina-1.0.0.jar &

+ 5 - 0
toolset/benchmark/framework_test.py

@@ -184,6 +184,11 @@ class FrameworkTest:
                 logDir,
                 self.benchmarker.threads))
 
+    # Always ensure that IROOT belongs to the runner_user
+    chown = "sudo chown -R %s:%s %s" % (self.benchmarker.runner_user,
+      self.benchmarker.runner_user, os.path.join(self.fwroot, self.install_root))
+    subprocess.check_call(chown, shell=True, cwd=cwd, executable='/bin/bash')
+
     # Run the module start inside parent of TROOT
     #  - we use the parent as a historical accident, a number of tests
     # refer to their TROOT maually still

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

@@ -95,6 +95,14 @@ 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

+ 0 - 91
toolset/setup/linux/installer.py

@@ -56,97 +56,6 @@ class Installer:
   # End install_software
   ############################################################
 
-  ############################################################
-  # __install_server_software
-  ############################################################
-  def __install_server_software(self):
-    print("\nINSTALL: Installing server software (strategy=%s)\n"%self.strategy)
-    # 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,
-      benchmarker=self.benchmarker)
-    
-    dirs = [t.directory for t in tests]
-
-    # Locate all installation files
-    install_files = glob.glob("%s/*/install.sh" % self.fwroot)
-    install_files.extend(glob.glob("%s/frameworks/*/*/install.sh" % self.fwroot))
-
-    # Run install for selected tests
-    for test_install_file in install_files:
-      test_dir = os.path.dirname(test_install_file)
-      test_rel_dir = os.path.relpath(test_dir, self.fwroot)
-      logging.debug("Considering install of %s (%s, %s)", test_install_file, test_rel_dir, test_dir)
-
-      if test_dir not in dirs:
-        continue
-
-      logging.info("Running installation for directory %s (cwd=%s)", test_dir, test_dir)
-
-      # Collect the tests in this directory
-      # local_tests = [t for t in tests if t.directory == test_dir]
-
-      # Find installation directory 
-      #   e.g. FWROOT/installs or FWROOT/installs/pertest/<test-name>
-      test_install_dir="%s/%s" % (self.fwroot, self.install_dir)
-      if self.strategy is 'pertest':
-        test_install_dir="%s/pertest/%s" % (test_install_dir, test_dir)
-      if not os.path.exists(test_install_dir):
-        os.makedirs(test_install_dir)
-      
-      # Move into the proper working directory
-      previousDir = os.getcwd()
-      os.chdir(test_dir)
-
-      # Load environment
-      setup_util.replace_environ(config='$FWROOT/config/benchmark_profile', 
-        command='export TROOT=%s && export IROOT=%s' %
-        (test_dir, test_install_dir))
-
-      # Run the install.sh script for the test as the "testrunner" user
-      # 
-      # `sudo` - Switching user requires superuser privs
-      #   -u [username] The username
-      #   -E Preserves the current environment variables
-      #   -H Forces the home var (~) to be reset to the user specified
-      #   TROOT  - Path to this test's directory 
-      #   IROOT  - Path of this test's install directory
-      # TODO export bash functions and call install.sh directly
-      command = 'sudo -u %s -E -H bash -c "source %s && source %s"' % (
-        self.benchmarker.runner_user, 
-        bash_functions_path, 
-        test_install_file)
-
-      debug_command = '''\
-        export FWROOT=%s && \\
-        export TROOT=%s && \\
-        export IROOT=%s && \\
-        cd $IROOT && \\
-        %s''' % (self.fwroot, 
-          test_dir, 
-          test_install_dir,
-          command)
-      logging.info("To run installation manually, copy/paste this:\n%s", debug_command)
-
-      # Run test installation script
-      self.__run_command(command, cwd=test_install_dir)
-
-      # Move back to previous directory
-      os.chdir(previousDir)
-
-    self.__run_command("sudo apt-get -yq autoremove");    
-
-    print("\nINSTALL: Finished installing server software\n")
-  ############################################################
-  # End __install_server_software
-  ############################################################
-
   ############################################################
   # __install_error
   ############################################################

+ 6 - 3
toolset/setup/linux/languages/java8.sh

@@ -3,7 +3,7 @@
 RETCODE=$(fw_exists java8.installed)
 [ ! "$RETCODE" == 0 ] || { \
   # Load environment variables
-  . $IROOT/java8.installed
+  source $IROOT/java8.installed
   return 0; }
 
 sudo add-apt-repository -y ppa:webupd8team/java
@@ -28,5 +28,8 @@ do
 done
 
 # Setup environment variables
-echo "export JAVA_HOME=/usr/lib/jvm/java-8-oracle" > $IROOT/java8.installed
-echo "export PATH=$JAVA_HOME/bin:$PATH" >> $IROOT/java8.installed
+JAVA_HOME=/usr/lib/jvm/java-8-oracle
+echo "export JAVA_HOME=${JAVA_HOME}" > $IROOT/java8.installed
+echo -e "export PATH=${JAVA_HOME}/bin:\$PATH" >> $IROOT/java8.installed
+
+source $IROOT/java8.installed