1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
import os
import shutil
from sys import platform
from pydriller import Repository
speedtest_src_path = os.path.join("tests", "python", "speedtest.py")
speedtest_copy_path = os.path.join("tests", "python", "speedtest2.py")
shutil.copyfile(speedtest_src_path, speedtest_copy_path) # the file has to be outside of git
commits = list(Repository('.', from_tag="v0.7.0").traverse_commits())
print("Found commits:")
for idx, commit in enumerate(commits):
name = commit.msg.replace('\n', ' ').replace('\r', ' ')
print(idx, commit.hash, name)
for commit in commits:
commit_time = commit.author_date.strftime("%Y-%m-%d %H:%M:%S")
author_name = commit.author.name
name = "auth:"+author_name+"_"+commit_time+"_msg:"+commit.msg.replace('\n', ' ').replace('\r', ' ').replace(",", ";")
print("\nProcessing", commit.hash, name)
if os.path.exists("build"):
shutil.rmtree("build")
os.system(f"git checkout {commit.hash}")
# Checking we have actually switched the branch:
current_commit=list(Repository('.').traverse_commits())[-1]
if current_commit.hash != commit.hash:
print("git checkout failed!!!!")
print("git checkout failed!!!!")
print("git checkout failed!!!!")
print("git checkout failed!!!!")
continue
print("\n\n--------------------\n\n")
ret = os.system("python -m pip install .")
print("Install result:", ret)
if ret != 0:
print("build failed!!!!")
print("build failed!!!!")
print("build failed!!!!")
print("build failed!!!!")
continue
os.system(f'python {speedtest_copy_path} -n "{commit.hash[:4]}_{name}" -d 16 -t 1')
os.system(f'python {speedtest_copy_path} -n "{commit.hash[:4]}_{name}" -d 16 -t 64')
os.system(f'python {speedtest_copy_path} -n "{commit.hash[:4]}_{name}" -d 4 -t 1')
os.system(f'python {speedtest_copy_path} -n "{commit.hash[:4]}_{name}" -d 4 -t 64')
os.system(f'python {speedtest_copy_path} -n "{commit.hash[:4]}_{name}" -d 128 -t 1')
os.system(f'python {speedtest_copy_path} -n "{commit.hash[:4]}_{name}" -d 128 -t 64')
|