#!/usr/bin/python import os from autotest.client import utils version = 1 def setup(tarball, topdir): # FIXME - Waiting to be able to specify dependency. # self.job.setup_dep(['pgsql']) srcdir = os.path.join(topdir, 'src') if not os.path.exists(tarball): utils.get_file('http://pgfoundry.org/frs/download.php/1083/pgpool-II-1.0.1.tar.gz', tarball) utils.extract_tarball_to_dir(tarball, 'src') os.chdir(srcdir) # FIXEME - Waiting to be able to use self.autodir instead of # os.environ['AUTODIR'] utils.configure('--prefix=%s/pgpool --with-pgsql=%s/deps/pgsql/pgsql' % (topdir, os.environ['AUTODIR'])) utils.make('-j %d' % utils.count_cpus()) utils.make('install') os.chdir(topdir) pwd = os.getcwd() tarball = os.path.join(pwd, 'pgpool-II-1.0.1.tar.gz') utils.update_version(pwd + '/src', False, version, setup, tarball, pwd)
#!/usr/bin/python import os from autotest.client import utils version = 1 def setup(tarball, topdir): srcdir = os.path.join(topdir, 'src') utils.extract_tarball_to_dir(tarball, 'src') os.chdir(srcdir) utils.configure('--prefix=%s/dejagnu' % topdir) utils.make() utils.make('install') os.chdir(topdir) pwd = os.getcwd() # http://ftp.gnu.org/pub/gnu/dejagnu/dejagnu-1.4.4.tar.gz tarball = os.path.join(pwd, 'dejagnu-1.4.4.tar.bz2') utils.update_version(pwd + '/src', False, version, setup, tarball, pwd)
def _exec(self, args, dargs): self.job.logging.tee_redirect_debug_dir(self.debugdir, log_name=self.tagged_testname) try: if self.network_destabilizing: self.job.disable_warnings("NETWORK") # write out the test attributes into a keyval dargs = dargs.copy() run_cleanup = dargs.pop("run_cleanup", self.job.run_test_cleanup) keyvals = dargs.pop("test_attributes", {}).copy() keyvals["version"] = self.version for i, arg in enumerate(args): keyvals["param-%d" % i] = repr(arg) for name, arg in dargs.iteritems(): keyvals["param-%s" % name] = repr(arg) self.write_test_keyval(keyvals) _validate_args(args, dargs, self.initialize, self.setup, self.execute, self.cleanup) try: # Initialize: _cherry_pick_call(self.initialize, *args, **dargs) lockfile = open(os.path.join(self.job.tmpdir, ".testlock"), "w") try: fcntl.flock(lockfile, fcntl.LOCK_EX) # Setup: (compile and install the test, if needed) p_args, p_dargs = _cherry_pick_args(self.setup, args, dargs) utils.update_version( self.srcdir, self.preserve_srcdir, self.version, self.setup, *p_args, **p_dargs ) finally: fcntl.flock(lockfile, fcntl.LOCK_UN) lockfile.close() # Execute: os.chdir(self.outputdir) # call self.warmup cherry picking the arguments it accepts and # translate exceptions if needed _call_test_function(_cherry_pick_call, self.warmup, *args, **dargs) if hasattr(self, "run_once"): p_args, p_dargs = _cherry_pick_args(self.run_once, args, dargs) # pull in any non-* and non-** args from self.execute for param in _get_nonstar_args(self.execute): if param in dargs: p_dargs[param] = dargs[param] else: p_args, p_dargs = _cherry_pick_args(self.execute, args, dargs) _call_test_function(self.execute, *p_args, **p_dargs) except Exception: # Save the exception while we run our cleanup() before # reraising it. exc_info = sys.exc_info() try: try: if run_cleanup: _cherry_pick_call(self.cleanup, *args, **dargs) except Exception: logging.error("Ignoring exception during cleanup() phase:") traceback.print_exc() logging.error("Now raising the earlier %s error", exc_info[0]) self.crash_handler_report() finally: self.job.logging.restore() try: raise exc_info[0], exc_info[1], exc_info[2] finally: # http://docs.python.org/library/sys.html#sys.exc_info # Be nice and prevent a circular reference. del exc_info else: try: if run_cleanup: _cherry_pick_call(self.cleanup, *args, **dargs) self.crash_handler_report() finally: self.job.logging.restore() except error.AutotestError: if self.network_destabilizing: self.job.enable_warnings("NETWORK") # Pass already-categorized errors on up. raise except Exception, e: if self.network_destabilizing: self.job.enable_warnings("NETWORK") # Anything else is an ERROR in our own code, not execute(). raise error.UnhandledTestError(e)
def _exec(self, args, dargs): self.job.logging.tee_redirect_debug_dir(self.debugdir, log_name=self.tagged_testname) try: if self.network_destabilizing: self.job.disable_warnings("NETWORK") # write out the test attributes into a keyval dargs = dargs.copy() run_cleanup = dargs.pop('run_cleanup', self.job.run_test_cleanup) keyvals = dargs.pop('test_attributes', {}).copy() keyvals['version'] = self.version for i, arg in enumerate(args): keyvals['param-%d' % i] = repr(arg) for name, arg in dargs.iteritems(): keyvals['param-%s' % name] = repr(arg) self.write_test_keyval(keyvals) _validate_args(args, dargs, self.initialize, self.setup, self.execute, self.cleanup) try: # Initialize: _cherry_pick_call(self.initialize, *args, **dargs) lockfile = open(os.path.join(self.job.tmpdir, '.testlock'), 'w') try: fcntl.flock(lockfile, fcntl.LOCK_EX) # Setup: (compile and install the test, if needed) p_args, p_dargs = _cherry_pick_args( self.setup, args, dargs) utils.update_version(self.srcdir, self.preserve_srcdir, self.version, self.setup, *p_args, **p_dargs) finally: fcntl.flock(lockfile, fcntl.LOCK_UN) lockfile.close() # Execute: os.chdir(self.outputdir) # call self.warmup cherry picking the arguments it accepts and # translate exceptions if needed _call_test_function(_cherry_pick_call, self.warmup, *args, **dargs) if hasattr(self, 'run_once'): p_args, p_dargs = _cherry_pick_args( self.run_once, args, dargs) # pull in any non-* and non-** args from self.execute for param in _get_nonstar_args(self.execute): if param in dargs: p_dargs[param] = dargs[param] else: p_args, p_dargs = _cherry_pick_args( self.execute, args, dargs) _call_test_function(self.execute, *p_args, **p_dargs) except Exception: try: logging.exception('Exception escaping from test:') except: pass # don't let logging exceptions here interfere # Save the exception while we run our cleanup() before # reraising it. exc_info = sys.exc_info() try: try: if run_cleanup: _cherry_pick_call(self.cleanup, *args, **dargs) except Exception: logging.error( 'Ignoring exception during cleanup() phase:') traceback.print_exc() logging.error('Now raising the earlier %s error', exc_info[0]) self.crash_handler_report() finally: self.job.logging.restore() try: raise exc_info[0], exc_info[1], exc_info[2] finally: # http://docs.python.org/library/sys.html#sys.exc_info # Be nice and prevent a circular reference. del exc_info else: try: if run_cleanup: _cherry_pick_call(self.cleanup, *args, **dargs) self.crash_handler_report() finally: self.job.logging.restore() except error.AutotestError: if self.network_destabilizing: self.job.enable_warnings("NETWORK") # Pass already-categorized errors on up. raise except Exception, e: if self.network_destabilizing: self.job.enable_warnings("NETWORK") # Anything else is an ERROR in our own code, not execute(). raise error.UnhandledTestError(e)
#!/usr/bin/python import os from autotest.client import utils version = 1 def setup(topdir): srcdir = os.path.join(topdir, 'src') os.chdir(srcdir) utils.configure('--with-elfutils=elfutils --prefix=%s/systemtap' % topdir) utils.make('-j %d' % utils.count_cpus()) utils.make('install') os.chdir(topdir) pwd = os.getcwd() utils.update_version(os.path.join(pwd, 'src'), True, version, setup, pwd)
#!/usr/bin/python3 import os from autotest.client import utils version = 2 def setup(srcdir, tarball='libcap-2.16.tar.gz'): topdir = os.getcwd() utils.extract_tarball_to_dir(tarball, srcdir) os.chdir(srcdir) utils.make('-C libcap LIBATTR=no') os.chdir(topdir) srcdir = os.path.abspath('./src') utils.update_version(srcdir, False, version, setup, srcdir)
#!/usr/bin/python import os from autotest.client import utils version = 2 def setup(srcdir, tarball='libcap-2.16.tar.gz'): topdir = os.getcwd() utils.extract_tarball_to_dir(tarball, srcdir) os.chdir(srcdir) utils.make('-C libcap LIBATTR=no') os.chdir(topdir) srcdir = os.path.abspath('./src') utils.update_version(srcdir, False, version, setup, srcdir)
#!/usr/bin/python import os from autotest.client import utils version = 1 def setup(tarball, topdir): srcdir = os.path.join(topdir, 'src') utils.extract_tarball_to_dir(tarball, srcdir) os.chdir(srcdir) utils.make() os.environ['MAKEOPTS'] = 'mandir=/usr/share/man' utils.make('install') os.chdir(topdir) pwd = os.getcwd() tarball = os.path.join(pwd, 'grubby-8.15.tar.bz2') utils.update_version(os.path.join(pwd, 'src'), False, version, setup, tarball, pwd)
#!/usr/bin/python import os from autotest.client import utils version = 1 def setup(tarball, topdir): srcdir = os.path.join(topdir, 'src') utils.extract_tarball_to_dir(tarball, srcdir) os.chdir(srcdir) utils.make() os.environ['MAKEOPTS'] = 'mandir=/usr/share/man' utils.make('install') os.chdir(topdir) pwd = os.getcwd() tarball = os.path.join(pwd, 'grubby-8.15.tar.bz2') utils.update_version(os.path.join(pwd, 'src'), False, version, setup, tarball, pwd)
#!/usr/bin/python import os from autotest.client import utils version = 1 def setup(topdir): srcdir = os.path.join(topdir, 'src') os.chdir(srcdir) utils.configure('--with-elfutils=elfutils ' \ '--prefix=%s/systemtap' % topdir) utils.make('-j %d' % utils.count_cpus()) utils.make('install') os.chdir(topdir) pwd = os.getcwd() utils.update_version(pwd+'/src', True, version, setup, pwd)
#!/usr/bin/python import os from autotest.client import utils version = 1 def setup(topdir): srcdir = os.path.join(topdir, 'src') os.chdir(srcdir) utils.configure('--with-elfutils=elfutils ' \ '--prefix=%s/systemtap' % topdir) utils.make('-j %d' % utils.count_cpus()) utils.make('install') os.chdir(topdir) pwd = os.getcwd() utils.update_version(pwd + '/src', True, version, setup, pwd)