From 6bbc4d2864f9dc3525aa889e38d0418050734676 Mon Sep 17 00:00:00 2001 From: Botao Sun Date: Fri, 21 Nov 2014 20:44:05 +1100 Subject: Add Phoronix Test Suite for Linaro ubuntu Two example test included in this patch: system-decompress-xz and stream. Test code has been validated in LAVA on TI Panda board. Signed-off by: Botao Sun Change-Id: Id041abd5d68d9b94804c9fb7712deb52a1ec92b9 --- ubuntu/phoronix.yaml | 53 +++++++++++++++++++ ubuntu/scripts/phoronix.py | 123 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 ubuntu/phoronix.yaml create mode 100755 ubuntu/scripts/phoronix.py (limited to 'ubuntu') diff --git a/ubuntu/phoronix.yaml b/ubuntu/phoronix.yaml new file mode 100644 index 0000000..71bfaae --- /dev/null +++ b/ubuntu/phoronix.yaml @@ -0,0 +1,53 @@ +metadata: + name: phoronix-test-suite + format: "Lava-Test-Shell Test Definition 1.0" + description: "Run a sub-set of phoronix test suite on Linux Linaro ubuntu" + maintainer: + - botao.sun@linaro.org + os: + - ubuntu + devices: + - panda + - panda-es + environment: + - lava-test-shell + +install: + deps: + - python + - python-pexpect + - php5-common + - php5-readline + - libgd3 + - libxpm4 + - phpapi-20121212+lfs + - libfontconfig1 + - libfreetype6 + - libjpeg8 + - libtiff5 + - libvpx1 + - psmisc + - fontconfig-config + - libjpeg-turbo8 + - libjbig0 + - fonts-dejavu-core + - ttf-bitstream-vera + - fonts-freefont-ttf + - gsfonts-x11 + - gsfonts + - xfonts-utils + - libfontenc1 + - libxfont1 + - x11-common + - xfonts-encodings + - php5-cli + - php5-gd + - php5-json + - php-fpdf + - iptables + +run: + steps: + - "wget http://phoronix-test-suite.com/releases/repo/pts.debian/files/phoronix-test-suite_5.2.1_all.deb" + - "dpkg -i phoronix-test-suite_5.2.1_all.deb" + - "cd ubuntu/scripts; ./phoronix.py" diff --git a/ubuntu/scripts/phoronix.py b/ubuntu/scripts/phoronix.py new file mode 100755 index 0000000..a2fa34c --- /dev/null +++ b/ubuntu/scripts/phoronix.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python +# +# Phoronix test for Linux Linaro ubuntu +# +# Copyright (C) 2010 - 2014, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Botao Sun + +import os +import pexpect +import sys +from subprocess import call, check_output + +# Switch to home path of current user +home_path = os.path.expanduser("~") +os.chdir(home_path) +print os.getcwd() + +# Result collection for LAVA +debug_switcher = False +def collect_result(testcase, result): + if debug_switcher == False: + call(['lava-test-case', testcase, '--result', result]) + else: + print ['lava-test-case', testcase, '--result', result] + +def collect_score_with_measurement(testcase, result, score, unit): + if debug_switcher == False: + call(['lava-test-case', testcase, '--result', result, '--measurement', str(score), '--units', unit]) + else: + print ['lava-test-case', testcase, '--result', result, '--measurement', str(score), '--units', unit] + +# Installation check +def phoronix_install_check(): + testcase = 'phoronix-install' + call_return = call(['which', 'phoronix-test-suite']) + if call_return != 0: + result = 'fail' + print 'Fatal error! Can not find phoronix command!' + collect_result(testcase, result) + sys.exit(1) + else: + result = 'pass' + collect_result(testcase, result) + +phoronix_install_check() + +# Walk through the user agreement - one shot +phoronix_home = home_path + '/.phoronix-test-suite' +if os.path.isdir(phoronix_home) != True: + user_agreement = pexpect.spawn('phoronix-test-suite version') + user_agreement.logfile = open(home_path + '/phoronix-user-agreement-log.txt', 'w') + user_agreement.expect('.+Do you agree to these terms and wish to proceed.+: ') + user_agreement.sendline('Y') + user_agreement.expect('.+Enable anonymous usage / statistics reporting.+: ') + user_agreement.sendline('n') + user_agreement.expect('.+Enable anonymous statistical reporting of installed software / hardware.+: ') + user_agreement.sendline('n') +else: + pass + +# Set batch mode to automate run the test +batchmode_setup = pexpect.spawn('phoronix-test-suite batch-setup') +batchmode_setup.logfile = open(home_path + '/phoronix-batch-mode-setup-log.txt', 'w') +batchmode_setup.expect('.+Save test results when in batch mode.+: ') +batchmode_setup.sendline('Y') +batchmode_setup.expect('.+Open the web browser automatically when in batch mode.+: ') +batchmode_setup.sendline('N') +batchmode_setup.expect('.+Auto upload the results to OpenBenchmarking.+: ') +batchmode_setup.sendline('n') +batchmode_setup.expect('.+Prompt for test identifier.+: ') +batchmode_setup.sendline('n') +batchmode_setup.expect('.+Prompt for test description.+: ') +batchmode_setup.sendline('n') +batchmode_setup.expect('.+Prompt for saved results file-name.+: ') +batchmode_setup.sendline('Y') +batchmode_setup.expect('.+Run all test options.+: ') +batchmode_setup.sendline('Y') + +# Print configuration file to stdout +call(['cat', home_path + '/.phoronix-test-suite/user-config.xml']) + +# Get all Ethernet interface name +# As the input is trusted, then call the function in this way +eth_interface_list = check_output("ifconfig -a | grep eth | awk '{print $1}'", shell=True).split('\n') +eth_interface_list = filter(None, eth_interface_list) +print eth_interface_list + +# Define test list +test_list = ['system-decompress-xz', 'stream'] + +# Run all the test +for i in range(0, len(test_list)): + test_install = call(['phoronix-test-suite', 'batch-install', test_list[i]]) + if test_install != 0: + print 'Fatal error! Failed to install ' + test_list[i] + '! Abort!' + collect_result(test_list[i], 'skip') + else: + test_run = pexpect.spawn('phoronix-test-suite batch-run ' + test_list[i], timeout=None) + test_run.expect('.+Enter a name to save these results under: ') + test_run.sendline(test_list[i] + '-linaro') + if test_run.isalive() == True: + test_run.wait() + test_result_file = home_path + '/.phoronix-test-suite/test-results/' + test_list[i] + '-linaro/' + 'test-1.xml' + call(['cat', test_result_file]) + collect_result(test_list[i], 'pass') + else: + print 'Test process has died!' + collect_result(test_list[i], 'fail') -- cgit v1.2.3