@@ -424,7 +424,10 @@ def _check_output(self, *args, **kwargs):
424
424
if 'cwd' in kwargs :
425
425
logger .info (' (In %s)' % kwargs ['cwd' ])
426
426
output = subprocess .check_output (* args , ** kwargs )
427
- sys .stdout .write (output )
427
+ if kwargs .get ('universal_newlines' , False ):
428
+ sys .stdout .write (output )
429
+ else :
430
+ sys .stdout .buffer .write (output )
428
431
return output
429
432
430
433
def _clean (self , path ):
@@ -652,7 +655,8 @@ def _get_lnt_code(self, code):
652
655
def _extract_cmake_vars_from_cache (self ):
653
656
assert self .configured is True
654
657
cmake_lah_output = self ._check_output (
655
- [self .opts .cmake ] + ['-LAH' , '-N' ] + [self ._base_path ])
658
+ [self .opts .cmake ] + ['-LAH' , '-N' ] + [self ._base_path ],
659
+ universal_newlines = True )
656
660
pattern2var = [
657
661
(re .compile ("^%s:[^=]*=(.*)$" % cmakevar ), cmakevar )
658
662
for cmakevar in (
@@ -875,13 +879,14 @@ def diagnose(self):
875
879
876
880
logger .info (' ' .join (cmd_temps ))
877
881
878
- out = subprocess .check_output (cmd_temps )
882
+ out = subprocess .check_output (cmd_temps , universal_newlines = True )
879
883
logger .info (out )
880
884
881
885
# Figure out our test's target.
882
886
make_cmd = [self .opts .make , "VERBOSE=1" , 'help' ]
883
887
884
- make_targets = subprocess .check_output (make_cmd )
888
+ make_targets = subprocess .check_output (make_cmd ,
889
+ universal_newlines = True )
885
890
matcher = re .compile (r"^\.\.\.\s{}$" .format (short_name ),
886
891
re .MULTILINE | re .IGNORECASE )
887
892
if not matcher .search (make_targets ):
@@ -894,15 +899,17 @@ def diagnose(self):
894
899
logger .info (" " .join (make_deps ))
895
900
p = subprocess .Popen (make_deps ,
896
901
stdout = subprocess .PIPE ,
897
- stderr = subprocess .STDOUT )
902
+ stderr = subprocess .STDOUT ,
903
+ universal_newlines = True )
898
904
std_out , std_err = p .communicate ()
899
905
logger .info (std_out )
900
906
901
907
make_save_temps = [self .opts .make , "VERBOSE=1" , short_name ]
902
908
logger .info (" " .join (make_save_temps ))
903
909
p = subprocess .Popen (make_save_temps ,
904
910
stdout = subprocess .PIPE ,
905
- stderr = subprocess .STDOUT )
911
+ stderr = subprocess .STDOUT ,
912
+ universal_newlines = True )
906
913
std_out , std_err = p .communicate ()
907
914
logger .info (std_out )
908
915
with open (report_path + "/build.log" , 'w' ) as f :
@@ -926,13 +933,14 @@ def diagnose(self):
926
933
927
934
logger .info (' ' .join (cmd_time_report ))
928
935
929
- out = subprocess .check_output (cmd_time_report )
936
+ out = subprocess .check_output (cmd_time_report , universal_newlines = True )
930
937
logger .info (out )
931
938
932
939
make_time_report = [self .opts .make , "VERBOSE=1" , short_name ]
933
940
p = subprocess .Popen (make_time_report ,
934
941
stdout = subprocess .PIPE ,
935
- stderr = subprocess .PIPE )
942
+ stderr = subprocess .PIPE ,
943
+ universal_newlines = True )
936
944
std_out , std_err = p .communicate ()
937
945
938
946
with open (report_path + "/time-report.txt" , 'w' ) as f :
@@ -944,13 +952,15 @@ def diagnose(self):
944
952
945
953
logger .info (' ' .join (cmd_stats_report ))
946
954
947
- out = subprocess .check_output (cmd_stats_report )
955
+ out = subprocess .check_output (cmd_stats_report ,
956
+ universal_newlines = True )
948
957
logger .info (out )
949
958
950
959
make_stats_report = [self .opts .make , "VERBOSE=1" , short_name ]
951
960
p = subprocess .Popen (make_stats_report ,
952
961
stdout = subprocess .PIPE ,
953
- stderr = subprocess .PIPE )
962
+ stderr = subprocess .PIPE ,
963
+ universal_newlines = True )
954
964
std_out , std_err = p .communicate ()
955
965
956
966
with open (report_path + "/stats-report.txt" , 'w' ) as f :
@@ -974,19 +984,20 @@ def diagnose(self):
974
984
cmd_iprofiler = cmd + ['-DTEST_SUITE_RUN_UNDER=' + iprofiler ]
975
985
print (' ' .join (cmd_iprofiler ))
976
986
977
- out = subprocess .check_output (cmd_iprofiler )
987
+ subprocess .check_output (cmd_iprofiler , universal_newlines = True )
978
988
979
989
os .chdir (local_path )
980
990
make_iprofiler_temps = [self .opts .make , "VERBOSE=1" , short_name ]
981
991
p = subprocess .Popen (make_iprofiler_temps ,
982
992
stdout = subprocess .PIPE ,
983
993
stderr = subprocess .PIPE )
984
- std_out , std_err = p .communicate ()
994
+ p .communicate ()
985
995
logger .warning ("Using sudo to collect execution trace." )
986
996
make_save_temps = sudo + [self .opts .lit , short_name + ".test" ]
987
997
p = subprocess .Popen (make_save_temps ,
988
998
stdout = subprocess .PIPE ,
989
- stderr = subprocess .PIPE )
999
+ stderr = subprocess .PIPE ,
1000
+ universal_newlines = True )
990
1001
std_out , std_err = p .communicate ()
991
1002
sys .stdout .write (std_out )
992
1003
sys .stderr .write (std_err )
0 commit comments