From 71bbcb87de4f5e5cb86fb65dfdd6cf0363377af5 Mon Sep 17 00:00:00 2001 From: Fathi Boudra Date: Mon, 11 Jun 2012 14:37:17 +0300 Subject: Imported Upstream version 0.1.20120608 --- PKG-INFO | 6 ++--- gatortests.py | 70 +++++++++++++++++++++++++++++++---------------------------- setup.py | 6 ++--- 3 files changed, 43 insertions(+), 39 deletions(-) diff --git a/PKG-INFO b/PKG-INFO index 005ec1e..cdfffad 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,10 +1,10 @@ Metadata-Version: 1.0 Name: gatortests -Version: 0.1.20120504 +Version: 0.1.20120608 Summary: Gator tests -Home-page: UNKNOWN +Home-page: http://git.linaro.org/gitweb?p=qa/gatortests.git Author: David Stubbs -Author-email: david.stubbs2@arm.com +Author-email: david.stubbs2@arm.com License: GPL-3 Description: UNKNOWN Platform: UNKNOWN diff --git a/gatortests.py b/gatortests.py index ed1234b..9940111 100755 --- a/gatortests.py +++ b/gatortests.py @@ -3,58 +3,62 @@ import subprocess import time import re +import platform -def testoutput(TestName,Result): - if (Result==0): +def testoutput(TestName, Result): + if Result == 0: print "***" + TestName + ": pass***" else: print "***" + TestName + ": fail***" def checkforerror(process): - ErrorLevel=0 - stdout="" + ErrorLevel = 0 + stdout = "" try: - stdout= subprocess.check_output(process,shell=True,stderr=subprocess.STDOUT) + stdout = subprocess.check_output(process, shell=True, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError, e: - ErrorLevel=-1 - stdout=e.output + except subprocess.CalledProcessError, e: + ErrorLevel = -1 + stdout = e.output - print process + "\n"+ stdout + print process + "\n" + stdout return ErrorLevel def get_stdout(command): - stdout="" + stdout = "" try: - stdout= subprocess.check_output(command,shell=True,stderr=subprocess.STDOUT) + stdout = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError, e: + except subprocess.CalledProcessError, e: stdout=e.output print command + "\n" + stdout return stdout def checkgator(): - apt_add=checkforerror('apt-add-repository ppa:linaro-maintainers/arm-ds5 --yes') - apt_get_update=checkforerror('apt-get -y update') - apt_get_install=checkforerror('apt-get -y install gator') - - time.sleep(10) - - gatord_running = get_stdout('ps ax') - lsmod_output= get_stdout('lsmod') - - modout=re.search("gator",lsmod_output) - if (modout>0): - modout=0 - daemonout=re.search('\d+:\d+\sgatord', gatord_running) - if (daemonout>0): - daemonout=0 - - testoutput("AptAdd",apt_add) - testoutput("AptGetUpdate",apt_get_update) - testoutput("AptGetInstall",apt_get_install) - testoutput("ModuleInserted",modout) - testoutput("DaemonRunning",daemonout) + (dist, version, id) = platform.linux_distribution() + if id == 'natty' or id == 'oneiric': + checkforerror('apt-get install --assume-yes python-software-properties') + checkforerror('apt-add-repository ppa:linaro-maintainers/arm-ds5 --yes') + checkforerror('apt-get update') + install_gator = checkforerror('apt-get install --assume-yes gator') + testoutput("InstallGator",install_gator) + if install_gator == 0: + time.sleep(5) + else: + sys.exit(1) + + lsmod_output = get_stdout('lsmod | grep gator') + modout = re.search("gator", lsmod_output) + if modout > 0: + modout = 0 + testoutput("ModuleInserted", modout) + + gatord_running = get_stdout('pgrep gatord') + if gatord_running == '': + gatord_running = -1 + else: + gatord_running = 0 + testoutput("DaemonRunning",gatord_running) checkgator() diff --git a/setup.py b/setup.py index e8989b7..16d4997 100644 --- a/setup.py +++ b/setup.py @@ -2,11 +2,11 @@ from distutils.core import setup setup( name='gatortests', - version='0.1.20120504', + version='0.1.20120608', packages=[''], - url='', + url='http://git.linaro.org/gitweb?p=qa/gatortests.git', license='GPL-3', author='David Stubbs', - author_email='david.stubbs2@arm.com ', + author_email='david.stubbs2@arm.com', description='Gator tests' ) -- cgit v1.2.3