# Path: hardware/benchmark/mem.py
# def get_available_memory():
# def check_mem_size(block_size, cpu_count):
# def run_sysbench_memory_threaded(hw_lst, max_time, block_size, cpu_count,
#                                  processor_num=None):
# def run_sysbench_memory_forked(hw_lst, max_time, block_size, cpu_count):
# def mem_perf(hw_lst, max_time=5):
# 
# Path: hardware/benchmark/utils.py
# def get_value(hw_lst, level1, level2, level3):
# def get_one_cpu_per_socket(hw_lst):


import subprocess
import unittest
from unittest import mock
from hardware.benchmark import mem
from hardware.benchmark import utils
        mock_get_memory.return_value = 123456789012
        mock_popen.return_value = mock.Mock(
            stdout=SYSBENCH_OUTPUT.encode().splitlines())
        mock_cpu_socket.return_value = range(2)
        mem.mem_perf(self.hw_data)

        expected = EXPECTED_RESULT
        self.assertEqual(sorted(expected), sorted(self.hw_data))

    def test_check_mem_size(self, mock_popen, mock_cpu_socket,
                            mock_get_memory):
        block_size_list = ('1K', '4K', '1M', '16M', '128M', '1G', '2G')

        mock_get_memory.return_value = 123456789012
        for block_size in block_size_list:
            self.assertTrue(mem.check_mem_size(block_size, 2))

        # Low memory
        mock_get_memory.return_value = 1
        for block_size in block_size_list:
            self.assertFalse(mem.check_mem_size(block_size, 2))

    def test_run_sysbench_memory_forked_bytes(self, mock_popen,
                                              mock_cpu_socket,
                                              mock_get_memory):
        mock_get_memory.return_value = 123456789012
        mock_popen.return_value = mock.Mock(
            stdout=SYSBENCH_OUTPUT.encode().splitlines())

        hw_data = []

# Path: hardware/benchmark/mem.py
# def get_available_memory():
# def check_mem_size(block_size, cpu_count):
# def run_sysbench_memory_threaded(hw_lst, max_time, block_size, cpu_count,
#                                  processor_num=None):
# def run_sysbench_memory_forked(hw_lst, max_time, block_size, cpu_count):
# def mem_perf(hw_lst, max_time=5):
# 
# Path: hardware/benchmark/utils.py
# def get_value(hw_lst, level1, level2, level3):
# def get_one_cpu_per_socket(hw_lst):


# Path: hardware/tests/test_benchmark_mem.py
import subprocess
import unittest
from unittest import mock
from hardware.benchmark import mem
from hardware.benchmark import utils

        mock_get_memory.return_value = 123456789012
        mock_popen.return_value = mock.Mock(
            stdout=SYSBENCH_OUTPUT.encode().splitlines())
        mock_cpu_socket.return_value = range(2)
        mem.mem_perf(self.hw_data)

        expected = EXPECTED_RESULT
        self.assertEqual(sorted(expected), sorted(self.hw_data))

    def test_check_mem_size(self, mock_popen, mock_cpu_socket,
                            mock_get_memory):
        block_size_list = ('1K', '4K', '1M', '16M', '128M', '1G', '2G')

        mock_get_memory.return_value = 123456789012
        for block_size in block_size_list:
            self.assertTrue(mem.check_mem_size(block_size, 2))

        # Low memory
        mock_get_memory.return_value = 1
        for block_size in block_size_list:
            self.assertFalse(mem.check_mem_size(block_size, 2))

    def test_run_sysbench_memory_forked_bytes(self, mock_popen,
                                              mock_cpu_socket,
                                              mock_get_memory):
        mock_get_memory.return_value = 123456789012
        mock_popen.return_value = mock.Mock(
            stdout=SYSBENCH_OUTPUT.encode().splitlines())

        hw_data = []

        mem.run_sysbench_memory_forked(hw_data, 10, '1K', 2)