Skip to content

Commit f96736b

Browse files
committed
Have CRev test script compare with BNLS
1 parent f18ba1a commit f96736b

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

scripts/crev_test.py

+13-15
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
from bnls import BnlsClient
99

1010

11-
def print_result(t):
12-
r, d = t.result()
13-
print(f"Results: {r}")
14-
print(f"Time taken: {d} seconds")
15-
16-
1711
async def main(args):
1812
logging.basicConfig(level=logging.DEBUG)
1913

@@ -24,25 +18,29 @@ async def main(args):
2418
seed = args.seed.encode('ascii')
2519

2620
product = BncsProduct.get(args.product)
21+
22+
remote = BnlsClient()
2723
local = LocalHashingProvider(args.hashes)
28-
await local.preload([('IX86', product.code)], version=args.archive)
2924

30-
# remote = BnlsClient()
31-
# await remote.connect()
25+
await asyncio.gather(
26+
local.preload([('IX86', product.code)], version=args.archive),
27+
remote.connect()
28+
)
3229

3330
async def run_test(src, tag):
3431
print(f"Starting {tag} test on {product.code} with archive {args.archive}")
3532
start = time.perf_counter()
3633
result = await src.check_version(product.code, args.archive, seed)
3734
duration = (time.perf_counter() - start)
38-
return result, duration
35+
print(f"{tag} {result} (time: {duration:.3f}s)")
36+
37+
remote_test = asyncio.create_task(run_test(remote, "REMOTE"))
38+
local_test = asyncio.create_task(run_test(local, "LOCAL"))
3939

40-
task = asyncio.create_task(run_test(local, "LOCAL"))
41-
task.add_done_callback(print_result)
42-
await task
40+
await asyncio.gather(remote_test, local_test)
4341

44-
# remote.disconnect("done")
45-
# await remote.wait_closed()
42+
remote.disconnect("done")
43+
await remote.wait_closed()
4644

4745

4846
if __name__ == "__main__":

0 commit comments

Comments
 (0)