test suite reviews and discussions
 help / color / mirror / Atom feed
From: Marvin Liu <yong.liu@intel.com>
To: dts@dpdk.org
Cc: Marvin Liu <yong.liu@intel.com>
Subject: [dts] [PATCH v1 06/16] framework/dts: support multiple VMs module
Date: Sun,  7 Jan 2018 21:49:19 -0500	[thread overview]
Message-ID: <1515379769-11553-7-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1515379769-11553-1-git-send-email-yong.liu@intel.com>

1. Added required external library system path
2. Initialized global parallel lock structure
3. Init DUTs and tester with index argument

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/framework/dts.py b/framework/dts.py
index 581d282..0b2240c 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -58,7 +58,7 @@ import logger
 import debugger
 from config import CrbsConf
 from checkCase import CheckCase
-from utils import get_subclasses, copy_instance_attr
+from utils import get_subclasses, copy_instance_attr, create_parallel_locks
 import sys
 reload(sys)
 sys.setdefaultencoding('UTF8')
@@ -211,7 +211,7 @@ def dts_run_commands(crb, dts_commands):
                         raise VerifyFailure("Command execution failed")
 
 
-def get_project_obj(project_name, super_class, crbInst, serializer):
+def get_project_obj(project_name, super_class, crbInst, serializer, dut_id):
     """
     Load project module and return crb instance.
     """
@@ -221,12 +221,12 @@ def get_project_obj(project_name, super_class, crbInst, serializer):
         project_module = __import__(PROJECT_MODULE_PREFIX + project_name)
 
         for project_subclassname, project_subclass in get_subclasses(project_module, super_class):
-            project_obj = project_subclass(crbInst, serializer)
+            project_obj = project_subclass(crbInst, serializer, dut_id)
         if project_obj is None:
-            project_obj = super_class(crbInst, serializer)
+            project_obj = super_class(crbInst, serializer, dut_id)
     except Exception as e:
         log_handler.info("LOAD PROJECT MODULE INFO: " + str(e))
-        project_obj = super_class(crbInst, serializer)
+        project_obj = super_class(crbInst, serializer, dut_id)
 
     return project_obj
 
@@ -280,13 +280,15 @@ def dts_crbs_init(crbInsts, skip_setup, read_cache, project, base_dir, serialize
 
     testInst = copy.copy(crbInsts[0])
     testInst['My IP'] = crbInsts[0]['tester IP']
-    tester = get_project_obj(project, Tester, testInst, serializer)
+    tester = get_project_obj(project, Tester, testInst, serializer, dut_id=0)
 
+    dut_id = 0
     for crbInst in crbInsts:
         dutInst = copy.copy(crbInst)
         dutInst['My IP'] = crbInst['IP']
-        dutobj = get_project_obj(project, Dut, dutInst, serializer)
+        dutobj = get_project_obj(project, Dut, dutInst, serializer, dut_id=dut_id)
         duts.append(dutobj)
+        dut_id += 1
 
     dts_log_execution(duts, tester, log_handler)
 
@@ -298,7 +300,7 @@ def dts_crbs_init(crbInsts, skip_setup, read_cache, project, base_dir, serialize
     nic = settings.load_global_setting(settings.HOST_NIC_SETTING)
     for dutobj in duts:
         dutobj.tester = tester
-        dutobj.set_virttype(virttype)
+        dutobj.setup_virtenv(virttype)
         dutobj.set_speedup_options(read_cache, skip_setup)
         dutobj.set_directory(base_dir)
         # save execution nic setting
@@ -463,6 +465,11 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
     if not os.path.exists(output_dir):
         os.mkdir(output_dir)
 
+    # add external library
+    exec_file = os.path.realpath(__file__)
+    extra_libs_path = exec_file.replace('framework/dts.py', '') + 'extra_libs'
+    sys.path.insert(1, extra_libs_path)
+
     # add python module search path
     sys.path.append(suite_dir)
 
@@ -537,6 +544,9 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
 
         result.dut = duts[0]
 
+        # init global lock
+        create_parallel_locks(len(duts))
+
         # init dut, tester crb
         duts, tester = dts_crbs_init(crbInsts, skip_setup, read_cache, project, base_dir, serializer, virttype)
         tester.set_re_run(re_run)
-- 
1.9.3

  parent reply	other threads:[~2018-01-08  9:56 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08  2:49 [dts] [PATCH v1 00/16] Support parallel multiple virtual machine management Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 01/16] framework: add external thread pool library Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 02/16] framework/multiple_vm: add multiple VM management module Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 03/16] framework/utils: support locks function in parallel model Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 04/16] framework: add DUT index support Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 05/16] framework/logger: optimize output format for child threads Marvin Liu
2018-01-08  2:49 ` Marvin Liu [this message]
2018-01-08  2:49 ` [dts] [PATCH v1 07/16] framework/debugger: support multiple VMs module Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 08/16] framework/ssh_pexpect: " Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 09/16] framework/ssh_connection: support DUT index argument Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 10/16] framework/settings: add parallel related settings Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 11/16] framework/virt_resource: support multiple VMs module Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 12/16] framework/virt_base: add attach/quick start/quit function for VM management Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 13/16] framework/virt_dut: support multiple VMs module Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 14/16] framework/qemu_kvm: " Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 15/16] conf/virt_global: add vm management related configuration Marvin Liu
2018-01-08  2:49 ` [dts] [PATCH v1 16/16] doc: add descriptions for multiple virtual machine module Marvin Liu
2018-01-10  0:10 ` [dts] [PATCH v2 00/16] Support parallel multiple virtual machines management Marvin Liu
2018-01-10  0:10   ` [dts] [PATCH v2 01/16] framework: add external thread pool library Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 02/16] framework/multiple_vm: add multiple VM management module Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 03/16] framework/utils: support locks for parallel model Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 04/16] framework: add DUT index support Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 05/16] framework/logger: optimize output format for threads Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 06/16] framework/dts: support multiple VMs module Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 07/16] framework/debugger: " Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH 08/16] framework/ssh_pexpect: " Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 09/16] framework/ssh_connection: " Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 10/16] framework/settings: add parallel related settings Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 11/16] framework/virt_resource: support multiple VMs module Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 12/16] framework/virt_base: add attach/quick start/quit function for VM management Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 13/16] framework/virt_dut: support multiple VMs module Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 14/16] framework/qemu_kvm: " Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 15/16] conf/virt_global: add vm management related configuration Marvin Liu
2018-01-10  0:11   ` [dts] [PATCH v2 16/16] doc: add descriptions for multiple virtual machines module Marvin Liu

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=1515379769-11553-7-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    /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).