[libvirt] [test-API PATCH] Added screenshot test

Guannan Ren gren at redhat.com
Wed Apr 4 05:13:04 UTC 2012



       Hi

          Currently, the testcase parser supports to cleanup testing 
environment
          after each testcase finished. we only need to add a flag 
command 'clean'
          after each testcase in testcase config, for example:

                       ...
                       domain:screenshot
                           guestname
                               rhel6
                           filename
                               /tmp/filescreen
                           screen
                               0
                       clean

                       domain: start
                            guestname
                       ...


          the 'clean' flag will make the framework invoke the function 
named screenshot_clean
          in screenshot.py.  That means each testcase needs two 
mandatory functions, one is the
          main function, the other is main function name with '_clean' 
appended.
          So I send a patch for this testcase as an example.  According 
to the above testcase config
          the '/tmp/filescreen.ppm' file will be removed after running.
          There are some other flags, I need to update the documentation 
sooner:)

---
  repos/domain/screenshot.py |    5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/repos/domain/screenshot.py b/repos/domain/screenshot.py
index 9986cab..eeda2b5 100644
--- a/repos/domain/screenshot.py
+++ b/repos/domain/screenshot.py
@@ -55,3 +55,8 @@ def screenshot(params):
              conn.close()

      return ret
+
+def screenshot_clean(params):
+    """clean testing environment"""
+    filename = params['filename']
+    os.system('rm -f %s.*' % filename)
-- 
1.7.7.5


          Guannan Ren






More information about the libvir-list mailing list