#!/usr/bin/python import os from autotest_lib.client.bin import utils version = 1 def setup(tarball, topdir): srcdir = os.path.join(topdir, 'src') if not os.path.exists(tarball): utils.get_file( 'http://www.packetfactory.net/libnet/dist/libnet.tar.gz', tarball) utils.extract_tarball_to_dir(tarball, 'src') os.chdir(srcdir) utils.configure('--prefix=%s/libnet' % topdir) utils.make() utils.make('install') os.chdir(topdir) pwd = os.getcwd() tarball = os.path.join(pwd, 'libnet.tar.gz') utils.update_version(pwd + '/src', False, version, setup, tarball, pwd)
#!/usr/bin/python import os import common from autotest_lib.client.bin 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.system ('make') utils.system ('make prefix=%s install' % topdir) os.chdir(topdir) # old source was # http://www.kernel.org/pub/linux/kernel/people/bcrl/aio/libaio-0.3.92.tar.bz2 # now grabbing from debian # http://ftp.debian.org/debian/pool/main/liba/libaio/libaio_0.3.106.orig.tar.gz pwd = os.getcwd() tarball = os.path.join(pwd, 'libaio_0.3.106.orig.tar.gz') utils.update_version(pwd+'/src', False, version, setup, tarball, pwd)
#!/usr/bin/python # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Install the telemetry_dep dependency. This is done by the Chrome ebuild so this in fact has nothing to do. """ import os from autotest_lib.client.bin import utils version = 1 def setup(top_dir): return pwd = os.getcwd() utils.update_version(pwd + '/src', False, version, setup, None)
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: # Make resultsdir and tmpdir accessible to everyone. We may # output data to these directories as others, e.g., chronos. self._make_writable_to_others(self.tmpdir) self._make_writable_to_others(self.resultsdir) # 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, but log it to so actual time of error is known. exc_info = sys.exc_info() logging.warning('The test failed with the following exception', exc_info=True) try: try: if run_cleanup: logging.debug('Running cleanup for test.') _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: # Raise exception after running cleanup, reporting crash, # and restoring job's logging, even if the first two # actions fail. 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: print 'Ignoring exception during cleanup() phase:' traceback.print_exc() print '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 # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Install the telemetry_dep dependency. This is done by the Chrome ebuild so this in fact has nothing to do. """ import os from autotest_lib.client.bin import utils version = 1 def setup(top_dir): return pwd = os.getcwd() utils.update_version(pwd + '/src', False, version, setup, None)
#!/usr/bin/python import os import shutil from autotest_lib.client.bin 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 # Copyright (c) 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os from autotest_lib.client.bin import utils version = 1 def setup(setup_dir): binary = 'arc_camera3_test' src_path = os.path.join(os.environ['SYSROOT'], 'usr', 'bin') dst_path = os.path.join(os.getcwd(), 'bin') os.mkdir(dst_path) utils.get_file(os.path.join(src_path, binary), os.path.join(dst_path, binary)) utils.update_version(os.getcwd(), True, version, setup, os.getcwd())
# found in the LICENSE file. import os, shutil from autotest_lib.client.bin import utils version = 1 def setup(topdir): """Download TDL library tarball and unpack to src/, then install remaining files/ into src/. @param topdir: The directory of this deps. """ tarball = 'tdl-0.0.2.tar.gz' srcdir = os.path.join(topdir, 'src') filesdir = os.path.join(topdir, 'files') tarball_path = os.path.join(filesdir, tarball) shutil.rmtree(srcdir, ignore_errors=True) if not os.path.exists(tarball_path): utils.get_file( 'http://github.com/greggman/tdl/archive/0.0.2.tar.gz', tarball_path) os.mkdir(srcdir) utils.extract_tarball_to_dir(tarball_path, srcdir) os.chdir(srcdir) shutil.copy(os.path.join(filesdir, 'WebGLClear.html'), srcdir) pwd = os.getcwd() utils.update_version(pwd + '/src', True, version, setup, pwd)
import os import common import shutil from autotest_lib.client.bin import utils version = 1 def setup(tarball_systemtap, tarball_elfutils, topdir): srcdir = os.path.join(topdir, "src") utils.extract_tarball_to_dir(tarball_systemtap, "src") utils.extract_tarball_to_dir(tarball_elfutils, "elfutils") shutil.move("elfutils", "src") os.chdir(srcdir) utils.system("./configure --with-elfutils=elfutils " "--prefix=%s/systemtap" % topdir) utils.system("make -j %d" % utils.count_cpus()) utils.system("make install") os.chdir(topdir) pwd = os.getcwd() # http://sourceware.org/systemtap/ftp/releases/systemtap-0.9.5.tar.gz tarball_systemtap = os.path.join(pwd, "systemtap-0.9.5.tar.gz") # https://fedorahosted.org/releases/e/l/elfutils/elfutils-0.140.tar.bz2 tarball_elfutils = os.path.join(pwd, "elfutils-0.140.tar.bz2") utils.update_version(pwd + "/src", False, version, setup, tarball_systemtap, tarball_elfutils, pwd)
#!/usr/bin/python import os from autotest_lib.client.bin 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)
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: print 'Ignoring exception during cleanup() phase:' traceback.print_exc() print '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 # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import common from autotest_lib.client.bin import utils version = 1 def setup(topdir): srcdir = os.path.join(topdir, 'src') # Build lansim os.chdir(srcdir) utils.make() utils.system('make install') os.chdir(topdir) pwd = os.getcwd() utils.update_version(os.path.join(pwd, 'src'), True, version, setup, pwd)
#!/usr/bin/python import os from autotest_lib.client.bin 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.11-autotest.tar.bz2') utils.update_version(os.path.join(pwd, 'src'), False, version, setup, tarball, pwd)
#!/usr/bin/python import os from autotest_lib.client.bin 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)