summaryrefslogtreecommitdiff
path: root/gatortests
diff options
context:
space:
mode:
Diffstat (limited to 'gatortests')
-rwxr-xr-xgatortests64
1 files changed, 64 insertions, 0 deletions
diff --git a/gatortests b/gatortests
new file mode 100755
index 0000000..9940111
--- /dev/null
+++ b/gatortests
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+
+import subprocess
+import time
+import re
+import platform
+
+def testoutput(TestName, Result):
+ if Result == 0:
+ print "***" + TestName + ": pass***"
+ else:
+ print "***" + TestName + ": fail***"
+
+def checkforerror(process):
+ ErrorLevel = 0
+ stdout = ""
+ try:
+ stdout = subprocess.check_output(process, shell=True, stderr=subprocess.STDOUT)
+
+ except subprocess.CalledProcessError, e:
+ ErrorLevel = -1
+ stdout = e.output
+
+ print process + "\n" + stdout
+ return ErrorLevel
+
+def get_stdout(command):
+ stdout = ""
+ try:
+ stdout = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
+
+ except subprocess.CalledProcessError, e:
+ stdout=e.output
+
+ print command + "\n" + stdout
+ return stdout
+
+def checkgator():
+ (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()