diff options
author | John Wren Kennedy <john.kennedy@delphix.com> | 2016-08-30 12:01:41 -0700 |
---|---|---|
committer | Matthew Ahrens <mahrens@delphix.com> | 2016-09-01 10:51:04 -0700 |
commit | f9a78bf4570eca58ad5e93f377573c9a390420c0 (patch) | |
tree | e31ef981fd5ab65c661bd99bcd798f76b65c226e | |
parent | 2ad25b4055c18f39b3fb20bd5c8c61057e34f377 (diff) | |
download | illumos-joyent-f9a78bf4570eca58ad5e93f377573c9a390420c0.tar.gz |
7248 large block support breaks rsend_009_pos
7249 rsend_015_pos produces false failures due to race
7250 testrunner can miss options specific to individual tests in runfiles
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
-rw-r--r-- | usr/src/test/test-runner/cmd/run.py | 74 | ||||
-rw-r--r-- | usr/src/test/zfs-tests/tests/functional/rsend/rsend_009_pos.ksh | 8 |
2 files changed, 37 insertions, 45 deletions
diff --git a/usr/src/test/test-runner/cmd/run.py b/usr/src/test/test-runner/cmd/run.py index 65a04a2413..81e53b210f 100644 --- a/usr/src/test/test-runner/cmd/run.py +++ b/usr/src/test/test-runner/cmd/run.py @@ -28,7 +28,6 @@ from subprocess import PIPE from subprocess import Popen from sys import argv from sys import maxint -from sys import exit from threading import Timer from time import time @@ -150,12 +149,12 @@ class Cmd(object): self.killed = False self.result = Result() - if self.timeout == None: + if self.timeout is None: self.timeout = 60 def __str__(self): - return "Pathname: %s\nOutputdir: %s\nTimeout: %d\nUser: %s\n" % ( - self.pathname, self.outputdir, self.timeout, self.user) + return "Pathname: %s\nOutputdir: %s\nTimeout: %d\nUser: %s\n" % \ + (self.pathname, self.outputdir, self.timeout, self.user) def kill_cmd(self, proc): """ @@ -324,9 +323,9 @@ class Test(Cmd): if len(self.post_user): post_user = ' (as %s)' % (self.post_user) return "Pathname: %s\nOutputdir: %s\nTimeout: %d\nPre: %s%s\nPost: " \ - "%s%s\nUser: %s\n" % (self.pathname, self.outputdir, - self.timeout, self.pre, pre_user, self.post, post_user, - self.user) + "%s%s\nUser: %s\n" % \ + (self.pathname, self.outputdir, self.timeout, self.pre, + pre_user, self.post, post_user, self.user) def verify(self, logger): """ @@ -355,13 +354,13 @@ class Test(Cmd): Create Cmd instances for the pre/post scripts. If the pre script doesn't pass, skip this Test. Run the post script regardless. """ - pretest = Cmd(self.pre, outputdir=os.path.join(self.outputdir, - os.path.basename(self.pre)), timeout=self.timeout, + odir = os.path.join(self.outputdir, os.path.basename(self.pre)) + pretest = Cmd(self.pre, outputdir=odir, timeout=self.timeout, user=self.pre_user) test = Cmd(self.pathname, outputdir=self.outputdir, timeout=self.timeout, user=self.user) - posttest = Cmd(self.post, outputdir=os.path.join(self.outputdir, - os.path.basename(self.post)), timeout=self.timeout, + odir = os.path.join(self.outputdir, os.path.basename(self.post)) + posttest = Cmd(self.post, outputdir=odir, timeout=self.timeout, user=self.post_user) cont = True @@ -399,9 +398,9 @@ class TestGroup(Test): if len(self.post_user): post_user = ' (as %s)' % (self.post_user) return "Pathname: %s\nOutputdir: %s\nTests: %s\nTimeout: %d\n" \ - "Pre: %s%s\nPost: %s%s\nUser: %s\n" % (self.pathname, - self.outputdir, self.tests, self.timeout, self.pre, pre_user, - self.post, post_user, self.user) + "Pre: %s%s\nPost: %s%s\nUser: %s\n" % \ + (self.pathname, self.outputdir, self.tests, self.timeout, + self.pre, pre_user, self.post, post_user, self.user) def verify(self, logger): """ @@ -443,8 +442,8 @@ class TestGroup(Test): if not verify_file(os.path.join(self.pathname, test)): del self.tests[self.tests.index(test)] logger.info("Warning: Test '%s' removed from TestGroup '%s' " - "because it failed verification." % (test, - self.pathname)) + "because it failed verification." % + (test, self.pathname)) return len(self.tests) is not 0 @@ -454,11 +453,11 @@ class TestGroup(Test): doesn't pass, skip all the tests in this TestGroup. Run the post script regardless. """ - pretest = Cmd(self.pre, outputdir=os.path.join(self.outputdir, - os.path.basename(self.pre)), timeout=self.timeout, + odir = os.path.join(self.outputdir, os.path.basename(self.pre)) + pretest = Cmd(self.pre, outputdir=odir, timeout=self.timeout, user=self.pre_user) - posttest = Cmd(self.post, outputdir=os.path.join(self.outputdir, - os.path.basename(self.post)), timeout=self.timeout, + odir = os.path.join(self.outputdir, os.path.basename(self.post)) + posttest = Cmd(self.post, outputdir=odir, timeout=self.timeout, user=self.post_user) cont = True @@ -570,11 +569,9 @@ class TestRun(object): if 'tests' in config.options(section): testgroup = TestGroup(section) for prop in TestGroup.props: - try: - setattr(testgroup, prop, config.get('DEFAULT', prop)) - setattr(testgroup, prop, config.get(section, prop)) - except ConfigParser.NoOptionError: - pass + for sect in ['DEFAULT', section]: + if config.has_option(sect, prop): + setattr(testgroup, prop, config.get(sect, prop)) # Repopulate tests using eval to convert the string to a list testgroup.tests = eval(config.get(section, 'tests')) @@ -584,11 +581,10 @@ class TestRun(object): else: test = Test(section) for prop in Test.props: - try: - setattr(test, prop, config.get('DEFAULT', prop)) - setattr(test, prop, config.get(section, prop)) - except ConfigParser.NoOptionError: - pass + for sect in ['DEFAULT', section]: + if config.has_option(sect, prop): + setattr(test, prop, config.get(sect, prop)) + if test.verify(logger): self.tests[section] = test @@ -603,7 +599,7 @@ class TestRun(object): """ defaults = dict([(prop, getattr(options, prop)) for prop, _ in - self.defaults]) + self.defaults]) config = ConfigParser.RawConfigParser(defaults) for test in sorted(self.tests.keys()): @@ -619,7 +615,7 @@ class TestRun(object): except IOError: fail('Could not open \'%s\' for writing.' % options.template) - def complete_outputdirs(self, options): + def complete_outputdirs(self): """ Collect all the pathnames for Tests, and TestGroups. Work backwards one pathname component at a time, to create a unique @@ -642,7 +638,7 @@ class TestRun(object): components -= 1 for testfile in tmp_dict.keys(): uniq = '/'.join(testfile.split('/')[components:]).lstrip('/') - if not uniq in l: + if uniq not in l: l.append(uniq) tmp_dict[testfile].outputdir = os.path.join(base, uniq) else: @@ -714,7 +710,7 @@ class TestRun(object): h, m = divmod(m, 60) print '\nRunning Time:\t%02d:%02d:%02d' % (h, m, s) print 'Percent passed:\t%.1f%%' % ((float(Result.runresults['PASS']) / - float(Result.total)) * 100) + float(Result.total)) * 100) print 'Log directory:\t%s' % self.outputdir @@ -737,7 +733,6 @@ def verify_user(user, logger): sudo without being prompted for a password. """ testcmd = [SUDO, '-n', '-u', user, TRUE] - can_sudo = exists = True if user in Cmd.verified_users: return True @@ -745,7 +740,6 @@ def verify_user(user, logger): try: _ = getpwnam(user) except KeyError: - exists = False logger.info("Warning: user '%s' does not exist.", user) return False @@ -788,7 +782,7 @@ def options_cb(option, opt_str, value, parser): path_options = ['runfile', 'outputdir', 'template'] if option.dest is 'runfile' and '-w' in parser.rargs or \ - option.dest is 'template' and '-c' in parser.rargs: + option.dest is 'template' and '-c' in parser.rargs: fail('-c and -w are mutually exclusive.') if opt_str in parser.rargs: @@ -852,7 +846,7 @@ def parse_args(): return options -def main(args): +def main(): options = parse_args() testrun = TestRun(options) @@ -867,11 +861,11 @@ def main(args): else: fail('Unknown command specified') - testrun.complete_outputdirs(options) + testrun.complete_outputdirs() testrun.run(options) testrun.summary() exit(0) if __name__ == '__main__': - main(argv[1:]) + main() diff --git a/usr/src/test/zfs-tests/tests/functional/rsend/rsend_009_pos.ksh b/usr/src/test/zfs-tests/tests/functional/rsend/rsend_009_pos.ksh index 8f201fde7f..c85d22d729 100644 --- a/usr/src/test/zfs-tests/tests/functional/rsend/rsend_009_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/rsend/rsend_009_pos.ksh @@ -26,7 +26,7 @@ # # -# Copyright (c) 2013 by Delphix. All rights reserved. +# Copyright (c) 2013, 2015 by Delphix. All rights reserved. # . $STF_SUITE/tests/functional/rsend/rsend.kshlib @@ -67,8 +67,7 @@ log_must zpool create spool $TESTDIR/sfile # Test out of space on sub-filesystem # log_must $ZFS create bpool/fs -mntpnt=$(get_prop mountpoint bpool/fs) -log_must $MKFILE 30M $mntpnt/file +log_must $MKFILE 30M /bpool/fs/file log_must $ZFS snapshot bpool/fs@snap log_must eval "$ZFS send -R bpool/fs@snap > $BACKDIR/fs-R" @@ -80,8 +79,7 @@ log_must ismounted spool # # Test out of space on top filesystem # -mntpnt2=$(get_prop mountpoint bpool) -log_must $MV $mntpnt/file $mntpnt2 +log_must $MV /bpool/fs/file /bpool log_must $ZFS destroy -rf bpool/fs log_must $ZFS snapshot bpool@snap |