test suite reviews and discussions
 help / color / mirror / Atom feed
From: yaobing <bingx.y.yao@intel.com>
To: dts@dpdk.org
Cc: yaobing <bingx.y.yao@intel.com>
Subject: [dts] [PATCH V1 2/3] add case suite fips_cryptodev
Date: Tue,  8 Oct 2019 13:29:28 +0800	[thread overview]
Message-ID: <1570512569-17999-2-git-send-email-bingx.y.yao@intel.com> (raw)
In-Reply-To: <1570512569-17999-1-git-send-email-bingx.y.yao@intel.com>

add case suite fips_cryptodev

Signed-off-by: yaobing <bingx.y.yao@intel.com>
---
 tests/TestSuite_fips_cryptodev.py | 190 ++++++++++++++++++++++++++++++
 1 file changed, 190 insertions(+)
 create mode 100644 tests/TestSuite_fips_cryptodev.py

diff --git a/tests/TestSuite_fips_cryptodev.py b/tests/TestSuite_fips_cryptodev.py
new file mode 100644
index 0000000..1165ad8
--- /dev/null
+++ b/tests/TestSuite_fips_cryptodev.py
@@ -0,0 +1,190 @@
+# BSD LICENSE
+#
+# Copyright (c) <2019> Intel Corporation
+# 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 utils
+from test_case import TestCase
+import cryptodev_common as cc
+import re
+
+class FipCryptodev(TestCase):
+
+    def set_up_all(self):
+        if not cc.is_build_skip(self):
+            cc.build_dpdk_with_cryptodev(self)
+        out = self.dut.build_dpdk_apps("./examples/fips_validation")
+        self.verify("Error"not in out,"Compilation error")
+        self.verify("No such"not in out,"Compilation error")
+        self.vf_driver = self.get_suite_cfg()['vf_driver']
+        cc.bind_qat_device(self, "vfio-pci")
+        self._app_path = "./examples/fips_validation/build/fips_validation"
+        self._default_fips_opts = {
+            "req-file": None,
+            "rsp-file": None,
+            "cryptodev": None,
+            "path-is-folder": "",
+            "cryptodev-id": 0,
+            "self-test":"",
+        }
+        self.FIP_path = "/root/FIPS"
+
+    def set_up(self):
+        pass
+
+    def tear_down(self):
+        self.dut.kill_all()
+
+    def tear_down_all(self):
+        cc.clear_dpdk_config(self)
+
+    # Private functions
+    def _get_fips_opt_str(self):
+        return cc.get_opt_str(self, self._default_fips_opts,{})
+
+    def _run_fips(self, eal_opt_str, fips_opt_str):
+        cmd_str = cc.get_dpdk_app_cmd_str(self._app_path,
+                                          eal_opt_str,
+                                          fips_opt_str)
+        self.logger.info(cmd_str)
+        try:
+            out = self.dut.send_expect(cmd_str, "#", 600)
+        except Exception, ex:
+            self.logger.error(ex)
+            raise ex
+        return out
+
+    def compare_resp_file(self,eal_opt_str,fips_opt_str):
+        out = self._run_fips(eal_opt_str, fips_opt_str)
+        check_out = out[out.index("Done"):]
+        self.verify("Error" not in check_out," req file error")
+        rep_list = re.findall(r"FIPS/(.*)/req/(.*).req", out)
+
+        for alog_name, file_name in rep_list:
+            out = self.dut.send_expect("diff %s/%s/resp/%s.rsp %s/%s/fax/%s.rsp | grep -v '#' | grep -v '\---'" % (
+            self.FIP_path, alog_name, file_name, self.FIP_path, alog_name, file_name), "#")
+            lines = re.split('\r\n', out)
+            self.verify(len(lines) <= 2, "%s.req file comparison failed!"%file_name)
+
+    def test_fips_aesni_mb_aes(self):
+        eal_opt_str = cc.get_eal_opt_str(self)
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str,fips_opt_str)
+
+    def test_fips_aesni_mb_3des(self):
+        eal_opt_str = cc.get_eal_opt_str(self)
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str,fips_opt_str)
+
+    def test_fips_aesni_mb_hmac(self):
+        eal_opt_str = cc.get_eal_opt_str(self)
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_aesni_mb_ccm(self):
+        eal_opt_str = cc.get_eal_opt_str(self)
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_aesni_mb_cmac(self):
+        eal_opt_str = cc.get_eal_opt_str(self)
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_qat_gcm(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"vdev":None})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_qat_aes(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"vdev":None})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_qat_3des(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"vdev":None})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_qat_hmac(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"vdev":None})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_qat_ccm(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"vdev":None})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_qat_cmac(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"vdev":None})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_openssl_gcm(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"vdev":"crypto_openssl_pmd_1"})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_openssl_aes(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"vdev":"crypto_openssl_pmd_1"})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_openssl_3des(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"vdev":"crypto_openssl_pmd_1"})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_openssl_hmac(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"vdev":"crypto_openssl_pmd_1"})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_openssl_ccm(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"vdev":"crypto_openssl_pmd_1"})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def  test_fips_aesni_gcm_gcm(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"vdev":"crypto_aesni_gcm_pmd_1"})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_self_test(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"l":None,"n":None,})
+        fips_opt_str = self._get_fips_opt_str()
+        self.compare_resp_file(eal_opt_str, fips_opt_str)
+
+    def test_fips_broken_test(self):
+        eal_opt_str = cc.get_eal_opt_str(self,{"l":None,"n":None,})
+        fips_opt_str = cc.get_opt_str(self, self._default_fips_opts,{"cryptodev-id":None, "broken-test-id":15, "broken-test-dir":"dec"})
+        out = self._run_fips(eal_opt_str, fips_opt_str)
+        self.verify("Failed init" in out, "test Failed!")
-- 
2.17.2


  reply	other threads:[~2019-10-08  5:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08  5:29 [dts] [PATCH V1 1/3] add fips environment variable yaobing
2019-10-08  5:29 ` yaobing [this message]
2019-10-09  0:51   ` [dts] [PATCH V1 2/3] add case suite fips_cryptodev Chen, Zhaoyan
2019-10-10  5:36   ` Yao, BingX Y
2019-10-08  5:29 ` [dts] [PATCH V1 3/3] add fips_cryptodev config yaobing
2019-10-09  0:50   ` Chen, Zhaoyan
2019-10-10  5:36   ` Yao, BingX Y
2019-10-09  0:51 ` [dts] [PATCH V1 1/3] add fips environment variable Chen, Zhaoyan
2019-10-10  5:36 ` Yao, BingX Y
2019-10-12  5:42 ` 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=1570512569-17999-2-git-send-email-bingx.y.yao@intel.com \
    --to=bingx.y.yao@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).