diff --git a/packager/app/test/packager_app.py b/packager/app/test/packager_app.py index 60c92c549f..58381fc2aa 100644 --- a/packager/app/test/packager_app.py +++ b/packager/app/test/packager_app.py @@ -22,6 +22,9 @@ class PackagerApp(object): if platform.system() == 'Windows': packager_name += '.exe' self.binary = os.path.join(test_env.SCRIPT_DIR, packager_name) + # Set this to empty for now in case GetCommandLine() is called before + # Package(). + self.packaging_command_line = '' assert os.path.exists(self.binary), ('Please run from output directory, ' 'e.g. out/Debug/packager_test.py') @@ -39,4 +42,10 @@ class PackagerApp(object): cmd = [self.binary] cmd.extend(streams) cmd.extend(flags) + # Put single-quotes around each entry so that things like '$' signs in + # segment templates won't be interpreted as shell variables. + self.packaging_command_line = ' '.join(["'%s'" % entry for entry in cmd]) assert 0 == subprocess.call(cmd) + + def GetCommandLine(self): + return self.packaging_command_line diff --git a/packager/app/test/packager_test.py b/packager/app/test/packager_test.py index 71f5441554..3164c1c576 100755 --- a/packager/app/test/packager_test.py +++ b/packager/app/test/packager_test.py @@ -19,6 +19,14 @@ import unittest import packager_app import test_env +_TEST_FAILURE_COMMAND_LINE_MESSAGE = """ +!!! To reproduce the failure, change the output files to an !!! +!!! existing directory, e.g. output artifacts to current !!! +!!! directory by removing /tmp/something/ in the following !!! +!!! command line. !!! +The test executed the following command line: +""" + class PackagerAppTest(unittest.TestCase): @@ -658,7 +666,11 @@ class PackagerAppTest(unittest.TestCase): stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, error = p.communicate() - self.fail(output + error) + command_line = self.packager.GetCommandLine() + failure_message = (output + error + '\n' + + _TEST_FAILURE_COMMAND_LINE_MESSAGE + + command_line) + self.fail(failure_message) # '*.media_info' outputs contain media file names, which is changing for # every test run. These needs to be replaced for comparison.