test-my-pr: Allow to specify packages to process (#3605)

This commit is contained in:
Rikard Falkeborn 2021-12-05 20:25:38 +01:00 committed by GitHub
parent 97f84a368d
commit 5fd17ef2c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 9 deletions

View File

@ -21,7 +21,9 @@ def format_float(a, b=1):
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Run this script from your branch with proposed Cppcheck patch to verify your patch against current main. It will compare output of testing bunch of opensource packages') parser = argparse.ArgumentParser(description='Run this script from your branch with proposed Cppcheck patch to verify your patch against current main. It will compare output of testing bunch of opensource packages')
parser.add_argument('-j', default=1, type=int, help='Concurency execution threads') parser.add_argument('-j', default=1, type=int, help='Concurency execution threads')
parser.add_argument('-p', default=256, type=int, help='Count of packages to check') group = parser.add_mutually_exclusive_group()
group.add_argument('-p', default=256, type=int, help='Count of packages to check')
group.add_argument('--packages', nargs='+', help='Check specific packages and then stop.')
parser.add_argument('-o', default='my_check_diff.log', help='Filename of result inside a working path dir') parser.add_argument('-o', default='my_check_diff.log', help='Filename of result inside a working path dir')
parser.add_argument('--work-path', '--work-path=', default=lib.work_path, type=str, help='Working directory for reference repo') parser.add_argument('--work-path', '--work-path=', default=lib.work_path, type=str, help='Working directory for reference repo')
args = parser.parse_args() args = parser.parse_args()
@ -74,20 +76,27 @@ if __name__ == "__main__":
print('Failed to compile your version of Cppcheck') print('Failed to compile your version of Cppcheck')
sys.exit(1) sys.exit(1)
packages_count = lib.get_packages_count(lib.server_address) if args.packages:
if not packages_count: args.p = len(args.packages)
print("network or server might be temporarily down..") packages_idxs = []
sys.exit(1) else:
packages_count = lib.get_packages_count(lib.server_address)
if not packages_count:
print("network or server might be temporarily down..")
sys.exit(1)
packages_idxs = list(range(packages_count)) packages_idxs = list(range(packages_count))
random.shuffle(packages_idxs) random.shuffle(packages_idxs)
packages_processed = 0 packages_processed = 0
crashes = [] crashes = []
timeouts = [] timeouts = []
while packages_processed < args.p and len(packages_idxs) > 0: while (packages_processed < args.p and len(packages_idxs) > 0) or args.packages:
package = lib.get_package(lib.server_address, packages_idxs.pop()) if args.packages:
package = args.packages.pop()
else:
package = lib.get_package(lib.server_address, packages_idxs.pop())
tgz = lib.download_package(work_path, package, None) tgz = lib.download_package(work_path, package, None)
if tgz is None: if tgz is None: