81
81
import attr
82
82
83
83
from integration_testing import config_reader
84
+ from integration_testing import test_validation
84
85
from integration_testing import xcodebuild
85
86
import utils
86
87
145
146
" the local spec repos available on this machine. Must also include iOS"
146
147
" in platforms flag." )
147
148
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
-
153
149
flags .DEFINE_string (
154
150
"compiler" , None ,
155
151
"(Desktop only) Specify the compiler with CMake during the testapps build."
@@ -187,6 +183,7 @@ def main(argv):
187
183
timestamp = datetime .datetime .now ().strftime ("%Y_%m_%d-%H_%M_%S" )
188
184
else :
189
185
timestamp = ""
186
+ output_dir = os .path .join (output_dir , "testapps" + timestamp )
190
187
191
188
ios_framework_dir = os .path .join (sdk_dir , "frameworks" )
192
189
ios_framework_exist = os .path .isdir (ios_framework_dir )
@@ -218,25 +215,22 @@ def main(argv):
218
215
output_dir = output_dir ,
219
216
sdk_dir = sdk_dir ,
220
217
ios_framework_exist = ios_framework_exist ,
221
- timestamp = timestamp ,
222
218
root_dir = root_dir ,
223
219
ios_sdk = FLAGS .ios_sdk ,
224
- cmake_flags = cmake_flags ,
225
- execute_desktop_testapp = FLAGS .execute_desktop_testapp )
220
+ cmake_flags = cmake_flags )
226
221
logging .info ("END building for %s" , testapp )
227
222
228
- _summarize_results (testapps , platforms , failures )
223
+ _summarize_results (testapps , platforms , failures , output_dir )
229
224
return 1 if failures else 0
230
225
231
226
232
227
def _build (
233
228
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 ):
235
230
"""Builds one testapp on each of the specified platforms."""
236
231
testapp_dir = os .path .join (root_dir , api_config .testapp_path )
237
232
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 ))
240
234
241
235
logging .info ("Copying testapp project to %s" , project_dir )
242
236
os .makedirs (project_dir )
@@ -253,8 +247,6 @@ def _build(
253
247
logging .info ("BEGIN %s, %s" , testapp , _DESKTOP )
254
248
try :
255
249
_build_desktop (sdk_dir , cmake_flags )
256
- if execute_desktop_testapp :
257
- _execute_desktop_testapp (project_dir )
258
250
except subprocess .SubprocessError as e :
259
251
failures .append (
260
252
Failure (testapp = testapp , platform = _DESKTOP , error_message = str (e )))
@@ -291,36 +283,30 @@ def _build(
291
283
return failures
292
284
293
285
294
- def _summarize_results (testapps , platforms , failures ):
286
+ def _summarize_results (testapps , platforms , failures , output_dir ):
295
287
"""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
+
301
293
if not failures :
302
- logging . info ( "No failures occurred " )
294
+ summary . append ( "ALL BUILDS SUCCEEDED " )
303
295
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:" )
306
297
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 )
309
303
310
304
311
305
def _build_desktop (sdk_dir , cmake_flags ):
312
306
_run (["cmake" , "." , "-DFIREBASE_CPP_SDK_DIR=" + sdk_dir ] + cmake_flags )
313
307
_run (["cmake" , "--build" , "." ])
314
308
315
309
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
-
324
310
def _get_desktop_compiler_flags (compiler , compiler_table ):
325
311
"""Returns the command line flags for this compiler."""
326
312
if not compiler : # None is an acceptable default value
@@ -461,14 +447,10 @@ def _build_ios(
461
447
462
448
podfile_tool_path = os .path .join (
463
449
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" )
468
450
podfile_patcher_args = [
469
451
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" )
472
454
]
473
455
_run (podfile_patcher_args )
474
456
_run (["pod" , "install" ])
0 commit comments