8181import attr
8282
8383from integration_testing import config_reader
84+ from integration_testing import test_validation
8485from integration_testing import xcodebuild
8586import utils
8687
145146 " the local spec repos available on this machine. Must also include iOS"
146147 " in platforms flag." )
147148
148- flags .DEFINE_bool (
149- "execute_desktop_testapp" , True ,
150- "(Desktop only) Run the testapp after building it. Will return non-zero"
151- " code if any tests fail inside the testapp." )
152-
153149flags .DEFINE_string (
154150 "compiler" , None ,
155151 "(Desktop only) Specify the compiler with CMake during the testapps build."
@@ -187,6 +183,7 @@ def main(argv):
187183 timestamp = datetime .datetime .now ().strftime ("%Y_%m_%d-%H_%M_%S" )
188184 else :
189185 timestamp = ""
186+ output_dir = os .path .join (output_dir , "testapps" + timestamp )
190187
191188 ios_framework_dir = os .path .join (sdk_dir , "frameworks" )
192189 ios_framework_exist = os .path .isdir (ios_framework_dir )
@@ -218,25 +215,22 @@ def main(argv):
218215 output_dir = output_dir ,
219216 sdk_dir = sdk_dir ,
220217 ios_framework_exist = ios_framework_exist ,
221- timestamp = timestamp ,
222218 root_dir = root_dir ,
223219 ios_sdk = FLAGS .ios_sdk ,
224- cmake_flags = cmake_flags ,
225- execute_desktop_testapp = FLAGS .execute_desktop_testapp )
220+ cmake_flags = cmake_flags )
226221 logging .info ("END building for %s" , testapp )
227222
228- _summarize_results (testapps , platforms , failures )
223+ _summarize_results (testapps , platforms , failures , output_dir )
229224 return 1 if failures else 0
230225
231226
232227def _build (
233228 testapp , platforms , api_config , output_dir , sdk_dir , ios_framework_exist ,
234- timestamp , root_dir , ios_sdk , cmake_flags , execute_desktop_testapp ):
229+ root_dir , ios_sdk , cmake_flags ):
235230 """Builds one testapp on each of the specified platforms."""
236231 testapp_dir = os .path .join (root_dir , api_config .testapp_path )
237232 project_dir = os .path .join (
238- output_dir , "testapps" + timestamp , api_config .full_name ,
239- os .path .basename (testapp_dir ))
233+ output_dir , api_config .full_name , os .path .basename (testapp_dir ))
240234
241235 logging .info ("Copying testapp project to %s" , project_dir )
242236 os .makedirs (project_dir )
@@ -253,8 +247,6 @@ def _build(
253247 logging .info ("BEGIN %s, %s" , testapp , _DESKTOP )
254248 try :
255249 _build_desktop (sdk_dir , cmake_flags )
256- if execute_desktop_testapp :
257- _execute_desktop_testapp (project_dir )
258250 except subprocess .SubprocessError as e :
259251 failures .append (
260252 Failure (testapp = testapp , platform = _DESKTOP , error_message = str (e )))
@@ -291,36 +283,30 @@ def _build(
291283 return failures
292284
293285
294- def _summarize_results (testapps , platforms , failures ):
286+ def _summarize_results (testapps , platforms , failures , output_dir ):
295287 """Logs a readable summary of the results of the build."""
296- logging . info (
297- "FINISHED BUILDING TESTAPPS. \n \n \n "
298- "Tried to build these testapps: %s \n "
299- "On these platforms: %s" ,
300- ", " . join ( testapps ), ", " . join ( platforms ))
288+ summary = []
289+ summary . append ( "BUILD SUMMARY:" )
290+ summary . append ( "TRIED TO BUILD: " + "," . join ( testapps ))
291+ summary . append ( "ON PLATFORMS: " + "," . join ( platforms ))
292+
301293 if not failures :
302- logging . info ( "No failures occurred " )
294+ summary . append ( "ALL BUILDS SUCCEEDED " )
303295 else :
304- # Collect lines, then log once, to reduce logging noise from timestamps etc.
305- lines = ["Some failures occurred:" ]
296+ summary .append ("SOME FAILURES OCCURRED:" )
306297 for i , failure in enumerate (failures , start = 1 ):
307- lines .append ("%d: %s" % (i , failure .describe ()))
308- logging .info ("\n " .join (lines ))
298+ summary .append ("%d: %s" % (i , failure .describe ()))
299+ summary = "\n " .join (summary )
300+
301+ logging .info (summary )
302+ test_validation .write_summary (output_dir , summary )
309303
310304
311305def _build_desktop (sdk_dir , cmake_flags ):
312306 _run (["cmake" , "." , "-DFIREBASE_CPP_SDK_DIR=" + sdk_dir ] + cmake_flags )
313307 _run (["cmake" , "--build" , "." ])
314308
315309
316- def _execute_desktop_testapp (project_dir ):
317- if platform .system () == "Windows" :
318- testapp_path = os .path .join (project_dir , "Debug" , "integration_test.exe" )
319- else :
320- testapp_path = os .path .join (project_dir , "integration_test" )
321- _run ([testapp_path ], timeout = 300 )
322-
323-
324310def _get_desktop_compiler_flags (compiler , compiler_table ):
325311 """Returns the command line flags for this compiler."""
326312 if not compiler : # None is an acceptable default value
@@ -461,14 +447,10 @@ def _build_ios(
461447
462448 podfile_tool_path = os .path .join (
463449 root_dir , "scripts" , "gha" , "integration_testing" , "update_podfile.py" )
464- sdk_podfile_path = os .path .join (
465- root_dir , "ios_pod" , "Podfile" )
466- app_podfile_path = os .path .join (
467- project_dir , "Podfile" )
468450 podfile_patcher_args = [
469451 sys .executable , podfile_tool_path ,
470- "--sdk_podfile" , sdk_podfile_path ,
471- "--app_podfile" , app_podfile_path
452+ "--sdk_podfile" , os . path . join ( root_dir , "ios_pod" , "Podfile" ) ,
453+ "--app_podfile" , os . path . join ( project_dir , "Podfile" )
472454 ]
473455 _run (podfile_patcher_args )
474456 _run (["pod" , "install" ])
0 commit comments