Esempio n. 1
0
    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 profile for this installation
            profile = "%s/bash_profile.sh" % test_dir
            if not os.path.exists(profile):
                profile = "$FWROOT/config/benchmark_profile"
            else:
                logging.info("Loading environment from %s (cwd=%s)", profile,
                             test_dir)
            setup_util.replace_environ(
                config=profile,
                command='export TROOT=%s && export IROOT=%s' %
                (test_dir, test_install_dir))

            # Run test installation script
            #   FWROOT - Path of the FwBm root
            #   IROOT  - Path of this test's install directory
            #   TROOT  - Path to this test's directory
            # Note: Cannot use ''' for newlines here or the script
            # passed to `bash -c` will fail.
            self.__run_command(
                'sudo -u %s -E -H bash -c "export TROOT=%s && export IROOT=%s && source %s && source %s"'
                % (self.benchmarker.runner_user, test_dir, test_install_dir,
                   bash_functions_path, test_install_file),
                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")
Esempio n. 2
0
  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 profile for this installation
      profile="%s/bash_profile.sh" % test_dir
      if not os.path.exists(profile):
        profile="$FWROOT/config/benchmark_profile"
      else:
        logging.info("Loading environment from %s (cwd=%s)", profile, test_dir)
      setup_util.replace_environ(config=profile, 
        command='export TROOT=%s && export IROOT=%s' %
        (test_dir, test_install_dir))

      # Run test installation script
      #   FWROOT - Path of the FwBm root
      #   IROOT  - Path of this test's install directory
      #   TROOT  - Path to this test's directory 
      # Note: Cannot use ''' for newlines here or the script
      # passed to `bash -c` will fail.
      self.__run_command('sudo -u %s -E -H bash -c "export TROOT=%s && export IROOT=%s && source %s && source %s"' % 
        (self.benchmarker.runner_user, test_dir, test_install_dir, 
          bash_functions_path, test_install_file),
          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")
  def __install_server_software(self):
    print("\nINSTALL: Installing server software (strategy=%s)\n"%self.strategy)
    # Install global prerequisites
    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))

    # Pull in benchmarker include and exclude list
    exclude = self.benchmarker.exclude
    include = self.benchmarker.test
    if exclude == None:
        exclude = []

    # Locate all known tests
    install_files = glob.glob("%s/*/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_name = os.path.basename(test_dir)
        test_rel_dir = setup_util.path_relative_to_root(test_dir)

        if test_name in exclude:
            logging.debug("%s has been excluded", test_name)
            continue
        elif include is not None and test_name not in include:
            logging.debug("%s not in include list", test_name)
            continue
        else:
            logging.info("Running installation for %s"%test_name)

            # 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_name)
            test_rel_install_dir=setup_util.path_relative_to_root(test_install_dir)
            if not os.path.exists(test_install_dir):
              os.makedirs(test_install_dir)

            # Load profile for this installation
            profile="%s/bash_profile.sh" % test_dir
            if not os.path.exists(profile):
              logging.warning("Framework %s does not have a bash_profile"%test_name)
              profile="$FWROOT/config/benchmark_profile"
            setup_util.replace_environ(config=profile)

            # Find relative installation file
            test_rel_install_file = "$FWROOT%s" % setup_util.path_relative_to_root(test_install_file)

            # Then run test installer file
            # Give all installers a number of variables
            # FWROOT - Path of the FwBm root
            # IROOT  - Path of this test's install directory
            # TROOT  - Path to this test's directory 
            self.__run_command('''
              export TROOT=$FWROOT%s && 
              export IROOT=$FWROOT%s && 
              . %s && 
              . %s''' % 
              (test_rel_dir, test_rel_install_dir, 
                bash_functions_path, test_rel_install_file),
                cwd=test_install_dir)

    self.__run_command("sudo apt-get -y autoremove");    

    print("\nINSTALL: Finished installing server software\n")
  def __install_server_software(self):
    print("\nINSTALL: Installing server software (strategy=%s)\n"%self.strategy)
    # Install global prerequisites
    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))

    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)

    # Run install for selected tests
    for test_install_file in install_files:
      test_dir = os.path.basename(os.path.dirname(test_install_file))
      test_rel_dir = os.path.relpath(os.path.dirname(test_install_file), self.fwroot)

      if test_dir not in dirs:
        continue
              
      logging.info("Running installation for directory %s", 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)
      test_rel_install_dir=os.path.relpath(test_install_dir, self.fwroot)
      if not os.path.exists(test_install_dir):
        os.makedirs(test_install_dir)

      # 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", profile)
      setup_util.replace_environ(config=profile, 
        command='export TROOT=$FWROOT%s && export IROOT=$FWROOT%s' %
        (test_rel_dir, test_rel_install_dir))

      # Find relative installation file
      test_rel_install_file = "$FWROOT%s" % setup_util.path_relative_to_root(test_install_file)

      # Then run test installer file
      # Give all installers a number of variables
      # FWROOT - Path of the FwBm root
      # IROOT  - Path of this test's install directory
      # TROOT  - Path to this test's directory 
      self.__run_command('''
        export TROOT=$FWROOT/%s && 
        export IROOT=$FWROOT/%s && 
        . %s && 
        . %s''' % 
        (test_rel_dir, test_rel_install_dir, 
          bash_functions_path, test_rel_install_file),
          cwd=test_install_dir)

    self.__run_command("sudo apt-get -y autoremove");    

    print("\nINSTALL: Finished installing server software\n")
Esempio n. 5
0
    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")
  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")