[PATCH] Download and run Dogtail script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux