mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 07:04:17 +00:00 
			
		
		
		
	tests: moved out of wa package
Tests now reside in the root of the repo, rather than in wa package. This means they will no longer packaged and installed in user deployments (they're only useful for developers).
This commit is contained in:
		
							
								
								
									
										50
									
								
								tests/test_runtime_param_utils.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								tests/test_runtime_param_utils.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| import unittest | ||||
| from nose.tools import assert_equal | ||||
| from mock.mock import Mock | ||||
|  | ||||
| from wa.utils.misc import resolve_cpus, resolve_unique_domain_cpus | ||||
|  | ||||
| class TestRuntimeParameterUtils(unittest.TestCase): | ||||
|  | ||||
|     def test_resolve_cpu(self): | ||||
|         # Set up a mock target | ||||
|         mock = Mock() | ||||
|         mock.big_core = "A72" | ||||
|         mock.little_core = "A53" | ||||
|         mock.core_names = ['A72', 'A72', 'A53', 'A53'] | ||||
|         mock.number_of_cpus = 4 | ||||
|         def mock_core_cpus(core): | ||||
|             return [i for i, c in enumerate(mock.core_names) if c == core] | ||||
|         def mock_online_cpus(): | ||||
|             return [0, 1, 2] | ||||
|         def mock_offline_cpus(): | ||||
|             return [3] | ||||
|         def mock_domain_cpus(core): | ||||
|             if core in [0, 1]: | ||||
|                 return [0, 1] | ||||
|             elif core in [2, 3]: | ||||
|                 return [2, 3] | ||||
|  | ||||
|         mock.list_online_cpus = mock_online_cpus | ||||
|         mock.list_offline_cpus = mock_offline_cpus | ||||
|         mock.core_cpus = mock_core_cpus | ||||
|         mock.core_cpus = mock_core_cpus | ||||
|         mock.cpufreq.get_domain_cpus = mock_domain_cpus | ||||
|  | ||||
|         # Check retrieving cpus from a given prefix | ||||
|         assert_equal(resolve_cpus('A72', mock), [0, 1]) | ||||
|         assert_equal(resolve_cpus('A53', mock), [2, 3]) | ||||
|         assert_equal(resolve_cpus('big', mock), [0, 1]) | ||||
|         assert_equal(resolve_cpus('little', mock), [2, 3]) | ||||
|         assert_equal(resolve_cpus('', mock), [0, 1, 2, 3]) | ||||
|         assert_equal(resolve_cpus('cpu0', mock), [0]) | ||||
|         assert_equal(resolve_cpus('cpu3', mock), [3]) | ||||
|  | ||||
|         # Check get unique domain cpus | ||||
|         assert_equal(resolve_unique_domain_cpus('A72', mock), [0]) | ||||
|         assert_equal(resolve_unique_domain_cpus('A53', mock), [2]) | ||||
|         assert_equal(resolve_unique_domain_cpus('big', mock), [0]) | ||||
|         assert_equal(resolve_unique_domain_cpus('little', mock), [2]) | ||||
|         assert_equal(resolve_unique_domain_cpus('', mock), [0, 2]) | ||||
|         assert_equal(resolve_unique_domain_cpus('cpu0', mock), [0]) | ||||
|         assert_equal(resolve_unique_domain_cpus('cpu3', mock), [2]) | ||||
		Reference in New Issue
	
	Block a user