test suite reviews and discussions
 help / color / mirror / Atom feed
From: hanyingya <yingyax.han@intel.com>
To: dts@dpdk.org
Cc: hanyingya <yingyax.han@intel.com>
Subject: [dts] [PATCH V1]tests/nic_single_core:Save standardized test results
Date: Fri, 21 Feb 2020 15:40:35 +0800	[thread overview]
Message-ID: <1582270835-100754-1-git-send-email-yingyax.han@intel.com> (raw)

Rich results in json format and remove redundant verification code.

Signed-off-by: hanyingya <yingyax.han@intel.com>
---
 tests/TestSuite_nic_single_core_perf.py | 54 +++++++++++--------------
 1 file changed, 23 insertions(+), 31 deletions(-)

diff --git a/tests/TestSuite_nic_single_core_perf.py b/tests/TestSuite_nic_single_core_perf.py
index 5781bc4..5fafe5f 100644
--- a/tests/TestSuite_nic_single_core_perf.py
+++ b/tests/TestSuite_nic_single_core_perf.py
@@ -197,20 +197,7 @@ class TestNicSingleCorePerf(TestCase):
         self.verify(self.nb_ports >= 1, "At least 1 port is required to test")
         self.perf_test(self.nb_ports)
         self.handle_results()
-
-        # check the gap between expected throughput and actual throughput
-        try:
-            for frame_size in list(self.test_parameters.keys()):
-                for nb_desc in self.test_parameters[frame_size]:
-                    cur_gap = (self.expected_throughput[frame_size][nb_desc] - self.throughput[frame_size][nb_desc])
-                    self.verify(cur_gap < self.gap, "Beyond Gap, Possible regression")
-        except Exception as e:
-            self.logger.error(e)
-            self.handle_expected()
-            raise VerifyFailure(
-                "Possible regression, Check your configuration please")
-        else:
-            self.handle_expected()
+        self.handle_expected()
 
     def handle_expected(self):
         """
@@ -336,27 +323,32 @@ class TestNicSingleCorePerf(TestCase):
         if self.save_result_flag is True
         '''
         json_obj = dict()
-        json_obj['nic_type'] = self.nic
-        json_obj['results'] = list()
+        case_name = self.running_case
+        json_obj[case_name] = list()
+        status_result = []
         for frame_size in list(self.test_parameters.keys()):
             for nb_desc in self.test_parameters[frame_size]:
                 row_in = self.test_result[frame_size][nb_desc]
-                row_dict = dict()
-                row_dict['parameters'] = dict()
-                row_dict['parameters']['frame_size'] = dict(
-                    value=row_in['Frame Size'], unit='bytes')
-                row_dict['parameters']['txd/rxd'] = dict(
-                    value=row_in['TXD/RXD'], unit='descriptors')
-                delta = (float(row_in['Throughput'].split()[0]) -
-                         float(row_in['Expected Throughput'].split()[0]))
-                if delta >= -self.gap:
-                    result = 'PASS'
+                row_dict0 = dict()
+                row_dict0['performance'] = list()
+                row_dict0['parameters'] = list()
+                result_throughput = float(row_in['Throughput'].split()[0])
+                expected_throughput = float(row_in['Expected Throughput'].split()[0])
+                # delta value and accepted tolerance in percentage
+                delta = result_throughput - expected_throughput
+                if delta > -self.gap:
+                    row_dict0['status'] = 'PASS'
                 else:
-                    result = 'FAIL'
-                row_dict['throughput'] = dict(
-                    delta=delta, unit=row_in['Throughput'].split()[1],
-                    result=result)
-                json_obj['results'].append(row_dict)
+                    row_dict0['status'] = 'FAIL'
+                row_dict1 = dict(name="Throughput", value=result_throughput, unit="Mpps", delta=delta)
+                row_dict2 = dict(name="Txd/Rxd", value=row_in["TXD/RXD"], unit="descriptor")
+                row_dict3 = dict(name="frame_size", value=row_in["Frame Size"], unit="bytes")
+                row_dict0['performance'].append(row_dict1)
+                row_dict0['parameters'].append(row_dict2)
+                row_dict0['parameters'].append(row_dict3)
+                json_obj[case_name].append(row_dict0)
+                status_result.append(row_dict0['status'])
+        self.verify("FAIL" not in status_result, "Excessive gap between test results and expectations")
         with open(os.path.join(rst.path2Result,
                                '{0:s}_single_core_perf.json'.format(
                                    self.nic)), 'w') as fp:
-- 
2.17.2


             reply	other threads:[~2020-02-21  7:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21  7:40 hanyingya [this message]
2020-02-21  7:57 ` 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=1582270835-100754-1-git-send-email-yingyax.han@intel.com \
    --to=yingyax.han@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).