From 8acb6b8c58fe4f3faef26e80b2a45470ae995d6d Mon Sep 17 00:00:00 2001 From: Enrico Pozzobon Date: Wed, 3 Jul 2019 09:07:54 +0200 Subject: [PATCH] randomized build dirs --- get_algos.py | 16 +++++++++++----- test.py | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/get_algos.py b/get_algos.py index 3582b2c..84c4ecd 100755 --- a/get_algos.py +++ b/get_algos.py @@ -3,16 +3,22 @@ import os import sys import shutil +import random import subprocess def bench(algo_dir): print(algo_dir) - build_dir = "build" - assets_dir = "assets" - while os.path.isdir(build_dir): - shutil.rmtree(build_dir) + build_dir = None + while build_dir is None: + r = "%09d" % random.randint(0, 999999999) + d = os.path.join("build", r) + if not os.path.isdir(d): + build_dir = d + shutil.copytree(algo_dir, build_dir) + assets_dir = "assets" + hs = os.path.join(assets_dir, "crypto_aead.h") h = os.path.join(build_dir, "crypto_aead.h") shutil.copy(hs, h) @@ -48,7 +54,7 @@ def bench(algo_dir): os.chdir(wd) # shutil.rmtree(build_dir) - exit(0) # stop immediately for now + #exit(0) # stop immediately for now diff --git a/test.py b/test.py index 2b6f373..8b3b59f 100755 --- a/test.py +++ b/test.py @@ -9,7 +9,7 @@ from subprocess import Popen, PIPE def main(argv): - p = Popen(["build/test"], bufsize=0, stdin=PIPE, stdout=PIPE) + p = Popen(argv[1:], bufsize=0, stdin=PIPE, stdout=PIPE) def write(data): l = p.stdin.write(data) -- libgit2 0.26.0