You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add ExtendedTestBase shared base class for benchmark and functional tests (#3689)
### Summary
Extracts shared test infrastructure from `BenchmarkBase` into a new
`ExtendedTestBase` base class, reducing code duplication between
benchmark and functional tests.
This addresses the reviewer feedback on #3648 about sharing common logic
between `benchmark_base.py` and `functional_base.py`.
### Changes
#### New: `utils/extended_test_base.py`
- Created ExtendedTestBase class with following shared infrastructure:
execute_command(), get_gpu_architecture(), detect_gpu_count(),
create_test_result(), calculate_statistics(), upload_results()
#### Updated: `benchmark/scripts/benchmark_base.py`
- BenchmarkBase now inherits from ExtendedTestBase
- Removed duplicated methods: execute_command, _detect_gpu_count,
calculate_statistics, upload_results
#### Updated: `benchmark/scripts/test_rccl_benchmark.py`
- self._detect_gpu_count() → self.detect_gpu_count() (now inherited from
base)
#### Updated: `utils/__init__.py`, `README.md`, `utils/README.md`
- Added ExtendedTestBase to exports and documentation
#### Inheritance Hierarchy
```
ExtendedTestBase (utils/extended_test_base.py)
├── BenchmarkBase (benchmark/scripts/benchmark_base.py)
│ ├── ROCfftBenchmark, RCCLBenchmark, ROCblasBenchmark, ...
└── FunctionalBase (functional/scripts/functional_base.py) ← will inherit in follow-up PR
├── MIOpenDriverConv, RcclTestInfra, ...
```
#### Follow-up
- Update FunctionalBase to inherit from ExtendedTestBase (after this PR
merges)
---------
Signed-off-by: Lenine Ajagappane <Lenine.Ajagappane@amd.com>
Copy file name to clipboardExpand all lines: tests/extended_tests/utils/README.md
+24-5Lines changed: 24 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,8 @@ Utility modules organized into logical subdirectories for maintainability and sc
7
7
```
8
8
extended_tests/utils/
9
9
├── __init__.py # Public exports
10
-
├── extended_test_client.py # Main ExtendedTestClient API
10
+
├── extended_test_base.py # ExtendedTestBase - shared base class for all tests
11
+
├── extended_test_client.py # ExtendedTestClient - system detection & result reporting
11
12
├── constants.py # Framework constants
12
13
├── exceptions.py # Custom exceptions
13
14
├── logger.py # Logging configuration
@@ -36,12 +37,28 @@ extended_tests/utils/
36
37
37
38
## Usage
38
39
39
-
### From Benchmark Scripts
40
+
### From Extended Test Base Classes
40
41
41
-
Benchmark scripts add `extended_tests/` to `sys.path`, then import:
42
+
Both `BenchmarkBase` and `FunctionalBase` inherit from `ExtendedTestBase`, which provides
43
+
shared infrastructure (command execution, GPU detection, result creation, statistics, uploads):
42
44
43
45
```python
44
-
# Import path setup (already done in benchmark_base.py)
46
+
# In benchmark_base.py / functional_base.py
47
+
from utils.extended_test_base import ExtendedTestBase
48
+
49
+
50
+
classBenchmarkBase(ExtendedTestBase): ...
51
+
52
+
53
+
classFunctionalBase(ExtendedTestBase): ...
54
+
```
55
+
56
+
### From Test Scripts
57
+
58
+
Test scripts add `extended_tests/` to `sys.path`, then import:
59
+
60
+
```python
61
+
# Import path setup (already done in base classes)
45
62
sys.path.insert(
46
63
0, str(Path(__file__).resolve().parents[2])
47
64
) # Adds extended_tests/ to path
@@ -52,6 +69,7 @@ from utils.constants import Constants
52
69
from utils.exceptions import ConfigurationError
53
70
54
71
# Main API classes
72
+
from utils.extended_test_base import ExtendedTestBase
55
73
from utils.extended_test_client import ExtendedTestClient
56
74
from utils.system.system_detector import SystemDetector
57
75
from utils.config.config_helper import ConfigHelper
@@ -80,10 +98,11 @@ from utils.results import ResultsHandler, ResultsAPI
80
98
81
99
### Root Level
82
100
101
+
-**extended_test_base.py** - `ExtendedTestBase` shared base class for benchmark and functional tests (command execution, GPU detection, test result creation, statistics, result uploads)
102
+
-**extended_test_client.py** - `ExtendedTestClient` API for system detection and result reporting
83
103
-**constants.py** - Framework constants and defaults
84
104
-**exceptions.py** - Custom exception classes
85
105
-**logger.py** - Logging configuration
86
-
-**extended_test_client.py** - Main ExtendedTestClient API
0 commit comments