* [dts] [PATCH V1 1/5] tests: add common method for compress test suites
@ 2019-11-24 22:32 Xinfeng Zhao
2019-11-24 22:32 ` [dts] [PATCH V1 2/5] tests: add suite for compressdev qat pmd test Xinfeng Zhao
` (6 more replies)
0 siblings, 7 replies; 14+ messages in thread
From: Xinfeng Zhao @ 2019-11-24 22:32 UTC (permalink / raw)
To: dts; +Cc: Xinfeng Zhao
Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
tests/compress_common.py | 285 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 285 insertions(+)
create mode 100644 tests/compress_common.py
diff --git a/tests/compress_common.py b/tests/compress_common.py
new file mode 100644
index 0000000..0a3c7ff
--- /dev/null
+++ b/tests/compress_common.py
@@ -0,0 +1,285 @@
+# BSD LICENSE
+#
+# Copyright(c) 2019 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import os
+import re
+import utils
+from config import SuiteConf
+
+conf = SuiteConf('compressdev_sample')
+
+default_opts = {
+ "driver-name": None,
+ "seg-sz": 2048,
+ "burst-sz": None,
+ "compress-level": "1:1:9",
+ "extended-input-sz": None,
+ "num-iter": 10,
+ "max-num-sgl-segs": 16,
+ "external-mbufs": None,
+ "huffman-enc": "dynamic",
+ "ptest": None,
+ "pool-sz": None
+ }
+
+default_eals = {
+ "l": "0-6",
+ "c": None,
+ "n": None,
+ "w": None,
+ "vdev": None
+ }
+
+
+def get_qat_device_list(test_case):
+ device_id = conf.suite_cfg["qat_device_id"]
+ out = test_case.dut.send_expect("lspci -d:{}|awk '{{print $1}}'".format(device_id), "# ", 10)
+ device_list = out.replace("\r", "\n").replace("\n\n", "\n").split("\n")
+
+ return device_list
+
+def bind_qat_device(test_case, driver = "igb_uio"):
+ if driver == 'vfio-pci':
+ test_case.dut.send_expect('modprobe vfio-pci', '#', 10)
+ else:
+ driver = 'igb_uio'
+
+ # Bind QAT VF devices
+ device_list = get_qat_device_list(test_case)
+ device_id = conf.suite_cfg["qat_device_id"]
+
+ test_case.dut.send_expect(
+ 'echo "8086 {}" > /sys/bus/pci/drivers/{}/new_id'.format(device_id, driver), "# ", 10)
+ for line in device_list:
+ cmd = "echo 0000:{} > /sys/bus/pci/devices/0000\:{}/driver/unbind".format(
+ line, line.replace(":", "\:"))
+ test_case.dut.send_expect(cmd, "# ", 10)
+ cmd = "echo 0000:{} > /sys/bus/pci/drivers/{}/bind".format(
+ line, driver)
+ test_case.dut.send_expect(cmd, "# ", 10)
+
+def get_opt_str(test_case, default_opts={}, override_opts={}):
+ case_cfg = conf.load_case_config(test_case._suite_result.test_case)
+ opts = default_opts.copy()
+ for key in default_opts.keys():
+ if key in case_cfg:
+ opts[key] = case_cfg[key]
+
+ opts.update(override_opts)
+
+ opt_str = ""
+ for key,value in opts.items():
+ if value is None:
+ continue
+ dash = "-" if len(key) == 1 else "--"
+ opt_str = opt_str + "{0}{1} {2} ".format(dash, key, value)
+
+ return opt_str
+
+def get_input_file(test_case):
+ case_cfg = conf.load_case_config(test_case._suite_result.test_case)
+ input_file = conf.suite_cfg["input-file"]
+ out = test_case.dut.send_expect("ls %s" % input_file, "# ", 10)
+ if out == input_file:
+ file_list = [input_file]
+ else:
+ file_list = [os.path.join(input_file, x.strip()) for x in out.split()]
+
+ return file_list
+
+def run_unit(test_case, eal={}):
+ cores = test_case.dut.get_core_list('1S/3C/1T')
+ core_mask = utils.create_mask(cores)
+ mem_channels = test_case.dut.get_memory_channels()
+
+ default = default_eals.copy()
+ default['l'] = None
+ default['c'] = core_mask
+ default['n'] = mem_channels
+
+ eal_str = get_opt_str(test_case, default, eal)
+ cmdline = "./{target}/app/test {eal}".format(target = test_case.dut.target,
+ eal = eal_str)
+ test_case.dut.send_expect(cmdline, ">", 30)
+ out = test_case.dut.send_expect("compressdev_autotest", ">", 30)
+ test_case.dut.send_expect("quit", "# ", 30)
+ print(out)
+
+ test_case.verify("Test OK" in out, "Test Failed")
+
+def run_perf(test_case, eal={}, opt={}):
+ eal_str = get_opt_str(test_case, default_eals, eal)
+ opt_str = get_opt_str(test_case, default_opts, opt)
+ input_file = get_input_file(test_case)
+
+ result = {}
+ for each_file in input_file:
+ test_case.logger.info("Testing file: {}".format(each_file))
+
+ cmdline = "./{target}/app/dpdk-test-compress-perf {eal}\
+ -- --input-file {file} {opt}"
+
+ cmdline = cmdline.format(target = test_case.dut.target,
+ eal = eal_str,
+ file = each_file,
+ opt = opt_str)
+
+ out = test_case.dut.send_expect(cmdline, "# ", 300)
+ test_case.verify("failed" not in out and "FATAL" not in out,
+ "Test Failed: Parameter or the value error")
+
+ case_name = test_case._suite_result.test_case
+ res = format_perf_data(case_name, out)
+ test_case.verify(res, "Test Failed: can't get performance data")
+
+ file_name = os.path.basename(each_file).split('.')[0]
+ result.update({case_name + '_' + file_name: res})
+
+ return result
+
+def parse_perf_output(output):
+ try:
+ lines = output.split("\r\n")
+ line_nb = len(lines)
+
+ # Find perf data line
+ for line_index in range(line_nb):
+ if lines[line_index].strip().startswith("lcore:"):
+ break
+ data_line = line_index + 1
+
+ results = []
+ pattern = re.compile(r'\s+')
+ for line in lines[data_line:]:
+ result = {}
+ result_list = pattern.split(line.strip())
+ if not result_list[0].isdigit():
+ continue
+ print(line)
+ result["lcore_id"] = int(result_list[0])
+ result["level"] = int(result_list[1])
+ result["comp_size"] = int(result_list[2])
+ result["comp_ratio"] = float(result_list[3])
+ result["comp"] = float(result_list[4])
+ result["decomp"] = float(result_list[5])
+ results.append(result)
+
+ stats_results = _stat_results_by_level(results)
+ return stats_results
+ except Exception as ex:
+ raise ex
+
+def _stat_results_by_level(results):
+ stats_results = {}
+ for result in results:
+ level = result["level"]
+ if level in stats_results:
+ stats_results[level]["lcore_id"] = \
+ str(stats_results[level]["lcore_id"]) \
+ + "," + str(result["lcore_id"])
+ stats_results[level]["comp_size"] = \
+ stats_results[level]["comp_size"] + \
+ result["comp_size"]
+ stats_results[level]["comp_ratio"] = \
+ stats_results[level]["comp_ratio"] + \
+ result["comp_ratio"]
+ stats_results[level]["comp"] = \
+ stats_results[level]["comp"] + \
+ result["comp"]
+ stats_results[level]["decomp"] = \
+ stats_results[level]["decomp"] + \
+ result["decomp"]
+ stats_results[level]["nr"] =\
+ stats_results[level]["nr"] + 1
+ else:
+ stats_results[level] = result
+ stats_results[level]["nr"] = 1
+
+ return stats_results
+
+def format_perf_data(flag, output):
+ stats_results = parse_perf_output(output)
+
+ json_result = []
+ for level, values in stats_results.items():
+ status, delta = "PASS", 0
+ try:
+ if 'accepted_tolerance' in conf.suite_cfg:
+ accepted_gap = conf.suite_cfg['accepted_tolerance']
+ expected_throughput =\
+ conf.suite_cfg['expected_throughput'][flag][level]
+ delta = (values["comp"] - expected_throughput)/expected_throughput
+ if abs(delta) > accepted_gap:
+ status = "FAIL"
+
+ perf_info={
+ "status": status,
+ "performance":[
+ {
+ "name": "comp",
+ "value": round(values["comp"], 2),
+ "unit": "Gbps",
+ "delta": round(delta, 2)
+ },
+ {
+ "name":"decomp",
+ "unit": "Gbps",
+ "value": round(values["decomp"], 2)
+ },
+ {
+ "name":"comp_size",
+ "unit": "bytes",
+ "value": values["comp_size"]
+ },
+ {
+ "name":"comp_ratio",
+ "unit": "%",
+ "value": round(values["comp_ratio"]/values["nr"], 2)
+ },
+ ],
+ "parameters":[
+ {
+ "name": "level",
+ "unit": "",
+ "value": level
+ },
+ {
+ "name": "core_num",
+ "unit": "core",
+ "value": values["nr"]
+ },
+ ]
+ }
+ json_result.append(perf_info)
+ except Exception as err:
+ print(err)
+ return json_result
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dts] [PATCH V1 2/5] tests: add suite for compressdev qat pmd test
2019-11-24 22:32 [dts] [PATCH V1 1/5] tests: add common method for compress test suites Xinfeng Zhao
@ 2019-11-24 22:32 ` Xinfeng Zhao
2019-11-25 8:38 ` Wan, Zhe
2019-11-24 22:32 ` [dts] [PATCH V1 3/5] tests: add suite for compressdev zlib " Xinfeng Zhao
` (5 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Xinfeng Zhao @ 2019-11-24 22:32 UTC (permalink / raw)
To: dts; +Cc: Xinfeng Zhao
Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
tests/TestSuite_compressdev_qat_pmd.py | 102 +++++++++++++++++++++++++++++++++
1 file changed, 102 insertions(+)
create mode 100644 tests/TestSuite_compressdev_qat_pmd.py
diff --git a/tests/TestSuite_compressdev_qat_pmd.py b/tests/TestSuite_compressdev_qat_pmd.py
new file mode 100644
index 0000000..40b3fac
--- /dev/null
+++ b/tests/TestSuite_compressdev_qat_pmd.py
@@ -0,0 +1,102 @@
+# BSD LICENSE
+#
+# Copyright(c) 2019 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import os
+from test_case import TestCase
+import json
+import compress_common as cc
+
+
+class TestCompressdevQatPmd(TestCase):
+
+ def set_up_all(self):
+ self.prepare_dpdk()
+ cc.bind_qat_device(self, self.drivername)
+ cc.default_opts.update({"driver-name": "compress_qat"})
+ self.device_list = cc.get_qat_device_list(self)
+ self._perf_result = dict()
+
+ def set_up(self):
+ pass
+
+ def prepare_dpdk(self):
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=n$/CONFIG_RTE_COMPRESSDEV_TEST=y/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_QAT_SYM=n$/CONFIG_RTE_LIBRTE_PMD_QAT_SYM=y/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ def get_perf_default_device(self, dev_num=3):
+ perf_device_list = []
+ for each in self.device_list:
+ if each.endswith("01.0"):
+ perf_device_list.append(each)
+ if len(perf_device_list) < dev_num:
+ perf_device_list += list(set(self.device_list).
+ difference(set(perf_device_list)))[:dev_num-len(perf_device_list)]
+ else:
+ perf_device_list = perf_device_list[:dev_num]
+
+ return perf_device_list
+
+ def test_qat_pmd_unit_test(self):
+ cc.default_eals['w'] = self.device_list[0]
+ cc.run_unit(self)
+
+ def test_qat_pmd_fixed_func(self):
+ cc.default_eals['w'] = ' -w '.join(self.get_perf_default_device())
+ cc.default_opts.update({"huffman-enc": "fixed"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def test_qat_pmd_dynamic_func(self):
+ cc.default_eals['w'] = ' -w '.join(self.get_perf_default_device())
+ cc.default_opts.update({"huffman-enc": "dynamic"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def tear_down(self):
+ pass
+
+ def tear_down_all(self):
+ self.dut.kill_all()
+
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=y$/CONFIG_RTE_COMPRESSDEV_TEST=n/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_QAT_SYM=y$/CONFIG_RTE_LIBRTE_PMD_QAT_SYM=n/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ if not self._perf_result:
+ return
+ with open(self.logger.log_path + "/" + self.suite_name + ".json", "w") as fv:
+ json.dump(self._perf_result, fv, indent=4)
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dts] [PATCH V1 3/5] tests: add suite for compressdev zlib pmd test
2019-11-24 22:32 [dts] [PATCH V1 1/5] tests: add common method for compress test suites Xinfeng Zhao
2019-11-24 22:32 ` [dts] [PATCH V1 2/5] tests: add suite for compressdev qat pmd test Xinfeng Zhao
@ 2019-11-24 22:32 ` Xinfeng Zhao
2019-11-25 8:39 ` Wan, Zhe
2019-11-24 22:32 ` [dts] [PATCH V1 4/5] tests: add suite for compressdev isal " Xinfeng Zhao
` (4 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Xinfeng Zhao @ 2019-11-24 22:32 UTC (permalink / raw)
To: dts; +Cc: Xinfeng Zhao
Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
tests/TestSuite_compressdev_zlib_pmd.py | 84 +++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
create mode 100644 tests/TestSuite_compressdev_zlib_pmd.py
diff --git a/tests/TestSuite_compressdev_zlib_pmd.py b/tests/TestSuite_compressdev_zlib_pmd.py
new file mode 100644
index 0000000..31d7194
--- /dev/null
+++ b/tests/TestSuite_compressdev_zlib_pmd.py
@@ -0,0 +1,84 @@
+# BSD LICENSE
+#
+# Copyright(c) 2019 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import os
+from test_case import TestCase
+import json
+import compress_common as cc
+
+class TestCompressdevZlibPmd(TestCase):
+
+ def set_up_all(self):
+ self.prepare_dpdk()
+ cc.default_eals.update({"w":"0000:00:00.0", "vdev": "compress_zlib"})
+ cc.default_opts.update({"driver-name": "compress_zlib"})
+ self._perf_result = dict()
+
+ def set_up(self):
+ pass
+
+ def prepare_dpdk(self):
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=n$/CONFIG_RTE_COMPRESSDEV_TEST=y/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_ZLIB=n$/CONFIG_RTE_LIBRTE_PMD_ZLIB=y/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ def test_zlib_pmd_unit_test(self):
+ cc.run_unit(self)
+
+ def test_zlib_pmd_fixed_func(self):
+ cc.default_opts.update({"huffman-enc": "fixed"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def test_zlib_pmd_dynamic_func(self):
+ cc.default_opts.update({"huffman-enc": "dynamic"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def tear_down(self):
+ pass
+
+ def tear_down_all(self):
+ self.dut.kill_all()
+
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=y$/CONFIG_RTE_COMPRESSDEV_TEST=n/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_ZLIB=y$/CONFIG_RTE_LIBRTE_PMD_ZLIB=n/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ if not self._perf_result:
+ return
+ with open(self.logger.log_path + "/" + self.suite_name + ".json", "w") as fv:
+ json.dump(self._perf_result, fv, indent=4)
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dts] [PATCH V1 4/5] tests: add suite for compressdev isal pmd test
2019-11-24 22:32 [dts] [PATCH V1 1/5] tests: add common method for compress test suites Xinfeng Zhao
2019-11-24 22:32 ` [dts] [PATCH V1 2/5] tests: add suite for compressdev qat pmd test Xinfeng Zhao
2019-11-24 22:32 ` [dts] [PATCH V1 3/5] tests: add suite for compressdev zlib " Xinfeng Zhao
@ 2019-11-24 22:32 ` Xinfeng Zhao
2019-11-25 7:26 ` Zhao, XinfengX
2019-11-24 22:32 ` [dts] [PATCH V1 5/5] conf: add config file for compress test Xinfeng Zhao
` (3 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Xinfeng Zhao @ 2019-11-24 22:32 UTC (permalink / raw)
To: dts; +Cc: Xinfeng Zhao
Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
tests/TestSuite_compressdev_isal_pmd.py | 84 +++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
create mode 100644 tests/TestSuite_compressdev_isal_pmd.py
diff --git a/tests/TestSuite_compressdev_isal_pmd.py b/tests/TestSuite_compressdev_isal_pmd.py
new file mode 100644
index 0000000..8d7e22e
--- /dev/null
+++ b/tests/TestSuite_compressdev_isal_pmd.py
@@ -0,0 +1,84 @@
+# BSD LICENSE
+#
+# Copyright(c) 2019 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import os
+from test_case import TestCase
+import json
+import compress_common as cc
+
+class TestCompressdevIsalPmd(TestCase):
+
+ def set_up_all(self):
+ self.prepare_dpdk()
+ cc.default_eals.update({'w': "0000:00:00.0", "vdev": "compress_isal"})
+ cc.default_opts.update({"driver-name": "compress_isal"})
+ self._perf_result = dict()
+
+ def set_up(self):
+ pass
+
+ def prepare_dpdk(self):
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=n$/CONFIG_RTE_COMPRESSDEV_TEST=y/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_ISAL=n$/CONFIG_RTE_LIBRTE_PMD_ISAL=y/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ def test_isal_pmd_unit_test(self):
+ cc.run_unit(self)
+
+ def test_isal_pmd_fixed_func(self):
+ cc.default_opts.update({"huffman-enc": "fixed"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def test_isal_pmd_dynamic_func(self):
+ cc.default_opts.update({"huffman-enc": "dynamic"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def tear_down(self):
+ pass
+
+ def tear_down_all(self):
+ self.dut.kill_all()
+
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=y$/CONFIG_RTE_COMPRESSDEV_TEST=n/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_ISAL=y$/CONFIG_RTE_LIBRTE_PMD_ISAL=n/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ if not self._perf_result:
+ return
+ with open(self.logger.log_path + "/" + self.suite_name + ".json", "w") as f:
+ json.dump(self._perf_result, f, indent=4)
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [dts] [PATCH V1 5/5] conf: add config file for compress test
2019-11-24 22:32 [dts] [PATCH V1 1/5] tests: add common method for compress test suites Xinfeng Zhao
` (2 preceding siblings ...)
2019-11-24 22:32 ` [dts] [PATCH V1 4/5] tests: add suite for compressdev isal " Xinfeng Zhao
@ 2019-11-24 22:32 ` Xinfeng Zhao
2019-11-25 8:40 ` Wan, Zhe
2019-11-25 7:28 ` [dts] [PATCH V1 1/5] tests: add common method for compress test suites Zhao, XinfengX
` (2 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Xinfeng Zhao @ 2019-11-24 22:32 UTC (permalink / raw)
To: dts; +Cc: Xinfeng Zhao
Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
conf/compressdev_sample.cfg | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 conf/compressdev_sample.cfg
diff --git a/conf/compressdev_sample.cfg b/conf/compressdev_sample.cfg
new file mode 100644
index 0000000..f2841a3
--- /dev/null
+++ b/conf/compressdev_sample.cfg
@@ -0,0 +1,16 @@
+[suite]
+# Compress common options qat device id
+qat_device_id="37c9"
+
+# the file to compress and decompress
+input-file = "/root/calgary"
+
+# you can make special settings for test case like this.
+#seg-sz=1024
+#compress-level="1:1:9"
+#num-iter=10
+#max-num-sgl-segs=1003
+
+#[test_qat_pmd_dynamic_func]
+#l="0-6"
+#w="1a:01.0 -w 1c:01.0 -w 1e:01.0"
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dts] [PATCH V1 4/5] tests: add suite for compressdev isal pmd test
2019-11-24 22:32 ` [dts] [PATCH V1 4/5] tests: add suite for compressdev isal " Xinfeng Zhao
@ 2019-11-25 7:26 ` Zhao, XinfengX
2019-11-25 8:39 ` Wan, Zhe
0 siblings, 1 reply; 14+ messages in thread
From: Zhao, XinfengX @ 2019-11-25 7:26 UTC (permalink / raw)
To: dts, Wan, Zhe
Tested-by: Zhao, Xinfeng<xinfengx.zhao@intel.com>
-----Original Message-----
From: Zhao, XinfengX
Sent: Monday, November 25, 2019 6:33 AM
To: dts@dpdk.org
Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
Subject: [dts][PATCH V1 4/5] tests: add suite for compressdev isal pmd test
Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
tests/TestSuite_compressdev_isal_pmd.py | 84 +++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
create mode 100644 tests/TestSuite_compressdev_isal_pmd.py
diff --git a/tests/TestSuite_compressdev_isal_pmd.py b/tests/TestSuite_compressdev_isal_pmd.py
new file mode 100644
index 0000000..8d7e22e
--- /dev/null
+++ b/tests/TestSuite_compressdev_isal_pmd.py
@@ -0,0 +1,84 @@
+# BSD LICENSE
+#
+# Copyright(c) 2019 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without #
+modification, are permitted provided that the following conditions #
+are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR #
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import os
+from test_case import TestCase
+import json
+import compress_common as cc
+
+class TestCompressdevIsalPmd(TestCase):
+
+ def set_up_all(self):
+ self.prepare_dpdk()
+ cc.default_eals.update({'w': "0000:00:00.0", "vdev": "compress_isal"})
+ cc.default_opts.update({"driver-name": "compress_isal"})
+ self._perf_result = dict()
+
+ def set_up(self):
+ pass
+
+ def prepare_dpdk(self):
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=n$/CONFIG_RTE_COMPRESSDEV_TEST=y/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_ISAL=n$/CONFIG_RTE_LIBRTE_PMD_ISAL=y/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ def test_isal_pmd_unit_test(self):
+ cc.run_unit(self)
+
+ def test_isal_pmd_fixed_func(self):
+ cc.default_opts.update({"huffman-enc": "fixed"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def test_isal_pmd_dynamic_func(self):
+ cc.default_opts.update({"huffman-enc": "dynamic"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def tear_down(self):
+ pass
+
+ def tear_down_all(self):
+ self.dut.kill_all()
+
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=y$/CONFIG_RTE_COMPRESSDEV_TEST=n/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_ISAL=y$/CONFIG_RTE_LIBRTE_PMD_ISAL=n/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ if not self._perf_result:
+ return
+ with open(self.logger.log_path + "/" + self.suite_name + ".json", "w") as f:
+ json.dump(self._perf_result, f, indent=4)
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dts] [PATCH V1 1/5] tests: add common method for compress test suites
2019-11-24 22:32 [dts] [PATCH V1 1/5] tests: add common method for compress test suites Xinfeng Zhao
` (3 preceding siblings ...)
2019-11-24 22:32 ` [dts] [PATCH V1 5/5] conf: add config file for compress test Xinfeng Zhao
@ 2019-11-25 7:28 ` Zhao, XinfengX
2019-11-27 9:07 ` Tu, Lijuan
2019-11-25 8:38 ` Wan, Zhe
2019-11-27 9:08 ` Tu, Lijuan
6 siblings, 1 reply; 14+ messages in thread
From: Zhao, XinfengX @ 2019-11-25 7:28 UTC (permalink / raw)
To: dts, Wan, Zhe
Tested-by: Zhao, Xinfeng<xinfengx.zhao at intel.com>
-----Original Message-----
From: Zhao, XinfengX
Sent: Monday, November 25, 2019 6:33 AM
To: dts@dpdk.org
Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
Subject: [dts][PATCH V1 1/5] tests: add common method for compress test suites
Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
tests/compress_common.py | 285 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 285 insertions(+)
create mode 100644 tests/compress_common.py
diff --git a/tests/compress_common.py b/tests/compress_common.py new file mode 100644 index 0000000..0a3c7ff
--- /dev/null
+++ b/tests/compress_common.py
@@ -0,0 +1,285 @@
+# BSD LICENSE
+#
+# Copyright(c) 2019 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without #
+modification, are permitted provided that the following conditions #
+are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR #
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import os
+import re
+import utils
+from config import SuiteConf
+
+conf = SuiteConf('compressdev_sample')
+
+default_opts = {
+ "driver-name": None,
+ "seg-sz": 2048,
+ "burst-sz": None,
+ "compress-level": "1:1:9",
+ "extended-input-sz": None,
+ "num-iter": 10,
+ "max-num-sgl-segs": 16,
+ "external-mbufs": None,
+ "huffman-enc": "dynamic",
+ "ptest": None,
+ "pool-sz": None
+ }
+
+default_eals = {
+ "l": "0-6",
+ "c": None,
+ "n": None,
+ "w": None,
+ "vdev": None
+ }
+
+
+def get_qat_device_list(test_case):
+ device_id = conf.suite_cfg["qat_device_id"]
+ out = test_case.dut.send_expect("lspci -d:{}|awk '{{print $1}}'".format(device_id), "# ", 10)
+ device_list = out.replace("\r", "\n").replace("\n\n",
+"\n").split("\n")
+
+ return device_list
+
+def bind_qat_device(test_case, driver = "igb_uio"):
+ if driver == 'vfio-pci':
+ test_case.dut.send_expect('modprobe vfio-pci', '#', 10)
+ else:
+ driver = 'igb_uio'
+
+ # Bind QAT VF devices
+ device_list = get_qat_device_list(test_case)
+ device_id = conf.suite_cfg["qat_device_id"]
+
+ test_case.dut.send_expect(
+ 'echo "8086 {}" > /sys/bus/pci/drivers/{}/new_id'.format(device_id, driver), "# ", 10)
+ for line in device_list:
+ cmd = "echo 0000:{} > /sys/bus/pci/devices/0000\:{}/driver/unbind".format(
+ line, line.replace(":", "\:"))
+ test_case.dut.send_expect(cmd, "# ", 10)
+ cmd = "echo 0000:{} > /sys/bus/pci/drivers/{}/bind".format(
+ line, driver)
+ test_case.dut.send_expect(cmd, "# ", 10)
+
+def get_opt_str(test_case, default_opts={}, override_opts={}):
+ case_cfg = conf.load_case_config(test_case._suite_result.test_case)
+ opts = default_opts.copy()
+ for key in default_opts.keys():
+ if key in case_cfg:
+ opts[key] = case_cfg[key]
+
+ opts.update(override_opts)
+
+ opt_str = ""
+ for key,value in opts.items():
+ if value is None:
+ continue
+ dash = "-" if len(key) == 1 else "--"
+ opt_str = opt_str + "{0}{1} {2} ".format(dash, key, value)
+
+ return opt_str
+
+def get_input_file(test_case):
+ case_cfg = conf.load_case_config(test_case._suite_result.test_case)
+ input_file = conf.suite_cfg["input-file"]
+ out = test_case.dut.send_expect("ls %s" % input_file, "# ", 10)
+ if out == input_file:
+ file_list = [input_file]
+ else:
+ file_list = [os.path.join(input_file, x.strip()) for x in
+out.split()]
+
+ return file_list
+
+def run_unit(test_case, eal={}):
+ cores = test_case.dut.get_core_list('1S/3C/1T')
+ core_mask = utils.create_mask(cores)
+ mem_channels = test_case.dut.get_memory_channels()
+
+ default = default_eals.copy()
+ default['l'] = None
+ default['c'] = core_mask
+ default['n'] = mem_channels
+
+ eal_str = get_opt_str(test_case, default, eal)
+ cmdline = "./{target}/app/test {eal}".format(target = test_case.dut.target,
+ eal = eal_str)
+ test_case.dut.send_expect(cmdline, ">", 30)
+ out = test_case.dut.send_expect("compressdev_autotest", ">", 30)
+ test_case.dut.send_expect("quit", "# ", 30)
+ print(out)
+
+ test_case.verify("Test OK" in out, "Test Failed")
+
+def run_perf(test_case, eal={}, opt={}):
+ eal_str = get_opt_str(test_case, default_eals, eal)
+ opt_str = get_opt_str(test_case, default_opts, opt)
+ input_file = get_input_file(test_case)
+
+ result = {}
+ for each_file in input_file:
+ test_case.logger.info("Testing file: {}".format(each_file))
+
+ cmdline = "./{target}/app/dpdk-test-compress-perf {eal}\
+ -- --input-file {file} {opt}"
+
+ cmdline = cmdline.format(target = test_case.dut.target,
+ eal = eal_str,
+ file = each_file,
+ opt = opt_str)
+
+ out = test_case.dut.send_expect(cmdline, "# ", 300)
+ test_case.verify("failed" not in out and "FATAL" not in out,
+ "Test Failed: Parameter or the value error")
+
+ case_name = test_case._suite_result.test_case
+ res = format_perf_data(case_name, out)
+ test_case.verify(res, "Test Failed: can't get performance
+ data")
+
+ file_name = os.path.basename(each_file).split('.')[0]
+ result.update({case_name + '_' + file_name: res})
+
+ return result
+
+def parse_perf_output(output):
+ try:
+ lines = output.split("\r\n")
+ line_nb = len(lines)
+
+ # Find perf data line
+ for line_index in range(line_nb):
+ if lines[line_index].strip().startswith("lcore:"):
+ break
+ data_line = line_index + 1
+
+ results = []
+ pattern = re.compile(r'\s+')
+ for line in lines[data_line:]:
+ result = {}
+ result_list = pattern.split(line.strip())
+ if not result_list[0].isdigit():
+ continue
+ print(line)
+ result["lcore_id"] = int(result_list[0])
+ result["level"] = int(result_list[1])
+ result["comp_size"] = int(result_list[2])
+ result["comp_ratio"] = float(result_list[3])
+ result["comp"] = float(result_list[4])
+ result["decomp"] = float(result_list[5])
+ results.append(result)
+
+ stats_results = _stat_results_by_level(results)
+ return stats_results
+ except Exception as ex:
+ raise ex
+
+def _stat_results_by_level(results):
+ stats_results = {}
+ for result in results:
+ level = result["level"]
+ if level in stats_results:
+ stats_results[level]["lcore_id"] = \
+ str(stats_results[level]["lcore_id"]) \
+ + "," + str(result["lcore_id"])
+ stats_results[level]["comp_size"] = \
+ stats_results[level]["comp_size"] + \
+ result["comp_size"]
+ stats_results[level]["comp_ratio"] = \
+ stats_results[level]["comp_ratio"] + \
+ result["comp_ratio"]
+ stats_results[level]["comp"] = \
+ stats_results[level]["comp"] + \
+ result["comp"]
+ stats_results[level]["decomp"] = \
+ stats_results[level]["decomp"] + \
+ result["decomp"]
+ stats_results[level]["nr"] =\
+ stats_results[level]["nr"] + 1
+ else:
+ stats_results[level] = result
+ stats_results[level]["nr"] = 1
+
+ return stats_results
+
+def format_perf_data(flag, output):
+ stats_results = parse_perf_output(output)
+
+ json_result = []
+ for level, values in stats_results.items():
+ status, delta = "PASS", 0
+ try:
+ if 'accepted_tolerance' in conf.suite_cfg:
+ accepted_gap = conf.suite_cfg['accepted_tolerance']
+ expected_throughput =\
+ conf.suite_cfg['expected_throughput'][flag][level]
+ delta = (values["comp"] - expected_throughput)/expected_throughput
+ if abs(delta) > accepted_gap:
+ status = "FAIL"
+
+ perf_info={
+ "status": status,
+ "performance":[
+ {
+ "name": "comp",
+ "value": round(values["comp"], 2),
+ "unit": "Gbps",
+ "delta": round(delta, 2)
+ },
+ {
+ "name":"decomp",
+ "unit": "Gbps",
+ "value": round(values["decomp"], 2)
+ },
+ {
+ "name":"comp_size",
+ "unit": "bytes",
+ "value": values["comp_size"]
+ },
+ {
+ "name":"comp_ratio",
+ "unit": "%",
+ "value": round(values["comp_ratio"]/values["nr"], 2)
+ },
+ ],
+ "parameters":[
+ {
+ "name": "level",
+ "unit": "",
+ "value": level
+ },
+ {
+ "name": "core_num",
+ "unit": "core",
+ "value": values["nr"]
+ },
+ ]
+ }
+ json_result.append(perf_info)
+ except Exception as err:
+ print(err)
+ return json_result
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dts] [PATCH V1 1/5] tests: add common method for compress test suites
2019-11-24 22:32 [dts] [PATCH V1 1/5] tests: add common method for compress test suites Xinfeng Zhao
` (4 preceding siblings ...)
2019-11-25 7:28 ` [dts] [PATCH V1 1/5] tests: add common method for compress test suites Zhao, XinfengX
@ 2019-11-25 8:38 ` Wan, Zhe
2019-11-27 9:08 ` Tu, Lijuan
6 siblings, 0 replies; 14+ messages in thread
From: Wan, Zhe @ 2019-11-25 8:38 UTC (permalink / raw)
To: Zhao, XinfengX, dts; +Cc: Zhao, XinfengX
Acked-by: Wan, Zhe <zhe.wan@intel.com>
-----Original Message-----
From: dts <dts-bounces@dpdk.org> On Behalf Of Xinfeng Zhao
Sent: 2019年11月25日 6:33
To: dts@dpdk.org
Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
Subject: [dts] [PATCH V1 1/5] tests: add common method for compress test suites
Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
tests/compress_common.py | 285 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 285 insertions(+)
create mode 100644 tests/compress_common.py
diff --git a/tests/compress_common.py b/tests/compress_common.py new file mode 100644 index 0000000..0a3c7ff
--- /dev/null
+++ b/tests/compress_common.py
@@ -0,0 +1,285 @@
+# BSD LICENSE
+#
+# Copyright(c) 2019 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without #
+modification, are permitted provided that the following conditions #
+are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR #
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import os
+import re
+import utils
+from config import SuiteConf
+
+conf = SuiteConf('compressdev_sample')
+
+default_opts = {
+ "driver-name": None,
+ "seg-sz": 2048,
+ "burst-sz": None,
+ "compress-level": "1:1:9",
+ "extended-input-sz": None,
+ "num-iter": 10,
+ "max-num-sgl-segs": 16,
+ "external-mbufs": None,
+ "huffman-enc": "dynamic",
+ "ptest": None,
+ "pool-sz": None
+ }
+
+default_eals = {
+ "l": "0-6",
+ "c": None,
+ "n": None,
+ "w": None,
+ "vdev": None
+ }
+
+
+def get_qat_device_list(test_case):
+ device_id = conf.suite_cfg["qat_device_id"]
+ out = test_case.dut.send_expect("lspci -d:{}|awk '{{print $1}}'".format(device_id), "# ", 10)
+ device_list = out.replace("\r", "\n").replace("\n\n",
+"\n").split("\n")
+
+ return device_list
+
+def bind_qat_device(test_case, driver = "igb_uio"):
+ if driver == 'vfio-pci':
+ test_case.dut.send_expect('modprobe vfio-pci', '#', 10)
+ else:
+ driver = 'igb_uio'
+
+ # Bind QAT VF devices
+ device_list = get_qat_device_list(test_case)
+ device_id = conf.suite_cfg["qat_device_id"]
+
+ test_case.dut.send_expect(
+ 'echo "8086 {}" > /sys/bus/pci/drivers/{}/new_id'.format(device_id, driver), "# ", 10)
+ for line in device_list:
+ cmd = "echo 0000:{} > /sys/bus/pci/devices/0000\:{}/driver/unbind".format(
+ line, line.replace(":", "\:"))
+ test_case.dut.send_expect(cmd, "# ", 10)
+ cmd = "echo 0000:{} > /sys/bus/pci/drivers/{}/bind".format(
+ line, driver)
+ test_case.dut.send_expect(cmd, "# ", 10)
+
+def get_opt_str(test_case, default_opts={}, override_opts={}):
+ case_cfg = conf.load_case_config(test_case._suite_result.test_case)
+ opts = default_opts.copy()
+ for key in default_opts.keys():
+ if key in case_cfg:
+ opts[key] = case_cfg[key]
+
+ opts.update(override_opts)
+
+ opt_str = ""
+ for key,value in opts.items():
+ if value is None:
+ continue
+ dash = "-" if len(key) == 1 else "--"
+ opt_str = opt_str + "{0}{1} {2} ".format(dash, key, value)
+
+ return opt_str
+
+def get_input_file(test_case):
+ case_cfg = conf.load_case_config(test_case._suite_result.test_case)
+ input_file = conf.suite_cfg["input-file"]
+ out = test_case.dut.send_expect("ls %s" % input_file, "# ", 10)
+ if out == input_file:
+ file_list = [input_file]
+ else:
+ file_list = [os.path.join(input_file, x.strip()) for x in
+out.split()]
+
+ return file_list
+
+def run_unit(test_case, eal={}):
+ cores = test_case.dut.get_core_list('1S/3C/1T')
+ core_mask = utils.create_mask(cores)
+ mem_channels = test_case.dut.get_memory_channels()
+
+ default = default_eals.copy()
+ default['l'] = None
+ default['c'] = core_mask
+ default['n'] = mem_channels
+
+ eal_str = get_opt_str(test_case, default, eal)
+ cmdline = "./{target}/app/test {eal}".format(target = test_case.dut.target,
+ eal = eal_str)
+ test_case.dut.send_expect(cmdline, ">", 30)
+ out = test_case.dut.send_expect("compressdev_autotest", ">", 30)
+ test_case.dut.send_expect("quit", "# ", 30)
+ print(out)
+
+ test_case.verify("Test OK" in out, "Test Failed")
+
+def run_perf(test_case, eal={}, opt={}):
+ eal_str = get_opt_str(test_case, default_eals, eal)
+ opt_str = get_opt_str(test_case, default_opts, opt)
+ input_file = get_input_file(test_case)
+
+ result = {}
+ for each_file in input_file:
+ test_case.logger.info("Testing file: {}".format(each_file))
+
+ cmdline = "./{target}/app/dpdk-test-compress-perf {eal}\
+ -- --input-file {file} {opt}"
+
+ cmdline = cmdline.format(target = test_case.dut.target,
+ eal = eal_str,
+ file = each_file,
+ opt = opt_str)
+
+ out = test_case.dut.send_expect(cmdline, "# ", 300)
+ test_case.verify("failed" not in out and "FATAL" not in out,
+ "Test Failed: Parameter or the value error")
+
+ case_name = test_case._suite_result.test_case
+ res = format_perf_data(case_name, out)
+ test_case.verify(res, "Test Failed: can't get performance
+ data")
+
+ file_name = os.path.basename(each_file).split('.')[0]
+ result.update({case_name + '_' + file_name: res})
+
+ return result
+
+def parse_perf_output(output):
+ try:
+ lines = output.split("\r\n")
+ line_nb = len(lines)
+
+ # Find perf data line
+ for line_index in range(line_nb):
+ if lines[line_index].strip().startswith("lcore:"):
+ break
+ data_line = line_index + 1
+
+ results = []
+ pattern = re.compile(r'\s+')
+ for line in lines[data_line:]:
+ result = {}
+ result_list = pattern.split(line.strip())
+ if not result_list[0].isdigit():
+ continue
+ print(line)
+ result["lcore_id"] = int(result_list[0])
+ result["level"] = int(result_list[1])
+ result["comp_size"] = int(result_list[2])
+ result["comp_ratio"] = float(result_list[3])
+ result["comp"] = float(result_list[4])
+ result["decomp"] = float(result_list[5])
+ results.append(result)
+
+ stats_results = _stat_results_by_level(results)
+ return stats_results
+ except Exception as ex:
+ raise ex
+
+def _stat_results_by_level(results):
+ stats_results = {}
+ for result in results:
+ level = result["level"]
+ if level in stats_results:
+ stats_results[level]["lcore_id"] = \
+ str(stats_results[level]["lcore_id"]) \
+ + "," + str(result["lcore_id"])
+ stats_results[level]["comp_size"] = \
+ stats_results[level]["comp_size"] + \
+ result["comp_size"]
+ stats_results[level]["comp_ratio"] = \
+ stats_results[level]["comp_ratio"] + \
+ result["comp_ratio"]
+ stats_results[level]["comp"] = \
+ stats_results[level]["comp"] + \
+ result["comp"]
+ stats_results[level]["decomp"] = \
+ stats_results[level]["decomp"] + \
+ result["decomp"]
+ stats_results[level]["nr"] =\
+ stats_results[level]["nr"] + 1
+ else:
+ stats_results[level] = result
+ stats_results[level]["nr"] = 1
+
+ return stats_results
+
+def format_perf_data(flag, output):
+ stats_results = parse_perf_output(output)
+
+ json_result = []
+ for level, values in stats_results.items():
+ status, delta = "PASS", 0
+ try:
+ if 'accepted_tolerance' in conf.suite_cfg:
+ accepted_gap = conf.suite_cfg['accepted_tolerance']
+ expected_throughput =\
+ conf.suite_cfg['expected_throughput'][flag][level]
+ delta = (values["comp"] - expected_throughput)/expected_throughput
+ if abs(delta) > accepted_gap:
+ status = "FAIL"
+
+ perf_info={
+ "status": status,
+ "performance":[
+ {
+ "name": "comp",
+ "value": round(values["comp"], 2),
+ "unit": "Gbps",
+ "delta": round(delta, 2)
+ },
+ {
+ "name":"decomp",
+ "unit": "Gbps",
+ "value": round(values["decomp"], 2)
+ },
+ {
+ "name":"comp_size",
+ "unit": "bytes",
+ "value": values["comp_size"]
+ },
+ {
+ "name":"comp_ratio",
+ "unit": "%",
+ "value": round(values["comp_ratio"]/values["nr"], 2)
+ },
+ ],
+ "parameters":[
+ {
+ "name": "level",
+ "unit": "",
+ "value": level
+ },
+ {
+ "name": "core_num",
+ "unit": "core",
+ "value": values["nr"]
+ },
+ ]
+ }
+ json_result.append(perf_info)
+ except Exception as err:
+ print(err)
+ return json_result
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dts] [PATCH V1 2/5] tests: add suite for compressdev qat pmd test
2019-11-24 22:32 ` [dts] [PATCH V1 2/5] tests: add suite for compressdev qat pmd test Xinfeng Zhao
@ 2019-11-25 8:38 ` Wan, Zhe
0 siblings, 0 replies; 14+ messages in thread
From: Wan, Zhe @ 2019-11-25 8:38 UTC (permalink / raw)
To: Zhao, XinfengX, dts; +Cc: Zhao, XinfengX
Acked-by: Wan, Zhe <zhe.wan@intel.com>
-----Original Message-----
From: dts <dts-bounces@dpdk.org> On Behalf Of Xinfeng Zhao
Sent: 2019年11月25日 6:33
To: dts@dpdk.org
Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
Subject: [dts] [PATCH V1 2/5] tests: add suite for compressdev qat pmd test
Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
tests/TestSuite_compressdev_qat_pmd.py | 102 +++++++++++++++++++++++++++++++++
1 file changed, 102 insertions(+)
create mode 100644 tests/TestSuite_compressdev_qat_pmd.py
diff --git a/tests/TestSuite_compressdev_qat_pmd.py b/tests/TestSuite_compressdev_qat_pmd.py
new file mode 100644
index 0000000..40b3fac
--- /dev/null
+++ b/tests/TestSuite_compressdev_qat_pmd.py
@@ -0,0 +1,102 @@
+# BSD LICENSE
+#
+# Copyright(c) 2019 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without #
+modification, are permitted provided that the following conditions #
+are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR #
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import os
+from test_case import TestCase
+import json
+import compress_common as cc
+
+
+class TestCompressdevQatPmd(TestCase):
+
+ def set_up_all(self):
+ self.prepare_dpdk()
+ cc.bind_qat_device(self, self.drivername)
+ cc.default_opts.update({"driver-name": "compress_qat"})
+ self.device_list = cc.get_qat_device_list(self)
+ self._perf_result = dict()
+
+ def set_up(self):
+ pass
+
+ def prepare_dpdk(self):
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=n$/CONFIG_RTE_COMPRESSDEV_TEST=y/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_QAT_SYM=n$/CONFIG_RTE_LIBRTE_PMD_QAT_SYM=y/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ def get_perf_default_device(self, dev_num=3):
+ perf_device_list = []
+ for each in self.device_list:
+ if each.endswith("01.0"):
+ perf_device_list.append(each)
+ if len(perf_device_list) < dev_num:
+ perf_device_list += list(set(self.device_list).
+ difference(set(perf_device_list)))[:dev_num-len(perf_device_list)]
+ else:
+ perf_device_list = perf_device_list[:dev_num]
+
+ return perf_device_list
+
+ def test_qat_pmd_unit_test(self):
+ cc.default_eals['w'] = self.device_list[0]
+ cc.run_unit(self)
+
+ def test_qat_pmd_fixed_func(self):
+ cc.default_eals['w'] = ' -w '.join(self.get_perf_default_device())
+ cc.default_opts.update({"huffman-enc": "fixed"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def test_qat_pmd_dynamic_func(self):
+ cc.default_eals['w'] = ' -w '.join(self.get_perf_default_device())
+ cc.default_opts.update({"huffman-enc": "dynamic"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def tear_down(self):
+ pass
+
+ def tear_down_all(self):
+ self.dut.kill_all()
+
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=y$/CONFIG_RTE_COMPRESSDEV_TEST=n/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_QAT_SYM=y$/CONFIG_RTE_LIBRTE_PMD_QAT_SYM=n/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ if not self._perf_result:
+ return
+ with open(self.logger.log_path + "/" + self.suite_name + ".json", "w") as fv:
+ json.dump(self._perf_result, fv, indent=4)
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dts] [PATCH V1 3/5] tests: add suite for compressdev zlib pmd test
2019-11-24 22:32 ` [dts] [PATCH V1 3/5] tests: add suite for compressdev zlib " Xinfeng Zhao
@ 2019-11-25 8:39 ` Wan, Zhe
0 siblings, 0 replies; 14+ messages in thread
From: Wan, Zhe @ 2019-11-25 8:39 UTC (permalink / raw)
To: Zhao, XinfengX, dts; +Cc: Zhao, XinfengX
Acked-by: Wan, Zhe <zhe.wan@intel.com>
-----Original Message-----
From: dts <dts-bounces@dpdk.org> On Behalf Of Xinfeng Zhao
Sent: 2019年11月25日 6:33
To: dts@dpdk.org
Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
Subject: [dts] [PATCH V1 3/5] tests: add suite for compressdev zlib pmd test
Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
tests/TestSuite_compressdev_zlib_pmd.py | 84 +++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
create mode 100644 tests/TestSuite_compressdev_zlib_pmd.py
diff --git a/tests/TestSuite_compressdev_zlib_pmd.py b/tests/TestSuite_compressdev_zlib_pmd.py
new file mode 100644
index 0000000..31d7194
--- /dev/null
+++ b/tests/TestSuite_compressdev_zlib_pmd.py
@@ -0,0 +1,84 @@
+# BSD LICENSE
+#
+# Copyright(c) 2019 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without #
+modification, are permitted provided that the following conditions #
+are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR #
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import os
+from test_case import TestCase
+import json
+import compress_common as cc
+
+class TestCompressdevZlibPmd(TestCase):
+
+ def set_up_all(self):
+ self.prepare_dpdk()
+ cc.default_eals.update({"w":"0000:00:00.0", "vdev": "compress_zlib"})
+ cc.default_opts.update({"driver-name": "compress_zlib"})
+ self._perf_result = dict()
+
+ def set_up(self):
+ pass
+
+ def prepare_dpdk(self):
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=n$/CONFIG_RTE_COMPRESSDEV_TEST=y/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_ZLIB=n$/CONFIG_RTE_LIBRTE_PMD_ZLIB=y/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ def test_zlib_pmd_unit_test(self):
+ cc.run_unit(self)
+
+ def test_zlib_pmd_fixed_func(self):
+ cc.default_opts.update({"huffman-enc": "fixed"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def test_zlib_pmd_dynamic_func(self):
+ cc.default_opts.update({"huffman-enc": "dynamic"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def tear_down(self):
+ pass
+
+ def tear_down_all(self):
+ self.dut.kill_all()
+
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=y$/CONFIG_RTE_COMPRESSDEV_TEST=n/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_ZLIB=y$/CONFIG_RTE_LIBRTE_PMD_ZLIB=n/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ if not self._perf_result:
+ return
+ with open(self.logger.log_path + "/" + self.suite_name + ".json", "w") as fv:
+ json.dump(self._perf_result, fv, indent=4)
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dts] [PATCH V1 4/5] tests: add suite for compressdev isal pmd test
2019-11-25 7:26 ` Zhao, XinfengX
@ 2019-11-25 8:39 ` Wan, Zhe
0 siblings, 0 replies; 14+ messages in thread
From: Wan, Zhe @ 2019-11-25 8:39 UTC (permalink / raw)
To: Zhao, XinfengX, dts
Acked-by: Wan, Zhe <zhe.wan@intel.com>
-----Original Message-----
From: Zhao, XinfengX <xinfengx.zhao@intel.com>
Sent: 2019年11月25日 15:27
To: dts@dpdk.org; Wan, Zhe <zhe.wan@intel.com>
Subject: RE: [dts][PATCH V1 4/5] tests: add suite for compressdev isal pmd test
Tested-by: Zhao, Xinfeng<xinfengx.zhao@intel.com>
-----Original Message-----
From: Zhao, XinfengX
Sent: Monday, November 25, 2019 6:33 AM
To: dts@dpdk.org
Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
Subject: [dts][PATCH V1 4/5] tests: add suite for compressdev isal pmd test
Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
tests/TestSuite_compressdev_isal_pmd.py | 84 +++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
create mode 100644 tests/TestSuite_compressdev_isal_pmd.py
diff --git a/tests/TestSuite_compressdev_isal_pmd.py b/tests/TestSuite_compressdev_isal_pmd.py
new file mode 100644
index 0000000..8d7e22e
--- /dev/null
+++ b/tests/TestSuite_compressdev_isal_pmd.py
@@ -0,0 +1,84 @@
+# BSD LICENSE
+#
+# Copyright(c) 2019 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without #
+modification, are permitted provided that the following conditions #
+are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR #
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import os
+from test_case import TestCase
+import json
+import compress_common as cc
+
+class TestCompressdevIsalPmd(TestCase):
+
+ def set_up_all(self):
+ self.prepare_dpdk()
+ cc.default_eals.update({'w': "0000:00:00.0", "vdev": "compress_isal"})
+ cc.default_opts.update({"driver-name": "compress_isal"})
+ self._perf_result = dict()
+
+ def set_up(self):
+ pass
+
+ def prepare_dpdk(self):
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=n$/CONFIG_RTE_COMPRESSDEV_TEST=y/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_ISAL=n$/CONFIG_RTE_LIBRTE_PMD_ISAL=y/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ def test_isal_pmd_unit_test(self):
+ cc.run_unit(self)
+
+ def test_isal_pmd_fixed_func(self):
+ cc.default_opts.update({"huffman-enc": "fixed"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def test_isal_pmd_dynamic_func(self):
+ cc.default_opts.update({"huffman-enc": "dynamic"})
+ result = cc.run_perf(self)
+ self._perf_result.update(result)
+
+ def tear_down(self):
+ pass
+
+ def tear_down_all(self):
+ self.dut.kill_all()
+
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_COMPRESSDEV_TEST=y$/CONFIG_RTE_COMPRESSDEV_TEST=n/' config/common_base", "# ")
+ self.dut.send_expect(
+ "sed -i 's/CONFIG_RTE_LIBRTE_PMD_ISAL=y$/CONFIG_RTE_LIBRTE_PMD_ISAL=n/' config/common_base", "# ")
+ self.dut.build_install_dpdk(self.dut.target)
+
+ if not self._perf_result:
+ return
+ with open(self.logger.log_path + "/" + self.suite_name + ".json", "w") as f:
+ json.dump(self._perf_result, f, indent=4)
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dts] [PATCH V1 5/5] conf: add config file for compress test
2019-11-24 22:32 ` [dts] [PATCH V1 5/5] conf: add config file for compress test Xinfeng Zhao
@ 2019-11-25 8:40 ` Wan, Zhe
0 siblings, 0 replies; 14+ messages in thread
From: Wan, Zhe @ 2019-11-25 8:40 UTC (permalink / raw)
To: Zhao, XinfengX, dts; +Cc: Zhao, XinfengX
Acked-by: Wan, Zhe <zhe.wan@intel.com>
-----Original Message-----
From: dts <dts-bounces@dpdk.org> On Behalf Of Xinfeng Zhao
Sent: 2019年11月25日 6:33
To: dts@dpdk.org
Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
Subject: [dts] [PATCH V1 5/5] conf: add config file for compress test
Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
conf/compressdev_sample.cfg | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 conf/compressdev_sample.cfg
diff --git a/conf/compressdev_sample.cfg b/conf/compressdev_sample.cfg new file mode 100644 index 0000000..f2841a3
--- /dev/null
+++ b/conf/compressdev_sample.cfg
@@ -0,0 +1,16 @@
+[suite]
+# Compress common options qat device id qat_device_id="37c9"
+
+# the file to compress and decompress
+input-file = "/root/calgary"
+
+# you can make special settings for test case like this.
+#seg-sz=1024
+#compress-level="1:1:9"
+#num-iter=10
+#max-num-sgl-segs=1003
+
+#[test_qat_pmd_dynamic_func]
+#l="0-6"
+#w="1a:01.0 -w 1c:01.0 -w 1e:01.0"
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dts] [PATCH V1 1/5] tests: add common method for compress test suites
2019-11-25 7:28 ` [dts] [PATCH V1 1/5] tests: add common method for compress test suites Zhao, XinfengX
@ 2019-11-27 9:07 ` Tu, Lijuan
0 siblings, 0 replies; 14+ messages in thread
From: Tu, Lijuan @ 2019-11-27 9:07 UTC (permalink / raw)
To: Zhao, XinfengX, dts, Wan, Zhe
Applied the series.
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Zhao, XinfengX
> Sent: Monday, November 25, 2019 3:29 PM
> To: dts@dpdk.org; Wan, Zhe <zhe.wan@intel.com>
> Subject: Re: [dts] [PATCH V1 1/5] tests: add common method for compress
> test suites
>
> Tested-by: Zhao, Xinfeng<xinfengx.zhao at intel.com>
>
> -----Original Message-----
> From: Zhao, XinfengX
> Sent: Monday, November 25, 2019 6:33 AM
> To: dts@dpdk.org
> Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
> Subject: [dts][PATCH V1 1/5] tests: add common method for compress test
> suites
>
> Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
> ---
> tests/compress_common.py | 285
> +++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 285 insertions(+)
> create mode 100644 tests/compress_common.py
>
> diff --git a/tests/compress_common.py b/tests/compress_common.py new
> file mode 100644 index 0000000..0a3c7ff
> --- /dev/null
> +++ b/tests/compress_common.py
> @@ -0,0 +1,285 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2019 Intel Corporation. All rights reserved.
> +# All rights reserved.
> +#
> +# Redistribution and use in source and binary forms, with or without #
> +modification, are permitted provided that the following conditions #
> +are met:
> +#
> +# * Redistributions of source code must retain the above copyright
> +# notice, this list of conditions and the following disclaimer.
> +# * Redistributions in binary form must reproduce the above copyright
> +# notice, this list of conditions and the following disclaimer in
> +# the documentation and/or other materials provided with the
> +# distribution.
> +# * Neither the name of Intel Corporation nor the names of its
> +# contributors may be used to endorse or promote products derived
> +# from this software without specific prior written permission.
> +#
> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> CONTRIBUTORS #
> +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> #
> +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
> FOR #
> +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> COPYRIGHT #
> +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
> INCIDENTAL, #
> +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> NOT #
> +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> USE, #
> +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> ON ANY #
> +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> #
> +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
> THE USE #
> +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
> DAMAGE.
> +
> +
> +import os
> +import re
> +import utils
> +from config import SuiteConf
> +
> +conf = SuiteConf('compressdev_sample')
> +
> +default_opts = {
> + "driver-name": None,
> + "seg-sz": 2048,
> + "burst-sz": None,
> + "compress-level": "1:1:9",
> + "extended-input-sz": None,
> + "num-iter": 10,
> + "max-num-sgl-segs": 16,
> + "external-mbufs": None,
> + "huffman-enc": "dynamic",
> + "ptest": None,
> + "pool-sz": None
> + }
> +
> +default_eals = {
> + "l": "0-6",
> + "c": None,
> + "n": None,
> + "w": None,
> + "vdev": None
> + }
> +
> +
> +def get_qat_device_list(test_case):
> + device_id = conf.suite_cfg["qat_device_id"]
> + out = test_case.dut.send_expect("lspci -d:{}|awk '{{print
> $1}}'".format(device_id), "# ", 10)
> + device_list = out.replace("\r", "\n").replace("\n\n",
> +"\n").split("\n")
> +
> + return device_list
> +
> +def bind_qat_device(test_case, driver = "igb_uio"):
> + if driver == 'vfio-pci':
> + test_case.dut.send_expect('modprobe vfio-pci', '#', 10)
> + else:
> + driver = 'igb_uio'
> +
> + # Bind QAT VF devices
> + device_list = get_qat_device_list(test_case)
> + device_id = conf.suite_cfg["qat_device_id"]
> +
> + test_case.dut.send_expect(
> + 'echo "8086 {}" > /sys/bus/pci/drivers/{}/new_id'.format(device_id,
> driver), "# ", 10)
> + for line in device_list:
> + cmd = "echo 0000:{} >
> /sys/bus/pci/devices/0000\:{}/driver/unbind".format(
> + line, line.replace(":", "\:"))
> + test_case.dut.send_expect(cmd, "# ", 10)
> + cmd = "echo 0000:{} > /sys/bus/pci/drivers/{}/bind".format(
> + line, driver)
> + test_case.dut.send_expect(cmd, "# ", 10)
> +
> +def get_opt_str(test_case, default_opts={}, override_opts={}):
> + case_cfg = conf.load_case_config(test_case._suite_result.test_case)
> + opts = default_opts.copy()
> + for key in default_opts.keys():
> + if key in case_cfg:
> + opts[key] = case_cfg[key]
> +
> + opts.update(override_opts)
> +
> + opt_str = ""
> + for key,value in opts.items():
> + if value is None:
> + continue
> + dash = "-" if len(key) == 1 else "--"
> + opt_str = opt_str + "{0}{1} {2} ".format(dash, key, value)
> +
> + return opt_str
> +
> +def get_input_file(test_case):
> + case_cfg = conf.load_case_config(test_case._suite_result.test_case)
> + input_file = conf.suite_cfg["input-file"]
> + out = test_case.dut.send_expect("ls %s" % input_file, "# ", 10)
> + if out == input_file:
> + file_list = [input_file]
> + else:
> + file_list = [os.path.join(input_file, x.strip()) for x in
> +out.split()]
> +
> + return file_list
> +
> +def run_unit(test_case, eal={}):
> + cores = test_case.dut.get_core_list('1S/3C/1T')
> + core_mask = utils.create_mask(cores)
> + mem_channels = test_case.dut.get_memory_channels()
> +
> + default = default_eals.copy()
> + default['l'] = None
> + default['c'] = core_mask
> + default['n'] = mem_channels
> +
> + eal_str = get_opt_str(test_case, default, eal)
> + cmdline = "./{target}/app/test {eal}".format(target = test_case.dut.target,
> + eal = eal_str)
> + test_case.dut.send_expect(cmdline, ">", 30)
> + out = test_case.dut.send_expect("compressdev_autotest", ">", 30)
> + test_case.dut.send_expect("quit", "# ", 30)
> + print(out)
> +
> + test_case.verify("Test OK" in out, "Test Failed")
> +
> +def run_perf(test_case, eal={}, opt={}):
> + eal_str = get_opt_str(test_case, default_eals, eal)
> + opt_str = get_opt_str(test_case, default_opts, opt)
> + input_file = get_input_file(test_case)
> +
> + result = {}
> + for each_file in input_file:
> + test_case.logger.info("Testing file: {}".format(each_file))
> +
> + cmdline = "./{target}/app/dpdk-test-compress-perf {eal}\
> + -- --input-file {file} {opt}"
> +
> + cmdline = cmdline.format(target = test_case.dut.target,
> + eal = eal_str,
> + file = each_file,
> + opt = opt_str)
> +
> + out = test_case.dut.send_expect(cmdline, "# ", 300)
> + test_case.verify("failed" not in out and "FATAL" not in out,
> + "Test Failed: Parameter or the value error")
> +
> + case_name = test_case._suite_result.test_case
> + res = format_perf_data(case_name, out)
> + test_case.verify(res, "Test Failed: can't get performance
> + data")
> +
> + file_name = os.path.basename(each_file).split('.')[0]
> + result.update({case_name + '_' + file_name: res})
> +
> + return result
> +
> +def parse_perf_output(output):
> + try:
> + lines = output.split("\r\n")
> + line_nb = len(lines)
> +
> + # Find perf data line
> + for line_index in range(line_nb):
> + if lines[line_index].strip().startswith("lcore:"):
> + break
> + data_line = line_index + 1
> +
> + results = []
> + pattern = re.compile(r'\s+')
> + for line in lines[data_line:]:
> + result = {}
> + result_list = pattern.split(line.strip())
> + if not result_list[0].isdigit():
> + continue
> + print(line)
> + result["lcore_id"] = int(result_list[0])
> + result["level"] = int(result_list[1])
> + result["comp_size"] = int(result_list[2])
> + result["comp_ratio"] = float(result_list[3])
> + result["comp"] = float(result_list[4])
> + result["decomp"] = float(result_list[5])
> + results.append(result)
> +
> + stats_results = _stat_results_by_level(results)
> + return stats_results
> + except Exception as ex:
> + raise ex
> +
> +def _stat_results_by_level(results):
> + stats_results = {}
> + for result in results:
> + level = result["level"]
> + if level in stats_results:
> + stats_results[level]["lcore_id"] = \
> + str(stats_results[level]["lcore_id"]) \
> + + "," + str(result["lcore_id"])
> + stats_results[level]["comp_size"] = \
> + stats_results[level]["comp_size"] + \
> + result["comp_size"]
> + stats_results[level]["comp_ratio"] = \
> + stats_results[level]["comp_ratio"] + \
> + result["comp_ratio"]
> + stats_results[level]["comp"] = \
> + stats_results[level]["comp"] + \
> + result["comp"]
> + stats_results[level]["decomp"] = \
> + stats_results[level]["decomp"] + \
> + result["decomp"]
> + stats_results[level]["nr"] =\
> + stats_results[level]["nr"] + 1
> + else:
> + stats_results[level] = result
> + stats_results[level]["nr"] = 1
> +
> + return stats_results
> +
> +def format_perf_data(flag, output):
> + stats_results = parse_perf_output(output)
> +
> + json_result = []
> + for level, values in stats_results.items():
> + status, delta = "PASS", 0
> + try:
> + if 'accepted_tolerance' in conf.suite_cfg:
> + accepted_gap = conf.suite_cfg['accepted_tolerance']
> + expected_throughput =\
> + conf.suite_cfg['expected_throughput'][flag][level]
> + delta = (values["comp"] -
> expected_throughput)/expected_throughput
> + if abs(delta) > accepted_gap:
> + status = "FAIL"
> +
> + perf_info={
> + "status": status,
> + "performance":[
> + {
> + "name": "comp",
> + "value": round(values["comp"], 2),
> + "unit": "Gbps",
> + "delta": round(delta, 2)
> + },
> + {
> + "name":"decomp",
> + "unit": "Gbps",
> + "value": round(values["decomp"], 2)
> + },
> + {
> + "name":"comp_size",
> + "unit": "bytes",
> + "value": values["comp_size"]
> + },
> + {
> + "name":"comp_ratio",
> + "unit": "%",
> + "value": round(values["comp_ratio"]/values["nr"], 2)
> + },
> + ],
> + "parameters":[
> + {
> + "name": "level",
> + "unit": "",
> + "value": level
> + },
> + {
> + "name": "core_num",
> + "unit": "core",
> + "value": values["nr"]
> + },
> + ]
> + }
> + json_result.append(perf_info)
> + except Exception as err:
> + print(err)
> + return json_result
> --
> 2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dts] [PATCH V1 1/5] tests: add common method for compress test suites
2019-11-24 22:32 [dts] [PATCH V1 1/5] tests: add common method for compress test suites Xinfeng Zhao
` (5 preceding siblings ...)
2019-11-25 8:38 ` Wan, Zhe
@ 2019-11-27 9:08 ` Tu, Lijuan
6 siblings, 0 replies; 14+ messages in thread
From: Tu, Lijuan @ 2019-11-27 9:08 UTC (permalink / raw)
To: Zhao, XinfengX, dts; +Cc: Zhao, XinfengX
Applied the series.
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xinfeng Zhao
> Sent: Monday, November 25, 2019 6:33 AM
> To: dts@dpdk.org
> Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
> Subject: [dts] [PATCH V1 1/5] tests: add common method for compress test
> suites
>
> Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
> ---
> tests/compress_common.py | 285
> +++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 285 insertions(+)
> create mode 100644 tests/compress_common.py
>
> diff --git a/tests/compress_common.py b/tests/compress_common.py new
> file mode 100644 index 0000000..0a3c7ff
> --- /dev/null
> +++ b/tests/compress_common.py
> @@ -0,0 +1,285 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2019 Intel Corporation. All rights reserved.
> +# All rights reserved.
> +#
> +# Redistribution and use in source and binary forms, with or without #
> +modification, are permitted provided that the following conditions #
> +are met:
> +#
> +# * Redistributions of source code must retain the above copyright
> +# notice, this list of conditions and the following disclaimer.
> +# * Redistributions in binary form must reproduce the above copyright
> +# notice, this list of conditions and the following disclaimer in
> +# the documentation and/or other materials provided with the
> +# distribution.
> +# * Neither the name of Intel Corporation nor the names of its
> +# contributors may be used to endorse or promote products derived
> +# from this software without specific prior written permission.
> +#
> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> CONTRIBUTORS #
> +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> #
> +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
> FOR #
> +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> COPYRIGHT #
> +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
> INCIDENTAL, #
> +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> NOT #
> +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> USE, #
> +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> ON ANY #
> +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> #
> +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
> THE USE #
> +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
> DAMAGE.
> +
> +
> +import os
> +import re
> +import utils
> +from config import SuiteConf
> +
> +conf = SuiteConf('compressdev_sample')
> +
> +default_opts = {
> + "driver-name": None,
> + "seg-sz": 2048,
> + "burst-sz": None,
> + "compress-level": "1:1:9",
> + "extended-input-sz": None,
> + "num-iter": 10,
> + "max-num-sgl-segs": 16,
> + "external-mbufs": None,
> + "huffman-enc": "dynamic",
> + "ptest": None,
> + "pool-sz": None
> + }
> +
> +default_eals = {
> + "l": "0-6",
> + "c": None,
> + "n": None,
> + "w": None,
> + "vdev": None
> + }
> +
> +
> +def get_qat_device_list(test_case):
> + device_id = conf.suite_cfg["qat_device_id"]
> + out = test_case.dut.send_expect("lspci -d:{}|awk '{{print
> $1}}'".format(device_id), "# ", 10)
> + device_list = out.replace("\r", "\n").replace("\n\n",
> +"\n").split("\n")
> +
> + return device_list
> +
> +def bind_qat_device(test_case, driver = "igb_uio"):
> + if driver == 'vfio-pci':
> + test_case.dut.send_expect('modprobe vfio-pci', '#', 10)
> + else:
> + driver = 'igb_uio'
> +
> + # Bind QAT VF devices
> + device_list = get_qat_device_list(test_case)
> + device_id = conf.suite_cfg["qat_device_id"]
> +
> + test_case.dut.send_expect(
> + 'echo "8086 {}" > /sys/bus/pci/drivers/{}/new_id'.format(device_id,
> driver), "# ", 10)
> + for line in device_list:
> + cmd = "echo 0000:{} >
> /sys/bus/pci/devices/0000\:{}/driver/unbind".format(
> + line, line.replace(":", "\:"))
> + test_case.dut.send_expect(cmd, "# ", 10)
> + cmd = "echo 0000:{} > /sys/bus/pci/drivers/{}/bind".format(
> + line, driver)
> + test_case.dut.send_expect(cmd, "# ", 10)
> +
> +def get_opt_str(test_case, default_opts={}, override_opts={}):
> + case_cfg = conf.load_case_config(test_case._suite_result.test_case)
> + opts = default_opts.copy()
> + for key in default_opts.keys():
> + if key in case_cfg:
> + opts[key] = case_cfg[key]
> +
> + opts.update(override_opts)
> +
> + opt_str = ""
> + for key,value in opts.items():
> + if value is None:
> + continue
> + dash = "-" if len(key) == 1 else "--"
> + opt_str = opt_str + "{0}{1} {2} ".format(dash, key, value)
> +
> + return opt_str
> +
> +def get_input_file(test_case):
> + case_cfg = conf.load_case_config(test_case._suite_result.test_case)
> + input_file = conf.suite_cfg["input-file"]
> + out = test_case.dut.send_expect("ls %s" % input_file, "# ", 10)
> + if out == input_file:
> + file_list = [input_file]
> + else:
> + file_list = [os.path.join(input_file, x.strip()) for x in
> +out.split()]
> +
> + return file_list
> +
> +def run_unit(test_case, eal={}):
> + cores = test_case.dut.get_core_list('1S/3C/1T')
> + core_mask = utils.create_mask(cores)
> + mem_channels = test_case.dut.get_memory_channels()
> +
> + default = default_eals.copy()
> + default['l'] = None
> + default['c'] = core_mask
> + default['n'] = mem_channels
> +
> + eal_str = get_opt_str(test_case, default, eal)
> + cmdline = "./{target}/app/test {eal}".format(target = test_case.dut.target,
> + eal = eal_str)
> + test_case.dut.send_expect(cmdline, ">", 30)
> + out = test_case.dut.send_expect("compressdev_autotest", ">", 30)
> + test_case.dut.send_expect("quit", "# ", 30)
> + print(out)
> +
> + test_case.verify("Test OK" in out, "Test Failed")
> +
> +def run_perf(test_case, eal={}, opt={}):
> + eal_str = get_opt_str(test_case, default_eals, eal)
> + opt_str = get_opt_str(test_case, default_opts, opt)
> + input_file = get_input_file(test_case)
> +
> + result = {}
> + for each_file in input_file:
> + test_case.logger.info("Testing file: {}".format(each_file))
> +
> + cmdline = "./{target}/app/dpdk-test-compress-perf {eal}\
> + -- --input-file {file} {opt}"
> +
> + cmdline = cmdline.format(target = test_case.dut.target,
> + eal = eal_str,
> + file = each_file,
> + opt = opt_str)
> +
> + out = test_case.dut.send_expect(cmdline, "# ", 300)
> + test_case.verify("failed" not in out and "FATAL" not in out,
> + "Test Failed: Parameter or the value error")
> +
> + case_name = test_case._suite_result.test_case
> + res = format_perf_data(case_name, out)
> + test_case.verify(res, "Test Failed: can't get performance
> + data")
> +
> + file_name = os.path.basename(each_file).split('.')[0]
> + result.update({case_name + '_' + file_name: res})
> +
> + return result
> +
> +def parse_perf_output(output):
> + try:
> + lines = output.split("\r\n")
> + line_nb = len(lines)
> +
> + # Find perf data line
> + for line_index in range(line_nb):
> + if lines[line_index].strip().startswith("lcore:"):
> + break
> + data_line = line_index + 1
> +
> + results = []
> + pattern = re.compile(r'\s+')
> + for line in lines[data_line:]:
> + result = {}
> + result_list = pattern.split(line.strip())
> + if not result_list[0].isdigit():
> + continue
> + print(line)
> + result["lcore_id"] = int(result_list[0])
> + result["level"] = int(result_list[1])
> + result["comp_size"] = int(result_list[2])
> + result["comp_ratio"] = float(result_list[3])
> + result["comp"] = float(result_list[4])
> + result["decomp"] = float(result_list[5])
> + results.append(result)
> +
> + stats_results = _stat_results_by_level(results)
> + return stats_results
> + except Exception as ex:
> + raise ex
> +
> +def _stat_results_by_level(results):
> + stats_results = {}
> + for result in results:
> + level = result["level"]
> + if level in stats_results:
> + stats_results[level]["lcore_id"] = \
> + str(stats_results[level]["lcore_id"]) \
> + + "," + str(result["lcore_id"])
> + stats_results[level]["comp_size"] = \
> + stats_results[level]["comp_size"] + \
> + result["comp_size"]
> + stats_results[level]["comp_ratio"] = \
> + stats_results[level]["comp_ratio"] + \
> + result["comp_ratio"]
> + stats_results[level]["comp"] = \
> + stats_results[level]["comp"] + \
> + result["comp"]
> + stats_results[level]["decomp"] = \
> + stats_results[level]["decomp"] + \
> + result["decomp"]
> + stats_results[level]["nr"] =\
> + stats_results[level]["nr"] + 1
> + else:
> + stats_results[level] = result
> + stats_results[level]["nr"] = 1
> +
> + return stats_results
> +
> +def format_perf_data(flag, output):
> + stats_results = parse_perf_output(output)
> +
> + json_result = []
> + for level, values in stats_results.items():
> + status, delta = "PASS", 0
> + try:
> + if 'accepted_tolerance' in conf.suite_cfg:
> + accepted_gap = conf.suite_cfg['accepted_tolerance']
> + expected_throughput =\
> + conf.suite_cfg['expected_throughput'][flag][level]
> + delta = (values["comp"] -
> expected_throughput)/expected_throughput
> + if abs(delta) > accepted_gap:
> + status = "FAIL"
> +
> + perf_info={
> + "status": status,
> + "performance":[
> + {
> + "name": "comp",
> + "value": round(values["comp"], 2),
> + "unit": "Gbps",
> + "delta": round(delta, 2)
> + },
> + {
> + "name":"decomp",
> + "unit": "Gbps",
> + "value": round(values["decomp"], 2)
> + },
> + {
> + "name":"comp_size",
> + "unit": "bytes",
> + "value": values["comp_size"]
> + },
> + {
> + "name":"comp_ratio",
> + "unit": "%",
> + "value": round(values["comp_ratio"]/values["nr"], 2)
> + },
> + ],
> + "parameters":[
> + {
> + "name": "level",
> + "unit": "",
> + "value": level
> + },
> + {
> + "name": "core_num",
> + "unit": "core",
> + "value": values["nr"]
> + },
> + ]
> + }
> + json_result.append(perf_info)
> + except Exception as err:
> + print(err)
> + return json_result
> --
> 2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2019-11-27 9:08 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-24 22:32 [dts] [PATCH V1 1/5] tests: add common method for compress test suites Xinfeng Zhao
2019-11-24 22:32 ` [dts] [PATCH V1 2/5] tests: add suite for compressdev qat pmd test Xinfeng Zhao
2019-11-25 8:38 ` Wan, Zhe
2019-11-24 22:32 ` [dts] [PATCH V1 3/5] tests: add suite for compressdev zlib " Xinfeng Zhao
2019-11-25 8:39 ` Wan, Zhe
2019-11-24 22:32 ` [dts] [PATCH V1 4/5] tests: add suite for compressdev isal " Xinfeng Zhao
2019-11-25 7:26 ` Zhao, XinfengX
2019-11-25 8:39 ` Wan, Zhe
2019-11-24 22:32 ` [dts] [PATCH V1 5/5] conf: add config file for compress test Xinfeng Zhao
2019-11-25 8:40 ` Wan, Zhe
2019-11-25 7:28 ` [dts] [PATCH V1 1/5] tests: add common method for compress test suites Zhao, XinfengX
2019-11-27 9:07 ` Tu, Lijuan
2019-11-25 8:38 ` Wan, Zhe
2019-11-27 9:08 ` Tu, Lijuan
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).