Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package cvise for openSUSE:Factory checked in at 2021-08-20 16:57:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cvise (Old) and /work/SRC/openSUSE:Factory/.cvise.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cvise" Fri Aug 20 16:57:55 2021 rev:37 rq:913267 version:2.3.0+git.20210819.0f98784 Changes: -------- --- /work/SRC/openSUSE:Factory/cvise/cvise.changes 2021-06-28 15:34:17.499234714 +0200 +++ /work/SRC/openSUSE:Factory/.cvise.new.1899/cvise.changes 2021-08-20 16:58:19.870831846 +0200 @@ -1,0 +2,12 @@ +Thu Aug 19 15:08:49 UTC 2021 - mli...@suse.cz + +- Update to version 2.3.0+git.20210819.0f98784: + * Properly handle keyboard interrupt when a pass is running (#62). + * Use pass name in the created temporary directories (#62). + * Install python3-chardet. + * Add support for --to-utf8 (#59). + * Add LLVM 12 build target. + * Support current LLVM tip. + * Fix CPU count detection on Darwin. + +------------------------------------------------------------------- Old: ---- cvise-2.3.0+git.20210628.38b42d9.tar.xz New: ---- cvise-2.3.0+git.20210819.0f98784.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cvise.spec ++++++ --- /var/tmp/diff_new_pack.CPPVIC/_old 2021-08-20 16:58:20.562830793 +0200 +++ /var/tmp/diff_new_pack.CPPVIC/_new 2021-08-20 16:58:20.566830787 +0200 @@ -17,7 +17,7 @@ Name: cvise -Version: 2.3.0+git.20210628.38b42d9 +Version: 2.3.0+git.20210819.0f98784 Release: 0 Summary: Super-parallel Python port of the C-Reduce License: BSD-3-Clause @@ -33,6 +33,7 @@ BuildRequires: ncurses-devel BuildRequires: ninja BuildRequires: python3-Pebble +BuildRequires: python3-chardet BuildRequires: python3-psutil BuildRequires: python3-pytest BuildRequires: python3-pytest-flake8 ++++++ cvise-2.3.0+git.20210628.38b42d9.tar.xz -> cvise-2.3.0+git.20210819.0f98784.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.3.0+git.20210628.38b42d9/.github/workflows/build.yml new/cvise-2.3.0+git.20210819.0f98784/.github/workflows/build.yml --- old/cvise-2.3.0+git.20210628.38b42d9/.github/workflows/build.yml 2021-06-28 11:11:43.000000000 +0200 +++ new/cvise-2.3.0+git.20210819.0f98784/.github/workflows/build.yml 2021-08-19 17:03:54.000000000 +0200 @@ -7,22 +7,22 @@ branches: [ master ] jobs: - build_and_test: + CI: runs-on: ubuntu-latest strategy: matrix: - llvm: [9, 10, 11] + llvm: [9, 10, 11, 12] build-type: [DEBUG] docker: [opensuse/tumbleweed] include: - - llvm: 11 + - llvm: 12 build-type: ASAN docker: opensuse/tumbleweed - - llvm: 11 + - llvm: 12 build-type: UBSAN docker: opensuse/tumbleweed - - llvm: 11 + - llvm: 12 build-type: COVERAGE docker: opensuse/tumbleweed - llvm: 9 @@ -34,7 +34,7 @@ steps: - run: zypper -n install - binutils clang${{ matrix.llvm }}-devel cmake flex gcc-c++ llvm${{ matrix.llvm }}-devel python3-Pebble python3-pytest unifdef python3-psutil curl git + binutils clang${{ matrix.llvm }}-devel cmake flex gcc-c++ llvm${{ matrix.llvm }}-devel python3-Pebble python3-pytest unifdef python3-psutil curl git python3-chardet python3-pytest-flake8 python3-flake8 python3-flake8-builtins diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.3.0+git.20210628.38b42d9/INSTALL.md new/cvise-2.3.0+git.20210819.0f98784/INSTALL.md --- old/cvise-2.3.0+git.20210628.38b42d9/INSTALL.md 2021-06-28 11:11:43.000000000 +0200 +++ new/cvise-2.3.0+git.20210819.0f98784/INSTALL.md 2021-08-19 17:03:54.000000000 +0200 @@ -82,6 +82,8 @@ * [Pebble](https://pypi.org/project/Pebble/) +* [chardet](https://pypi.org/project/chardet/) + * [psutil](https://pypi.org/project/psutil/) * [CMake](https://cmake.org/) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.3.0+git.20210628.38b42d9/clang_delta/RewriteUtils.cpp new/cvise-2.3.0+git.20210819.0f98784/clang_delta/RewriteUtils.cpp --- old/cvise-2.3.0+git.20210628.38b42d9/clang_delta/RewriteUtils.cpp 2021-06-28 11:11:43.000000000 +0200 +++ new/cvise-2.3.0+git.20210819.0f98784/clang_delta/RewriteUtils.cpp 2021-08-19 17:03:54.000000000 +0200 @@ -554,7 +554,7 @@ // in this case, struct S0 is implicitly declared if (PrevDecl) { if ( RecordDecl *RD = dyn_cast<RecordDecl>(PrevDecl) ) { - DeclGroup DGroup = DS->getDeclGroup().getDeclGroup(); + DeclGroup &DGroup = DS->getDeclGroup().getDeclGroup(); IsFirstDecl = true; if ((!RD->getDefinition() || RD->getNameAsString() == "") && DGroup.size() == 2) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.3.0+git.20210628.38b42d9/cvise/utils/testing.py new/cvise-2.3.0+git.20210819.0f98784/cvise/utils/testing.py --- old/cvise-2.3.0+git.20210628.38b42d9/cvise/utils/testing.py 2021-06-28 11:11:43.000000000 +0200 +++ new/cvise-2.3.0+git.20210819.0f98784/cvise/utils/testing.py 2021-08-19 17:03:54.000000000 +0200 @@ -170,7 +170,8 @@ subprocess.run('colordiff --version', shell=True, stdout=subprocess.DEVNULL).returncode == 0) def create_root(self): - self.root = tempfile.mkdtemp(prefix=self.TEMP_PREFIX) + pass_name = str(self.current_pass).replace('::', '-') + self.root = tempfile.mkdtemp(prefix=f'{self.TEMP_PREFIX}{pass_name}-') logging.debug('Creating pass root folder: %s' % self.root) def remove_root(self): @@ -288,7 +289,7 @@ def check_sanity(self, verbose=False): logging.debug('perform sanity check... ') - folder = tempfile.mkdtemp(prefix=self.TEMP_PREFIX) + folder = tempfile.mkdtemp(prefix=f'{self.TEMP_PREFIX}sanity-') test_env = TestEnvironment(None, 0, self.test_script, folder, None, self.test_cases, None) logging.debug('sanity check tmpdir = {}'.format(test_env.folder)) @@ -481,60 +482,65 @@ if not self.skip_key_off: logger = KeyLogger() - for test_case in self.sorted_test_cases: - self.current_test_case = test_case - - if self.get_file_size([test_case]) == 0: - continue - - if not self.no_cache: - with open(test_case, mode='rb+') as tmp_file: - test_case_before_pass = tmp_file.read() - - if (pass_key in self.cache and - test_case_before_pass in self.cache[pass_key]): - tmp_file.seek(0) - tmp_file.truncate(0) - tmp_file.write(self.cache[pass_key][test_case_before_pass]) - logging.info('cache hit for {}'.format(test_case)) - continue - - # create initial state - self.state = self.current_pass.new(self.current_test_case, self.check_sanity) - self.skip = False - - while self.state is not None and not self.skip: - # Ignore more key presses after skip has been detected - if not self.skip_key_off and not self.skip: - key = logger.pressed_key() - if key == 's': - self.skip = True - self.log_key_event('skipping the rest of this pass') - elif key == 'd': - self.log_key_event('toggle print diff') - self.print_diff = not self.print_diff - - success_env = self.run_parallel_tests() - self.kill_pid_queue() - - if success_env: - self.process_result(success_env) - self.release_folders() - self.futures.clear() - if not success_env: - break - - # Cache result of this pass - if not self.no_cache: - with open(test_case, mode='rb') as tmp_file: - if pass_key not in self.cache: - self.cache[pass_key] = {} - - self.cache[pass_key][test_case_before_pass] = tmp_file.read() - - self.restore_mode() - self.remove_root() - self.pass_statistic.stop(self.current_pass) + try: + for test_case in self.sorted_test_cases: + self.current_test_case = test_case + + if self.get_file_size([test_case]) == 0: + continue + + if not self.no_cache: + with open(test_case, mode='rb+') as tmp_file: + test_case_before_pass = tmp_file.read() + + if (pass_key in self.cache and + test_case_before_pass in self.cache[pass_key]): + tmp_file.seek(0) + tmp_file.truncate(0) + tmp_file.write(self.cache[pass_key][test_case_before_pass]) + logging.info('cache hit for {}'.format(test_case)) + continue + + # create initial state + self.state = self.current_pass.new(self.current_test_case, self.check_sanity) + self.skip = False + + while self.state is not None and not self.skip: + # Ignore more key presses after skip has been detected + if not self.skip_key_off and not self.skip: + key = logger.pressed_key() + if key == 's': + self.skip = True + self.log_key_event('skipping the rest of this pass') + elif key == 'd': + self.log_key_event('toggle print diff') + self.print_diff = not self.print_diff + + success_env = self.run_parallel_tests() + self.kill_pid_queue() + + if success_env: + self.process_result(success_env) + self.release_folders() + self.futures.clear() + if not success_env: + break + + # Cache result of this pass + if not self.no_cache: + with open(test_case, mode='rb') as tmp_file: + if pass_key not in self.cache: + self.cache[pass_key] = {} + + self.cache[pass_key][test_case_before_pass] = tmp_file.read() + + self.restore_mode() + self.pass_statistic.stop(self.current_pass) + self.remove_root() + except KeyboardInterrupt: + logging.info('Exiting now ...') + self.remove_root() + sys.exit(1) def process_result(self, test_env): if self.print_diff: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.3.0+git.20210628.38b42d9/cvise.py new/cvise-2.3.0+git.20210819.0f98784/cvise.py --- old/cvise-2.3.0+git.20210628.38b42d9/cvise.py 2021-06-28 11:11:43.000000000 +0200 +++ new/cvise-2.3.0+git.20210819.0f98784/cvise.py 2021-08-19 17:03:54.000000000 +0200 @@ -19,6 +19,7 @@ sys.path.append('@CMAKE_INSTALL_FULL_DATADIR@') sys.path.append(destdir + '@CMAKE_INSTALL_FULL_DATADIR@') +import chardet # noqa: E402 from cvise.cvise import CVise # noqa: E402 from cvise.passes.abstract import AbstractPass # noqa: E402 from cvise.utils import misc, statistics, testing # noqa: E402 @@ -126,16 +127,7 @@ return group_names -EPILOG_TEXT = """ -available shortcuts: - S - skip execution of the current pass - D - toggle --print-diff option - -For bug reporting instructions, please use: -%s -""" % CVise.Info.PACKAGE_URL - -if __name__ == '__main__': +def get_available_cores(): try: # try to detect only physical cores, ignore HyperThreading # in order to speed up parallel execution @@ -143,17 +135,33 @@ if not core_count: core_count = psutil.cpu_count(logical=True) # respect affinity - affinity = len(psutil.Process().cpu_affinity()) - assert affinity >= 1 + try: + affinity = len(psutil.Process().cpu_affinity()) + assert affinity >= 1 + except AttributeError: + return core_count + if core_count: core_count = min(core_count, affinity) else: core_count = affinity + return core_count except NotImplementedError: - core_count = 1 + return 1 + +EPILOG_TEXT = """ +available shortcuts: + S - skip execution of the current pass + D - toggle --print-diff option + +For bug reporting instructions, please use: +%s +""" % CVise.Info.PACKAGE_URL + +if __name__ == '__main__': parser = argparse.ArgumentParser(description='C-Vise', formatter_class=argparse.RawDescriptionHelpFormatter, epilog=EPILOG_TEXT) - parser.add_argument('--n', '-n', type=int, default=core_count, help='Number of cores to use; C-Vise tries to automatically pick a good setting but its choice may be too low or high for your situation') + parser.add_argument('--n', '-n', type=int, default=get_available_cores(), help='Number of cores to use; C-Vise tries to automatically pick a good setting but its choice may be too low or high for your situation') parser.add_argument('--tidy', action='store_true', help='Do not make a backup copy of each file to reduce as file.orig') parser.add_argument('--shaddap', action='store_true', help='Suppress output about non-fatal internal errors') parser.add_argument('--die-on-pass-bug', action='store_true', help='Terminate C-Vise if a pass encounters an otherwise non-fatal problem') @@ -185,6 +193,7 @@ parser.add_argument('--list-passes', action='store_true', help='Print all available passes and exit') parser.add_argument('--version', action='version', version=CVise.Info.PACKAGE_STRING + (' (%s)' % CVise.Info.GIT_VERSION if CVise.Info.GIT_VERSION != 'unknown' else '')) parser.add_argument('--commands', '-c', help='Use bash commands instead of an interestingness test case') + parser.add_argument('--to-utf8', action='store_true', help='Convert any non-UTF-8 encoded input file to UTF-8') parser.add_argument('interestingness_test', metavar='INTERESTINGNESS_TEST', nargs='?', help='Executable to check interestingness of test cases') parser.add_argument('test_cases', metavar='TEST_CASE', nargs='+', help='Test cases') @@ -261,6 +270,16 @@ args.test_cases.insert(0, args.interestingness_test) args.interestingness_test = None + if args.to_utf8: + for test_case in args.test_cases: + with open(test_case, 'rb') as fd: + encoding = chardet.detect(fd.read())['encoding'] + if encoding not in ('ascii', 'utf-8'): + logging.info(f'Converting {test_case} file ({encoding} encoding) to UTF-8') + data = open(test_case, 'r', encoding=encoding).read() + with open(test_case, 'w') as w: + w.write(data) + script = None if args.commands: with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.sh') as script: