示例#1
0
 def run(self, opts):
     from calibre.utils.run_tests import run_cli, filter_tests_by_name, remove_tests_by_name
     tests = find_tests(which_tests=frozenset(opts.test_module), exclude_tests=frozenset(opts.exclude_test_module))
     if opts.test_name:
         tests = filter_tests_by_name(tests, *opts.test_name)
     if opts.exclude_test_name:
         tests = remove_tests_by_name(tests, *opts.exclude_test_name)
     run_cli(tests, verbosity=opts.test_verbosity)
示例#2
0
文件: test.py 项目: qykth-git/calibre
 def run(self, opts):
     if opts.under_sanitize and 'CALIBRE_EXECED_UNDER_SANITIZE' not in os.environ:
         if 'libasan' not in os.environ.get('LD_PRELOAD', ''):
             os.environ['LD_PRELOAD'] = os.path.abspath(subprocess.check_output('gcc -print-file-name=libasan.so'.split()).decode('utf-8').strip())
         os.environ['CALIBRE_EXECED_UNDER_SANITIZE'] = '1'
         os.environ['ASAN_OPTIONS'] = 'detect_leaks=0'
         os.environ['PYCRYPTODOME_DISABLE_DEEPBIND'] = '1'  # https://github.com/Legrandin/pycryptodome/issues/558
         self.info(f'Re-execing with LD_PRELOAD={os.environ["LD_PRELOAD"]}')
         sys.stdout.flush()
         os.execl('setup.py', *sys.argv)
     from calibre.utils.run_tests import (
         filter_tests_by_name, remove_tests_by_name, run_cli
     )
     tests = find_tests(which_tests=frozenset(opts.test_module), exclude_tests=frozenset(opts.exclude_test_module))
     if opts.test_name:
         tests = filter_tests_by_name(tests, *opts.test_name)
     if opts.exclude_test_name:
         tests = remove_tests_by_name(tests, *opts.exclude_test_name)
     run_cli(tests, verbosity=opts.test_verbosity)
示例#3
0
 def run(self, opts):
     if opts.under_sanitize and 'libasan' not in os.environ.get(
             'LD_PRELOAD', ''):
         os.environ['LD_PRELOAD'] = os.path.abspath(
             subprocess.check_output(
                 'gcc -print-file-name=libasan.so'.split()).decode(
                     'utf-8').strip())
         os.environ['ASAN_OPTIONS'] = 'detect_leaks=0'
         self.info(f'Re-execing with LD_PRELOAD={os.environ["LD_PRELOAD"]}')
         sys.stdout.flush()
         os.execl('setup.py', *sys.argv)
     from calibre.utils.run_tests import (filter_tests_by_name,
                                          remove_tests_by_name, run_cli)
     tests = find_tests(which_tests=frozenset(opts.test_module),
                        exclude_tests=frozenset(opts.exclude_test_module))
     if opts.test_name:
         tests = filter_tests_by_name(tests, *opts.test_name)
     if opts.exclude_test_name:
         tests = remove_tests_by_name(tests, *opts.exclude_test_name)
     run_cli(tests, verbosity=opts.test_verbosity)
示例#4
0
文件: test.py 项目: j-howell/calibre
 def run(self, opts):
     from calibre.utils.run_tests import run_cli, filter_tests_by_name
     tests = find_tests(which_tests=frozenset(opts.test_module))
     if opts.test_name:
         tests = filter_tests_by_name(tests, *opts.test_name)
     run_cli(tests, verbosity=opts.test_verbosity)