Print this page
9600 LDT still not happy under KPTI
   1 #!@PYTHON@
   2 
   3 #
   4 # This file and its contents are supplied under the terms of the
   5 # Common Development and Distribution License ("CDDL"), version 1.0.
   6 # You may only use this file in accordance with the terms of version
   7 # 1.0 of the CDDL.
   8 #
   9 # A full copy of the text of the CDDL should have accompanied this
  10 # source.  A copy of the CDDL is also available via the Internet at
  11 # http://www.illumos.org/license/CDDL.
  12 #
  13 
  14 #
  15 # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
  16 # Copyright (c) 2017, Chris Fraire <cfraire@me.com>.

  17 #
  18 
  19 import ConfigParser
  20 import os
  21 import logging

  22 from logging.handlers import WatchedFileHandler
  23 from datetime import datetime
  24 from optparse import OptionParser
  25 from pwd import getpwnam
  26 from pwd import getpwuid
  27 from select import select
  28 from subprocess import PIPE
  29 from subprocess import Popen
  30 from sys import argv
  31 from sys import maxint
  32 from threading import Timer
  33 from time import time
  34 
  35 BASEDIR = '/var/tmp/test_results'
  36 KILL = '/usr/bin/kill'
  37 TRUE = '/usr/bin/true'
  38 SUDO = '/usr/bin/sudo'
  39 
  40 # Custom class to reopen the log file in case it is forcibly closed by a test.
  41 class WatchedFileHandlerClosed(WatchedFileHandler):


 547 
 548     def read(self, logger, options):
 549         """
 550         Read in the specified runfile, and apply the TestRun properties
 551         listed in the 'DEFAULT' section to our TestRun. Then read each
 552         section, and apply the appropriate properties to the Test or
 553         TestGroup. Properties from individual sections override those set
 554         in the 'DEFAULT' section. If the Test or TestGroup passes
 555         verification, add it to the TestRun.
 556         """
 557         config = ConfigParser.RawConfigParser()
 558         if not len(config.read(options.runfile)):
 559             fail("Coulnd't read config file %s" % options.runfile)
 560 
 561         for opt in TestRun.props:
 562             if config.has_option('DEFAULT', opt):
 563                 setattr(self, opt, config.get('DEFAULT', opt))
 564         self.outputdir = os.path.join(self.outputdir, self.timestamp)
 565 
 566         for section in config.sections():




 567             if 'tests' in config.options(section):
 568                 testgroup = TestGroup(section)
 569                 for prop in TestGroup.props:
 570                     for sect in ['DEFAULT', section]:
 571                         if config.has_option(sect, prop):
 572                             setattr(testgroup, prop, config.get(sect, prop))
 573 
 574                 # Repopulate tests using eval to convert the string to a list
 575                 testgroup.tests = eval(config.get(section, 'tests'))
 576 
 577                 if testgroup.verify(logger):
 578                     self.testgroups[section] = testgroup
 579 
 580             elif 'autotests' in config.options(section):
 581                 testgroup = TestGroup(section)
 582                 for prop in TestGroup.props:
 583                     for sect in ['DEFAULT', section]:
 584                         if config.has_option(sect, prop):
 585                             setattr(testgroup, prop, config.get(sect, prop))
 586 


   1 #!@PYTHON@
   2 
   3 #
   4 # This file and its contents are supplied under the terms of the
   5 # Common Development and Distribution License ("CDDL"), version 1.0.
   6 # You may only use this file in accordance with the terms of version
   7 # 1.0 of the CDDL.
   8 #
   9 # A full copy of the text of the CDDL should have accompanied this
  10 # source.  A copy of the CDDL is also available via the Internet at
  11 # http://www.illumos.org/license/CDDL.
  12 #
  13 
  14 #
  15 # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
  16 # Copyright (c) 2017, Chris Fraire <cfraire@me.com>.
  17 # Copyright 2018 Joyent, Inc.
  18 #
  19 
  20 import ConfigParser
  21 import os
  22 import logging
  23 import platform
  24 from logging.handlers import WatchedFileHandler
  25 from datetime import datetime
  26 from optparse import OptionParser
  27 from pwd import getpwnam
  28 from pwd import getpwuid
  29 from select import select
  30 from subprocess import PIPE
  31 from subprocess import Popen
  32 from sys import argv
  33 from sys import maxint
  34 from threading import Timer
  35 from time import time
  36 
  37 BASEDIR = '/var/tmp/test_results'
  38 KILL = '/usr/bin/kill'
  39 TRUE = '/usr/bin/true'
  40 SUDO = '/usr/bin/sudo'
  41 
  42 # Custom class to reopen the log file in case it is forcibly closed by a test.
  43 class WatchedFileHandlerClosed(WatchedFileHandler):


 549 
 550     def read(self, logger, options):
 551         """
 552         Read in the specified runfile, and apply the TestRun properties
 553         listed in the 'DEFAULT' section to our TestRun. Then read each
 554         section, and apply the appropriate properties to the Test or
 555         TestGroup. Properties from individual sections override those set
 556         in the 'DEFAULT' section. If the Test or TestGroup passes
 557         verification, add it to the TestRun.
 558         """
 559         config = ConfigParser.RawConfigParser()
 560         if not len(config.read(options.runfile)):
 561             fail("Coulnd't read config file %s" % options.runfile)
 562 
 563         for opt in TestRun.props:
 564             if config.has_option('DEFAULT', opt):
 565                 setattr(self, opt, config.get('DEFAULT', opt))
 566         self.outputdir = os.path.join(self.outputdir, self.timestamp)
 567 
 568         for section in config.sections():
 569             if ('arch' in config.options(section) and
 570                 platform.machine() != config.get(section, 'arch')):
 571                 continue
 572 
 573             if 'tests' in config.options(section):
 574                 testgroup = TestGroup(section)
 575                 for prop in TestGroup.props:
 576                     for sect in ['DEFAULT', section]:
 577                         if config.has_option(sect, prop):
 578                             setattr(testgroup, prop, config.get(sect, prop))
 579 
 580                 # Repopulate tests using eval to convert the string to a list
 581                 testgroup.tests = eval(config.get(section, 'tests'))
 582 
 583                 if testgroup.verify(logger):
 584                     self.testgroups[section] = testgroup
 585 
 586             elif 'autotests' in config.options(section):
 587                 testgroup = TestGroup(section)
 588                 for prop in TestGroup.props:
 589                     for sect in ['DEFAULT', section]:
 590                         if config.has_option(sect, prop):
 591                             setattr(testgroup, prop, config.get(sect, prop))
 592