aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/common/test_utils.py
diff options
context:
space:
mode:
authorSerhiy Pshyk <serhiyx.pshyk@intel.com>2018-10-04 10:21:33 +0100
committerAbhijit Sinha <abhijit.sinha@intel.com>2018-10-27 18:42:17 +0000
commit7c7a14132588f99c6291da9037dc61d0d8ea935a (patch)
tree3720e4b07c3490559b282417e3f1d8b74b5e2a04 /yardstick/tests/unit/common/test_utils.py
parent820b81753dc50ccd8762806f2d5c8398c319c4a0 (diff)
Setup hugepages on SA host(sriov, ovs_dpdk)
JIRA: YARDSTICK-1461 Change-Id: Ia1f5026eee989672aac57775ec9dd182df658fa4 Signed-off-by: Serhiy Pshyk <serhiyx.pshyk@intel.com>
Diffstat (limited to 'yardstick/tests/unit/common/test_utils.py')
-rw-r--r--yardstick/tests/unit/common/test_utils.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/yardstick/tests/unit/common/test_utils.py b/yardstick/tests/unit/common/test_utils.py
index 3cf6c4d05..c0c928916 100644
--- a/yardstick/tests/unit/common/test_utils.py
+++ b/yardstick/tests/unit/common/test_utils.py
@@ -1407,3 +1407,20 @@ class SafeCaseTestCase(unittest.TestCase):
def test_default_value(self):
self.assertEqual(0, utils.safe_cast('', 'int', 0))
+
+
+class SetupHugepagesTestCase(unittest.TestCase):
+
+ @mock.patch.object(six, 'BytesIO', return_value=six.BytesIO(b'5\n'))
+ @mock.patch.object(utils, 'read_meminfo',
+ return_value={'Hugepagesize': '1024'})
+ def test_setup_hugepages(self, mock_meminfo, *args):
+ ssh = mock.Mock()
+ ssh.execute = mock.Mock()
+ hp_size_kb, hp_number, hp_number_set = utils.setup_hugepages(ssh, 10 * 1024)
+ mock_meminfo.assert_called_once_with(ssh)
+ ssh.execute.assert_called_once_with(
+ 'echo 10 | sudo tee /proc/sys/vm/nr_hugepages')
+ self.assertEqual(hp_size_kb, 1024)
+ self.assertEqual(hp_number, 10)
+ self.assertEqual(hp_number_set, 5)