def _GenerateBenchmarkDocumentation(): """Generates benchmark documentation to show in --help.""" benchmark_docs = [] for benchmark_module in (linux_benchmarks.BENCHMARKS + windows_benchmarks.BENCHMARKS): benchmark_config = configs.LoadMinimalConfig( benchmark_module.BENCHMARK_CONFIG, benchmark_module.BENCHMARK_NAME) vm_groups = benchmark_config.get('vm_groups', {}) total_vm_count = 0 vm_str = '' scratch_disk_str = '' for group in vm_groups.itervalues(): group_vm_count = group.get('vm_count', 1) if group_vm_count is None: vm_str = 'variable' else: total_vm_count += group_vm_count if group.get('disk_spec'): scratch_disk_str = ' with scratch volume(s)' name = benchmark_module.BENCHMARK_NAME if benchmark_module in windows_benchmarks.BENCHMARKS: name += ' (Windows)' benchmark_docs.append('%s: %s (%s VMs%s)' % (name, benchmark_config['description'], vm_str or total_vm_count, scratch_disk_str)) return '\n\t'.join(benchmark_docs)
def testLoadInvalidYaml(self): with self.assertRaises(errors.Config.ParseError): configs.LoadMinimalConfig(INVALID_YAML_CONFIG, CONFIG_NAME)
def testWrongName(self): with self.assertRaises(KeyError): configs.LoadMinimalConfig(VALID_CONFIG, INVALID_NAME)
def testLoadValidConfig(self): self.assertIsInstance( configs.LoadMinimalConfig(VALID_CONFIG, CONFIG_NAME), dict)
def testLoadConfigWithBadReference(self): with self.assertRaises(errors.Config.ParseError): configs.LoadMinimalConfig(BAD_REF_CONFIG, CONFIG_NAME)
def testLoadConfigWithExternalReference(self): self.assertIsInstance( configs.LoadMinimalConfig(REF_CONFIG, CONFIG_NAME), dict)