summaryrefslogtreecommitdiffstats
path: root/qtip/driver
diff options
context:
space:
mode:
authorwu.zhihui <wu.zhihui1@zte.com.cn>2017-03-02 18:40:11 +0800
committerzhihui wu <zhihui.wu2006+zte@gmail.com>2017-03-03 00:53:59 +0000
commit7433b1c89e2ffba3b097832f353146f12987e6dd (patch)
tree2e99d8a91417414d4cce6dd299d918a604e4d206 /qtip/driver
parent473deae9a10162f000c49ca49b4e31b28c4bf0d8 (diff)
Refactor dhrystone playbook
- Break previous one playbook into three playbooks: setup.yaml: setup test environment. run.yaml: execute test steps clean.yaml: cleanup test environment to restore environment The advantage is cleaning part will never be blocked by another. - Just do testing on remote hosts, parse logfile on localhost. - Use ansible module instead of shell command. - Move up all files under /ansible and remove ansible directory. Under /ansible, ansible package cann't be imported. Change-Id: I43c65be23869b7d42ca769994d4decb9a012d196 Signed-off-by: wu.zhihui <wu.zhihui1@zte.com.cn>
Diffstat (limited to 'qtip/driver')
-rw-r--r--qtip/driver/ansible.py (renamed from qtip/driver/ansible/ansible.py)0
-rw-r--r--qtip/driver/ansible/__init__.py0
-rw-r--r--qtip/driver/playbook/bwn_ng.yaml (renamed from qtip/driver/ansible/playbook/bwn_ng.yaml)0
-rw-r--r--qtip/driver/playbook/dhrystone/clean.yaml27
-rw-r--r--qtip/driver/playbook/dhrystone/run.yaml63
-rw-r--r--qtip/driver/playbook/dhrystone/setup.yaml66
-rw-r--r--qtip/driver/playbook/inxi.yaml (renamed from qtip/driver/ansible/playbook/inxi.yaml)0
-rw-r--r--qtip/driver/playbook/prepare_env.yaml (renamed from qtip/driver/ansible/playbook/prepare_env.yaml)14
-rw-r--r--qtip/driver/playbook/top.yaml (renamed from qtip/driver/ansible/playbook/top.yaml)0
9 files changed, 169 insertions, 1 deletions
diff --git a/qtip/driver/ansible/ansible.py b/qtip/driver/ansible.py
index cd17625d..cd17625d 100644
--- a/qtip/driver/ansible/ansible.py
+++ b/qtip/driver/ansible.py
diff --git a/qtip/driver/ansible/__init__.py b/qtip/driver/ansible/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/qtip/driver/ansible/__init__.py
+++ /dev/null
diff --git a/qtip/driver/ansible/playbook/bwn_ng.yaml b/qtip/driver/playbook/bwn_ng.yaml
index 99477856..99477856 100644
--- a/qtip/driver/ansible/playbook/bwn_ng.yaml
+++ b/qtip/driver/playbook/bwn_ng.yaml
diff --git a/qtip/driver/playbook/dhrystone/clean.yaml b/qtip/driver/playbook/dhrystone/clean.yaml
new file mode 100644
index 00000000..72bfab7e
--- /dev/null
+++ b/qtip/driver/playbook/dhrystone/clean.yaml
@@ -0,0 +1,27 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+- hosts: hosts
+ become: yes
+ remote_user: root
+
+ tasks:
+ - name: Checking home directory
+ shell: echo $HOME
+ register: home_dir
+
+ - name: Cleaning tempT
+ file:
+ path: '{{ home_dir.stdout }}/tempT'
+ state: absent
+
+ - name: Cleaning qtip_result
+ file:
+ path: '{{ home_dir.stdout }}/qtip_result'
+ state: absent
diff --git a/qtip/driver/playbook/dhrystone/run.yaml b/qtip/driver/playbook/dhrystone/run.yaml
new file mode 100644
index 00000000..55de6597
--- /dev/null
+++ b/qtip/driver/playbook/dhrystone/run.yaml
@@ -0,0 +1,63 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+- hosts: hosts
+ become: yes
+ remote_user: root
+
+ tasks:
+ - name: Get current timestamp
+ set_fact:
+ timestamp: "{{ lookup('pipe', 'date +%Y-%m-%d-%H-%M') }}"
+
+ - name: Checking home directory
+ shell: echo $HOME
+ register: home_dir
+
+ - name: Fetch hostname
+ shell: hostname
+ register: host_name
+
+ - name: Make UnixBench
+ shell: make --directory $HOME/tempT/UnixBench/
+
+ - name: Make some directories needed
+ file:
+ path: '{{ home_dir.stdout }}/qtip_result/{{ timestamp }}/{{ host_name.stdout }}'
+ state: directory
+
+ - include: ../inxi.yaml
+
+ - include: ../top.yaml
+
+ - name: Run dhrystone
+ shell: ./Run -v dhrystone
+ args:
+ chdir: '{{ home_dir.stdout }}/tempT/UnixBench/'
+
+ - name: Copying result to qtip result directory
+ shell: cp -r $HOME/tempT/UnixBench/results/* ./
+ args:
+ chdir: '{{ home_dir.stdout }}/qtip_result/{{ timestamp }}/{{ host_name.stdout }}'
+
+ - name: Copy top log to qtip result directory
+ shell: mv $HOME/qtip_result/top.log ./
+ args:
+ chdir: '{{ home_dir.stdout }}/qtip_result/{{ timestamp }}/{{ host_name.stdout }}'
+
+ - name: Copy inxi log to qtip result directory
+ shell: mv $HOME/qtip_result/inxi.log ./
+ args:
+ chdir: '{{ home_dir.stdout }}/qtip_result/{{ timestamp }}/{{ host_name.stdout }}'
+
+ - name: Fetch result files to local manchine
+ synchronize:
+ mode: pull
+ src: '{{ home_dir.stdout }}/qtip_result/'
+ dest: '{{ result_dir }}/dhrystone/logs/'
diff --git a/qtip/driver/playbook/dhrystone/setup.yaml b/qtip/driver/playbook/dhrystone/setup.yaml
new file mode 100644
index 00000000..430670c1
--- /dev/null
+++ b/qtip/driver/playbook/dhrystone/setup.yaml
@@ -0,0 +1,66 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+- hosts: localhost
+ connection: local
+ gather_facts: no
+
+ tasks:
+ - name: Making dhrystone directory
+ file:
+ path: '{{ result_dir }}/dhrystone/logs/'
+ state: directory
+
+- hosts: hosts
+ become: yes
+ remote_user: root
+
+ tasks:
+ - name: Checking home directory
+ shell: echo $HOME
+ register: home_dir
+
+ - name: Cleaning tempT directory
+ file:
+ path: '{{ home_dir.stdout }}/tempT'
+ state: absent
+
+ - name: Cleaning qtip_result directory
+ file:
+ path: '{{ home_dir.stdout }}/qtip_result'
+ state: absent
+
+ - include: ../prepare_env.yaml
+
+ - name: Installing UnixBench dependencies if CentOS
+ yum:
+ name: '{{ item }}'
+ state: present
+ when: ansible_os_family == "RedHat"
+ with_items:
+ - git
+ - gcc
+ - patch
+ - perl-Time-HiRes
+
+ - name: Installing UnixBench dependencies if Ubuntu
+ apt:
+ name: '{{ item }}'
+ state: present
+ when: ansible_os_family == "Debian"
+ with_items:
+ - git
+ - gcc
+ - patch
+ - perl
+
+ - name: Clone unixbench
+ git:
+ repo: https://github.com/kdlucas/byte-unixbench.git
+ dest: '{{ home_dir.stdout }}/tempT'
diff --git a/qtip/driver/ansible/playbook/inxi.yaml b/qtip/driver/playbook/inxi.yaml
index f6a0311d..f6a0311d 100644
--- a/qtip/driver/ansible/playbook/inxi.yaml
+++ b/qtip/driver/playbook/inxi.yaml
diff --git a/qtip/driver/ansible/playbook/prepare_env.yaml b/qtip/driver/playbook/prepare_env.yaml
index 0595d988..1ec71520 100644
--- a/qtip/driver/ansible/playbook/prepare_env.yaml
+++ b/qtip/driver/playbook/prepare_env.yaml
@@ -10,7 +10,7 @@
yum:
name: epel-release
state: present
- when: ansible_os_family == "RedHat"
+ when: ansible_os_family == "RedHat"
- name: Software Properties Common
apt:
@@ -40,3 +40,15 @@
name: python-selinux
state: present
when: ansible_os_family == "Debian"
+
+- name: Install rsync when CentOS
+ yum:
+ name: rsync
+ state: present
+ when: ansible_os_family == "RedHat"
+
+- name: Install rsync when Ubuntu
+ apt:
+ name: rsync
+ state: present
+ when: ansible_os_family == "Debian"
diff --git a/qtip/driver/ansible/playbook/top.yaml b/qtip/driver/playbook/top.yaml
index 8de7e3d6..8de7e3d6 100644
--- a/qtip/driver/ansible/playbook/top.yaml
+++ b/qtip/driver/playbook/top.yaml