zip corpus

This commit is contained in:
Yakov Olkhovskiy 2024-10-17 12:42:51 +00:00
parent 4ba099cd7d
commit 55d7563c48

View File

@ -23,6 +23,15 @@ NO_CHANGES_MSG = "Nothing to run"
s3 = S3Helper()
def zipdir(path, ziph):
# ziph is zipfile handle
for root, dirs, files in os.walk(path):
for file in files:
ziph.write(os.path.join(root, file),
os.path.relpath(os.path.join(root, file),
os.path.join(path, '..')))
def get_additional_envs(check_name, run_by_hash_num, run_by_hash_total):
result = []
if "DatabaseReplicated" in check_name:
@ -111,10 +120,15 @@ def download_corpus(corpus_path: str, fuzzer_name: str):
def upload_corpus(result_path: str):
for file in os.listdir(f"{result_path}/corpus/"):
s3.upload_build_directory_to_s3(
Path(f"{result_path}/corpus/{file}"), f"fuzzer/corpus/{file}", False
)
with zipfile.ZipFile(f"{result_path}/corpus.zip", "w", zipfile.ZIP_DEFLATED) as zipf:
zipdir(f"{result_path}/corpus/", zipf)
s3.upload_file(
bucket=S3_BUILDS_BUCKET, file_path=f"{result_path}/corpus.zip", s3_path="fuzzer/corpus.zip"
)
# for file in os.listdir(f"{result_path}/corpus/"):
# s3.upload_build_directory_to_s3(
# Path(f"{result_path}/corpus/{file}"), f"fuzzer/corpus/{file}", False
# )
def main():