diff --git a/microsoft/testsuites/sysbench/sysbenchperf.py b/microsoft/testsuites/sysbench/sysbenchperf.py new file mode 100644 index 0000000000..0ce8cbfdd6 --- /dev/null +++ b/microsoft/testsuites/sysbench/sysbenchperf.py @@ -0,0 +1,100 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +from pathlib import Path +from typing import Any, Dict, List +from lisa import ( + Environment, + Logger, + Node, + TestCaseMetadata, + TestSuite, + TestSuiteMetadata, +) +from lisa.testsuite import TestResult +from lisa.tools import Sysbench + + +@TestSuiteMetadata( + area="sysbench", + category="performance", + description=""" + This test suite is for executing the sysbench tests + """, +) +class SysbenchTestSuite(TestSuite): + @TestCaseMetadata( + description=""" + Runs Sysbench test for cpu + """, + priority=3, + ) + def perf_sysbench_cpu( + self, + log: Logger, + node: Node, + environment: Environment, + log_path: Path, + result: TestResult, + variables: Dict[str, Any], + ) -> None: + node.tools[Sysbench].run_cpu_perf( + test_result=result, + ) + + @TestCaseMetadata( + description=""" + Runs Sysbench test for fileio + """, + priority=3, + ) + def perf_sysbench_fileio( + self, + log: Logger, + node: Node, + environment: Environment, + log_path: Path, + result: TestResult, + variables: Dict[str, Any], + ) -> None: + io_ops = [ + "seqwr", + "seqrd", + "rndrd", + "rndwr", + "seqrewr", + "rndrw", + ] + sysbench = node.tools[Sysbench] + for mode in io_ops: + sysbench.run_fileio_perf( + test_result=result, + operation=mode, + total_file=1, + ) + + @TestCaseMetadata( + description=""" + Runs Sysbench test for memory + """, + priority=3, + ) + def perf_sysbench_memory( + self, + log: Logger, + node: Node, + environment: Environment, + log_path: Path, + result: TestResult, + variables: Dict[str, Any], + ) -> None: + memory_operation: List[str] = ["read", "write"] + memory_access_mode: List[str] = ["seq", "rnd"] + sysbench = node.tools[Sysbench] + + for op in memory_operation: + for access_mode in memory_access_mode: + sysbench.run_memory_perf( + test_result=result, + memory_access_mode=access_mode, + memory_oper=op, + )