Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Commit

Permalink
6642 testrunner output can be displayed in the wrong order
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jwk404 authored and ahrens committed Feb 25, 2016
1 parent a6c5c5c commit 412db4e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
10 changes: 6 additions & 4 deletions usr/src/test/test-runner/cmd/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#

#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#

import ConfigParser
Expand Down Expand Up @@ -277,8 +277,10 @@ def log(self, logger, options):
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):
Expand All @@ -291,7 +293,7 @@ def log(self, logger, options):
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)


Expand Down
15 changes: 6 additions & 9 deletions usr/src/test/zfs-tests/cmd/scripts/zfstest.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#

#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
# Copyright 2014, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2016 Nexenta Systems, Inc.
#
Expand All @@ -30,7 +30,7 @@ function fail

function find_disks
{
typeset all_disks=$(echo '' | sudo /usr/sbin/format | awk \
typeset all_disks=$(echo '' | sudo -k /usr/sbin/format | awk \
'/c[0-9]/ {print $2}')
typeset used_disks=$(/sbin/zpool status | awk \
'/c[0-9]*t[0-9a-f]*d[0-9]/ {print $1}' | sed 's/s[0-9]//g')
Expand Down Expand Up @@ -71,19 +71,15 @@ function verify_id
{
[[ $(id -u) = "0" ]] && fail "This script must not be run as root."

sudo -n id >/dev/null 2>&1
sudo -k -n id >/dev/null 2>&1
[[ $? -eq 0 ]] || fail "User must be able to sudo without a password."

typeset -i priv_cnt=$(ppriv $$ | egrep -v \
": basic$| L:| <none>|$$:" | wc -l)
[[ $priv_cnt -ne 0 ]] && fail "User must only have basic privileges."
}

function verify_disks
{
typeset disk
for disk in $DISKS; do
sudo /usr/sbin/prtvtoc /dev/rdsk/${disk}s0 >/dev/null 2>&1
sudo -k /usr/sbin/prtvtoc /dev/rdsk/${disk}s0 >/dev/null 2>&1
[[ $? -eq 0 ]] || return 1
done
return 0
Expand Down Expand Up @@ -135,6 +131,7 @@ export KEEP="^$(echo $KEEP | sed 's/ /$|^/g')\$"
num_disks=$(echo $DISKS | awk '{print NF}')
[[ $num_disks -lt 3 ]] && fail "Not enough disks to run ZFS Test Suite"

$runner $quiet -c $runfile
# Ensure user has only basic privileges.
/usr/bin/ppriv -s EIP=basic -e $runner $quiet -c $runfile

exit $?

0 comments on commit 412db4e

Please sign in to comment.