Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port git_tester.py on Windows #404

Merged
merged 3 commits into from
Sep 2, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update port git_tester.py on Windows
  • Loading branch information
dyashuni committed Aug 21, 2022
commit c5be3f5079422940ac04475e1834b8b588347ad0
64 changes: 37 additions & 27 deletions examples/git_tester.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,44 @@
import os

from sys import platform
from pydriller import Repository
import os
import datetime
os.system("cp examples/speedtest.py examples/speedtest2.py") # the file has to be outside of git
for idx, commit in enumerate(Repository('.', from_tag="v0.6.0").traverse_commits()):
name=commit.msg.replace('\n', ' ').replace('\r', ' ')
print(idx, commit.hash, name)

if platform == "win32":
copy_cmd = "copy"
rm_dir_cmd = "rmdir /s /q"
else:
copy_cmd = "cp"
rm_dir_cmd = "rm -rf"

speedtest_src_path = os.path.join("examples", "speedtest.py")
speedtest_path = os.path.join("examples", "speedtest2.py")
os.system(f"{copy_cmd} {speedtest_src_path} {speedtest_path}") # the file has to be outside of git

commits = list(Repository('.', from_tag="v0.6.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 Repository('.', from_tag="v0.6.0").traverse_commits():

name=commit.msg.replace('\n', ' ').replace('\r', ' ')
print(commit.hash, name)

os.system(f"git checkout {commit.hash}; rm -rf build; ")
for commit in commits:
name = commit.msg.replace('\n', ' ').replace('\r', ' ')
print("\nProcessing", commit.hash, name)

os.system(f"git checkout {commit.hash}")
os.system(f"{rm_dir_cmd} build")
print("\n\n--------------------\n\n")
ret=os.system("python -m pip install .")
print(ret)

if ret != 0:
print ("build failed!!!!")
print ("build failed!!!!")
print ("build failed!!!!")
print ("build failed!!!!")
continue

os.system(f'python examples/speedtest2.py -n "{name}" -d 4 -t 1')
os.system(f'python examples/speedtest2.py -n "{name}" -d 64 -t 1')
os.system(f'python examples/speedtest2.py -n "{name}" -d 128 -t 1')
os.system(f'python examples/speedtest2.py -n "{name}" -d 4 -t 24')
os.system(f'python examples/speedtest2.py -n "{name}" -d 128 -t 24')
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_path} -n "{name}" -d 4 -t 1')
os.system(f'python {speedtest_path} -n "{name}" -d 64 -t 1')
os.system(f'python {speedtest_path} -n "{name}" -d 128 -t 1')
os.system(f'python {speedtest_path} -n "{name}" -d 4 -t 24')
os.system(f'python {speedtest_path} -n "{name}" -d 128 -t 24')