@@ -89,6 +89,29 @@ def is_option_enabled(option: str, fail_if_not_enabled: bool = False) -> bool:
89
89
return False
90
90
91
91
92
+ def maybe_get_tosa_collate_path () -> str | None :
93
+ """
94
+ Checks the environment variable TOSA_TESTCASES_BASE_PATH and returns the
95
+ path to the where to store the current tests if it is set.
96
+ """
97
+ tosa_test_base = os .environ .get ("TOSA_TESTCASES_BASE_PATH" )
98
+ if tosa_test_base :
99
+ current_test = os .environ .get ("PYTEST_CURRENT_TEST" )
100
+ #'backends/arm/test/ops/test_mean_dim.py::TestMeanDim::test_meandim_tosa_BI_0_zeros (call)'
101
+ test_class = current_test .split ("::" )[1 ]
102
+ test_name = current_test .split ("::" )[- 1 ].split (" " )[0 ]
103
+ if "BI" in test_name :
104
+ tosa_test_base = os .path .join (tosa_test_base , "tosa-bi" )
105
+ elif "MI" in test_name :
106
+ tosa_test_base = os .path .join (tosa_test_base , "tosa-mi" )
107
+ else :
108
+ tosa_test_base = os .path .join (tosa_test_base , "other" )
109
+
110
+ return os .path .join (tosa_test_base , test_class , test_name )
111
+
112
+ return None
113
+
114
+
92
115
def get_tosa_compile_spec (
93
116
permute_memory_to_nhwc = True , custom_path = None
94
117
) -> list [CompileSpec ]:
@@ -104,7 +127,13 @@ def get_tosa_compile_spec_unbuilt(
104
127
"""Get the ArmCompileSpecBuilder for the default TOSA tests, to modify
105
128
the compile spec before calling .build() to finalize it.
106
129
"""
107
- intermediate_path = custom_path or tempfile .mkdtemp (prefix = "arm_tosa_" )
130
+ if not custom_path :
131
+ intermediate_path = maybe_get_tosa_collate_path () or tempfile .mkdtemp (
132
+ prefix = "arm_tosa_"
133
+ )
134
+ else :
135
+ intermediate_path = custom_path
136
+
108
137
if not os .path .exists (intermediate_path ):
109
138
os .makedirs (intermediate_path , exist_ok = True )
110
139
compile_spec_builder = (
0 commit comments