Update 7zip harness (#56)

- Lock to specific version and download from the network drive.
- Iterate 3 times per invocation.
This commit is contained in:
nharris-lmg
2024-06-25 13:25:35 -07:00
committed by GitHub
3 changed files with 25 additions and 11 deletions

View File

@@ -3,10 +3,14 @@ import json
import logging
import os.path
import re
import sys
import time
from subprocess import Popen
import subprocess
import requests
sys.path.insert(1, os.path.join(sys.path[0], ".."))
from sevenzip_utils import copy_from_network_drive
script_dir = os.path.dirname(os.path.realpath(__file__))
log_dir = os.path.join(script_dir, "run")
@@ -22,24 +26,20 @@ formatter = logging.Formatter(LOGGING_FORMAT)
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)
EXECUTABLE = "7zr.exe"
DOWNLOAD_URL = f"https://www.7-zip.org/a/{EXECUTABLE}"
EXECUTABLE = "7zr_24.07.exe"
ABS_EXECUTABLE_PATH = os.path.join(
os.path.dirname(os.path.realpath(__file__)), EXECUTABLE)
if os.path.isfile(ABS_EXECUTABLE_PATH) is False:
logging.info(
"7-Zip executable not found, downloading from %s", DOWNLOAD_URL)
r = requests.get(DOWNLOAD_URL, allow_redirects=True, timeout=120)
with open(ABS_EXECUTABLE_PATH, 'wb') as file:
file.write(r.content)
"7-Zip executable not found, downloading from network drive")
copy_from_network_drive()
command = f'{ABS_EXECUTABLE_PATH}'
command = command.rstrip()
t1 = time.time()
args = ["b"]
logging.info("Starting 7-Zip benchmark! This may take a minute or so...")
with Popen([command, "b"], cwd=os.path.dirname(
with Popen([command, "b", "3"], cwd=os.path.dirname(
os.path.realpath(__file__)), stdout=subprocess.PIPE) as process:
list_of_strings = [x.decode('utf-8').rstrip('\n')
for x in iter(process.stdout.readlines())]
@@ -67,13 +67,13 @@ with Popen([command, "b"], cwd=os.path.dirname(
logging.info("Benchmark took %s seconds", round((t2 - t1), 3))
result = [
{
"test": "compression",
"test": "7-Zip Compression",
"score": SPEED_C,
"unit": "KiB/s",
"version": VERSION.strip()
},
{
"test": "decompression",
"test": "7-Zip Decompression",
"score": SPEED_D,
"unit": "KiB/s",
"version": VERSION.strip()

12
7z/sevenzip_utils.py Normal file
View File

@@ -0,0 +1,12 @@
"""utility functions for 7-zip harness"""
import os
import shutil
def copy_from_network_drive():
"""Download 7zip from network drive"""
source = r"\\Labs\labs\01_Installers_Utilities\7ZIP\7zr_24.07.exe"
root_dir = os.path.dirname(os.path.realpath(__file__))
destination = os.path.join(root_dir, "7zr_24.07.exe")
shutil.copyfile(source, destination)

View File

@@ -8,6 +8,8 @@ Changes are grouped by the date they are merged to the main branch of the reposi
- Update y-cruncher version, and change parameter to 1b from 5b to loosen memory constraints.
- Update y-cruncher to run 5 times and average the score.
- Update 7-Zip to used a locked version, 24.07.
- Update 7-Zip to iterate 3 times each test run.
## 2024-02-20