diff --git a/core/tester.py b/core/tester.py index e249752..031eab0 100644 --- a/core/tester.py +++ b/core/tester.py @@ -106,16 +106,16 @@ def run(self) -> None: def load_tests(self, name): core.log_open_sec(name.capitalize() + " tests") - tests_subdir = os.path.join(self.config.get('dirs', 'tests'), name) +# tests_subdir = os.path.join(self.config.get('dirs', 'tests'), name) tests = [] - for td in os.listdir(tests_subdir): - test = f'{name}/{td}' - if test not in self.exclude and (len(self.include) == 0 or test in self.include): - core.log(f"Adding test {test}") - tests.append(Test(os.path.join(tests_subdir, td), td)) - else: - core.log(f"Skipped test {test}") - core.log_end_sec() +# for td in os.listdir(tests_subdir): +# test = f'{name}/{td}' +# if test not in self.exclude and (len(self.include) == 0 or test in self.include): +# core.log(f"Adding test {test}") +# tests.append(Test(os.path.join(tests_subdir, td), td)) +# else: +# core.log(f"Skipped test {test}") +# core.log_end_sec() return tests diff --git a/core/tree.py b/core/tree.py index ad3bff9..1130d47 100644 --- a/core/tree.py +++ b/core/tree.py @@ -213,6 +213,23 @@ def check_applies_with_depends(self, thing): return ret + def push_tree(self, series_id, patch_ids): + try: + if not patch_ids: + print(f"{series_id} has no patches") + return + + patch_ids.reverse() + for id in patch_ids: + name = f"{id}->{self.name}" + self.git(["checkout", "-B", name]) + self.git(["push", "github", name]) + print(f"pushed {name} to git**b") + self.git(["checkout", "HEAD~1"]) + + except CMD.CmdError as e: + raise PatchApplyError(e) from e + def _pull_safe(self, pull_url): try: self.git_pull(pull_url) diff --git a/pw/pw_series.py b/pw/pw_series.py index f974245..c5ba274 100644 --- a/pw/pw_series.py +++ b/pw/pw_series.py @@ -19,6 +19,7 @@ def __init__(self, pw, pw_series): self.pw_series = pw_series # pull_url loaded from patch 0, not from cover; it's for pure pulls only self.pull_url = None + self.patch_ids = [] if pw_series['cover_letter']: pw_cover_letter = pw.get_mbox('cover', pw_series['cover_letter']['id']) @@ -37,6 +38,7 @@ def __init__(self, pw, pw_series): for p in self.pw_series['patches']: raw_patch = pw.get_mbox('patch', p['id']) self.patches.append(Patch(raw_patch, p['id'])) + self.patch_ids.append(p['id']) return # Do more magic around series which are complete @@ -73,6 +75,7 @@ def __init__(self, pw, pw_series): for pid in pids: raw_patch = pw.get_mbox('patch', pid) self.patches.append(Patch(raw_patch, pid)) + self.patch_ids.append(pid) if not pw_series['cover_letter']: if len(self.patches) == 1: diff --git a/pw_poller.py b/pw_poller.py index e35c2c5..edb9d94 100755 --- a/pw_poller.py +++ b/pw_poller.py @@ -115,6 +115,8 @@ def _series_determine_tree(self, s: PwSeries) -> str: elif "master" in self._trees and self._trees["master"].check_applies(s): s.tree_name = "master" + self.series_push_github(s) + if hasattr(s, 'tree_name') and s.tree_name: log(f"Target tree - {s.tree_name}", "") res = f"Guessed tree name to be {s.tree_name}" @@ -135,6 +137,21 @@ def series_determine_tree(self, s: PwSeries) -> str: return ret + def series_push_github(self, s: PwSeries): + log_open_sec('Pushing the tree') + + patch_ids = list() + + for patch in s['patches']: + patch_ids.append(patch['id']) + + try: + if hasattr(s, 'tree_name') and s.tree_name and patch_ids: + print(f"{patch_ids}") + self._trees[s.tree_name].push_tree(s.id, patch_ids) + finally: + log_end_sec() + def _process_series(self, pw_series) -> None: if pw_series['id'] in self.seen_series: log(f"Already seen {pw_series['id']}", "") @@ -157,7 +174,9 @@ def _process_series(self, pw_series) -> None: if hasattr(s, 'tree_name') and s.tree_name: s.tree_selection_comment = comment - self._workers[s.tree_name].queue.put(s) + #self._workers[s.tree_name].queue.put(s) + core.write_tree_selection_result(self.result_dir, s, comment, False) + core.mark_done(self.result_dir, s) else: core.write_tree_selection_result(self.result_dir, s, comment, False) core.mark_done(self.result_dir, s) diff --git a/tests/patch/build_32bit/build_32bit.sh b/tests/patch/build_32bit/build_32bit.sh deleted file mode 100755 index c659579..0000000 --- a/tests/patch/build_32bit/build_32bit.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -cc="ccache gcc" -output_dir=build_32bit/ -ncpu=$(grep -c processor /proc/cpuinfo) -build_flags="-Oline -j $ncpu W=1 C=1" -tmpfile_o=$(mktemp) -tmpfile_n=$(mktemp) -rc=0 - -prep_config() { - make CC="$cc" O=$output_dir ARCH=i386 allmodconfig - ./scripts/config --file $output_dir/.config -d werror -} - -echo "Using $build_flags redirect to $tmpfile_o and $tmpfile_n" -echo "CC=$cc" -"$cc" --version | head -n1 - -HEAD=$(git rev-parse HEAD) - -echo "Tree base:" -git log -1 --pretty='%h ("%s")' HEAD~ - -echo "Baseline building the tree" - -prep_config -make CC="$cc" O=$output_dir ARCH=i386 $build_flags - -git checkout -q HEAD~ - -echo "Building the tree before the patch" - -prep_config -make CC="$cc" O=$output_dir ARCH=i386 $build_flags 2> >(tee $tmpfile_o >&2) -incumbent=$(grep -i -c "\(warn\|error\)" $tmpfile_o) - -echo "Building the tree with the patch" - -git checkout -q $HEAD - -prep_config -make CC="$cc" O=$output_dir ARCH=i386 $build_flags -j $ncpu 2> >(tee $tmpfile_n >&2) || rc=1 - -current=$(grep -i -c "\(warn\|error\)" $tmpfile_n) - -echo "Errors and warnings before: $incumbent this patch: $current" >&$DESC_FD - -if [ $current -gt $incumbent ]; then - echo "New errors added" 1>&2 - diff -U 0 $tmpfile_o $tmpfile_n 1>&2 - - echo "Per-file breakdown" 1>&2 - tmpfile_fo=$(mktemp) - tmpfile_fn=$(mktemp) - - grep -i "\(warn\|error\)" $tmpfile_o | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fo - grep -i "\(warn\|error\)" $tmpfile_n | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fn - - diff -U 0 $tmpfile_fo $tmpfile_fn 1>&2 - rm $tmpfile_fo $tmpfile_fn - - rc=1 -fi - -rm $tmpfile_o $tmpfile_n - -exit $rc diff --git a/tests/patch/build_32bit/info.json b/tests/patch/build_32bit/info.json deleted file mode 100644 index 63c9a16..0000000 --- a/tests/patch/build_32bit/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "run": ["build_32bit.sh"], - "pull-requests": true -} diff --git a/tests/patch/build_allmodconfig_warn/build_allmodconfig.sh b/tests/patch/build_allmodconfig_warn/build_allmodconfig.sh deleted file mode 100755 index 2fd5fca..0000000 --- a/tests/patch/build_allmodconfig_warn/build_allmodconfig.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -cc="ccache gcc" -output_dir=build_allmodconfig_warn/ -ncpu=$(grep -c processor /proc/cpuinfo) -build_flags="-Oline -j $ncpu W=1 C=1" -tmpfile_o=$(mktemp) -tmpfile_n=$(mktemp) -rc=0 - -prep_config() { - make CC="$cc" O=$output_dir allmodconfig - ./scripts/config --file $output_dir/.config -d werror -} - -echo "Using $build_flags redirect to $tmpfile_o and $tmpfile_n" -echo "CC=$cc" -"$cc" --version | head -n1 - -HEAD=$(git rev-parse HEAD) - -echo "Tree base:" -git log -1 --pretty='%h ("%s")' HEAD~ - -echo "Baseline building the tree" - -prep_config -make CC="$cc" O=$output_dir $build_flags - -git checkout -q HEAD~ - -echo "Building the tree before the patch" - -prep_config -make CC="$cc" O=$output_dir $build_flags 2> >(tee $tmpfile_o >&2) -incumbent=$(grep -i -c "\(warn\|error\)" $tmpfile_o) - -echo "Building the tree with the patch" - -git checkout -q $HEAD - -prep_config -make CC="$cc" O=$output_dir $build_flags -j $ncpu 2> >(tee $tmpfile_n >&2) || rc=1 - -current=$(grep -i -c "\(warn\|error\)" $tmpfile_n) - -echo "Errors and warnings before: $incumbent this patch: $current" >&$DESC_FD - -if [ $current -gt $incumbent ]; then - echo "New errors added" 1>&2 - diff -U 0 $tmpfile_o $tmpfile_n 1>&2 - - echo "Per-file breakdown" 1>&2 - tmpfile_fo=$(mktemp) - tmpfile_fn=$(mktemp) - - grep -i "\(warn\|error\)" $tmpfile_o | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fo - grep -i "\(warn\|error\)" $tmpfile_n | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fn - - diff -U 0 $tmpfile_fo $tmpfile_fn 1>&2 - rm $tmpfile_fo $tmpfile_fn - - rc=1 -fi - -rm $tmpfile_o $tmpfile_n - -exit $rc diff --git a/tests/patch/build_allmodconfig_warn/info.json b/tests/patch/build_allmodconfig_warn/info.json deleted file mode 100644 index ad54b50..0000000 --- a/tests/patch/build_allmodconfig_warn/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "run": ["build_allmodconfig.sh"], - "pull-requests": true -} diff --git a/tests/patch/build_clang/build_clang.sh b/tests/patch/build_clang/build_clang.sh deleted file mode 100755 index da20730..0000000 --- a/tests/patch/build_clang/build_clang.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -cc="ccache clang" -output_dir=build_clang/ -ncpu=$(grep -c processor /proc/cpuinfo) -build_flags="-Oline -j $ncpu W=1" -tmpfile_o=$(mktemp) -tmpfile_n=$(mktemp) -rc=0 - -prep_config() { - make CC="$cc" O=$output_dir allmodconfig - ./scripts/config --file $output_dir/.config -d werror -} - -echo "Using $build_flags redirect to $tmpfile_o and $tmpfile_n" -echo "CC=$cc" -"$cc" --version | head -n1 - -HEAD=$(git rev-parse HEAD) - -echo "Tree base:" -git log -1 --pretty='%h ("%s")' HEAD~ - -echo "Baseline building the tree" - -prep_config -make CC="$cc" O=$output_dir $build_flags - -git checkout -q HEAD~ - -echo "Building the tree before the patch" - -prep_config -make CC="$cc" O=$output_dir $build_flags 2> >(tee $tmpfile_o >&2) -incumbent=$(grep -i -c "\(warn\|error\)" $tmpfile_o) - -echo "Building the tree with the patch" - -git checkout -q $HEAD - -prep_config -make CC="$cc" O=$output_dir $build_flags -j $ncpu 2> >(tee $tmpfile_n >&2) || rc=1 - -current=$(grep -i -c "\(warn\|error\)" $tmpfile_n) - -echo "Errors and warnings before: $incumbent this patch: $current" >&$DESC_FD - -if [ $current -gt $incumbent ]; then - echo "New errors added" 1>&2 - diff -U 0 $tmpfile_o $tmpfile_n 1>&2 - - echo "Per-file breakdown" 1>&2 - tmpfile_fo=$(mktemp) - tmpfile_fn=$(mktemp) - - grep -i "\(warn\|error\)" $tmpfile_o | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fo - grep -i "\(warn\|error\)" $tmpfile_n | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fn - - diff -U 0 $tmpfile_fo $tmpfile_fn 1>&2 - rm $tmpfile_fo $tmpfile_fn - - rc=1 -fi - -rm $tmpfile_o $tmpfile_n - -exit $rc diff --git a/tests/patch/build_clang/info.json b/tests/patch/build_clang/info.json deleted file mode 100644 index e91e26d..0000000 --- a/tests/patch/build_clang/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "run": ["build_clang.sh"], - "pull-requests": true -} diff --git a/tests/patch/cc_maintainers/info.json b/tests/patch/cc_maintainers/info.json deleted file mode 100644 index a8e0459..0000000 --- a/tests/patch/cc_maintainers/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pymod": "test", - "pyfunc": "cc_maintainers" -} diff --git a/tests/patch/cc_maintainers/test.py b/tests/patch/cc_maintainers/test.py deleted file mode 100644 index d0f0b57..0000000 --- a/tests/patch/cc_maintainers/test.py +++ /dev/null @@ -1,111 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2020 Facebook - -from typing import Tuple -import email -import email.utils -import subprocess -import tempfile -import os -import re -""" Test if relevant maintainers were CCed """ - -emailpat = re.compile(r'([^ <"]*@[^ >"]*)') - -ignore_emails = { - 'linux-kernel@vger.kernel.org', # Don't expect people to CC LKML on everything - 'nipa@patchwork.hopto.org', # For new files NIPA will get marked as committer - 'jeffrey.t.kirsher@intel.com' -} - -# Maintainers who don't CC their co-employees -maintainers = { - 'michael.chan@broadcom.com': ['@broadcom.com'], - 'huangguangbin2@huawei.com': ['@huawei.com', '@hisilicon.com'], - 'anthony.l.nguyen@intel.com': ['@intel.com', '@lists.osuosl.org'], - 'saeed@kernel.org': [ - '@nvidia.com', '@mellanox.com', 'leon@kernel.org', 'linux-rdma@vger.kernel.org' - ] -} - -local_map = ["Vladimir Oltean "] - - -def cc_maintainers(tree, thing, result_dir) -> Tuple[int, str]: - patch = thing - - msg = email.message_from_string(patch.raw_patch) - addrs = msg.get_all('to', []) - addrs += msg.get_all('cc', []) - addrs += msg.get_all('from', []) - addrs += msg.get_all('sender', []) - included = set([e for n, e in email.utils.getaddresses(addrs)]) - - ignore_domains = [] - sender_from = msg.get_all('from', ['nobody@nothing'])[0] - match = emailpat.search(sender_from) - if match: - sender = match.group(1) - if sender in maintainers: - ignore_domains = maintainers[sender] - - expected = set() - blamed = set() - ignored = set() - with tempfile.NamedTemporaryFile() as fp: - patch.write_out(fp) - command = ['./scripts/get_maintainer.pl', '--git-min-percent', '25', '--', fp.name] - with subprocess.Popen(command, cwd=tree.path, stdout=subprocess.PIPE) as p: - line = p.stdout.readline().decode('utf8', 'replace') - while line: - match = emailpat.search(line) - if match: - addr = match.group(1) - expected.add(addr) - if 'blamed_fixes' in line: - blamed.add(addr) - for domain in ignore_domains: - if domain in addr: - ignored.add(addr) - line = p.stdout.readline().decode('utf8', 'replace') - p.wait() - - expected.difference_update(ignore_emails) - blamed.difference_update(ignore_emails) - - expected.difference_update(ignored) - blamed.difference_update(ignored) - - found = expected.intersection(included) - missing = expected.difference(included) - missing_blamed = blamed.difference(included) - - # Last resort, sift thru aliases - if len(missing): - with open(os.path.join(tree.path, '.mailmap'), 'r') as f: - mmap_lines = f.readlines() - mmap_lines += local_map - - mapped = set() - for m in missing: - for line in mmap_lines: - if m in line: - mmap_emails = emailpat.findall(line) - if m not in mmap_emails: # re-check the match with the real regex - continue - for have in included: - if have in mmap_emails: - mapped.add(m) - - found.update(mapped) - missing.difference_update(mapped) - missing_blamed.difference_update(mapped) - - if len(missing_blamed): - return 1, f"{len(missing_blamed)} blamed authors not CCed: {' '.join(missing_blamed)}; " + \ - f"{len(missing)} maintainers not CCed: {' '.join(missing)}" - if len(missing): - ret = 250 if len(found) > 1 else 1 - return ret, f"{len(missing)} maintainers not CCed: {' '.join(missing)}" - return 0, f"CCed {len(found)} of {len(expected)} maintainers" diff --git a/tests/patch/check_selftest/check_selftest.sh b/tests/patch/check_selftest/check_selftest.sh deleted file mode 100755 index e6ce905..0000000 --- a/tests/patch/check_selftest/check_selftest.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Check if the shell selftest scripts are in correspond Makefile - -rt=0 - -files=$(git show --pretty="" --name-only -- tools/testing/selftests*.sh) -if [ -z "$files" ]; then - echo "No net selftest shell script" >&$DESC_FD - exit $rt -fi - -for file in $files; do - f=$(basename $file) - d=$(dirname $file) - if [ -f "${d}/Makefile" ] && ! grep -P "[\t| ]${f}" ${d}/Makefile; then - echo "Script ${f} not found in ${d}/Makefile" >&$DESC_FD - rt=1 - fi -done - -[ ${rt} -eq 0 ] && echo "net selftest script(s) already in Makefile" >&$DESC_FD - -exit $rt diff --git a/tests/patch/check_selftest/info.json b/tests/patch/check_selftest/info.json deleted file mode 100644 index 615779f..0000000 --- a/tests/patch/check_selftest/info.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "run": ["check_selftest.sh"] -} diff --git a/tests/patch/checkpatch/checkpatch.sh b/tests/patch/checkpatch/checkpatch.sh deleted file mode 100755 index 2a95905..0000000 --- a/tests/patch/checkpatch/checkpatch.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -IGNORED=\ -COMMIT_LOG_LONG_LINE,\ -MACRO_ARG_REUSE,\ -ALLOC_SIZEOF_STRUCT,\ -NO_AUTHOR_SIGN_OFF,\ -GIT_COMMIT_ID,\ -CAMELCASE - -tmpfile=$(mktemp) - -./scripts/checkpatch.pl --strict --max-line-length=80 --ignore=$IGNORED -g HEAD | tee $tmpfile - -grep 'total: 0 errors, 0 warnings, 0 checks' $tmpfile -ret=$? - -# return 250 (warning) if there are not errors -[ $ret -ne 0 ] && grep -P 'total: 0 errors, \d+ warnings, \d+ checks' $tmpfile && ret=250 - -if [ $ret -ne 0 ]; then - grep '\(WARNING\|ERROR\|CHECK\): ' $tmpfile | LC_COLLATE=C sort -u >&$DESC_FD -else - grep 'total: ' $tmpfile | LC_COLLATE=C sort -u >&$DESC_FD -fi - -rm $tmpfile - -exit $ret - -# ./scripts/checkpatch.pl --ignore=SPACING_CAST,LONG_LINE,LONG_LINE_COMMENT,LONG_LINE_STRING,LINE_SPACING_STRUCT,FILE_PATH_CHANGES,CAMELCASE,OPEN_ENDED_LINE,AVOID_EXTERNS_HEADER,UNCOMMENTED_DEFINITION diff --git a/tests/patch/checkpatch/info.json b/tests/patch/checkpatch/info.json deleted file mode 100644 index 357a5c2..0000000 --- a/tests/patch/checkpatch/info.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "run": ["checkpatch.sh"] -} diff --git a/tests/patch/header_inline/header_inline.sh b/tests/patch/header_inline/header_inline.sh deleted file mode 100755 index 1b54911..0000000 --- a/tests/patch/header_inline/header_inline.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2020 Facebook - -inlines=$( - git show -- '*.h' | grep -C1 -P '^\+static (?!(__always_)?inline).*\('; - git show -- '*.h' | grep -C1 -P '^\+(static )?(?!(__always_)?inline )((unsigned|long|short) )*(char|bool|void|int|u[0-9]*) [0-9A-Za-z_]*\(.*\) *{' - ) - -if [ -z "$inlines" ]; then - echo "No static functions without inline keyword in header files" >&$DESC_FD - exit 0 -else - msg="Detected static functions without inline keyword in header files:" - echo -e "$msg\n$inlines" 1>&2 - count=$( (echo "---"; echo "$inlines") | grep '^---$' | wc -l) - echo "$msg $count" >&$DESC_FD - exit 1 -fi diff --git a/tests/patch/header_inline/info.json b/tests/patch/header_inline/info.json deleted file mode 100644 index d27d067..0000000 --- a/tests/patch/header_inline/info.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "run": ["header_inline.sh"] -} diff --git a/tests/patch/kdoc/info.json b/tests/patch/kdoc/info.json deleted file mode 100644 index a409c44..0000000 --- a/tests/patch/kdoc/info.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "run": ["kdoc.sh"] -} diff --git a/tests/patch/kdoc/kdoc.sh b/tests/patch/kdoc/kdoc.sh deleted file mode 100755 index 88c574c..0000000 --- a/tests/patch/kdoc/kdoc.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. -# Copyright (c) 2020 Facebook - -tmpfile_o=$(mktemp) -tmpfile_n=$(mktemp) -rc=0 - -files=$(git show --pretty="" --name-only HEAD) - -HEAD=$(git rev-parse HEAD) - -echo "Checking the tree before the patch" -git checkout -q HEAD~ -./scripts/kernel-doc -none $files 2> >(tee $tmpfile_o >&2) - -incumbent=$(grep -v 'Error: Cannot open file ' $tmpfile_o | wc -l) - -echo "Checking the tree with the patch" - -git checkout -q $HEAD -./scripts/kernel-doc -none $files 2> >(tee $tmpfile_n >&2) - -current=$(grep -v 'Error: Cannot open file ' $tmpfile_n | wc -l) - -echo "Errors and warnings before: $incumbent this patch: $current" >&$DESC_FD - -if [ $current -gt $incumbent ]; then - echo "New warnings added" 1>&2 - diff $tmpfile_o $tmpfile_n 1>&2 - - echo "Per-file breakdown" 1>&2 - tmpfile_fo=$(mktemp) - tmpfile_fn=$(mktemp) - - grep -i "\(warn\|error\)" $tmpfile_o | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fo - grep -i "\(warn\|error\)" $tmpfile_n | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fn - - diff $tmpfile_fo $tmpfile_fn 1>&2 - rm $tmpfile_fo $tmpfile_fn - - rc=1 -fi - -rm $tmpfile_o $tmpfile_n - -exit $rc diff --git a/tests/patch/maintainers/info.json b/tests/patch/maintainers/info.json deleted file mode 100644 index 26f8179..0000000 --- a/tests/patch/maintainers/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "run": ["maintainers.sh"], - "disabled": true -} diff --git a/tests/patch/maintainers/maintainers.sh b/tests/patch/maintainers/maintainers.sh deleted file mode 100755 index bb50ca6..0000000 --- a/tests/patch/maintainers/maintainers.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 - -if git diff-index --quiet --name-only HEAD~ -- MAINTAINERS; then - echo "MAINTAINERS not touched" >&$DESC_FD - exit 0 -fi - -tmpfile_o=$(mktemp) -tmpfile_n=$(mktemp) -rc=0 - -echo "MAINTAINERS self-test: redirect to $tmpfile_o and $tmpfile_n" - -HEAD=$(git rev-parse HEAD) - -git checkout -q HEAD~ - -echo "Checking old warning count" - -./scripts/get_maintainer.pl --self-test 2> >(tee $tmpfile_o >&2) -incumbent=$(grep -i -c "\(warn\|error\)" $tmpfile_o) - -echo "Checking new warning count" - -git checkout -q $HEAD - -./scripts/get_maintainer.pl --self-test 2> >(tee $tmpfile_n >&2) -current=$(grep -i -c "\(warn\|error\)" $tmpfile_n) - -echo "Errors and warnings before: $incumbent this patch: $current" >&$DESC_FD - -if [ $current -gt $incumbent ]; then - echo "New errors added" 1>&2 - diff $tmpfile_o $tmpfile_n 1>&2 - - rc=1 -fi - -rm $tmpfile_o $tmpfile_n - -exit $rc diff --git a/tests/patch/module_param/info.json b/tests/patch/module_param/info.json deleted file mode 100644 index c6d11d9..0000000 --- a/tests/patch/module_param/info.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "run": ["module_param.sh"] -} diff --git a/tests/patch/module_param/module_param.sh b/tests/patch/module_param/module_param.sh deleted file mode 100755 index a7c061c..0000000 --- a/tests/patch/module_param/module_param.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2020 Facebook - -params=$(git show | grep -i '^\+.*module_param') -new_params=$(git show | grep -ic '^\+.*module_param') -old_params=$(git show | grep -ic '^\-.*module_param') - -echo "Was $old_params now: $new_params" >&$DESC_FD - -if [ -z "$params" ]; then - exit 0 -else - echo -e "Detected module_param\n$params" 1>&2 - - if [ $new_params -eq $old_params ]; then - exit 250 - else - exit 1 - fi -fi diff --git a/tests/patch/signed/info.json b/tests/patch/signed/info.json deleted file mode 100644 index 0fce6f7..0000000 --- a/tests/patch/signed/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pymod": "test", - "pyfunc": "signed" -} diff --git a/tests/patch/signed/selftest/bad.mbox b/tests/patch/signed/selftest/bad.mbox deleted file mode 100644 index fb26490..0000000 --- a/tests/patch/signed/selftest/bad.mbox +++ /dev/null @@ -1,106 +0,0 @@ -From a0cde59a3a25d2708d8ae62488559e9974798cd8 Mon Sep 17 00:00:00 2001 -From: Kees Cook -Date: Fri, 17 Sep 2021 07:49:38 +1000 -Subject: [PATCH v3 1/8] rapidio: Avoid bogus __alloc_size warning -To: Andrew Morton -X-Developer-Signature: v=1; a=openpgp-sha256; l=3560; h=from:subject; - bh=d94GdIidGnmnix6Lfr4v5jKawcjolJm1KlCBxnnJy6k=; - b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBhVjm22lbILpU3a928XS7AjfDqGHN2fNCgtxXpqL4C - vZpYRAqJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYVY5tgAKCRCJcvTf3G3AJoJAEA - CkQ4KHKGJZGbYmK+l1h5sRm1VUBh6JfQZa/gzvXJbs5XaNgP24EPw8Dnih4znZJD1ATTwTmsErFD+Q - GZ6OxclhvrD/Vl0n+y95WYCyiegLqupRVyVFFRo/b1orpbSJhekIx+wLfu5K82nwfR/z3fqHspd6Jb - C25b2/S4YVArCQx5p/IuFXg8MkHWWwVJGUtFz8bBY4Q1tNHUXbXLWxD6TrGhzWXHRTElkTlX6qC8L2 - kkoQerLVTHGEpiXZ7dRR87HWTpaWfUDSt7bcTbf3OEIwZMiD2CUSmascMBmaCN9Lm2CYzFbnJj59Z3 - QhDesB6qHk3d2G31rFJolLcoutGjK3X+AJiFJX8Q5LkbMNhoM1xPVcrkb1hill82zRek3uIYvFmoal - TWtTKlV7b7M04qtOznFW+wyE1HsAIF/XWpHZ/T7dmjAY38+EG/JV8bSiWFJ3DN2/kMH3opOPMPqLm8 - 7HktqHnvYvAiun7gBTv+lcoY76OVlmWVuhVEqb+NeVsK0ycLvO6PlLnO5x+btj22XbuHnKNCRG4k2S - OeBHJ+KPdk9sja34I/vFVHDfMVK5iy4mXCdbe4ip4w3Ov6jjqjsb6epT+yg3BIMUCScGfAsg7fyA0v - HNNTdQCNlDpTzp5mOY3uIkDpIfjNhHWJg4S5+XL+hlGt8+9O4d6fE//ZNtVA== -X-Developer-Key: i=keescook@chromium.org; a=openpgp; - fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 - -After adding __alloc_size attributes to the allocators, GCC 9.3 (but not -later) may incorrectly evaluate the arguments to check_copy_size(), -getting seemingly confused by the size being returned from array_size(). -Instead, perform the calculation once, which both makes the code more -readable and avoids the bug in GCC. - - In file included from arch/x86/include/asm/preempt.h:7, - from include/linux/preempt.h:78, - from include/linux/spinlock.h:55, - from include/linux/mm_types.h:9, - from include/linux/buildid.h:5, - from include/linux/module.h:14, - from drivers/rapidio/devices/rio_mport_cdev.c:13: - In function 'check_copy_size', - inlined from 'copy_from_user' at include/linux/uaccess.h:191:6, - inlined from 'rio_mport_transfer_ioctl' at drivers/rapidio/devices/rio_mport_cdev.c:983:6: - include/linux/thread_info.h:213:4: error: call to '__bad_copy_to' declared with attribute error: copy destination size is too small - 213 | __bad_copy_to(); - | ^~~~~~~~~~~~~~~ - -But the allocation size and the copy size are identical: - - transfer = vmalloc(array_size(sizeof(*transfer), transaction.count)); - if (!transfer) - return -ENOMEM; - - if (unlikely(copy_from_user(transfer, - (void __user *)(uintptr_t)transaction.block, - array_size(sizeof(*transfer), transaction.count)))) { - -Reported-by: kernel test robot -Link: https://lore.kernel.org/linux-mm/202109091134.FHnRmRxu-lkp@intel.com/ -Cc: Matt Porter -Cc: Alexandre Bounine -Cc: Jing Xiangfeng -Cc: Ira Weiny -Cc: Souptick Joarder -Signed-off-by: Kees Cook -Reviewed-by: John Hubbard ---- - drivers/rapidio/devices/rio_mport_cdev.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c -index 94331d999d27..7df466e22282 100644 ---- a/drivers/rapidio/devices/rio_mport_cdev.c -+++ b/drivers/rapidio/devices/rio_mport_cdev.c -@@ -965,6 +965,7 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg) - struct rio_transfer_io *transfer; - enum dma_data_direction dir; - int i, ret = 0; -+ size_t size; - - if (unlikely(copy_from_user(&transaction, arg, sizeof(transaction)))) - return -EFAULT; -@@ -976,13 +977,14 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg) - priv->md->properties.transfer_mode) == 0) - return -ENODEV; - -- transfer = vmalloc(array_size(sizeof(*transfer), transaction.count)); -+ size = array_size(sizeof(*transfer), transaction.count); -+ transfer = vmalloc(size); - if (!transfer) - return -ENOMEM; - - if (unlikely(copy_from_user(transfer, - (void __user *)(uintptr_t)transaction.block, -- array_size(sizeof(*transfer), transaction.count)))) { -+ size))) { - ret = -EFAULT; - goto out_free; - } -@@ -994,8 +996,7 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg) - transaction.sync, dir, &transfer[i]); - - if (unlikely(copy_to_user((void __user *)(uintptr_t)transaction.block, -- transfer, -- array_size(sizeof(*transfer), transaction.count)))) -+ transfer, size))) - ret = -EFAULT; - - out_free: --- -2.30.2 - diff --git a/tests/patch/signed/selftest/good.mbox b/tests/patch/signed/selftest/good.mbox deleted file mode 100644 index 2920a1c..0000000 --- a/tests/patch/signed/selftest/good.mbox +++ /dev/null @@ -1,107 +0,0 @@ -From a0cde59a3a25d2708d8ae62488559e9974798cd8 Mon Sep 17 00:00:00 2001 -From: Kees Cook -Date: Fri, 17 Sep 2021 07:49:38 +1000 -Subject: [PATCH v3 1/8] rapidio: Avoid bogus __alloc_size warning -To: Andrew Morton -X-Developer-Signature: v=1; a=openpgp-sha256; l=3560; h=from:subject; - bh=d94GdIidGnmnix6Lfr4v5jKawcjolJm1KlCBxnnJy6k=; - b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBhVjm22lbILpU3a928XS7AjfDqGHN2fNCgtxXpqL4C - vZpYRAqJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYVY5tgAKCRCJcvTf3G3AJoJAEA - CkQ4KHKGJZGbYmK+l1h5sRm1VUBh6JfQZa/gzvXJbs5XaNgP24EPw8Dnih4znZJD1ATTwTmsErFD+Q - GZ6OxclhvrD/Vl0n+y95WYCyiegLqupRVyVFFRo/b1orpbSJhekIx+wLfu5K82nwfR/z3fqHspd6Jb - C25b2/S4YVArCQx5p/IuFXg8MkHWWwVJGUtFz8bBY4Q1tNHUXbXLWxD6TrGhzWXHRTElkTlX6qC8L2 - kkoQerLVTHGEpiXZ7dRR87HWTpaWfUDSt7bcTbf3OEIwZMiD2CUSmascMBmaCN9Lm2CYzFbnJj59Z3 - QhDesB6qHk3d2G31rFJolLcoutGjK3X+AJiFJX8Q5LkbMNhoM1xPVcrkb1hill82zRek3uIYvFmoal - TWtTKlV7b7M04qtOznFW+wyE1HsAIF/XWpHZ/T7dmjAY38+EG/JV8bSiWFJ3DN2/kMH3opOPMPqLm8 - 7HktqHnvYvAiun7gBTv+lcoY76OVlmWVuhVEqb+NeVsK0ycLvO6PlLnO5x+btj22XbuHnKNCRG4k2S - OeBHJ+KPdk9sja34I/vFVHDfMVK5iy4mXCdbe4ip4w3Ov6jjqjsb6epT+yg3BIMUCScGfAsg7fyA0v - HNNTdQCNlDpTzp5mOY3uIkDpIfjNhHWJg4S5+XL+hlGt8+9O4d6fE//ZNtVA== -X-Developer-Key: i=keescook@chromium.org; a=openpgp; - fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 - -After adding __alloc_size attributes to the allocators, GCC 9.3 (but not -later) may incorrectly evaluate the arguments to check_copy_size(), -getting seemingly confused by the size being returned from array_size(). -Instead, perform the calculation once, which both makes the code more -readable and avoids the bug in GCC. - - In file included from arch/x86/include/asm/preempt.h:7, - from include/linux/preempt.h:78, - from include/linux/spinlock.h:55, - from include/linux/mm_types.h:9, - from include/linux/buildid.h:5, - from include/linux/module.h:14, - from drivers/rapidio/devices/rio_mport_cdev.c:13: - In function 'check_copy_size', - inlined from 'copy_from_user' at include/linux/uaccess.h:191:6, - inlined from 'rio_mport_transfer_ioctl' at drivers/rapidio/devices/rio_mport_cdev.c:983:6: - include/linux/thread_info.h:213:4: error: call to '__bad_copy_to' declared with attribute error: copy destination size is too small - 213 | __bad_copy_to(); - | ^~~~~~~~~~~~~~~ - -But the allocation size and the copy size are identical: - - transfer = vmalloc(array_size(sizeof(*transfer), transaction.count)); - if (!transfer) - return -ENOMEM; - - if (unlikely(copy_from_user(transfer, - (void __user *)(uintptr_t)transaction.block, - array_size(sizeof(*transfer), transaction.count)))) { - -Reported-by: kernel test robot -Link: https://lore.kernel.org/linux-mm/202109091134.FHnRmRxu-lkp@intel.com/ -Cc: Matt Porter -Cc: Alexandre Bounine -Cc: Jing Xiangfeng -Cc: Ira Weiny -Cc: Souptick Joarder -Cc: Gustavo A. R. Silva -Signed-off-by: Kees Cook -Reviewed-by: John Hubbard ---- - drivers/rapidio/devices/rio_mport_cdev.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c -index 94331d999d27..7df466e22282 100644 ---- a/drivers/rapidio/devices/rio_mport_cdev.c -+++ b/drivers/rapidio/devices/rio_mport_cdev.c -@@ -965,6 +965,7 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg) - struct rio_transfer_io *transfer; - enum dma_data_direction dir; - int i, ret = 0; -+ size_t size; - - if (unlikely(copy_from_user(&transaction, arg, sizeof(transaction)))) - return -EFAULT; -@@ -976,13 +977,14 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg) - priv->md->properties.transfer_mode) == 0) - return -ENODEV; - -- transfer = vmalloc(array_size(sizeof(*transfer), transaction.count)); -+ size = array_size(sizeof(*transfer), transaction.count); -+ transfer = vmalloc(size); - if (!transfer) - return -ENOMEM; - - if (unlikely(copy_from_user(transfer, - (void __user *)(uintptr_t)transaction.block, -- array_size(sizeof(*transfer), transaction.count)))) { -+ size))) { - ret = -EFAULT; - goto out_free; - } -@@ -994,8 +996,7 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg) - transaction.sync, dir, &transfer[i]); - - if (unlikely(copy_to_user((void __user *)(uintptr_t)transaction.block, -- transfer, -- array_size(sizeof(*transfer), transaction.count)))) -+ transfer, size))) - ret = -EFAULT; - - out_free: --- -2.30.2 - diff --git a/tests/patch/signed/selftest/nokey.mbox b/tests/patch/signed/selftest/nokey.mbox deleted file mode 100644 index 01c2444..0000000 --- a/tests/patch/signed/selftest/nokey.mbox +++ /dev/null @@ -1,107 +0,0 @@ -From a0cde59a3a25d2708d8ae62488559e9974798cd8 Mon Sep 17 00:00:00 2001 -From: Kees Cook -Date: Fri, 17 Sep 2021 07:49:38 +1000 -Subject: [PATCH v3 1/8] rapidio: Avoid bogus __alloc_size warning -To: Andrew Morton -X-Developer-Signature: v=1; a=openpgp-sha256; l=3560; h=from:subject; - bh=d94GdIidGnmnix6Lfr4v5jKawcjolJm1KlCBxnnJy6k=; - b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBhVjm22lbILpU3a928XS7AjfDqGHN2fNCgtxXpqL4C - vZpYRAqJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYVY5tgAKCRCJcvTf3G3AJoJAEA - CkQ4KHKGJZGbYmK+l1h5sRm1VUBh6JfQZa/gzvXJbs5XaNgP24EPw8Dnih4znZJD1ATTwTmsErFD+Q - GZ6OxclhvrD/Vl0n+y95WYCyiegLqupRVyVFFRo/b1orpbSJhekIx+wLfu5K82nwfR/z3fqHspd6Jb - C25b2/S4YVArCQx5p/FuFXg8MkHWWwVJGUtFz8bBY4Q1tNHUXbXLWxD6TrGhzWXHRTElkTlX6qC8L2 - kkoQerLVTHGEpiXZ7dRR87HWTpaWfUDSt7bcTbf3OEIwZMiD2CUSmascMBmaCN9Lm2CYzFbnJj59Z3 - QhDesB6qHk3d2G31rFJolLcoutGjK3X+AJiFJX8Q5LkbMNhoM1xPVcrkb1hill82zRek3uIYvFmoal - TWtTKlV7b7M04qtOznFW+wyE1HsAIF/XWpHZ/T7dmjAY38+EG/JV8bSiWFJ3DN2/kMH3opOPMPqLm8 - 7HktqHnvYvAiun7gBTv+lcoY76OVlmWVuhVEqb+NeVsK0ycLvO6PlLnO5x+btj22XbuHnKNCRG4k2S - OeBHJ+KPdk9sja34I/vFVHDfMVK5iy4mXCdbe4ip4w3Ov6jjqjsb6epT+yg3BIMUCScGfAsg7fyA0v - HNNTdQCNlDpTzp5mOY3uIkDpIfjNhHWJg4S5+XL+hlGt8+9O4d6fE//ZNtVA== -X-Developer-Key: i=keescook@chromium.org; a=openpgp; - fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 - -After adding __alloc_size attributes to the allocators, GCC 9.3 (but not -later) may incorrectly evaluate the arguments to check_copy_size(), -getting seemingly confused by the size being returned from array_size(). -Instead, perform the calculation once, which both makes the code more -readable and avoids the bug in GCC. - - In file included from arch/x86/include/asm/preempt.h:7, - from include/linux/preempt.h:78, - from include/linux/spinlock.h:55, - from include/linux/mm_types.h:9, - from include/linux/buildid.h:5, - from include/linux/module.h:14, - from drivers/rapidio/devices/rio_mport_cdev.c:13: - In function 'check_copy_size', - inlined from 'copy_from_user' at include/linux/uaccess.h:191:6, - inlined from 'rio_mport_transfer_ioctl' at drivers/rapidio/devices/rio_mport_cdev.c:983:6: - include/linux/thread_info.h:213:4: error: call to '__bad_copy_to' declared with attribute error: copy destination size is too small - 213 | __bad_copy_to(); - | ^~~~~~~~~~~~~~~ - -But the allocation size and the copy size are identical: - - transfer = vmalloc(array_size(sizeof(*transfer), transaction.count)); - if (!transfer) - return -ENOMEM; - - if (unlikely(copy_from_user(transfer, - (void __user *)(uintptr_t)transaction.block, - array_size(sizeof(*transfer), transaction.count)))) { - -Reported-by: kernel test robot -Link: https://lore.kernel.org/linux-mm/202109091134.FHnRmRxu-lkp@intel.com/ -Cc: Matt Porter -Cc: Alexandre Bounine -Cc: Jing Xiangfeng -Cc: Ira Weiny -Cc: Souptick Joarder -Cc: Gustavo A. R. Silva -Signed-off-by: Kees Cook -Reviewed-by: John Hubbard ---- - drivers/rapidio/devices/rio_mport_cdev.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c -index 94331d999d27..7df466e22282 100644 ---- a/drivers/rapidio/devices/rio_mport_cdev.c -+++ b/drivers/rapidio/devices/rio_mport_cdev.c -@@ -965,6 +965,7 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg) - struct rio_transfer_io *transfer; - enum dma_data_direction dir; - int i, ret = 0; -+ size_t size; - - if (unlikely(copy_from_user(&transaction, arg, sizeof(transaction)))) - return -EFAULT; -@@ -976,13 +977,14 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg) - priv->md->properties.transfer_mode) == 0) - return -ENODEV; - -- transfer = vmalloc(array_size(sizeof(*transfer), transaction.count)); -+ size = array_size(sizeof(*transfer), transaction.count); -+ transfer = vmalloc(size); - if (!transfer) - return -ENOMEM; - - if (unlikely(copy_from_user(transfer, - (void __user *)(uintptr_t)transaction.block, -- array_size(sizeof(*transfer), transaction.count)))) { -+ size))) { - ret = -EFAULT; - goto out_free; - } -@@ -994,8 +996,7 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg) - transaction.sync, dir, &transfer[i]); - - if (unlikely(copy_to_user((void __user *)(uintptr_t)transaction.block, -- transfer, -- array_size(sizeof(*transfer), transaction.count)))) -+ transfer, size))) - ret = -EFAULT; - - out_free: --- -2.30.2 - diff --git a/tests/patch/signed/selftest/nosig.mbox b/tests/patch/signed/selftest/nosig.mbox deleted file mode 100644 index bb4f3d7..0000000 --- a/tests/patch/signed/selftest/nosig.mbox +++ /dev/null @@ -1,92 +0,0 @@ -From a0cde59a3a25d2708d8ae62488559e9974798cd8 Mon Sep 17 00:00:00 2001 -From: Kees Cook -Date: Fri, 17 Sep 2021 07:49:38 +1000 -Subject: [PATCH v3 1/8] rapidio: Avoid bogus __alloc_size warning -To: Andrew Morton - -After adding __alloc_size attributes to the allocators, GCC 9.3 (but not -later) may incorrectly evaluate the arguments to check_copy_size(), -getting seemingly confused by the size being returned from array_size(). -Instead, perform the calculation once, which both makes the code more -readable and avoids the bug in GCC. - - In file included from arch/x86/include/asm/preempt.h:7, - from include/linux/preempt.h:78, - from include/linux/spinlock.h:55, - from include/linux/mm_types.h:9, - from include/linux/buildid.h:5, - from include/linux/module.h:14, - from drivers/rapidio/devices/rio_mport_cdev.c:13: - In function 'check_copy_size', - inlined from 'copy_from_user' at include/linux/uaccess.h:191:6, - inlined from 'rio_mport_transfer_ioctl' at drivers/rapidio/devices/rio_mport_cdev.c:983:6: - include/linux/thread_info.h:213:4: error: call to '__bad_copy_to' declared with attribute error: copy destination size is too small - 213 | __bad_copy_to(); - | ^~~~~~~~~~~~~~~ - -But the allocation size and the copy size are identical: - - transfer = vmalloc(array_size(sizeof(*transfer), transaction.count)); - if (!transfer) - return -ENOMEM; - - if (unlikely(copy_from_user(transfer, - (void __user *)(uintptr_t)transaction.block, - array_size(sizeof(*transfer), transaction.count)))) { - -Reported-by: kernel test robot -Link: https://lore.kernel.org/linux-mm/202109091134.FHnRmRxu-lkp@intel.com/ -Cc: Matt Porter -Cc: Alexandre Bounine -Cc: Jing Xiangfeng -Cc: Ira Weiny -Cc: Souptick Joarder -Cc: Gustavo A. R. Silva -Signed-off-by: Kees Cook -Reviewed-by: John Hubbard ---- - drivers/rapidio/devices/rio_mport_cdev.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c -index 94331d999d27..7df466e22282 100644 ---- a/drivers/rapidio/devices/rio_mport_cdev.c -+++ b/drivers/rapidio/devices/rio_mport_cdev.c -@@ -965,6 +965,7 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg) - struct rio_transfer_io *transfer; - enum dma_data_direction dir; - int i, ret = 0; -+ size_t size; - - if (unlikely(copy_from_user(&transaction, arg, sizeof(transaction)))) - return -EFAULT; -@@ -976,13 +977,14 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg) - priv->md->properties.transfer_mode) == 0) - return -ENODEV; - -- transfer = vmalloc(array_size(sizeof(*transfer), transaction.count)); -+ size = array_size(sizeof(*transfer), transaction.count); -+ transfer = vmalloc(size); - if (!transfer) - return -ENOMEM; - - if (unlikely(copy_from_user(transfer, - (void __user *)(uintptr_t)transaction.block, -- array_size(sizeof(*transfer), transaction.count)))) { -+ size))) { - ret = -EFAULT; - goto out_free; - } -@@ -994,8 +996,7 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg) - transaction.sync, dir, &transfer[i]); - - if (unlikely(copy_to_user((void __user *)(uintptr_t)transaction.block, -- transfer, -- array_size(sizeof(*transfer), transaction.count)))) -+ transfer, size))) - ret = -EFAULT; - - out_free: --- -2.30.2 - diff --git a/tests/patch/signed/test.py b/tests/patch/signed/test.py deleted file mode 100644 index a20d844..0000000 --- a/tests/patch/signed/test.py +++ /dev/null @@ -1,70 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2021 Kees Cook - -from typing import Tuple -import subprocess -""" Test if the patch passes signature checks """ - - -def signed(tree, thing, result_dir) -> Tuple[int, str]: - command = ['patatt', 'validate'] - p = subprocess.run(command, cwd=tree.path, input=thing.raw_patch.encode(), - stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - # Fail closed. - ret = 1 - reason = p.stdout.decode("utf-8", "replace") - if p.returncode < 16: - # If patatt returns less than RES_ERROR, lower result to a warning. - ret = 250 - # $ cat tests/patch/signed/selftest/nokey.mbox | patatt validate - # NOKEY | keescook@chromium.org, - - # | keescook@chromium.org/default no matching openpgp key found - # $ echo $? - # 8 - if 'NOKEY' in reason: - reason = f"Signing key not found in keyring: {reason}" - # $ cat tests/patch/signed/selftest/nosig.mbox | patatt validate - # NOSIG | - - # | no signatures found - if 'NOSIG' in reason: - reason = "No signature found. Please sign patches: https://github.com/mricon/patatt" - if p.returncode == 0: - # Make sure we see ONLY "PASS" output, even when rc == 0. - bad = 0 - good = 0 - for line in reason.split('\n'): - line = line.strip() - if len(line) == 0: - # Ignore empty lines. - continue - msg, details = line.split('|', 1) - msg = msg.strip() - if len(msg) == 0: - # Ignore lines with empty msg (i.e. informational continuation line). - continue - # $ cat tests/patch/signed/selftest/good.mbox | patatt validate - # PASS | keescook@chromium.org, - - if msg == 'PASS': - good += 1 - else: - bad += 1 - # Now check for any bad statuses. - if bad == 0: - if good == 0: - # If there is nothing in stdout then no validation happened (no signature) - # (As seen with patatt < 5.0) - # $ cat tests/patch/signed/selftest/nosig.mbox | patatt validate - # $ echo $? - # 0 - ret = 250 - reason = "No signature found. Please sign patches: https://github.com/mricon/patatt" - if good > 0: - ret = 0 - else: - # $ cat tests/patch/signed/selftest/bad.mbox | patatt validate - # BADSIG | keescook@chromium.org, - - # | failed to validate using /home/nipa-user/trusted/kernel/pgpkeys/.keyring/openpgp/chromium.org/keescook/default - ret = 1 - - return ret, reason diff --git a/tests/patch/source_inline/info.json b/tests/patch/source_inline/info.json deleted file mode 100644 index 54bca3c..0000000 --- a/tests/patch/source_inline/info.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "run": ["source_inline.sh"] -} diff --git a/tests/patch/source_inline/source_inline.sh b/tests/patch/source_inline/source_inline.sh deleted file mode 100755 index 579e52e..0000000 --- a/tests/patch/source_inline/source_inline.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -inlines=$(git show -- '*.c' | grep -i '^\+\([^*/]*\W\|\)inline\W') -new_inlines=$(git show -- '*.c' | grep -ic '^\+\([^*/]*\W\|\)inline\W') -old_inlines=$(git show -- '*.c' | grep -ic '^\-\([^*/]*\W\|\)inline\W') - -echo "Was $old_inlines now: $new_inlines" >&$DESC_FD - -if [ -z "$inlines" ]; then - exit 0 -else - echo -e "Detected inline keyword in C files\n$inlines" 1>&2 - - if [ $new_inlines -eq $old_inlines ]; then - exit 250 - else - exit 1 - fi -fi diff --git a/tests/patch/verify_fixes/info.json b/tests/patch/verify_fixes/info.json deleted file mode 100644 index 114c7d3..0000000 --- a/tests/patch/verify_fixes/info.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "source": "https://raw.githubusercontent.com/gregkh/gregkh-linux/master/work/verify_fixes.sh", - "run": ["verify_fixes.sh", "HEAD~..HEAD"], - "pull-requests": true -} diff --git a/tests/patch/verify_fixes/verify_fixes.sh b/tests/patch/verify_fixes/verify_fixes.sh deleted file mode 100755 index 7ed4d64..0000000 --- a/tests/patch/verify_fixes/verify_fixes.sh +++ /dev/null @@ -1,212 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Stephen Rothwell -# Copyright (C) 2019 Greg Kroah-Hartman -# Copyright (c) 2020 Facebook -# -# Verify that the "Fixes:" tag is correct in a kernel commit -# -# usage: -# verify_fixes.sh GIT_RANGE -# -# To test just the HEAD commit do: -# verify_fixes.sh HEAD^..HEAD -# -# -# Thanks to Stephen Rothwell for the majority of this code -# - -# Only thing you might want to change here, the location of where Linus's git -# tree is on your system: - -########################################## -# No need to touch anything below here - -split_re='^([Cc][Oo][Mm][Mm][Ii][Tt])?[[:space:]]*([[:xdigit:]]{5,})([[:space:]]*)(.*)$' -nl=$'\n' -tab=$'\t' - -help() -{ - echo "error, git range not found" - echo "usage:" - echo " $0 GIT_RANGE" - exit 1 -} - -# Strip the leading and training spaces from a string -strip_spaces() -{ - [[ "$1" =~ ^[[:space:]]*(.*[^[:space:]])[[:space:]]*$ ]] - echo "${BASH_REMATCH[1]}" -} - -verify_fixes() -{ - git_range=$1 - error=0 - commits=$(git rev-list --no-merges -i --grep='^[[:space:]]*Fixes:' "${git_range}") - if [ -z "$commits" ]; then - echo "No Fixes tag" >&$DESC_FD - return 0 - fi - - for c in $commits; do - - commit_log=$(git log -1 --format='%h ("%s")' "$c") -# commit_msg="In commit: -# $commit_log -#" - commit_msg="Commit: $commit_log -" - - fixes_lines=$(git log -1 --format='%B' "$c" | - grep -i '^[[:space:]]*Fixes:') - - while read -r fline; do - [[ "$fline" =~ ^[[:space:]]*[Ff][Ii][Xx][Ee][Ss]:[[:space:]]*(.*)$ ]] - f="${BASH_REMATCH[1]}" -# fixes_msg=" Fixes tag: -# $fline -# Has these problem(s): -#" - fixes_msg=" Fixes tag: $fline - Has these problem(s): -" - sha= - subject= - msg= - - if git log -1 --format='%B' "$c" | tr '\n' '#' | grep -qF "##$fline##"; then - msg="${msg:+${msg}${nl}}${tab}${tab}- empty lines surround the Fixes tag" - error=$(( error + 1 )) - fi - - if [[ "$f" =~ $split_re ]]; then - first="${BASH_REMATCH[1]}" - sha="${BASH_REMATCH[2]}" - spaces="${BASH_REMATCH[3]}" - subject="${BASH_REMATCH[4]}" - if [ "$first" ]; then - msg="${msg:+${msg}${nl}}${tab}${tab}- leading word '$first' unexpected" - error=$(( error + 1 )) - fi - if [ -z "$subject" ]; then - msg="${msg:+${msg}${nl}}${tab}${tab}- missing subject" - error=$(( error + 1 )) - elif [ -z "$spaces" ]; then - msg="${msg:+${msg}${nl}}${tab}${tab}- missing space between the SHA1 and the subject" - error=$(( error + 1 )) - fi - else - printf '%s%s\t\t- %s\n' "$commit_msg" "$fixes_msg" 'No SHA1 recognised' - error=$(( error + 1 )) - commit_msg='' - continue - fi - if ! git rev-parse -q --verify "$sha" >/dev/null; then - printf '%s%s\t\t- %s\n' "$commit_msg" "$fixes_msg" 'Target SHA1 does not exist' - error=$(( error + 1 )) - commit_msg='' - continue - fi - - if [ "${#sha}" -lt 12 ]; then - msg="${msg:+${msg}${nl}}${tab}${tab}- SHA1 should be at least 12 digits long${nl}${tab}${tab} Can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11${nl}${tab}${tab} or later) just making sure it is not set (or set to \"auto\")." - error=$(( error + 1 )) - fi - # reduce the subject to the part between () if there - if [[ "$subject" =~ ^\((.*)\) ]]; then - subject="${BASH_REMATCH[1]}" - elif [[ "$subject" =~ ^\((.*) ]]; then - subject="${BASH_REMATCH[1]}" - msg="${msg:+${msg}${nl}}${tab}${tab}- Subject has leading but no trailing parentheses" - error=$(( error + 1 )) - fi - - # strip matching quotes at the start and end of the subject - # the unicode characters in the classes are - # U+201C LEFT DOUBLE QUOTATION MARK - # U+201D RIGHT DOUBLE QUOTATION MARK - # U+2018 LEFT SINGLE QUOTATION MARK - # U+2019 RIGHT SINGLE QUOTATION MARK - re1=$'^[\"\u201C](.*)[\"\u201D]$' - re2=$'^[\'\u2018](.*)[\'\u2019]$' - re3=$'^[\"\'\u201C\u2018](.*)$' - if [[ "$subject" =~ $re1 ]]; then - subject="${BASH_REMATCH[1]}" - elif [[ "$subject" =~ $re2 ]]; then - subject="${BASH_REMATCH[1]}" - elif [[ "$subject" =~ $re3 ]]; then - subject="${BASH_REMATCH[1]}" - msg="${msg:+${msg}${nl}}${tab}${tab}- Subject has leading but no trailing quotes" - error=$(( error + 1 )) - fi - - subject=$(strip_spaces "$subject") - - target_subject=$(git log -1 --format='%s' "$sha") - target_subject=$(strip_spaces "$target_subject") - - # match with ellipses - case "$subject" in - *...) subject="${subject%...}" - target_subject="${target_subject:0:${#subject}}" - ;; - ...*) subject="${subject#...}" - target_subject="${target_subject: -${#subject}}" - ;; - *\ ...\ *) - s1="${subject% ... *}" - s2="${subject#* ... }" - subject="$s1 $s2" - t1="${target_subject:0:${#s1}}" - t2="${target_subject: -${#s2}}" - target_subject="$t1 $t2" - ;; - esac - subject=$(strip_spaces "$subject") - target_subject=$(strip_spaces "$target_subject") - - if [ "$subject" != "${target_subject:0:${#subject}}" ]; then - msg="${msg:+${msg}${nl}}${tab}${tab}- Subject does not match target commit subject${nl}${tab}${tab} Just use${nl}${tab}${tab}${tab}git log -1 --format='Fixes: %h (\"%s\")'" - error=$(( error + 1 )) - fi - lsha=$(git rev-parse -q --verify "$sha") - if [ -z "$lsha" ]; then - count=$(git rev-list --count "$sha".."$c") - if [ "$count" -eq 0 ]; then - msg="${msg:+${msg}${nl}}${tab}${tab}- Target is not an ancestor of this commit" - error=$(( error + 1 )) - fi - fi - - if [ "$msg" ]; then - printf '%s%s%s\n' "$commit_msg" "$fixes_msg" "$msg" - commit_msg='' - # Make sure we don't accidentally miss anything. - if [ $error -eq 0 ]; then - echo 'Whoops! $error out of sync with $msg' >&2 - error=1 - fi - fi - done <<< "$fixes_lines" - done - - if [ ${error} -ne 0 ] ; then - echo "Problems with Fixes tag: $error" >&$DESC_FD - exit 1 - fi - echo "Fixes tag looks correct" >&$DESC_FD - return 0 -} - -git_range=$1 - -if [ "${git_range}" == "" ] ; then - help -fi - -verify_fixes "${git_range}" -exit 0 diff --git a/tests/patch/verify_signedoff/info.json b/tests/patch/verify_signedoff/info.json deleted file mode 100644 index e044eaa..0000000 --- a/tests/patch/verify_signedoff/info.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "source": "https://raw.githubusercontent.com/gregkh/gregkh-linux/master/work/verify_signedoff.sh", - "run": ["verify_signedoff.sh", "HEAD~..HEAD"], - "pull-requests": true -} diff --git a/tests/patch/verify_signedoff/verify_signedoff.sh b/tests/patch/verify_signedoff/verify_signedoff.sh deleted file mode 100755 index 445b132..0000000 --- a/tests/patch/verify_signedoff/verify_signedoff.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Stephen Rothwell -# Copyright (C) 2019 Greg Kroah-Hartman -# -# Verify that the signed-off-by chain looks correct for a range of git commits. -# -# usage: -# verify_signedoff.sh GIT_RANGE -# -# To test just the HEAD commit do: -# verify_signedoff.sh HEAD^..HEAD -# -# -# Thanks to Stephen Rothwell for the majority of this code -# - -help() -{ - echo "error, git range not found" - echo "usage:" - echo " $0 GIT_RANGE" - exit 1 -} - -verify_signedoff() -{ - git_range=$1 - error=false - for c in $(git rev-list --no-merges "${git_range}"); do - ae=$(git log -1 --format='%ae' "$c") - aE=$(git log -1 --format='%aE' "$c") - an=$(git log -1 --format='%an' "$c") - aN=$(git log -1 --format='%aN' "$c") - ce=$(git log -1 --format='%ce' "$c") - cE=$(git log -1 --format='%cE' "$c") - cn=$(git log -1 --format='%cn' "$c") - cN=$(git log -1 --format='%cN' "$c") - sob=$(git log -1 --format='%b' "$c" | grep -i '^[[:space:]]*Signed-off-by:') - - am=false - cm=false - grep -i -q "<$ae>" <<<"$sob" || - grep -i -q "<$aE>" <<<"$sob" || - grep -i -q ":[[:space:]]*${an}[[:space:]]*<" <<<"$sob" || - grep -i -q ":[[:space:]]*${aN}[[:space:]]*<" <<<"$sob" || - am=true - grep -i -q "<$ce>" <<<"$sob" || - grep -i -q "<$cE>" <<<"$sob" || - grep -i -q ":[[:space:]]*${cn}[[:space:]]*<" <<<"$sob" || - grep -i -q ":[[:space:]]*${cN}[[:space:]]*<" <<<"$sob" || - cm=true - - if "$am" || "$cm"; then - printf "Commit %s\n" "$(git show -s --abbrev-commit --abbrev=12 --pretty=format:"%h (\"%s\")%n" "${c}")" - "$am" && printf "\tauthor Signed-off-by missing\n" | tee -a /dev/fd/$DESC_FD - "$cm" && printf "\tcommitter Signed-off-by missing\n" | tee -a /dev/fd/$DESC_FD - printf "\tauthor email: %s\n" "$ae" - printf "\tcommitter email: %s\n" "$ce" - readarray -t s <<< "${sob}" - printf "\t%s\n" "${s[@]}" - printf "\n" - error=true - fi - done - if "$error"; then - echo "Errors in tree with Signed-off-by, please fix!" - exit 1 - fi - echo "Signed-off-by tag matches author and committer" >&$DESC_FD -} - -git_range=$1 - -if [ "${git_range}" == "" ] ; then - help -fi - -verify_signedoff "${git_range}" -exit 0 diff --git a/tests/series/cover_letter/info.json b/tests/series/cover_letter/info.json deleted file mode 100644 index 301f822..0000000 --- a/tests/series/cover_letter/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pymod": "test", - "pyfunc": "cover_letter" -} diff --git a/tests/series/cover_letter/test.py b/tests/series/cover_letter/test.py deleted file mode 100644 index 75a83d4..0000000 --- a/tests/series/cover_letter/test.py +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -from typing import Tuple -""" Test presence of a cover letter """ - - -def cover_letter(tree, thing, result_dir) -> Tuple[int, str]: - if thing.cover_letter: - return 0, "Series has a cover letter" - if thing.cover_pull: - return 0, "Pull request is its own cover letter" - # 2 patches are okay without a cover letter; this covers trivial cases like - # feature + selftest postings where commit message of the feature is definitive - if len(thing.patches) < 3: - return 0, "Single patches do not need cover letters" - return 250, "Series does not have a cover letter" diff --git a/tests/series/fixes_present/info.json b/tests/series/fixes_present/info.json deleted file mode 100644 index e1813be..0000000 --- a/tests/series/fixes_present/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pymod": "test", - "pyfunc": "fixes_present" -} diff --git a/tests/series/fixes_present/test.py b/tests/series/fixes_present/test.py deleted file mode 100644 index 40bf6db..0000000 --- a/tests/series/fixes_present/test.py +++ /dev/null @@ -1,45 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -import re - -from typing import Tuple -""" Test presence of the Fixes tag in non *-next patches """ - - -def fixes_present(tree, thing, result_dir) -> Tuple[int, str]: - if tree.pfx.count("next"): - return 0, "Fixes tag not required for -next series" - for patch in thing.patches: - if patch.raw_patch.count('\nFixes: '): - return 0, "Fixes tag present in non-next series" - - r_header = re.compile(r'\+\+\+ b/([-\w/._]+)$') - all_safe = None - for p in thing.patches: - lines = p.raw_patch.split('\n') - safe = None - - for line in lines: - match = r_header.match(line) - if not match: - continue - - file_name = match.group(1) - if file_name.startswith("Documentation/") or \ - file_name.startswith("MAINTAINERS"): - safe = True - else: - safe = False - break - - if safe: - all_safe = True - else: - all_safe = False - break - if all_safe: - return 0, "No Fixes tags, but series doesn't touch code" - - return 1, "Series targets non-next tree, but doesn't contain any Fixes tags" diff --git a/tests/series/patch_count/info.json b/tests/series/patch_count/info.json deleted file mode 100644 index e8806db..0000000 --- a/tests/series/patch_count/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pymod": "test", - "pyfunc": "patch_count" -} diff --git a/tests/series/patch_count/test.py b/tests/series/patch_count/test.py deleted file mode 100644 index 4160fcb..0000000 --- a/tests/series/patch_count/test.py +++ /dev/null @@ -1,15 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -from typing import Tuple -""" Test number of patches, we have a 15 patch limit on netdev """ - - -def patch_count(tree, thing, result_dir) -> Tuple[int, str]: - if len(thing.patches) <= 15: - return 0, "" - if thing.cover_pull: - return 250, "Series longer than 15 patches" - # Really no good if there's no cover letter. - return 1, "Series longer than 15 patches (and no cover letter)" diff --git a/tests/series/subject_prefix/info.json b/tests/series/subject_prefix/info.json deleted file mode 100644 index 37a3d6d..0000000 --- a/tests/series/subject_prefix/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pymod": "test", - "pyfunc": "subject_prefix" -} diff --git a/tests/series/subject_prefix/test.py b/tests/series/subject_prefix/test.py deleted file mode 100644 index f960121..0000000 --- a/tests/series/subject_prefix/test.py +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -from typing import Tuple -""" Test if subject prefix (tree designation) is present """ - - -def subject_prefix(tree, thing, result_dir) -> Tuple[int, str]: - if thing.tree_mark_expected and not thing.tree_marked: - return 250, "Target tree name not specified in the subject" - return 0, "" diff --git a/tests_rv/patch/alphanumeric_selects/alphanumeric_selects.pl b/tests_rv/patch/alphanumeric_selects/alphanumeric_selects.pl deleted file mode 100755 index 6c2cca2..0000000 --- a/tests_rv/patch/alphanumeric_selects/alphanumeric_selects.pl +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/perl -# -# composite series of images over a background image -# -# -while (<>) { - while (/\\\s*$/) { - $_ .= <>; - } - undef %selects if /^\s*config\s+/; - if (/^\s+select\s+(\w+).*/) { - if (defined($selects{$1})) { - if ($selects{$1} eq $_) { - print STDERR "Warning: removing duplicated $1 entry\n"; - } else { - print STDERR "Error: $1 differently selected\n". - "\tOld: $selects{$1}\n". - "\tNew: $_\n"; - exit 1; - } - } - $selects{$1} = $_; - next; - } - if (%selects and (/^\s*$/ or /^\s+help/ or /^\s+---help---/ or - /^endif/ or /^endchoice/)) { - foreach $k (sort (keys %selects)) { - print "$selects{$k}"; - } - undef %selects; - } - print; -} -if (%selects) { - foreach $k (sort (keys %selects)) { - print "$selects{$k}"; - } -} diff --git a/tests_rv/patch/alphanumeric_selects/alphanumeric_selects.sh b/tests_rv/patch/alphanumeric_selects/alphanumeric_selects.sh deleted file mode 100755 index 06132af..0000000 --- a/tests_rv/patch/alphanumeric_selects/alphanumeric_selects.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# - -tmpfile_b=$(mktemp) -tmpfile_n=$(mktemp) - -rc=250 - -HEAD=$(git rev-parse HEAD) - -git checkout -q HEAD~ - -output_b=$(../../tests_rv/patch/alphanumeric_selects/alphanumeric_selects.pl arch/riscv/Kconfig) - -diff -y arch/riscv/Kconfig <(echo "$output_b") > $tmpfile_b -before=$(wc -l < $tmpfile_b) - -git checkout -q $HEAD - -output_n=$(../../tests_rv/patch/alphanumeric_selects/alphanumeric_selects.pl arch/riscv/Kconfig) - -diff -y arch/riscv/Kconfig <(echo "$output_n") > $tmpfile_n -now=$(wc -l < $tmpfile_n) - -echo "Out of order selects before the patch: $before and now $now" >&$DESC_FD - -if [ $now -gt $before ]; then - output=$(diff -U1 $tmpfile_b $tmpfile_n | tail -n +4 | cut -c 2-) - if grep -q ">" <<< "$output" && grep -q "<" <<< "$output"; then - echo "New out of order content added" 1>&2 - echo "Ideally, sort depends first, the default second, selects (in alphanumerical order) third." 1>&2 - echo "Suggested fixups:" 1>&2 - printf "$output\n" - fi -else - rc=0 -fi - -rm -rf $tmpfile_b $tmpfile_n -exit $rc diff --git a/tests_rv/patch/alphanumeric_selects/info.json b/tests_rv/patch/alphanumeric_selects/info.json deleted file mode 100644 index c6a9a05..0000000 --- a/tests_rv/patch/alphanumeric_selects/info.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "run": ["alphanumeric_selects.sh"], - "pull-requests": true, - "disabled": true -} diff --git a/tests_rv/patch/build_boot_rv64/build_boot_rv64.sh b/tests_rv/patch/build_boot_rv64/build_boot_rv64.sh deleted file mode 100755 index 5fdf21f..0000000 --- a/tests_rv/patch/build_boot_rv64/build_boot_rv64.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2022 by Rivos Inc. - -tmpdir=build -rc=0 - -tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \ - --environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \ - --environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \ - -o $tmpdir --toolchain gcc CROSS_COMPILE=riscv64-linux- || rc=1 - -if [ $rc -ne 0 ]; then - echo "Build failed" >&$DESC_FD -else - tuxrun --device qemu-riscv64 --tuxmake $tmpdir || rc=1 - if [ $rc -ne 0 ]; then - echo "Boot/poweroff failed" >&$DESC_FD - else - echo "Build and boot/poweroff OK" >&$DESC_FD - fi -fi - -rm -rf $tmpdir - -exit $rc diff --git a/tests_rv/patch/build_boot_rv64/info.json b/tests_rv/patch/build_boot_rv64/info.json deleted file mode 100644 index 4cd64e8..0000000 --- a/tests_rv/patch/build_boot_rv64/info.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "run": ["build_boot_rv64.sh"], - "pull-requests": true, - "disabled": true -} diff --git a/tests_rv/patch/build_boot_rv64_clang/build_boot_rv64_clang.sh b/tests_rv/patch/build_boot_rv64_clang/build_boot_rv64_clang.sh deleted file mode 100755 index ba9a2fc..0000000 --- a/tests_rv/patch/build_boot_rv64_clang/build_boot_rv64_clang.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2022 by Rivos Inc. - -tmpdir=build -rc=0 - -tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \ - --environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \ - --environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \ - -o $tmpdir --toolchain llvm CROSS_COMPILE=riscv64-linux- || rc=1 - -# FIXME: Add -z none to tuxmake (reduce build time), but tuxrun bailes out. :-( - -if [ $rc -ne 0 ]; then - echo "Build failed" >&$DESC_FD -else - tuxrun --device qemu-riscv64 --tuxmake $tmpdir || rc=1 - if [ $rc -ne 0 ]; then - echo "Boot/poweroff failed" >&$DESC_FD - else - echo "Build and boot/poweroff OK" >&$DESC_FD - fi -fi - -rm -rf $tmpdir - -exit $rc diff --git a/tests_rv/patch/build_boot_rv64_clang/info.json b/tests_rv/patch/build_boot_rv64_clang/info.json deleted file mode 100644 index 09eda19..0000000 --- a/tests_rv/patch/build_boot_rv64_clang/info.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "run": ["build_boot_rv64_clang.sh"], - "pull-requests": true, - "disabled": true -} diff --git a/tests_rv/patch/build_rv32_defconfig/build_rv32_defconfig.sh b/tests_rv/patch/build_rv32_defconfig/build_rv32_defconfig.sh deleted file mode 100755 index 46bc848..0000000 --- a/tests_rv/patch/build_rv32_defconfig/build_rv32_defconfig.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2022 by Rivos Inc. - -tmpdir=build -tmpfile=$(mktemp) -rc=0 - -tuxmake --wrapper ccache --target-arch riscv --directory . \ - --environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \ - --environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \ - -o $tmpdir --toolchain llvm -z none -k rv32_defconfig \ - CROSS_COMPILE=riscv64-linux- \ - > $tmpfile || rc=1 - -if [ $rc -ne 0 ]; then - echo "Build failed" >&$DESC_FD - grep "\(warning\|error\):" $tmpfile >&2 -else - echo "Build OK" >&$DESC_FD -fi - -rm -rf $tmpdir $tmpfile - -exit $rc diff --git a/tests_rv/patch/build_rv32_defconfig/info.json b/tests_rv/patch/build_rv32_defconfig/info.json deleted file mode 100644 index d3e0976..0000000 --- a/tests_rv/patch/build_rv32_defconfig/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "run": ["build_rv32_defconfig.sh"], - "pull-requests": true -} diff --git a/tests_rv/patch/build_rv64_clang_allmodconfig/build_rv64_clang_allmodconfig.sh b/tests_rv/patch/build_rv64_clang_allmodconfig/build_rv64_clang_allmodconfig.sh deleted file mode 100755 index e300ceb..0000000 --- a/tests_rv/patch/build_rv64_clang_allmodconfig/build_rv64_clang_allmodconfig.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -# Modified tests/patch/build_defconfig_warn.sh for RISC-V builds - -tmpfile_e=$(mktemp) -tmpfile_o=$(mktemp) -tmpfile_n=$(mktemp) - -tmpdir_b=build_llvm -tmpdir_o=output - -rc=0 - -echo "Redirect to $tmpfile_o and $tmpfile_n" - -HEAD=$(git rev-parse HEAD) - -echo "Tree base:" -git log -1 --pretty='%h ("%s")' HEAD~ - -echo "Building the whole tree with the patch" - -tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \ - --environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \ - --environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \ - -o $tmpdir_o -b $tmpdir_b --toolchain llvm -z none --kconfig allmodconfig \ - -K CONFIG_WERROR=n -K CONFIG_RANDSTRUCT_NONE=y W=1 \ - CROSS_COMPILE=riscv64-linux- \ - config default \ - > $tmpfile_e || rc=1 - -if [ $rc -eq 1 ] -then - echo "Failed to build the tree with this patch." >&$DESC_FD - grep "\(error\):" $tmpfile_e >&2 - rm -rf $tmpdir_o $tmpfile_o $tmpfile_n $tmpdir_b $tmpfile_e - exit $rc -fi - -current=$(grep -c "\(warning\|error\):" $tmpfile_n) - -git checkout -q HEAD~ - -echo "Building the tree before the patch" - -tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \ - --environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \ - --environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \ - -o $tmpdir_o -b $tmpdir_b --toolchain llvm -z none --kconfig allmodconfig \ - -K CONFIG_WERROR=n -K CONFIG_RANDSTRUCT_NONE=y W=1 \ - CROSS_COMPILE=riscv64-linux- \ - config default \ - > $tmpfile_o - -incumbent=$(grep -c "\(warning\|error\):" $tmpfile_o) - -git checkout -q $HEAD - -echo "Building the tree with the patch" - -tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \ - --environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \ - --environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \ - -o $tmpdir_o -b $tmpdir_b --toolchain llvm -z none --kconfig allmodconfig \ - -K CONFIG_WERROR=n -K CONFIG_RANDSTRUCT_NONE=y W=1 \ - CROSS_COMPILE=riscv64-linux- \ - config default \ - > $tmpfile_n || rc=1 - -if [ $rc -eq 1 ] -then - echo "Failed to build the tree with this patch." >&$DESC_FD - grep "\(warning\|error\):" $tmpfile_n >&2 - rm -rf $tmpdir_o $tmpfile_o $tmpfile_n $tmpdir_b - exit $rc -fi - -current=$(grep -c "\(warning\|error\):" $tmpfile_n) - -echo "Errors and warnings before: $incumbent this patch: $current" >&$DESC_FD - -if [ $current -gt $incumbent ]; then - echo "New errors added:" 1>&2 - - tmpfile_errors_before=$(mktemp) - tmpfile_errors_now=$(mktemp) - grep "\(warning\|error\):" $tmpfile_o | sort | uniq -c > $tmpfile_errors_before - grep "\(warning\|error\):" $tmpfile_n | sort | uniq -c > $tmpfile_errors_now - - diff -U 0 $tmpfile_errors_before $tmpfile_errors_now 1>&2 - - rm $tmpfile_errors_before $tmpfile_errors_now - - echo "Per-file breakdown" 1>&2 - tmpfile_fo=$(mktemp) - tmpfile_fn=$(mktemp) - - grep "\(warning\|error\):" $tmpfile_o | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fo - grep "\(warning\|error\):" $tmpfile_n | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fn - - diff -U 0 $tmpfile_fo $tmpfile_fn 1>&2 - rm $tmpfile_fo $tmpfile_fn - - rc=1 -fi - -rm -rf $tmpdir_o $tmpfile_o $tmpfile_n $tmpdir_b $tmpfile_e - -exit $rc diff --git a/tests_rv/patch/build_rv64_clang_allmodconfig/info.json b/tests_rv/patch/build_rv64_clang_allmodconfig/info.json deleted file mode 100644 index eb8d5fd..0000000 --- a/tests_rv/patch/build_rv64_clang_allmodconfig/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "run": ["build_rv64_clang_allmodconfig.sh"], - "pull-requests": true -} diff --git a/tests_rv/patch/build_rv64_gcc_allmodconfig/build_rv64_gcc_allmodconfig.sh b/tests_rv/patch/build_rv64_gcc_allmodconfig/build_rv64_gcc_allmodconfig.sh deleted file mode 100755 index 4370440..0000000 --- a/tests_rv/patch/build_rv64_gcc_allmodconfig/build_rv64_gcc_allmodconfig.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -# Modified tests/patch/build_defconfig_warn.sh for RISC-V builds - -tmpfile_e=$(mktemp) -tmpfile_o=$(mktemp) -tmpfile_n=$(mktemp) - -tmpdir_b=build_gcc -tmpdir_o=output - -rc=0 - -echo "Redirect to $tmpfile_o and $tmpfile_n" - -HEAD=$(git rev-parse HEAD) - -echo "Tree base:" -git log -1 --pretty='%h ("%s")' HEAD~ - -echo "Building the whole tree with the patch" - -tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \ - --environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \ - --environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \ - -o $tmpdir_o -b $tmpdir_b --toolchain gcc -z none --kconfig allmodconfig \ - -K CONFIG_WERROR=n -K CONFIG_GCC_PLUGINS=n W=1 \ - CROSS_COMPILE=riscv64-linux- \ - config default \ - > $tmpfile_e || rc=1 - -if [ $rc -eq 1 ] -then - echo "Failed to build the tree with this patch." >&$DESC_FD - grep "\(error\):" $tmpfile_e >&2 - rm -rf $tmpdir_o $tmpfile_o $tmpfile_n $tmpdir_b $tmpfile_e - exit $rc -fi - -git checkout -q HEAD~ - -echo "Building the tree before the patch" - -tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \ - --environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \ - --environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \ - -o $tmpdir_o -b $tmpdir_b --toolchain gcc -z none --kconfig allmodconfig \ - -K CONFIG_WERROR=n -K CONFIG_GCC_PLUGINS=n W=1 C=1 \ - CROSS_COMPILE=riscv64-linux- \ - config default \ - > $tmpfile_o - -incumbent=$(grep -c "\(warning\|error\):" $tmpfile_o) - -git checkout -q $HEAD - -echo "Building the tree with the patch" - -tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \ - --environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \ - --environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \ - -o $tmpdir_o -b $tmpdir_b --toolchain gcc -z none --kconfig allmodconfig \ - -K CONFIG_WERROR=n -K CONFIG_GCC_PLUGINS=n W=1 C=1 \ - CROSS_COMPILE=riscv64-linux- \ - config default \ - > $tmpfile_n || rc=1 - -if [ $rc -eq 1 ] -then - echo "Failed to build the tree with this patch." >&$DESC_FD - grep "\(warning\|error\):" $tmpfile_n >&2 - rm -rf $tmpdir_o $tmpfile_o $tmpfile_n $tmpdir_b - exit $rc -fi - -current=$(grep -c "\(warning\|error\):" $tmpfile_n) - -echo "Errors and warnings before: $incumbent this patch: $current" >&$DESC_FD - -if [ $current -gt $incumbent ]; then - echo "New errors added:" 1>&2 - - tmpfile_errors_before=$(mktemp) - tmpfile_errors_now=$(mktemp) - grep "\(warning\|error\):" $tmpfile_o | sort | uniq -c > $tmpfile_errors_before - grep "\(warning\|error\):" $tmpfile_n | sort | uniq -c > $tmpfile_errors_now - - diff -U 0 $tmpfile_errors_before $tmpfile_errors_now 1>&2 - - rm $tmpfile_errors_before $tmpfile_errors_now - - echo "Per-file breakdown" 1>&2 - tmpfile_fo=$(mktemp) - tmpfile_fn=$(mktemp) - - grep "\(warning\|error\):" $tmpfile_o | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fo - grep "\(warning\|error\):" $tmpfile_n | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fn - - diff -U 0 $tmpfile_fo $tmpfile_fn 1>&2 - rm $tmpfile_fo $tmpfile_fn - - rc=1 -fi - -rm -rf $tmpdir_o $tmpfile_o $tmpfile_n $tmpdir_b $tmpfile_e - -exit $rc diff --git a/tests_rv/patch/build_rv64_gcc_allmodconfig/info.json b/tests_rv/patch/build_rv64_gcc_allmodconfig/info.json deleted file mode 100644 index 888106a..0000000 --- a/tests_rv/patch/build_rv64_gcc_allmodconfig/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "run": ["build_rv64_gcc_allmodconfig.sh"], - "pull-requests": true -} diff --git a/tests_rv/patch/build_rv64_nommu_k210_defconfig/build_rv64_nommu_k210_defconfig.sh b/tests_rv/patch/build_rv64_nommu_k210_defconfig/build_rv64_nommu_k210_defconfig.sh deleted file mode 100755 index 7530c69..0000000 --- a/tests_rv/patch/build_rv64_nommu_k210_defconfig/build_rv64_nommu_k210_defconfig.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2022 by Rivos Inc. - -tmpdir=$(mktemp -d) -tmpfile=$(mktemp) -rc=0 - -tuxmake --wrapper ccache --target-arch riscv --directory . \ - --environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \ - --environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \ - -o $tmpdir --toolchain gcc -z none -k nommu_k210_defconfig \ - CROSS_COMPILE=riscv64-linux- \ - > $tmpfile || rc=1 - -if [ $rc -ne 0 ]; then - echo "Build failed" >&$DESC_FD - grep "\(warning\|error\):" $tmpfile >&2 -else - echo "Build OK" >&$DESC_FD -fi - -rm -rf $tmpdir $tmpfile - -exit $rc diff --git a/tests_rv/patch/build_rv64_nommu_k210_defconfig/info.json b/tests_rv/patch/build_rv64_nommu_k210_defconfig/info.json deleted file mode 100644 index c8247d4..0000000 --- a/tests_rv/patch/build_rv64_nommu_k210_defconfig/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "run": ["build_rv64_nommu_k210_defconfig.sh"], - "pull-requests": true -} diff --git a/tests_rv/patch/build_rv64_nommu_virt_defconfig/build_rv64_nommu_virt_defconfig.sh b/tests_rv/patch/build_rv64_nommu_virt_defconfig/build_rv64_nommu_virt_defconfig.sh deleted file mode 100755 index d4840a8..0000000 --- a/tests_rv/patch/build_rv64_nommu_virt_defconfig/build_rv64_nommu_virt_defconfig.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2022 by Rivos Inc. - -tmpdir=$(mktemp -d) -tmpfile=$(mktemp) -rc=0 - -tuxmake --wrapper ccache --target-arch riscv --directory . \ - --environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \ - --environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \ - -o $tmpdir --toolchain gcc -z none -k nommu_virt_defconfig \ - CROSS_COMPILE=riscv64-linux- \ - > $tmpfile || rc=1 - -if [ $rc -ne 0 ]; then - echo "Build failed" >&$DESC_FD - grep "\(warning\|error\):" $tmpfile >&2 -else - echo "Build OK" >&$DESC_FD -fi - -rm -rf $tmpdir $tmpfile - -exit $rc diff --git a/tests_rv/patch/build_rv64_nommu_virt_defconfig/info.json b/tests_rv/patch/build_rv64_nommu_virt_defconfig/info.json deleted file mode 100644 index 56de8f3..0000000 --- a/tests_rv/patch/build_rv64_nommu_virt_defconfig/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "run": ["build_rv64_nommu_virt_defconfig.sh"], - "pull-requests": true -} diff --git a/tests_rv/patch/checkpatch/checkpatch.sh b/tests_rv/patch/checkpatch/checkpatch.sh deleted file mode 100755 index a39b512..0000000 --- a/tests_rv/patch/checkpatch/checkpatch.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -IGNORED=\ -COMMIT_LOG_LONG_LINE,\ -MACRO_ARG_REUSE,\ -ALLOC_SIZEOF_STRUCT,\ -NO_AUTHOR_SIGN_OFF,\ -GIT_COMMIT_ID,\ -CAMELCASE - -tmpfile=$(mktemp) - -./scripts/checkpatch.pl --strict --ignore=$IGNORED -g HEAD | tee $tmpfile - -grep 'total: 0 errors, 0 warnings, 0 checks' $tmpfile -ret=$? - -# return 250 (warning) if there are not errors -[ $ret -ne 0 ] && grep -P 'total: 0 errors, \d+ warnings, \d+ checks' $tmpfile && ret=250 - -if [ $ret -ne 0 ]; then - grep '\(WARNING\|ERROR\|CHECK\): ' $tmpfile | LC_COLLATE=C sort -u >&$DESC_FD -else - grep 'total: ' $tmpfile | LC_COLLATE=C sort -u >&$DESC_FD -fi - -rm $tmpfile - -exit $ret - -# ./scripts/checkpatch.pl --ignore=SPACING_CAST,LONG_LINE,LONG_LINE_COMMENT,LONG_LINE_STRING,LINE_SPACING_STRUCT,FILE_PATH_CHANGES,CAMELCASE,OPEN_ENDED_LINE,AVOID_EXTERNS_HEADER,UNCOMMENTED_DEFINITION diff --git a/tests_rv/patch/checkpatch/info.json b/tests_rv/patch/checkpatch/info.json deleted file mode 100644 index 357a5c2..0000000 --- a/tests_rv/patch/checkpatch/info.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "run": ["checkpatch.sh"] -} diff --git a/tests_rv/patch/dtb_warn_rv64/dtb_warn_rv64.sh b/tests_rv/patch/dtb_warn_rv64/dtb_warn_rv64.sh deleted file mode 100755 index 68a464b..0000000 --- a/tests_rv/patch/dtb_warn_rv64/dtb_warn_rv64.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -# Modified tests/patch/build_defconfig_warn.sh for RISC-V builds - -tmpfile_o=$(mktemp) -tmpfile_n=$(mktemp) - -tmpdir_o=$(mktemp -d) -tmpdir_n=$(mktemp -d) - -rc=0 - -echo "Redirect to $tmpfile_o and $tmpfile_n" - -HEAD=$(git rev-parse HEAD) - -echo "Tree base:" -git log -1 --pretty='%h ("%s")' HEAD~ - -git checkout -q HEAD~ - -echo "Building the tree before the patch" - -make -C . O=$tmpdir_o ARCH=riscv CROSS_COMPILE=$CROSS_COMPILE PATH=$PATH \ - defconfig - -make -C . O=$tmpdir_o ARCH=riscv CROSS_COMPILE=$CROSS_COMPILE PATH=$PATH \ - dtbs_check W=1 -j$(nproc) \ - 2> >(tee $tmpfile_o >&2) - -incumbent=$(cat $tmpfile_o | grep -v "From schema" | wc -l) - -echo "Building the tree with the patch" - -git checkout -q $HEAD - -make -C . O=$tmpdir_n ARCH=riscv CROSS_COMPILE=$CROSS_COMPILE PATH=$PATH \ - defconfig - -make -C . O=$tmpdir_n ARCH=riscv CROSS_COMPILE=$CROSS_COMPILE PATH=$PATH \ - dtbs_check W=1 -j$(nproc) \ - 2> >(tee $tmpfile_n >&2) || rc=1 - -current=$(cat $tmpfile_n | grep -v "From schema" | wc -l) - -echo "Errors and warnings before: $incumbent this patch: $current" >&$DESC_FD - -if [ $current -gt $incumbent ]; then - echo "New errors added" 1>&2 - sed -i 's|^.*arch|arch|g' $tmpfile_o - sed -i 's|^.*arch|arch|g' $tmpfile_n - diff -U 0 $tmpfile_o $tmpfile_n 1>&2 - - rc=1 -fi - -rm -rf $tmpdir_o $tmpdir_n $tmpfile_o $tmpfile_n - -exit $rc diff --git a/tests_rv/patch/dtb_warn_rv64/info.json b/tests_rv/patch/dtb_warn_rv64/info.json deleted file mode 100644 index 0382067..0000000 --- a/tests_rv/patch/dtb_warn_rv64/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "run": ["dtb_warn_rv64.sh"], - "pull-requests": true -} diff --git a/tests_rv/patch/header_inline/header_inline.sh b/tests_rv/patch/header_inline/header_inline.sh deleted file mode 100755 index 1b54911..0000000 --- a/tests_rv/patch/header_inline/header_inline.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2020 Facebook - -inlines=$( - git show -- '*.h' | grep -C1 -P '^\+static (?!(__always_)?inline).*\('; - git show -- '*.h' | grep -C1 -P '^\+(static )?(?!(__always_)?inline )((unsigned|long|short) )*(char|bool|void|int|u[0-9]*) [0-9A-Za-z_]*\(.*\) *{' - ) - -if [ -z "$inlines" ]; then - echo "No static functions without inline keyword in header files" >&$DESC_FD - exit 0 -else - msg="Detected static functions without inline keyword in header files:" - echo -e "$msg\n$inlines" 1>&2 - count=$( (echo "---"; echo "$inlines") | grep '^---$' | wc -l) - echo "$msg $count" >&$DESC_FD - exit 1 -fi diff --git a/tests_rv/patch/header_inline/info.json b/tests_rv/patch/header_inline/info.json deleted file mode 100644 index d27d067..0000000 --- a/tests_rv/patch/header_inline/info.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "run": ["header_inline.sh"] -} diff --git a/tests_rv/patch/kdoc/info.json b/tests_rv/patch/kdoc/info.json deleted file mode 100644 index a409c44..0000000 --- a/tests_rv/patch/kdoc/info.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "run": ["kdoc.sh"] -} diff --git a/tests_rv/patch/kdoc/kdoc.sh b/tests_rv/patch/kdoc/kdoc.sh deleted file mode 100755 index 88c574c..0000000 --- a/tests_rv/patch/kdoc/kdoc.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. -# Copyright (c) 2020 Facebook - -tmpfile_o=$(mktemp) -tmpfile_n=$(mktemp) -rc=0 - -files=$(git show --pretty="" --name-only HEAD) - -HEAD=$(git rev-parse HEAD) - -echo "Checking the tree before the patch" -git checkout -q HEAD~ -./scripts/kernel-doc -none $files 2> >(tee $tmpfile_o >&2) - -incumbent=$(grep -v 'Error: Cannot open file ' $tmpfile_o | wc -l) - -echo "Checking the tree with the patch" - -git checkout -q $HEAD -./scripts/kernel-doc -none $files 2> >(tee $tmpfile_n >&2) - -current=$(grep -v 'Error: Cannot open file ' $tmpfile_n | wc -l) - -echo "Errors and warnings before: $incumbent this patch: $current" >&$DESC_FD - -if [ $current -gt $incumbent ]; then - echo "New warnings added" 1>&2 - diff $tmpfile_o $tmpfile_n 1>&2 - - echo "Per-file breakdown" 1>&2 - tmpfile_fo=$(mktemp) - tmpfile_fn=$(mktemp) - - grep -i "\(warn\|error\)" $tmpfile_o | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fo - grep -i "\(warn\|error\)" $tmpfile_n | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \ - > $tmpfile_fn - - diff $tmpfile_fo $tmpfile_fn 1>&2 - rm $tmpfile_fo $tmpfile_fn - - rc=1 -fi - -rm $tmpfile_o $tmpfile_n - -exit $rc diff --git a/tests_rv/patch/maintainers_pattern/info.json b/tests_rv/patch/maintainers_pattern/info.json deleted file mode 100644 index 70463e9..0000000 --- a/tests_rv/patch/maintainers_pattern/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "run": ["maintainers_patterns.sh"], - "pull-requests": true -} diff --git a/tests_rv/patch/maintainers_pattern/maintainers_patterns.sh b/tests_rv/patch/maintainers_pattern/maintainers_patterns.sh deleted file mode 100755 index 191b9d1..0000000 --- a/tests_rv/patch/maintainers_pattern/maintainers_patterns.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# - -tmpfile_b=$(mktemp) -tmpfile_n=$(mktemp) - -rc=1 - -HEAD=$(git rev-parse HEAD) - -git checkout -q HEAD~ - -./scripts/get_maintainer.pl --self-test=patterns > $tmpfile_b - -before=$(cat $tmpfile_b | wc -l) - -git checkout -q $HEAD - -./scripts/get_maintainer.pl --self-test=patterns > $tmpfile_n - -now=$(cat $tmpfile_n | wc -l) - -echo "MAINTAINERS pattern errors before the patch: $before and now $now" >&$DESC_FD - -if [ $now -gt $before ]; then - echo "New pattern errors added, run ./scripts/get_maintainer.pl --self-test=patterns for more info" 1>&2 -else - rc=0 -fi - -rm -rf $tmpfile_b $tmpfile_n - -exit $rc diff --git a/tests_rv/patch/module_param/info.json b/tests_rv/patch/module_param/info.json deleted file mode 100644 index c6d11d9..0000000 --- a/tests_rv/patch/module_param/info.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "run": ["module_param.sh"] -} diff --git a/tests_rv/patch/module_param/module_param.sh b/tests_rv/patch/module_param/module_param.sh deleted file mode 100755 index a7c061c..0000000 --- a/tests_rv/patch/module_param/module_param.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (c) 2020 Facebook - -params=$(git show | grep -i '^\+.*module_param') -new_params=$(git show | grep -ic '^\+.*module_param') -old_params=$(git show | grep -ic '^\-.*module_param') - -echo "Was $old_params now: $new_params" >&$DESC_FD - -if [ -z "$params" ]; then - exit 0 -else - echo -e "Detected module_param\n$params" 1>&2 - - if [ $new_params -eq $old_params ]; then - exit 250 - else - exit 1 - fi -fi diff --git a/tests_rv/patch/source_inline/info.json b/tests_rv/patch/source_inline/info.json deleted file mode 100644 index bd866bc..0000000 --- a/tests_rv/patch/source_inline/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "run": ["source_inline.sh"], - "disabled": true -} diff --git a/tests_rv/patch/source_inline/source_inline.sh b/tests_rv/patch/source_inline/source_inline.sh deleted file mode 100755 index 579e52e..0000000 --- a/tests_rv/patch/source_inline/source_inline.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -inlines=$(git show -- '*.c' | grep -i '^\+\([^*/]*\W\|\)inline\W') -new_inlines=$(git show -- '*.c' | grep -ic '^\+\([^*/]*\W\|\)inline\W') -old_inlines=$(git show -- '*.c' | grep -ic '^\-\([^*/]*\W\|\)inline\W') - -echo "Was $old_inlines now: $new_inlines" >&$DESC_FD - -if [ -z "$inlines" ]; then - exit 0 -else - echo -e "Detected inline keyword in C files\n$inlines" 1>&2 - - if [ $new_inlines -eq $old_inlines ]; then - exit 250 - else - exit 1 - fi -fi diff --git a/tests_rv/patch/verify_fixes/info.json b/tests_rv/patch/verify_fixes/info.json deleted file mode 100644 index 114c7d3..0000000 --- a/tests_rv/patch/verify_fixes/info.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "source": "https://raw.githubusercontent.com/gregkh/gregkh-linux/master/work/verify_fixes.sh", - "run": ["verify_fixes.sh", "HEAD~..HEAD"], - "pull-requests": true -} diff --git a/tests_rv/patch/verify_fixes/verify_fixes.sh b/tests_rv/patch/verify_fixes/verify_fixes.sh deleted file mode 100755 index 7ed4d64..0000000 --- a/tests_rv/patch/verify_fixes/verify_fixes.sh +++ /dev/null @@ -1,212 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Stephen Rothwell -# Copyright (C) 2019 Greg Kroah-Hartman -# Copyright (c) 2020 Facebook -# -# Verify that the "Fixes:" tag is correct in a kernel commit -# -# usage: -# verify_fixes.sh GIT_RANGE -# -# To test just the HEAD commit do: -# verify_fixes.sh HEAD^..HEAD -# -# -# Thanks to Stephen Rothwell for the majority of this code -# - -# Only thing you might want to change here, the location of where Linus's git -# tree is on your system: - -########################################## -# No need to touch anything below here - -split_re='^([Cc][Oo][Mm][Mm][Ii][Tt])?[[:space:]]*([[:xdigit:]]{5,})([[:space:]]*)(.*)$' -nl=$'\n' -tab=$'\t' - -help() -{ - echo "error, git range not found" - echo "usage:" - echo " $0 GIT_RANGE" - exit 1 -} - -# Strip the leading and training spaces from a string -strip_spaces() -{ - [[ "$1" =~ ^[[:space:]]*(.*[^[:space:]])[[:space:]]*$ ]] - echo "${BASH_REMATCH[1]}" -} - -verify_fixes() -{ - git_range=$1 - error=0 - commits=$(git rev-list --no-merges -i --grep='^[[:space:]]*Fixes:' "${git_range}") - if [ -z "$commits" ]; then - echo "No Fixes tag" >&$DESC_FD - return 0 - fi - - for c in $commits; do - - commit_log=$(git log -1 --format='%h ("%s")' "$c") -# commit_msg="In commit: -# $commit_log -#" - commit_msg="Commit: $commit_log -" - - fixes_lines=$(git log -1 --format='%B' "$c" | - grep -i '^[[:space:]]*Fixes:') - - while read -r fline; do - [[ "$fline" =~ ^[[:space:]]*[Ff][Ii][Xx][Ee][Ss]:[[:space:]]*(.*)$ ]] - f="${BASH_REMATCH[1]}" -# fixes_msg=" Fixes tag: -# $fline -# Has these problem(s): -#" - fixes_msg=" Fixes tag: $fline - Has these problem(s): -" - sha= - subject= - msg= - - if git log -1 --format='%B' "$c" | tr '\n' '#' | grep -qF "##$fline##"; then - msg="${msg:+${msg}${nl}}${tab}${tab}- empty lines surround the Fixes tag" - error=$(( error + 1 )) - fi - - if [[ "$f" =~ $split_re ]]; then - first="${BASH_REMATCH[1]}" - sha="${BASH_REMATCH[2]}" - spaces="${BASH_REMATCH[3]}" - subject="${BASH_REMATCH[4]}" - if [ "$first" ]; then - msg="${msg:+${msg}${nl}}${tab}${tab}- leading word '$first' unexpected" - error=$(( error + 1 )) - fi - if [ -z "$subject" ]; then - msg="${msg:+${msg}${nl}}${tab}${tab}- missing subject" - error=$(( error + 1 )) - elif [ -z "$spaces" ]; then - msg="${msg:+${msg}${nl}}${tab}${tab}- missing space between the SHA1 and the subject" - error=$(( error + 1 )) - fi - else - printf '%s%s\t\t- %s\n' "$commit_msg" "$fixes_msg" 'No SHA1 recognised' - error=$(( error + 1 )) - commit_msg='' - continue - fi - if ! git rev-parse -q --verify "$sha" >/dev/null; then - printf '%s%s\t\t- %s\n' "$commit_msg" "$fixes_msg" 'Target SHA1 does not exist' - error=$(( error + 1 )) - commit_msg='' - continue - fi - - if [ "${#sha}" -lt 12 ]; then - msg="${msg:+${msg}${nl}}${tab}${tab}- SHA1 should be at least 12 digits long${nl}${tab}${tab} Can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11${nl}${tab}${tab} or later) just making sure it is not set (or set to \"auto\")." - error=$(( error + 1 )) - fi - # reduce the subject to the part between () if there - if [[ "$subject" =~ ^\((.*)\) ]]; then - subject="${BASH_REMATCH[1]}" - elif [[ "$subject" =~ ^\((.*) ]]; then - subject="${BASH_REMATCH[1]}" - msg="${msg:+${msg}${nl}}${tab}${tab}- Subject has leading but no trailing parentheses" - error=$(( error + 1 )) - fi - - # strip matching quotes at the start and end of the subject - # the unicode characters in the classes are - # U+201C LEFT DOUBLE QUOTATION MARK - # U+201D RIGHT DOUBLE QUOTATION MARK - # U+2018 LEFT SINGLE QUOTATION MARK - # U+2019 RIGHT SINGLE QUOTATION MARK - re1=$'^[\"\u201C](.*)[\"\u201D]$' - re2=$'^[\'\u2018](.*)[\'\u2019]$' - re3=$'^[\"\'\u201C\u2018](.*)$' - if [[ "$subject" =~ $re1 ]]; then - subject="${BASH_REMATCH[1]}" - elif [[ "$subject" =~ $re2 ]]; then - subject="${BASH_REMATCH[1]}" - elif [[ "$subject" =~ $re3 ]]; then - subject="${BASH_REMATCH[1]}" - msg="${msg:+${msg}${nl}}${tab}${tab}- Subject has leading but no trailing quotes" - error=$(( error + 1 )) - fi - - subject=$(strip_spaces "$subject") - - target_subject=$(git log -1 --format='%s' "$sha") - target_subject=$(strip_spaces "$target_subject") - - # match with ellipses - case "$subject" in - *...) subject="${subject%...}" - target_subject="${target_subject:0:${#subject}}" - ;; - ...*) subject="${subject#...}" - target_subject="${target_subject: -${#subject}}" - ;; - *\ ...\ *) - s1="${subject% ... *}" - s2="${subject#* ... }" - subject="$s1 $s2" - t1="${target_subject:0:${#s1}}" - t2="${target_subject: -${#s2}}" - target_subject="$t1 $t2" - ;; - esac - subject=$(strip_spaces "$subject") - target_subject=$(strip_spaces "$target_subject") - - if [ "$subject" != "${target_subject:0:${#subject}}" ]; then - msg="${msg:+${msg}${nl}}${tab}${tab}- Subject does not match target commit subject${nl}${tab}${tab} Just use${nl}${tab}${tab}${tab}git log -1 --format='Fixes: %h (\"%s\")'" - error=$(( error + 1 )) - fi - lsha=$(git rev-parse -q --verify "$sha") - if [ -z "$lsha" ]; then - count=$(git rev-list --count "$sha".."$c") - if [ "$count" -eq 0 ]; then - msg="${msg:+${msg}${nl}}${tab}${tab}- Target is not an ancestor of this commit" - error=$(( error + 1 )) - fi - fi - - if [ "$msg" ]; then - printf '%s%s%s\n' "$commit_msg" "$fixes_msg" "$msg" - commit_msg='' - # Make sure we don't accidentally miss anything. - if [ $error -eq 0 ]; then - echo 'Whoops! $error out of sync with $msg' >&2 - error=1 - fi - fi - done <<< "$fixes_lines" - done - - if [ ${error} -ne 0 ] ; then - echo "Problems with Fixes tag: $error" >&$DESC_FD - exit 1 - fi - echo "Fixes tag looks correct" >&$DESC_FD - return 0 -} - -git_range=$1 - -if [ "${git_range}" == "" ] ; then - help -fi - -verify_fixes "${git_range}" -exit 0 diff --git a/tests_rv/patch/verify_signedoff/info.json b/tests_rv/patch/verify_signedoff/info.json deleted file mode 100644 index e044eaa..0000000 --- a/tests_rv/patch/verify_signedoff/info.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "source": "https://raw.githubusercontent.com/gregkh/gregkh-linux/master/work/verify_signedoff.sh", - "run": ["verify_signedoff.sh", "HEAD~..HEAD"], - "pull-requests": true -} diff --git a/tests_rv/patch/verify_signedoff/verify_signedoff.sh b/tests_rv/patch/verify_signedoff/verify_signedoff.sh deleted file mode 100755 index 445b132..0000000 --- a/tests_rv/patch/verify_signedoff/verify_signedoff.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Stephen Rothwell -# Copyright (C) 2019 Greg Kroah-Hartman -# -# Verify that the signed-off-by chain looks correct for a range of git commits. -# -# usage: -# verify_signedoff.sh GIT_RANGE -# -# To test just the HEAD commit do: -# verify_signedoff.sh HEAD^..HEAD -# -# -# Thanks to Stephen Rothwell for the majority of this code -# - -help() -{ - echo "error, git range not found" - echo "usage:" - echo " $0 GIT_RANGE" - exit 1 -} - -verify_signedoff() -{ - git_range=$1 - error=false - for c in $(git rev-list --no-merges "${git_range}"); do - ae=$(git log -1 --format='%ae' "$c") - aE=$(git log -1 --format='%aE' "$c") - an=$(git log -1 --format='%an' "$c") - aN=$(git log -1 --format='%aN' "$c") - ce=$(git log -1 --format='%ce' "$c") - cE=$(git log -1 --format='%cE' "$c") - cn=$(git log -1 --format='%cn' "$c") - cN=$(git log -1 --format='%cN' "$c") - sob=$(git log -1 --format='%b' "$c" | grep -i '^[[:space:]]*Signed-off-by:') - - am=false - cm=false - grep -i -q "<$ae>" <<<"$sob" || - grep -i -q "<$aE>" <<<"$sob" || - grep -i -q ":[[:space:]]*${an}[[:space:]]*<" <<<"$sob" || - grep -i -q ":[[:space:]]*${aN}[[:space:]]*<" <<<"$sob" || - am=true - grep -i -q "<$ce>" <<<"$sob" || - grep -i -q "<$cE>" <<<"$sob" || - grep -i -q ":[[:space:]]*${cn}[[:space:]]*<" <<<"$sob" || - grep -i -q ":[[:space:]]*${cN}[[:space:]]*<" <<<"$sob" || - cm=true - - if "$am" || "$cm"; then - printf "Commit %s\n" "$(git show -s --abbrev-commit --abbrev=12 --pretty=format:"%h (\"%s\")%n" "${c}")" - "$am" && printf "\tauthor Signed-off-by missing\n" | tee -a /dev/fd/$DESC_FD - "$cm" && printf "\tcommitter Signed-off-by missing\n" | tee -a /dev/fd/$DESC_FD - printf "\tauthor email: %s\n" "$ae" - printf "\tcommitter email: %s\n" "$ce" - readarray -t s <<< "${sob}" - printf "\t%s\n" "${s[@]}" - printf "\n" - error=true - fi - done - if "$error"; then - echo "Errors in tree with Signed-off-by, please fix!" - exit 1 - fi - echo "Signed-off-by tag matches author and committer" >&$DESC_FD -} - -git_range=$1 - -if [ "${git_range}" == "" ] ; then - help -fi - -verify_signedoff "${git_range}" -exit 0 diff --git a/tests_rv/series/cover_letter/info.json b/tests_rv/series/cover_letter/info.json deleted file mode 100644 index 301f822..0000000 --- a/tests_rv/series/cover_letter/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pymod": "test", - "pyfunc": "cover_letter" -} diff --git a/tests_rv/series/cover_letter/test.py b/tests_rv/series/cover_letter/test.py deleted file mode 100644 index 94dabe1..0000000 --- a/tests_rv/series/cover_letter/test.py +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -from typing import Tuple -""" Test presence of a cover letter """ - - -def cover_letter(tree, thing, result_dir) -> Tuple[int, str]: - if thing.cover_letter: - return 0, "Series has a cover letter" - if thing.cover_pull: - return 0, "Pull request is its own cover letter" - # 2 patches are okay without a cover letter; this covers trivial cases like - # feature + selftest postings where commit message of the feature is definitive - if len(thing.patches) < 3: - return 0, "Single patches do not need cover letters" - return 1, "Series does not have a cover letter" diff --git a/tests_rv/series/fixes_present/info.json b/tests_rv/series/fixes_present/info.json deleted file mode 100644 index e1813be..0000000 --- a/tests_rv/series/fixes_present/info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pymod": "test", - "pyfunc": "fixes_present" -} diff --git a/tests_rv/series/fixes_present/test.py b/tests_rv/series/fixes_present/test.py deleted file mode 100644 index 40bf6db..0000000 --- a/tests_rv/series/fixes_present/test.py +++ /dev/null @@ -1,45 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -import re - -from typing import Tuple -""" Test presence of the Fixes tag in non *-next patches """ - - -def fixes_present(tree, thing, result_dir) -> Tuple[int, str]: - if tree.pfx.count("next"): - return 0, "Fixes tag not required for -next series" - for patch in thing.patches: - if patch.raw_patch.count('\nFixes: '): - return 0, "Fixes tag present in non-next series" - - r_header = re.compile(r'\+\+\+ b/([-\w/._]+)$') - all_safe = None - for p in thing.patches: - lines = p.raw_patch.split('\n') - safe = None - - for line in lines: - match = r_header.match(line) - if not match: - continue - - file_name = match.group(1) - if file_name.startswith("Documentation/") or \ - file_name.startswith("MAINTAINERS"): - safe = True - else: - safe = False - break - - if safe: - all_safe = True - else: - all_safe = False - break - if all_safe: - return 0, "No Fixes tags, but series doesn't touch code" - - return 1, "Series targets non-next tree, but doesn't contain any Fixes tags" diff --git a/tests_rv/series/patch_count/info.json b/tests_rv/series/patch_count/info.json deleted file mode 100644 index e15455c..0000000 --- a/tests_rv/series/patch_count/info.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "pymod": "test", - "pyfunc": "patch_count", - "disabled": true -} diff --git a/tests_rv/series/patch_count/test.py b/tests_rv/series/patch_count/test.py deleted file mode 100644 index 4160fcb..0000000 --- a/tests_rv/series/patch_count/test.py +++ /dev/null @@ -1,15 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Copyright (C) 2019 Netronome Systems, Inc. - -from typing import Tuple -""" Test number of patches, we have a 15 patch limit on netdev """ - - -def patch_count(tree, thing, result_dir) -> Tuple[int, str]: - if len(thing.patches) <= 15: - return 0, "" - if thing.cover_pull: - return 250, "Series longer than 15 patches" - # Really no good if there's no cover letter. - return 1, "Series longer than 15 patches (and no cover letter)"