OpenZFS 6642 - testrunner output can be displayed in the wrong order

6643 zfstest should enforce the required privileges before running.
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Jonathan Mackenzie <jonathan.mackenzie@delphix.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov

OpenZFS-issue: https://www.illumos.org/issues/6642
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/412db4e
Closes #5777

Porting notes:
- The 6643 changes were dropped a different version of this script
  is used to configure the environment under Linux.
This commit is contained in:
John Wren Kennedy 2016-02-24 21:13:41 -08:00 committed by Brian Behlendorf
parent d6df043c53
commit 717afc1326
1 changed files with 6 additions and 4 deletions

View File

@ -12,7 +12,7 @@
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#
import ConfigParser
@ -272,8 +272,10 @@ class Cmd(object):
else:
logger.debug('%s%s%s' % (msga, pad, msgb))
lines = self.result.stdout + self.result.stderr
for dt, line in sorted(lines):
lines = sorted(self.result.stdout + self.result.stderr,
cmp=lambda x, y: cmp(x[0], y[0]))
for dt, line in lines:
logger.debug('%s %s' % (dt.strftime("%H:%M:%S.%f ")[:11], line))
if len(self.result.stdout):
@ -286,7 +288,7 @@ class Cmd(object):
os.write(err.fileno(), '%s\n' % line)
if len(self.result.stdout) and len(self.result.stderr):
with open(os.path.join(self.outputdir, 'merged'), 'w') as merged:
for _, line in sorted(lines):
for _, line in lines:
os.write(merged.fileno(), '%s\n' % line)