This will be used when running virt-tests from the QEMU Makefile.
It is better to place the logs in the QEMU build directory.

Signed-off-by: Paolo Bonzini <[email protected]>
---
 run                         | 4 ++++
 virttest/standalone_test.py | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/run b/run
index da2bfda..b530026 100755
--- a/run
+++ b/run
@@ -207,6 +207,10 @@ class VirtTestRunParser(optparse.OptionParser):
         general.add_option("--list-guests", action="store_true",
                            dest="list_guests",
                            help="List guests available")
+        general.add_option("--logs-dir", action="store", dest="logdir",
+                           help=("Path to the logs directory. "
+                                 "Default path: %s/logs" %
+                                 data_dir.get_backing_data_dir()))
         general.add_option("--data-dir", action="store", dest="datadir",
                            help=("Path to a data dir. "
                                  "Default path: %s" %
diff --git a/virttest/standalone_test.py b/virttest/standalone_test.py
index 6451af9..2bc46c3 100644
--- a/virttest/standalone_test.py
+++ b/virttest/standalone_test.py
@@ -679,8 +679,8 @@ def run_tests(parser, options):
     @param parser: Config parser object.
     @return: True, if all tests ran passed, False if any of them failed.
     """
-    debugdir = os.path.join(data_dir.get_root_dir(), 'logs',
-                            'run-%s' % time.strftime('%Y-%m-%d-%H.%M.%S'))
+    debugdir = options.logdir or os.path.join(data_dir.get_root_dir(), 'logs')
+    debugdir = os.path.join(debugdir, 'run-%s' % 
time.strftime('%Y-%m-%d-%H.%M.%S'))
     if not os.path.isdir(debugdir):
         os.makedirs(debugdir)
     debuglog = os.path.join(debugdir, "debug.log")
-- 
1.8.0.2


_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to