diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-06-22 22:42:59 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-06-23 00:03:59 +0300 |
commit | 436eab9b85d78e36c66afa650059d0ebe5b156c5 (patch) | |
tree | fb16024c55339400d40052d87d171a7b089ed244 /mesonbuild | |
parent | ba4f26f8bfa33885157585c5e71695ae05093e7e (diff) | |
download | meson-436eab9b85d78e36c66afa650059d0ebe5b156c5.zip meson-436eab9b85d78e36c66afa650059d0ebe5b156c5.tar.gz meson-436eab9b85d78e36c66afa650059d0ebe5b156c5.tar.bz2 |
Print full mesonlog on failed tests when run under CI.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers.py | 17 | ||||
-rw-r--r-- | mesonbuild/mlog.py | 2 |
2 files changed, 13 insertions, 6 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 610cfd1..884732f 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -520,7 +520,7 @@ int main () {{ {1}; }}''' commands.append(srcname) commands += extra_args mlog.debug('Running compile:') - mlog.debug('Command line: ', ' '.join(commands)) + mlog.debug('Command line: ', ' '.join(commands), '\n') mlog.debug('Code:\n', code) p = subprocess.Popen(commands, cwd=os.path.split(srcname)[0], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stde, stdo) = p.communicate() @@ -593,7 +593,6 @@ int main () {{ {1}; }}''' def run(self, code, env, extra_args=None): if extra_args is None: extra_args = [] - mlog.debug('Running code:\n\n', code) if self.is_cross and self.exe_wrapper is None: raise CrossNoRunException('Can not run test applications in this cross environment.') (fd, srcname) = tempfile.mkstemp(suffix='.'+self.default_suffix) @@ -612,12 +611,16 @@ int main () {{ {1}; }}''' commands = self.get_exelist() + args commands.append(srcname) commands += self.get_output_args(exename) + mlog.debug('Running code:\n\n', code) + mlog.debug('Command line:', ' '.join(commands)) p = subprocess.Popen(commands, cwd=os.path.split(srcname)[0], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdo, stde) = p.communicate() stde = stde.decode() stdo = stdo.decode() - mlog.debug('Compiler stdout:\n', stdo) - mlog.debug('Compiler stderr:\n', stde) + mlog.debug('Compiler stdout:\n') + mlog.debug(stdo) + mlog.debug('Compiler stderr:\n') + mlog.debug(stde) os.remove(srcname) if p.returncode != 0: return RunResult(False) @@ -634,8 +637,10 @@ int main () {{ {1}; }}''' (so, se) = pe.communicate() so = so.decode() se = se.decode() - mlog.debug('Program stdout:\n', so) - mlog.debug('Program stderr:\n', se) + mlog.debug('Program stdout:\n') + mlog.debug(so) + mlog.debug('Program stderr:\n') + mlog.debug(se) try: os.remove(exename) except PermissionError: diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py index 2807c2b..dab51bd 100644 --- a/mesonbuild/mlog.py +++ b/mesonbuild/mlog.py @@ -71,11 +71,13 @@ def debug(*args, **kwargs): arr = process_markup(args, False) if log_file is not None: print(*arr, file=log_file, **kwargs) # Log file never gets ANSI codes. + log_file.flush() def log(*args, **kwargs): arr = process_markup(args, False) if log_file is not None: print(*arr, file=log_file, **kwargs) # Log file never gets ANSI codes. + log_file.flush() if colorize_console: arr = process_markup(args, True) print(*arr, **kwargs) |