From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 14409A328D for ; Tue, 22 Oct 2019 04:39:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A78871BE95; Tue, 22 Oct 2019 04:39:01 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id AB80A1BE93 for ; Tue, 22 Oct 2019 04:39:00 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Oct 2019 19:38:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,325,1566889200"; d="scan'208";a="191317874" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.118.203]) by orsmga008.jf.intel.com with ESMTP; 21 Oct 2019 19:38:58 -0700 From: lihong To: dts@dpdk.org Cc: zhaoyan.chen@intel.com, lihong Date: Tue, 22 Oct 2019 03:13:53 +0800 Message-Id: <1571685233-1934-1-git-send-email-lihongx.ma@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH V1] framework/virt_base: reduce dpdk complie times in vm at same suite X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" 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 --- 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