import unittest import logging import subprocess import json from pathlib import Path class ClusterBenchTestCase(unittest.TestCase): logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') def setUp(self) -> None: # pylint: disable=useless-parent-delegation return super().setUp() def test_clusterbench_submit(self): logging.info('test_clusterbench_submit') subprocess.run('pip list', shell=True, check=True, executable='/bin/bash') results_dir = Path('/tmp/mamul1_out') config = { 'compiler_id': 'gfortran', 'matrix_size': 1024, 'num_loops': 10, } resultsdb_params = { 'type': 'tsv-files', 'tsv_results_dir': f'{results_dir / "results"}' } command = f'clusterbench-submit --cluster-id \'dummy\' --arch-regexp "intel_core.*" --benchmark-id \'mamul1\' --config \'{json.dumps(config)}\' --results-dir {results_dir} --resultsdb-params \'{json.dumps(resultsdb_params)}\'' subprocess.run(command, shell=True, check=True, executable='/bin/bash') def test_clusterbench_hibench(self): logging.info('test_clusterbench_hibench') results_dir = Path('/tmp/hibench_out') config = { 'compiler_id': 'gfortran', 'test_id': 'arch4_quick', 'hibridon_version': 'a3bed1c3ccfbca572003020d3e3d3b1ff3934fad', 'cmake_path': 'cmake', } resultsdb_params = { 'type': 'tsv-files', 'tsv_results_dir': f'{results_dir / "results"}' } command = f'clusterbench-submit --cluster-id \'dummy\' --benchmark-id \'hibench\' --config \'{json.dumps(config)}\' --results-dir {results_dir} --resultsdb-params \'{json.dumps(resultsdb_params)}\'' subprocess.run(command, shell=True, check=True, executable='/bin/bash') if __name__ == '__main__': unittest.main()