145145 lit_config .fatal (f"Could not identify flang executable" )
146146
147147# Intrinsic paths that are added implicitly by the `flang` driver, but have to be added manually when invoking the frontend `flang -fc1`.
148- intrinsics_search_args = []
148+ flang_driver_search_args = []
149149
150150# Intrinsic paths that are added to `flang` as well as `flang -fc1`.
151- extra_intrinsics_search_args = list (config .flang_test_fortran_flags )
151+ flang_extra_search_args = list (config .flang_test_fortran_flags )
152152
153153
154154def get_resource_module_intrinsic_dir (modfile ):
155155 # Determine the intrinsic module search path that is added by the driver. If
156156 # skipping the driver using -fc1, we need to append the path manually.
157- flang_intrinsics_dir = subprocess .check_output ([flang_exe , * config .flang_test_fortran_flags , f"-print-file-name={ modfile } " ], text = True ).strip ()
157+ flang_intrinsics_dir = subprocess .check_output (
158+ [flang_exe , * config .flang_test_fortran_flags , f"-print-file-name={ modfile } " ],
159+ text = True ,
160+ ).strip ()
158161 flang_intrinsics_dir = os .path .dirname (flang_intrinsics_dir )
159162 return flang_intrinsics_dir or None
160163
164+
161165intrinsics_mod_path = get_resource_module_intrinsic_dir ("__fortran_builtins.mod" )
162166if intrinsics_mod_path :
163- intrinsics_search_args += [f"-fintrinsic-modules-path={ intrinsics_mod_path } " ]
167+ flang_driver_search_args += [f"-fintrinsic-modules-path={ intrinsics_mod_path } " ]
164168
165169openmp_mod_path = get_resource_module_intrinsic_dir ("omp_lib.mod" )
166170if openmp_mod_path and openmp_mod_path != intrinsics_mod_path :
167- intrinsics_search_args += [f"-fintrinsic-modules-path={ openmp_mod_path } " ]
171+ flang_driver_search_args += [f"-fintrinsic-modules-path={ openmp_mod_path } " ]
168172
169173
170174# If intrinsic modules are not available, disable tests unless they are marked as 'module-independent'.
171175config .available_features .add ("module-independent" )
172176if config .flang_test_enable_modules or intrinsics_mod_path :
173177 config .available_features .add ("flangrt-modules" )
174178else :
175- lit_config .warning (f"Intrinsic modules not in driver default paths: disabling most tests; Use FLANG_TEST_ENABLE_MODULES=ON to force-enable" )
179+ lit_config .warning (
180+ f"Intrinsic modules not in driver default paths: disabling most tests; Use FLANG_TEST_ENABLE_MODULES=ON to force-enable"
181+ )
176182 config .limit_to_features .add ("module-independent" )
177183
178184# Determine if OpenMP runtime was built (enable OpenMP tests via REQUIRES in test file)
@@ -181,34 +187,41 @@ def get_resource_module_intrinsic_dir(modfile):
181187
182188 # Search path for omp_lib.h with LLVM_ENABLE_RUNTIMES=openmp
183189 # FIXME: openmp should write this file into the resource directory
184- extra_intrinsics_search_args += ["-I" , f"{ config .flang_obj_root } /../../runtimes/runtimes-bins/openmp/runtime/src" ]
190+ flang_extra_search_args += [
191+ "-I" ,
192+ f"{ config .flang_obj_root } /../../runtimes/runtimes-bins/openmp/runtime/src" ,
193+ ]
185194else :
186- lit_config .warning (f"OpenMP modules found not in driver default paths: OpenMP tests disabled; Use FLANG_TEST_ENABLE_OPENMP=ON to force-enable" )
195+ lit_config .warning (
196+ f"OpenMP modules found not in driver default paths: OpenMP tests disabled; Use FLANG_TEST_ENABLE_OPENMP=ON to force-enable"
197+ )
187198
188199
189200lit_config .note (f"using flang: { flang_exe } " )
190- lit_config .note (f"using flang implicit search paths: { ' ' .join (intrinsics_search_args )} " )
191- lit_config .note (f"using flang extra search paths: { ' ' .join (extra_intrinsics_search_args )} " )
201+ lit_config .note (
202+ f"using flang implicit search paths: { ' ' .join (flang_driver_search_args )} "
203+ )
204+ lit_config .note (f"using flang extra search paths: { ' ' .join (flang_extra_search_args )} " )
192205
193206# For each occurrence of a flang tool name, replace it with the full path to
194207# the build directory holding that tool.
195208tools = [
196209 ToolSubst (
197210 "bbc" ,
198211 command = FindTool ("bbc" ),
199- extra_args = intrinsics_search_args + extra_intrinsics_search_args ,
212+ extra_args = flang_driver_search_args + flang_extra_search_args ,
200213 unresolved = "fatal" ,
201214 ),
202215 ToolSubst (
203216 "%flang" ,
204217 command = flang_exe ,
205- extra_args = extra_intrinsics_search_args ,
218+ extra_args = flang_extra_search_args ,
206219 unresolved = "fatal" ,
207220 ),
208221 ToolSubst (
209222 "%flang_fc1" ,
210223 command = flang_exe ,
211- extra_args = ["-fc1" ] + intrinsics_search_args + extra_intrinsics_search_args ,
224+ extra_args = ["-fc1" ] + flang_driver_search_args + flang_extra_search_args ,
212225 unresolved = "fatal" ,
213226 ),
214227 # Variant that does not implicitly add intrinsic search paths
0 commit comments