validate:launcher: Enhance command printing when using a server

So it can be copy pasted and work
This commit is contained in:
Thibault Saunier 2017-06-20 10:43:54 -04:00
parent 82dd230ef1
commit 2f35acf558

View file

@ -123,14 +123,10 @@ class Test(Loggable):
string += ": " + self.result string += ": " + self.result
if self.result in [Result.FAILED, Result.TIMEOUT]: if self.result in [Result.FAILED, Result.TIMEOUT]:
string += " '%s'\n" \ string += " '%s'\n" \
" You can reproduce with: %s %s\n" \ " You can reproduce with: %s\n" \
% (self.message, self._env_variable, ' '.join(self.command)) % (self.message, self.get_command_repr())
if not self.options.redirect_logs: string += self.get_logfile_repr()
string += " You can find logs in:\n" \
" - %s" % (self.logfile)
for log in self.extra_logfiles:
string += "\n - %s" % log
return string return string
@ -418,13 +414,24 @@ class Test(Loggable):
return None return None
def get_logfile_repr(self): def get_logfile_repr(self):
message = " Logs:\n" \ message = " Logs:\n"
" - %s" % (self.logfile) logfiles = self.extra_logfiles.copy()
for log in self.extra_logfiles:
if not self.options.redirect_logs:
logfiles.insert(0, self.logfile)
for log in logfiles:
message += "\n - %s" % log message += "\n - %s" % log
return message return message
def get_command_repr(self):
message = "%s %s" % (self._env_variable, ' '.join(self.command))
if self.server_command:
message = "%s & %s" % (self.server_command, message)
return "'%s'" % message
def test_start(self, queue): def test_start(self, queue):
self.open_logfile() self.open_logfile()
@ -446,11 +453,8 @@ class Test(Loggable):
self.command = self.use_valgrind(self.command, self.proc_env) self.command = self.use_valgrind(self.command, self.proc_env)
message = "Launching: %s%s\n" \ message = "Launching: %s%s\n" \
" Command: '%s & %s %s'\n" % ( " Command: %s\n" % (Colors.ENDC, self.classname,
Colors.ENDC, self.classname, self.server_command, self.get_command_repr())
self._env_variable, ' '.join(self.command))
if self.server_command:
message += " Server command: %s\n" % self.server_command
if not self.options.redirect_logs: if not self.options.redirect_logs:
message += self.get_logfile_repr() message += self.get_logfile_repr()