def Prepare(benchmark_spec):
  """Installs SPEC CPU2006 on the target vm.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.
  """
  vm = benchmark_spec.vms[0]
  speccpu_vm_state = _SpecCpu2006SpecificState()
  setattr(vm, _BENCHMARK_SPECIFIC_VM_STATE_ATTR, speccpu_vm_state)
  vm.Install('wget')
  vm.Install('fortran')
  vm.Install('build_tools')

  # If using default config files and runspec_build_tool_version is not set,
  # install 4.7 gcc/g++/gfortan. If either one of the flag is set, we assume
  # user is smart
  if not FLAGS['runspec_config'].present or FLAGS.runspec_build_tool_version:
    build_tool_version = FLAGS.runspec_build_tool_version or '4.7'
    build_tools.Reinstall(vm, version=build_tool_version)
  if FLAGS.runspec_enable_32bit:
    vm.Install('multilib')
  vm.Install('numactl')
  scratch_dir = vm.GetScratchDir()
  vm.RemoteCommand('chmod 777 {0}'.format(scratch_dir))
  speccpu_vm_state.spec_dir = posixpath.join(scratch_dir, _SPECCPU2006_DIR)
  try:
    _PrepareWithTarFile(vm, speccpu_vm_state)
  except data.ResourceNotFound:
    _PrepareWithIsoFile(vm, speccpu_vm_state)
def Install(vm, speccpu_vm_state):
    """Installs SPEC CPU2006 or 2017 on the target vm.

  Args:
    vm: Vm on which speccpu is installed.
    speccpu_vm_state: SpecInstallConfigurations. Install configuration for spec.
  """
    setattr(vm, _VM_STATE_ATTR, speccpu_vm_state)
    scratch_dir = vm.GetScratchDir()
    vm.RemoteCommand('chmod 777 {0}'.format(scratch_dir))
    speccpu_vm_state.spec_dir = posixpath.join(scratch_dir,
                                               speccpu_vm_state.base_spec_dir)
    try:
        # Since this will override 'build_tools' installation, install this
        # before we install 'build_tools' package
        _PrepareWithPreprovisionedTarFile(vm, speccpu_vm_state)
        _CheckTarFile(vm, FLAGS.runspec_config, stages.PROVISION
                      in FLAGS.run_stage, speccpu_vm_state)
    except errors.Setup.BadPreprovisionedDataError:
        _CheckIsoAndCfgFile(FLAGS.runspec_config, speccpu_vm_state.iso_dir)
        _PrepareWithIsoFile(vm, speccpu_vm_state)

    vm.Install('wget')
    vm.Install('fortran')
    vm.Install('build_tools')

    # If using default config files and runspec_build_tool_version is not set,
    # install 4.7 gcc/g++/gfortan. If either one of the flag is set, we assume
    # user is smart
    if not FLAGS['runspec_config'].present or FLAGS.runspec_build_tool_version:
        build_tool_version = FLAGS.runspec_build_tool_version or '4.7'
        build_tools.Reinstall(vm, version=build_tool_version)
    if FLAGS.runspec_enable_32bit:
        vm.Install('multilib')
    vm.Install('numactl')
def Install(vm):
  """Installs SPECCPU dependencies."""
  vm.Install('wget')
  vm.Install('fortran')
  vm.Install('build_tools')

  # If using default config files and runspec_build_tool_version is not set,
  # install 4.7 gcc/g++/gfortan. If either one of the flag is set, we assume
  # user is smart
  if not FLAGS['runspec_config'].present or FLAGS.runspec_build_tool_version:
    build_tool_version = FLAGS.runspec_build_tool_version or '4.7'
    build_tools.Reinstall(vm, version=build_tool_version)
  if FLAGS.runspec_enable_32bit:
    vm.Install('multilib')
  vm.Install('numactl')
def Install(vm):
  """Installs SPECCPU dependencies."""
  vm.Install('wget')
  vm.Install('fortran')
  vm.Install('build_tools')

  # If runspec_build_tool_version is not set,
  # install 4.7 gcc/g++/gfortan. If either one of the flag is set, we assume
  # user is smart
  if FLAGS.runspec_build_tool_version:
    build_tool_version = FLAGS.runspec_build_tool_version or '4.7'
    if not (vm.OS_TYPE == os_types.DEBIAN9 and build_tool_version == '6'):
      # debian9 already comes with version 6
      build_tools.Reinstall(vm, version=build_tool_version)
  if FLAGS.runspec_enable_32bit:
    vm.Install('multilib')
  vm.Install('numactl')
def Install(vm):
    """Installs SPECCPU dependencies."""
    vm.Install('wget')
    vm.Install('fortran')
    vm.Install('build_tools')

    # If runspec_build_tool_version is not set,
    # install 4.7 gcc/g++/gfortan. If either one of the flag is set, we assume
    # user is smart
    if FLAGS.runspec_build_tool_version:
        build_tool_version = FLAGS.runspec_build_tool_version or '4.7'
        if 'debian' not in vm.OS_TYPE:
            # do not reinstall gcc/g++/gfortran on Debian OS's;
            # reinstallation may be done by setting FLAGS.gcc_version
            build_tools.Reinstall(vm, version=build_tool_version)
    if FLAGS.runspec_enable_32bit:
        vm.Install('multilib')
    vm.Install('numactl')