[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Download and run Dogtail script
- From: Alexander Todorov <atodorov redhat com>
- To: Discussion of Development and Customization of the Red Hat Linux Installer <anaconda-devel-list redhat com>
- Subject: [PATCH] Download and run Dogtail script
- Date: Mon, 21 Jan 2008 14:30:20 +0100
Download and run the Dogtail script.
The script should be responsible for detecting a running GUI (or waiting
for it to start/initialize and display widgets) before performing any tests.
diff --git a/anaconda b/anaconda
index 6119e6b..42ff771 100755
--- a/anaconda
+++ b/anaconda
@@ -273,6 +273,7 @@ def parseOptions():
op.add_option("--module", action="append", default=[])
op.add_option("--nomount", dest="rescue_nomount", action="store_true", default=False)
op.add_option("--updates", dest="updateSrc", action="store", type="string")
+ op.add_option("--dogtail", dest="dogtail", action="store", type="string")
return op.parse_args()
@@ -972,6 +973,38 @@ if __name__ == "__main__":
anaconda.setDispatch()
+ # download and run Dogtail script
+ if opts.dogtail:
+ try:
+ import urlgrabber
+
+ try:
+ fr = urlgrabber.urlopen(opts.dogtail)
+ except urlgrabber.grabber.URLGrabError, e:
+ log.error("Could not retrieve Dogtail script from %s.\nError was\n%s" % (opts.dogtail, e))
+ fr = None
+
+ if fr:
+ from tempfile import mkstemp
+
+ (fw, testcase) = mkstemp(prefix='testcase.py.', dir='/tmp')
+ os.write(fw, fr.read())
+ fr.close()
+ os.close(fw)
+
+ # download completed, run the test
+ if not os.fork():
+ # we are in the child
+ os.chmod(testcase, 0755)
+ os.execv(testcase, [testcase])
+ sys.exit(0)
+ else:
+ # we are in the parent, sleep to give time for the testcase to initialize
+ # todo: is this needed, how to avoid possible race conditions
+ time.sleep(1)
+ except Exception, e:
+ log.error("Exception %s while running Dogtail testcase" % e)
+
if opts.lang:
anaconda.dispatch.skipStep("language", permanent = 1)
instClass.setLanguage(anaconda.id, opts.lang)
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]