From e7338e897892b3d1c484379d8706e503bde684ab Mon Sep 17 00:00:00 2001 From: rexlee8776 Date: Thu, 16 Nov 2017 08:49:16 +0000 Subject: bugfix: tc078 fails in some situations 1. make "SPECint_benchmark, runspec_iterations, runspec_tune, runspec_size, runspec_rate" parameterized and change the default value "int^429" to "int" 2. remove "become: true" in some roles since it does not need root privilege JIRA: YARDSTICK-852 Change-Id: Icb384bddc12911e2681a981d0504e0e142d1a8ec Signed-off-by: rexlee8776 (cherry picked from commit 7bd43b239b7be6f478399526a177922d4482bcc2) --- .../roles/archive_spec_cpu2006_result/tasks/main.yaml | 5 ++--- ansible/roles/fetch_spec_cpu2006_result/tasks/main.yaml | 3 +-- ansible/roles/install_spec_cpu2006/tasks/main.yaml | 6 ++---- .../roles/unarchive_spec_cpu2006_result/tasks/main.yaml | 1 - ansible/roles/uninstall_spec_cpu2006/tasks/main.yaml | 4 +--- tests/opnfv/test_cases/opnfv_yardstick_tc078.yaml | 16 ++++++++++------ yardstick/benchmark/scenarios/compute/spec_cpu.py | 10 +++++++--- 7 files changed, 23 insertions(+), 22 deletions(-) mode change 100644 => 100755 tests/opnfv/test_cases/opnfv_yardstick_tc078.yaml diff --git a/ansible/roles/archive_spec_cpu2006_result/tasks/main.yaml b/ansible/roles/archive_spec_cpu2006_result/tasks/main.yaml index 7f72e1394..0282244ae 100644 --- a/ansible/roles/archive_spec_cpu2006_result/tasks/main.yaml +++ b/ansible/roles/archive_spec_cpu2006_result/tasks/main.yaml @@ -10,6 +10,5 @@ - name: archive_spec_cpu2006_result archive: - path: /usr/cpu2006/result - dest: /usr/cpu2006/spec_cpu2006_result.zip - become: true + path: ~/cpu2006/result + dest: ~/cpu2006/spec_cpu2006_result.zip diff --git a/ansible/roles/fetch_spec_cpu2006_result/tasks/main.yaml b/ansible/roles/fetch_spec_cpu2006_result/tasks/main.yaml index 370ec7a0c..ccc89000c 100644 --- a/ansible/roles/fetch_spec_cpu2006_result/tasks/main.yaml +++ b/ansible/roles/fetch_spec_cpu2006_result/tasks/main.yaml @@ -10,7 +10,6 @@ - name: fetch_spec_cpu2006_result fetch: - src: /usr/cpu2006/spec_cpu2006_result.zip + src: ~/cpu2006/spec_cpu2006_result.zip dest: /tmp/ flat: yes - become: true diff --git a/ansible/roles/install_spec_cpu2006/tasks/main.yaml b/ansible/roles/install_spec_cpu2006/tasks/main.yaml index baa9f6ca0..ea698f5a2 100644 --- a/ansible/roles/install_spec_cpu2006/tasks/main.yaml +++ b/ansible/roles/install_spec_cpu2006/tasks/main.yaml @@ -12,13 +12,11 @@ copy: src: /home/opnfv/repos/yardstick/yardstick/resources/cpu2006-1.2.iso dest: ~/cpu2006-1.2.iso - become: true - name: install SPEC CPU2006 shell: - mount -t iso9660 -o ro,exec ~/cpu2006-1.2.iso /mnt; + sudo mount -t iso9660 -o ro,exec ~/cpu2006-1.2.iso /mnt; cd /mnt; - ./install.sh -fd /usr/cpu2006; + ./install.sh -fd ~/cpu2006; args: executable: /bin/bash - become: true diff --git a/ansible/roles/unarchive_spec_cpu2006_result/tasks/main.yaml b/ansible/roles/unarchive_spec_cpu2006_result/tasks/main.yaml index 86dcc1aeb..07d15d1a9 100644 --- a/ansible/roles/unarchive_spec_cpu2006_result/tasks/main.yaml +++ b/ansible/roles/unarchive_spec_cpu2006_result/tasks/main.yaml @@ -13,4 +13,3 @@ src: /tmp/spec_cpu2006_result.zip dest: /tmp/ remote_src: True - become: true diff --git a/ansible/roles/uninstall_spec_cpu2006/tasks/main.yaml b/ansible/roles/uninstall_spec_cpu2006/tasks/main.yaml index 72d8c93ee..b2a50896e 100644 --- a/ansible/roles/uninstall_spec_cpu2006/tasks/main.yaml +++ b/ansible/roles/uninstall_spec_cpu2006/tasks/main.yaml @@ -10,9 +10,8 @@ - name: remove SPEC CPU 2006 file: - path: /usr/cpu2006 + path: ~/cpu2006 state: absent - become: true - name: umount SPEC CPU 2006 ISO shell: @@ -25,4 +24,3 @@ file: path: ~/cpu2006-1.2.iso state: absent - become: true diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc078.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc078.yaml old mode 100644 new mode 100755 index d20045b25..e5cf6ce36 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc078.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc078.yaml @@ -10,22 +10,26 @@ schema: "yardstick:task:0.1" description: > - Yardstick TC078 config file; Measure CPU performance using SPEC CPU2006; {% set file = file or "/etc/yardstick/pod.yaml" %} {% set host = host or 'node1' %} +{% set benchmark = benchmark or 'int' %} +{% set runspec_iterations = runspec_iterations or 1 %} +{% set runspec_tune = runspec_tune or 'base' %} +{% set runspec_size = runspec_size or 'ref' %} +{% set runspec_rate = runspec_rate or 1 %} scenarios: - type: SpecCPU2006 options: - SPECint_benchmark: int^429 - runspec_iterations: 1 - runspec_tune: base - runspec_size: ref - runspec_rate: 1 + SPECint_benchmark: {{benchmark}} + runspec_iterations: {{runspec_iterations}} + runspec_tune: {{runspec_tune}} + runspec_size: {{runspec_size}} + runspec_rate: {{runspec_rate}} host: {{host}}.yardstick-TC078 diff --git a/yardstick/benchmark/scenarios/compute/spec_cpu.py b/yardstick/benchmark/scenarios/compute/spec_cpu.py index df361cd94..0294f524d 100644 --- a/yardstick/benchmark/scenarios/compute/spec_cpu.py +++ b/yardstick/benchmark/scenarios/compute/spec_cpu.py @@ -10,6 +10,7 @@ from __future__ import absolute_import import logging import pkg_resources +import os import yardstick.ssh as ssh from yardstick.benchmark.scenarios import base @@ -66,6 +67,7 @@ class SpecCPU(base.Scenario): default: na """ __scenario_type__ = "SpecCPU2006" + CPU2006_DIR = "~/cpu2006" def __init__(self, scenario_cfg, context_cfg): self.scenario_cfg = scenario_cfg @@ -87,8 +89,9 @@ class SpecCPU(base.Scenario): "yardstick.resources", 'files/' + self.runspec_config) # copy SPEC CPU2006 config file to host if given - self.client._put_file_shell(self.runspec_config_file, - '/usr/cpu2006/config/yardstick_spec_cpu2006.cfg') + cfg_path = os.path.join(self.CPU2006_DIR, + 'config/yardstick_spec_cpu2006.cfg') + self.client._put_file_shell(self.runspec_config_file, cfg_path) else: self.runspec_config = "Example-linux64-amd64-gcc43+.cfg" @@ -100,7 +103,8 @@ class SpecCPU(base.Scenario): if not self.setup_done: self.setup() - cmd = "cd /usr/cpu2006/ && . ./shrc && runspec --config %s" % self.runspec_config + cmd = "cd %s && . ./shrc && runspec --config %s" % ( + self.CPU2006_DIR, self.runspec_config) cmd_args = "" if "rate" in self.options: -- cgit 1.2.3-korg