def testParsePeakResults(self): speccpu.FLAGS.spec_runmode = 'peak' vm = mock.Mock(vm=linux_virtual_machine.DebianMixin) spec_test_config = speccpu.SpecInstallConfigurations() spec_test_config.benchmark_name = 'speccpu2017' spec_test_config.log_format = r'Est. (SPEC.*2017_.*_base)\s*(\S*)' vm.speccpu_vm_state = spec_test_config samples = speccpu._ExtractScore(TEST_OUTPUT_PEAK, vm, False, None) self.assertSampleListsEqualUpToTimestamp(samples, EXPECTED_PEAK_RESULT_SPECINT)
def testParseSpeedResults(self): speccpu.FLAGS.spec_runmode = 'base' vm = mock.Mock(vm=linux_virtual_machine.DebianMixin) spec_test_config = speccpu.SpecInstallConfigurations() spec_test_config.benchmark_name = 'speccpu2006' spec_test_config.log_format = r'Est. (SPEC.*_base2006)\s*(\S*)' vm.speccpu_vm_state = spec_test_config samples = speccpu._ExtractScore(SPEED_OUTPUT_SPECINT, vm, False, 'speed') self.assertSampleListsEqualUpToTimestamp( samples, EXPECTED_SPEED_RESULT_SPECINT)
def testParseAllResults(self): speccpu.FLAGS.spec_runmode = 'all' vm = mock.Mock(vm=linux_virtual_machine.Ubuntu1804Mixin) spec_test_config = speccpu.SpecInstallConfigurations() spec_test_config.benchmark_name = 'speccpu2017' spec_test_config.log_format = r'Est. (SPEC.*2017_.*_base)\s*(\S*)' spec_test_config.runspec_config = r'linux64-x64-gcc47.cfg' vm.speccpu_vm_state = spec_test_config samples = speccpu._ExtractScore(TEST_OUTPUT_ALL, vm, False, None) self.assertSampleListsEqualUpToTimestamp(samples, EXPECTED_ALL_RESULT_SPECINT)
def Install(vm): """Installs SPECCPU 2006.""" install_config = speccpu.SpecInstallConfigurations() install_config.package_name = _PACKAGE_NAME install_config.base_mount_dir = _MOUNT_DIR install_config.base_spec_dir = _SPECCPU2006_DIR install_config.base_iso_file_path = _SPECCPU2006_ISO install_config.base_tar_file_path = _SPECCPU2006_TAR install_config.required_members = _TAR_REQUIRED_MEMBERS install_config.log_format = _LOG_FORMAT install_config.runspec_config = (FLAGS.runspec_config or _DEFAULT_RUNSPEC_CONFIG) speccpu.InstallSPECCPU(vm, install_config)
def GetSpecInstallConfig(scratch_dir): """Returns a SpecInstallConfigurations() for SPEC CPU 2017. Args: scratch_dir: The scratch directory on the VM that SPEC is installed on. """ install_config = speccpu.SpecInstallConfigurations() install_config.package_name = _PACKAGE_NAME install_config.base_spec_dir = _SPECCPU2017_DIR install_config.base_tar_file_path = _SPECCPU2017_TAR install_config.required_members = _TAR_REQUIRED_MEMBERS install_config.log_format = _LOG_FORMAT install_config.runspec_config = (FLAGS.runspec_config or _DEFAULT_RUNSPEC_CONFIG) install_config.UpdateConfig(scratch_dir) return install_config
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] install_config = speccpu.SpecInstallConfigurations() install_config.benchmark_name = BENCHMARK_NAME install_config.base_mount_dir = _MOUNT_DIR install_config.base_spec_dir = _SPECCPU2006_DIR install_config.base_iso_file_path = _SPECCPU2006_ISO install_config.base_tar_file_path = _SPECCPU2006_TAR install_config.required_members = _TAR_REQUIRED_MEMBERS install_config.log_format = _LOG_FORMAT speccpu.InstallSPECCPU(vm, install_config)
def Prepare(benchmark_spec): """Installs SPEC CPU2017 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] CheckVmPrerequisites(vm) install_config = speccpu.SpecInstallConfigurations() install_config.benchmark_name = BENCHMARK_NAME install_config.base_spec_dir = _SPECCPU2017_DIR install_config.base_tar_file_path = _SPECCPU2017_TAR install_config.required_members = _TAR_REQUIRED_MEMBERS install_config.log_format = _LOG_FORMAT speccpu.InstallSPECCPU(vm, install_config) vm.Install('speccpu2017_dependencies')
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] install_config = speccpu.SpecInstallConfigurations() install_config.benchmark_name = BENCHMARK_NAME install_config.base_spec_dir = _SPECCPU2017_DIR install_config.base_tar_file_path = _SPECCPU2017_TAR install_config.required_members = _TAR_REQUIRED_MEMBERS install_config.log_format = _LOG_FORMAT speccpu.Install(vm, install_config) vm.RemoteCommand('cd {0} && wget {1} && tar xf {2}'.format( INSTALL_DIR, LLVM_TAR_URL, LLVM_TAR)) vm.RemoteCommand('cd {0} && wget {1} && tar xf {2}'.format( INSTALL_DIR, OPENMP_TAR_URL, OPENMP_TAR))
def testParseResultsC(self): vm = mock.Mock(vm=linux_virtual_machine.Ubuntu1604Mixin) spec_test_config = speccpu.SpecInstallConfigurations() spec_test_config.benchmark_name = 'speccpu2006' spec_test_config.log_format = r'Est. (SPEC.*_base2006)\s*(\S*)' spec_test_config.runspec_config = r'linux64-x64-gcc47.cfg' speccpu.FLAGS.spec_runmode = 'base' vm.speccpu_vm_state = spec_test_config samples = speccpu._ExtractScore(TEST_OUTPUT_SPECINT, vm, False, 'rate') self.assertSampleListsEqualUpToTimestamp(samples, EXPECTED_RESULT_SPECINT) samples = speccpu._ExtractScore(TEST_OUTPUT_SPECFP, vm, False, 'rate') self.assertSampleListsEqualUpToTimestamp(samples, EXPECTED_RESULT_SPECFP) # By default, incomplete results result in error. with self.assertRaises(errors.Benchmarks.RunError): samples = speccpu._ExtractScore(TEST_OUTPUT_BAD1, vm, False, 'rate') with self.assertRaises(errors.Benchmarks.RunError): samples = speccpu._ExtractScore(TEST_OUTPUT_BAD2, vm, False, 'rate') # Now use keep_partial_results samples = speccpu._ExtractScore(TEST_OUTPUT_BAD1, vm, True, 'rate') self.assertSampleListsEqualUpToTimestamp(samples, EXPECTED_RESULT_BAD1) samples = speccpu._ExtractScore(TEST_OUTPUT_BAD2, vm, True, 'rate') self.assertSampleListsEqualUpToTimestamp(samples, EXPECTED_RESULT_BAD2) # Estimate scores speccpu.FLAGS.runspec_estimate_spec = True samples = speccpu._ExtractScore(TEST_OUTPUT_EST, vm, True, 'rate') self.assertSampleListsEqualUpToTimestamp(samples, EXPECTED_RESULT_EST)
def Install(vm): """Installs SPECCPU 2017.""" install_config = speccpu.SpecInstallConfigurations() install_config.package_name = _PACKAGE_NAME install_config.base_spec_dir = _SPECCPU2017_DIR install_config.base_tar_file_path = _SPECCPU2017_TAR install_config.required_members = _TAR_REQUIRED_MEMBERS install_config.log_format = _LOG_FORMAT install_config.runspec_config = (FLAGS.runspec_config or _DEFAULT_RUNSPEC_CONFIG) speccpu.InstallSPECCPU(vm, install_config) vm.RemoteCommand('cd {0} && wget {1} && tar xf {2}'.format( INSTALL_DIR, LLVM_TAR_URL, LLVM_TAR)) vm.RemoteCommand('cd {0} && wget {1} && tar xf {2}'.format( INSTALL_DIR, OPENMP_TAR_URL, OPENMP_TAR)) vm.RemoteCommand('sudo apt-get install libjemalloc1 libjemalloc-dev') vm.RemoteCommand('sudo apt-get update && sudo apt-get install -y libomp-dev') # spec17 tarball comes pre-packages with runner scripts for x86 architecture. # But because we may have x86 or arm architecture machines, just rerun the # install script to regenerate the runner scripts based on what spec detects # to be the vm architecture. vm.RemoteCommand('echo yes | /scratch/cpu2017/install.sh')
def Prepare(benchmark_spec): """Installs SPEC CPU2017 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] CheckVmPrerequisites(vm) install_config = speccpu.SpecInstallConfigurations() install_config.benchmark_name = BENCHMARK_NAME install_config.base_spec_dir = _SPECCPU2017_DIR install_config.base_tar_file_path = _SPECCPU2017_TAR install_config.required_members = _TAR_REQUIRED_MEMBERS install_config.log_format = _LOG_FORMAT install_config.runspec_config = benchmark_spec.config.speccpu.runspec_config speccpu.InstallSPECCPU(vm, install_config) vm.Install('speccpu2017_dependencies') # spec17 tarball comes pre-packages with runner scripts for x86 architecture. # But because we may have x86 or arm architecture machines, just rerun the # install script to regenerate the runner scripts based on what spec detects # to be the vm architecture. vm.RemoteCommand('echo yes | /scratch/cpu2017/install.sh')