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-03-10 08:56:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cvise (Old) and /work/SRC/openSUSE:Factory/.cvise.new.2378 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cvise" Wed Mar 10 08:56:41 2021 rev:27 rq:877950 version:2.3.0+git.20210309.0a14640 Changes: -------- --- /work/SRC/openSUSE:Factory/cvise/cvise.changes 2021-03-05 13:50:12.751891419 +0100 +++ /work/SRC/openSUSE:Factory/.cvise.new.2378/cvise.changes 2021-03-10 08:58:19.370955098 +0100 @@ -1,0 +2,20 @@ +Tue Mar 09 10:09:06 UTC 2021 - [email protected] + +- Update to version 2.3.0+git.20210309.0a14640: + * Add note about GCDA pass to README page. + * Add experimental GCDA reduction pass. + +------------------------------------------------------------------- +Tue Mar 09 08:22:24 UTC 2021 - [email protected] + +- Update to version 2.2.0+git.20210309.3f80c31: + * Bump to v2.3.0. + * Port to LLVM 12 (tested with 12.0.0 rc2). + +------------------------------------------------------------------- +Mon Mar 08 15:30:07 UTC 2021 - [email protected] + +- Update to version 2.2.0+git.20210308.de9373b: + * Remove temporary files in working directory. + +------------------------------------------------------------------- Old: ---- cvise-2.2.0+git.20210304.4c7f4cd.tar.xz New: ---- cvise-2.3.0+git.20210309.0a14640.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cvise.spec ++++++ --- /var/tmp/diff_new_pack.hHTxwC/_old 2021-03-10 08:58:19.922955668 +0100 +++ /var/tmp/diff_new_pack.hHTxwC/_new 2021-03-10 08:58:19.922955668 +0100 @@ -17,7 +17,7 @@ Name: cvise -Version: 2.2.0+git.20210304.4c7f4cd +Version: 2.3.0+git.20210309.0a14640 Release: 0 Summary: Super-parallel Python port of the C-Reduce License: BSD-3-Clause ++++++ _service ++++++ --- /var/tmp/diff_new_pack.hHTxwC/_old 2021-03-10 08:58:19.962955709 +0100 +++ /var/tmp/diff_new_pack.hHTxwC/_new 2021-03-10 08:58:19.962955709 +0100 @@ -4,7 +4,7 @@ <param name="scm">git</param> <param name="changesgenerate">enable</param> <param name="filename">cvise</param> - <param name="versionformat">2.2.0+git.%cd.%h</param> + <param name="versionformat">2.3.0+git.%cd.%h</param> </service> <service mode="disabled" name="recompress"> <param name="file">*.tar</param> ++++++ cvise-2.2.0+git.20210304.4c7f4cd.tar.xz -> cvise-2.3.0+git.20210309.0a14640.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.2.0+git.20210304.4c7f4cd/CMakeLists.txt new/cvise-2.3.0+git.20210309.0a14640/CMakeLists.txt --- old/cvise-2.2.0+git.20210304.4c7f4cd/CMakeLists.txt 2021-03-04 13:49:32.000000000 +0100 +++ new/cvise-2.3.0+git.20210309.0a14640/CMakeLists.txt 2021-03-09 10:47:27.000000000 +0100 @@ -122,11 +122,11 @@ set(cvise_PACKAGE "cvise") set(cvise_PACKAGE_BUGREPORT "https://github.com/marxin/cvise/issues") set(cvise_PACKAGE_NAME "cvise") -set(cvise_PACKAGE_STRING "cvise 2.2.0") +set(cvise_PACKAGE_STRING "cvise 2.3.0") set(cvise_PACKAGE_TARNAME "cvise") set(cvise_PACKAGE_URL "https://github.com/marxin/cvise/") -set(cvise_PACKAGE_VERSION "2.2.0") -set(cvise_VERSION "2.2.0") +set(cvise_PACKAGE_VERSION "2.3.0") +set(cvise_VERSION "2.3.0") set(cvise_LLVM_VERSION "${LLVM_PACKAGE_VERSION}") configure_file("cmake_config.h.in" "${PROJECT_BINARY_DIR}/config.h") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.2.0+git.20210304.4c7f4cd/README.md new/cvise-2.3.0+git.20210309.0a14640/README.md --- old/cvise-2.2.0+git.20210304.4c7f4cd/README.md 2021-03-04 13:49:32.000000000 +0100 +++ new/cvise-2.3.0+git.20210309.0a14640/README.md 2021-03-09 10:47:27.000000000 +0100 @@ -29,6 +29,9 @@ If you need to reduce programs in some other language, please give it a try. +*NOTE:*: Binary passes (`--pass-group=binary`) contains an experimental pass +that can reduce GCC's `.gcda` files. + ## Speed Comparison I made a comparison for couple of GCC bug reports on my AMD Ryzen 7 2700X Eight-Core Processor diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.2.0+git.20210304.4c7f4cd/clang_delta/TransformationManager.cpp new/cvise-2.3.0+git.20210309.0a14640/clang_delta/TransformationManager.cpp --- old/cvise-2.2.0+git.20210304.4c7f4cd/clang_delta/TransformationManager.cpp 2021-03-04 13:49:32.000000000 +0100 +++ new/cvise-2.3.0+git.20210309.0a14640/clang_delta/TransformationManager.cpp 2021-03-09 10:47:27.000000000 +0100 @@ -95,7 +95,9 @@ ClangInstance->createDiagnostics(); TargetOptions &TargetOpts = ClangInstance->getTargetOpts(); +#if LLVM_VERSION_MAJOR < 12 PreprocessorOptions &PPOpts = ClangInstance->getPreprocessorOpts(); +#endif if (const char *env = getenv("CVISE_TARGET_TRIPLE")) { TargetOpts.Triple = std::string(env); } else { @@ -138,7 +140,7 @@ Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind::CXX, T, PPOpts, LSTD); } else if(IK.getLanguage() == InputKind::OpenCL) { -#else +#elif LLVM_VERSION_MAJOR < 12 if (IK.getLanguage() == Language::C) { Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind(Language::C), T, PPOpts); } @@ -149,6 +151,18 @@ Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind(Language::CXX), T, PPOpts, LSTD); } else if(IK.getLanguage() == Language::OpenCL) { +#else + vector<string> includes; + if (IK.getLanguage() == Language::C) { + Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind(Language::C), T, includes); + } + else if (IK.getLanguage() == Language::CXX) { + // ISSUE: it might cause some problems when building AST + // for a function which has a non-declared callee, e.g., + // It results an empty AST for the caller. + Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind(Language::CXX), T, includes, LSTD); + } + else if(IK.getLanguage() == Language::OpenCL) { #endif //Commandline parameters std::vector<const char*> Args; @@ -183,7 +197,12 @@ #else InputKind::OpenCL, #endif + +#if LLVM_VERSION_MAJOR < 12 T, PPOpts); +#else + T, includes); +#endif } else { ErrorMsg = "Unsupported file type!"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/CMakeLists.txt new/cvise-2.3.0+git.20210309.0a14640/cvise/CMakeLists.txt --- old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/CMakeLists.txt 2021-03-04 13:49:32.000000000 +0100 +++ new/cvise-2.3.0+git.20210309.0a14640/cvise/CMakeLists.txt 2021-03-09 10:47:27.000000000 +0100 @@ -67,6 +67,7 @@ "pass_groups/all.json" "pass_groups/opencl-120.json" "pass_groups/delta.json" + "pass_groups/binary.json" "passes/__init__.py" "passes/abstract.py" "passes/balanced.py" @@ -75,6 +76,7 @@ "passes/clangbinarysearch.py" "passes/clex.py" "passes/comments.py" + "passes/gcdabinary.py" "passes/ifs.py" "passes/includeincludes.py" "passes/includes.py" @@ -99,6 +101,7 @@ "tests/test_ternary.py" "utils/__init__.py" "utils/error.py" + "utils/misc.py" "utils/nestedmatcher.py" "utils/readkey.py" "utils/statistics.py" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/cvise.py new/cvise-2.3.0+git.20210309.0a14640/cvise/cvise.py --- old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/cvise.py 2021-03-04 13:49:32.000000000 +0100 +++ new/cvise-2.3.0+git.20210309.0a14640/cvise/cvise.py 2021-03-09 10:47:27.000000000 +0100 @@ -9,6 +9,7 @@ from cvise.passes.clangbinarysearch import ClangBinarySearchPass from cvise.passes.clex import ClexPass from cvise.passes.comments import CommentsPass +from cvise.passes.gcdabinary import GCDABinaryPass from cvise.passes.ifs import IfPass from cvise.passes.includeincludes import IncludeIncludesPass from cvise.passes.includes import IncludesPass @@ -42,6 +43,7 @@ 'clangbinarysearch': ClangBinarySearchPass, 'clex': ClexPass, 'comments': CommentsPass, + 'gcda-binary': GCDABinaryPass, 'ifs': IfPass, 'includeincludes': IncludeIncludesPass, 'includes': IncludesPass, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/pass_groups/binary.json new/cvise-2.3.0+git.20210309.0a14640/cvise/pass_groups/binary.json --- old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/pass_groups/binary.json 1970-01-01 01:00:00.000000000 +0100 +++ new/cvise-2.3.0+git.20210309.0a14640/cvise/pass_groups/binary.json 2021-03-09 10:47:27.000000000 +0100 @@ -0,0 +1,8 @@ +{ "first": [ + {"pass": "gcda-binary", "arg": "None" } + ], + "main": [ + ], + "last": [ + ] +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/passes/gcdabinary.py new/cvise-2.3.0+git.20210309.0a14640/cvise/passes/gcdabinary.py --- old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/passes/gcdabinary.py 1970-01-01 01:00:00.000000000 +0100 +++ new/cvise-2.3.0+git.20210309.0a14640/cvise/passes/gcdabinary.py 2021-03-09 10:47:27.000000000 +0100 @@ -0,0 +1,56 @@ +import logging +import os +import shutil +import subprocess +import tempfile + +from cvise.passes.abstract import AbstractPass, BinaryState, PassResult + + +class GCDABinaryPass(AbstractPass): + def check_prerequisites(self): + return self.check_external_program('gcov-dump') + + def __create_state(self, test_case): + try: + proc = subprocess.run([self.external_programs['gcov-dump'], '-p', test_case], encoding='utf8', timeout=1, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + if proc.returncode != 0: + logging.warning(f'gcov-dump -p failed: {proc.stderr}') + return None + functions = [] + for line in proc.stdout.splitlines(): + parts = line.split(':') + if 'FUNCTION' in line and len(parts) >= 5: + functions.append(4 * int(parts[1])) + + state = BinaryState.create(len(functions)) + state.functions = functions + return state + except subprocess.SubprocessError as e: + logging.warning(f'gcov-dump -p failed: {e}') + return None + + def new(self, test_case, check_sanity=None): + return self.__create_state(test_case) + + def advance(self, test_case, state): + return state.advance() + + def advance_on_success(self, test_case, state): + return self.__create_state(test_case) + + def transform(self, test_case, state, process_event_notifier): + data = open(test_case, 'rb').read() + old_len = len(data) + newdata = data[0:state.functions[state.index]] + if state.end() < len(state.functions): + newdata += data[state.functions[state.end()]:] + assert len(newdata) < old_len + + tmp = os.path.dirname(test_case) + with tempfile.NamedTemporaryFile(mode='wb', delete=False, dir=tmp) as tmp_file: + tmp_file.write(newdata) + + shutil.move(tmp_file.name, test_case) + return (PassResult.OK, state) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/passes/lines.py new/cvise-2.3.0+git.20210309.0a14640/cvise/passes/lines.py --- old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/passes/lines.py 2021-03-04 13:49:32.000000000 +0100 +++ new/cvise-2.3.0+git.20210309.0a14640/cvise/passes/lines.py 2021-03-09 10:47:27.000000000 +0100 @@ -33,8 +33,8 @@ shutil.move(tmp_file.name, test_case) try: check_sanity() + os.unlink(backup.name) except InsaneTestCaseError: - shutil.move(backup.name, test_case) # if we are not the first lines pass, we should bail out if self.arg != '0': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/utils/misc.py new/cvise-2.3.0+git.20210309.0a14640/cvise/utils/misc.py --- old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/utils/misc.py 1970-01-01 01:00:00.000000000 +0100 +++ new/cvise-2.3.0+git.20210309.0a14640/cvise/utils/misc.py 2021-03-09 10:47:27.000000000 +0100 @@ -0,0 +1,6 @@ +def is_readable_file(filename): + try: + open(filename).read() + return True + except UnicodeDecodeError: + return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/utils/testing.py new/cvise-2.3.0+git.20210309.0a14640/cvise/utils/testing.py --- old/cvise-2.2.0+git.20210304.4c7f4cd/cvise/utils/testing.py 2021-03-04 13:49:32.000000000 +0100 +++ new/cvise-2.3.0+git.20210309.0a14640/cvise/utils/testing.py 2021-03-09 10:47:27.000000000 +0100 @@ -19,6 +19,7 @@ from cvise.utils.error import InvalidTestCaseError from cvise.utils.error import PassBugError from cvise.utils.error import ZeroSizeError +from cvise.utils.misc import is_readable_file from cvise.utils.readkey import KeyLogger import pebble import psutil @@ -203,8 +204,9 @@ def get_line_count(files): lines = 0 for file in files: - with open(file) as f: - lines += len([line for line in f.readlines() if line and not line.isspace()]) + if is_readable_file(file): + with open(file) as f: + lines += len([line for line in f.readlines() if line and not line.isspace()]) return lines def backup_test_cases(self): @@ -482,7 +484,7 @@ continue if not self.no_cache: - with open(test_case, mode='r+') as tmp_file: + with open(test_case, mode='rb+') as tmp_file: test_case_before_pass = tmp_file.read() if (pass_key in self.cache and @@ -520,7 +522,7 @@ # Cache result of this pass if not self.no_cache: - with open(test_case, mode='r') as tmp_file: + with open(test_case, mode='rb') as tmp_file: if pass_key not in self.cache: self.cache[pass_key] = {} @@ -541,4 +543,6 @@ self.pass_statistic.add_success(self.current_pass) pct = 100 - (self.total_file_size * 100.0 / self.orig_total_file_size) - logging.info('({}%, {} bytes, {} lines)'.format(round(pct, 1), self.total_file_size, self.total_line_count)) + msg = f'({round(pct, 1)}%, {self.total_file_size} bytes' + msg += f', {self.total_line_count} lines)' if self.total_line_count else ')' + logging.info(msg) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cvise-2.2.0+git.20210304.4c7f4cd/cvise.py new/cvise-2.3.0+git.20210309.0a14640/cvise.py --- old/cvise-2.2.0+git.20210304.4c7f4cd/cvise.py 2021-03-04 13:49:32.000000000 +0100 +++ new/cvise-2.3.0+git.20210309.0a14640/cvise.py 2021-03-09 10:47:27.000000000 +0100 @@ -21,8 +21,7 @@ from cvise.cvise import CVise # noqa: E402 from cvise.passes.abstract import AbstractPass # noqa: E402 -from cvise.utils import statistics # noqa: E402 -from cvise.utils import testing # noqa: E402 +from cvise.utils import misc, statistics, testing # noqa: E402 from cvise.utils.error import CViseError # noqa: E402 from cvise.utils.error import MissingPassGroupsError # noqa: E402 import psutil # noqa: E402 @@ -62,6 +61,7 @@ 'clex': 'clex', 'topformflat': 'delta', 'unifdef': None, + 'gcov-dump': None } for prog, local_folder in programs.items(): @@ -303,10 +303,11 @@ print('Reduced test-cases:\n') for test_case in sorted(test_manager.test_cases): - print(f'--- {test_case} ---') - with open(test_case) as test_case_file: - print(test_case_file.read()) + if misc.is_readable_file(test_case): + print(f'--- {test_case} ---') + with open(test_case) as test_case_file: + print(test_case_file.read()) if script: - os.remove(script.name) + os.unlink(script.name) logging.shutdown()
