test-my-pr.py: several improvements (#2294)
* test-my-pr.py: specify remote branch explicitly When I merged (local) branch to master, `merge-base` returned me not valid commit hash. * donate_cpu_lib.py: strip filename properly * test-my-pr.py: reduced packages count; reduced output * donate_cpu_lib.py: fix previous change
This commit is contained in:
parent
1ea3fc8083
commit
48012aceb4
|
@ -467,7 +467,7 @@ def get_libraries():
|
||||||
return libraries
|
return libraries
|
||||||
|
|
||||||
|
|
||||||
my_script_name = os.path.splitext(sys.argv[0])[0]
|
my_script_name = os.path.splitext(os.path.basename(sys.argv[0]))[0]
|
||||||
jobs = '-j1'
|
jobs = '-j1'
|
||||||
stop_time = None
|
stop_time = None
|
||||||
work_path = os.path.expanduser('~/cppcheck-' + my_script_name + '-workfolder')
|
work_path = os.path.expanduser('~/cppcheck-' + my_script_name + '-workfolder')
|
||||||
|
|
|
@ -14,7 +14,7 @@ import subprocess
|
||||||
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 master. 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 master. 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=1000, type=int, help='Count of packages to check')
|
parser.add_argument('-p', default=256, type=int, help='Count of packages to check')
|
||||||
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()
|
||||||
|
@ -39,7 +39,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.chdir(your_repo_dir)
|
os.chdir(your_repo_dir)
|
||||||
commit_id = (subprocess.check_output(['git', 'merge-base', 'master', 'HEAD'])).strip().decode('ascii')
|
commit_id = (subprocess.check_output(['git', 'merge-base', 'origin/master', 'HEAD'])).strip().decode('ascii')
|
||||||
with open(result_file, 'a') as myfile:
|
with open(result_file, 'a') as myfile:
|
||||||
myfile.write('Common ancestor: ' + commit_id + '\n\n')
|
myfile.write('Common ancestor: ' + commit_id + '\n\n')
|
||||||
|
|
||||||
|
@ -122,7 +122,9 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
with open(result_file, 'a') as myfile:
|
with open(result_file, 'a') as myfile:
|
||||||
myfile.write(package + '\n')
|
myfile.write(package + '\n')
|
||||||
myfile.write('diff:\n' + lib.diff_results(work_path, 'master', results_to_diff[0], 'your', results_to_diff[1]) + '\n')
|
diff = lib.diff_results(work_path, 'master', results_to_diff[0], 'your', results_to_diff[1])
|
||||||
|
if diff != '':
|
||||||
|
myfile.write('diff:\n' + diff + '\n')
|
||||||
|
|
||||||
packages_processed += 1
|
packages_processed += 1
|
||||||
print(str(packages_processed) + ' of ' + str(args.p) + ' packages processed\n')
|
print(str(packages_processed) + ' of ' + str(args.p) + ' packages processed\n')
|
||||||
|
|
Loading…
Reference in New Issue