test suite reviews and discussions
 help / color / mirror / Atom feed
From: lihong <lihongx.ma@intel.com>
To: dts@dpdk.org
Cc: zhaoyan.chen@intel.com, lihong <lihongx.ma@intel.com>
Subject: [dts] [PATCH V1] framework/virt_base: reduce dpdk complie times in vm at same suite
Date: Tue, 22 Oct 2019 03:13:53 +0800	[thread overview]
Message-ID: <1571685233-1934-1-git-send-email-lihongx.ma@intel.com> (raw)

Add global variable to record all the vm image name in each dut and suite,
in same suite, same vm only compile one times.

Signed-off-by: lihong <lihongx.ma@intel.com>
---
 framework/virt_base.py | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/framework/virt_base.py b/framework/virt_base.py
index 6e3462c..31623be 100644
--- a/framework/virt_base.py
+++ b/framework/virt_base.py
@@ -31,6 +31,7 @@
 import os
 import sys
 import traceback
+import threading
 from random import randint
 from itertools import imap
 
@@ -47,6 +48,8 @@ ST_NOTSTART = "NOTSTART"
 ST_PAUSE = "PAUSE"
 ST_RUNNING = "RUNNING"
 ST_UNKNOWN = "UNKNOWN"
+VM_IMG_LIST = []
+mutex_vm_list = threading.Lock()
 
 class VirtBase(object):
     """
@@ -388,6 +391,20 @@ class VirtBase(object):
         """
         NotImplemented
 
+    def get_vm_img(self):
+        """
+        get current vm img name from params
+        get format like: 10.67.110.11:TestVhostMultiQueueQemu:/home/img/Ub1604.img
+        """
+        param_len = len(self.params)
+        for i in range(param_len):
+            if 'disk' in self.params[i].keys():
+                value = self.params[i]['disk'][0]
+                if 'file' in value.keys():
+                    host_ip = self.host_dut.get_ip_address()
+                    return host_ip + ':' + self.host_dut.test_classname + ':' + value['file']
+        return None
+
     def instantiate_vm_dut(self, set_target=True, cpu_topo='', bind_dev=True, autodetect_topo=True):
         """
         Instantiate the Dut class for VM.
@@ -427,9 +444,11 @@ class VirtBase(object):
 
         read_cache = False
         skip_setup = self.host_dut.skip_setup
+        vm_img = self.get_vm_img()
         # if current vm is migration vm, skip compile dpdk
-        if self.migration_vm:
-	        skip_setup = True
+        # if VM_IMG_list include the vm_img, it means the vm have complie the dpdk ok, skip it
+        if self.migration_vm or vm_img in VM_IMG_LIST:
+            skip_setup = True
         base_dir = self.host_dut.base_dir
         vm_dut.set_speedup_options(read_cache, skip_setup)
 
@@ -449,6 +468,12 @@ class VirtBase(object):
             raise exception.VirtDutInitException(vm_dut)
             return None
 
+        # after prerequisites and set_target, the dpdk compile is ok, add this vm img to list
+        if vm_img not in VM_IMG_LIST:
+            mutex_vm_list.acquire()
+            VM_IMG_LIST.append(vm_img)
+            mutex_vm_list.release()
+
         self.vm_dut = vm_dut
         return vm_dut
 
-- 
2.7.4


             reply	other threads:[~2019-10-22  2:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21 19:13 lihong [this message]
2019-11-04  2:41 ` Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1571685233-1934-1-git-send-email-lihongx.ma@intel.com \
    --to=lihongx.ma@intel.com \
    --cc=dts@dpdk.org \
    --cc=zhaoyan.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).