Skip to content

Commit

Permalink
kunit: capture stderr on all make subprocess calls
Browse files Browse the repository at this point in the history
Direct stderr to subprocess.STDOUT so error messages get included in the
subprocess.CalledProcessError exceptions output field. This results in
more meaningful error messages for the user.

This is already being done in the make_allyesconfig method. Do the same
for make_mrproper, make_olddefconfig, and make methods.

With this, failures on unclean trees [1] will give users an error
message that includes:
"The source tree is not clean, please run 'make ARCH=um mrproper'"

[1] https://bugzilla.kernel.org/show_bug.cgi?id=205219

Signed-off-by: Will Chen <chenwi@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Tested-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
Will Chen authored and Shuah Khan committed Jul 17, 2020
1 parent 39f65da commit 5a9fcad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/testing/kunit/kunit_kernel.py
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ class LinuxSourceTreeOperations(object):

def make_mrproper(self):
try:
subprocess.check_output(['make', 'mrproper'])
subprocess.check_output(['make', 'mrproper'], stderr=subprocess.STDOUT)
except OSError as e:
raise ConfigError('Could not call make command: ' + e)
except subprocess.CalledProcessError as e:
@@ -47,7 +47,7 @@ def make_olddefconfig(self, build_dir, make_options):
if build_dir:
command += ['O=' + build_dir]
try:
subprocess.check_output(command, stderr=subprocess.PIPE)
subprocess.check_output(command, stderr=subprocess.STDOUT)
except OSError as e:
raise ConfigError('Could not call make command: ' + e)
except subprocess.CalledProcessError as e:
@@ -77,7 +77,7 @@ def make(self, jobs, build_dir, make_options):
if build_dir:
command += ['O=' + build_dir]
try:
subprocess.check_output(command)
subprocess.check_output(command, stderr=subprocess.STDOUT)
except OSError as e:
raise BuildError('Could not call execute make: ' + e)
except subprocess.CalledProcessError as e:

0 comments on commit 5a9fcad

Please sign in to comment.