Fixes for PugetBench including new Lightroom (#175)

Added some much needed maintenance on PugetBench to fix some issues with
errors for the newer 1.4 versions.
Added Lightroom to the list of tests available
This commit is contained in:
J-Doiron
2025-12-15 10:29:31 -08:00
committed by GitHub
3 changed files with 157 additions and 49 deletions

View File

@@ -13,6 +13,7 @@ options:
- premierepro
- photoshop
- aftereffects
- lightroom
- resolve
tooltip: Select which test to run
- name: benchmark_version

View File

@@ -8,7 +8,7 @@ from argparse import ArgumentParser
import time
from subprocess import Popen, PIPE
import threading
from utils import find_latest_log, find_score_in_log, get_photoshop_version, get_premierepro_version, get_aftereffects_version, get_davinci_version, get_pugetbench_version, get_latest_benchmark_by_version
from utils import find_latest_log, find_score_in_log, get_photoshop_version, get_premierepro_version, get_lightroom_version, get_aftereffects_version, get_davinci_version, get_pugetbench_version, get_latest_benchmark_by_version
sys.path.insert(1, os.path.join(sys.path[0], ".."))
from harness_utils.process import terminate_processes
@@ -74,6 +74,8 @@ def run_benchmark(application: str, app_version: str, benchmark_version: str):
command = [executable_path] + command_args + ["--app", "photoshop"]
elif application == "aftereffects":
command = [executable_path] + command_args + ["--app", "aftereffects"]
elif application == "lightroom":
command = [executable_path] + command_args + ["--app", "lightroom"]
elif application == "resolve":
command = [executable_path] + command_args + ["--app", "resolve"]
@@ -122,6 +124,7 @@ def main():
"premierepro",
"photoshop",
"aftereffects",
"lightroom",
"resolve"
]
@@ -134,27 +137,36 @@ def main():
version = args.app_version
score = 0
full_version = None
trimmed_version = None
test = ""
if args.app == "premierepro":
test = "Adobe Premiere Pro"
if version is None:
version = get_premierepro_version()
full_version, trimmed_version = get_premierepro_version()
elif args.app == "photoshop":
test = "Adobe Photoshop"
if version is None:
version = get_photoshop_version()
full_version, trimmed_version = get_photoshop_version()
elif args.app == "aftereffects":
test = "Adobe After Effects"
if version is None:
version = get_aftereffects_version()
full_version, trimmed_version = get_aftereffects_version()
elif args.app == "lightroom":
test = "Adobe Lightroom Classic"
if version is None:
full_version, trimmed_version = get_lightroom_version()
elif args.app == "resolve":
test = "Davinci Resolve Studio"
if version is None:
version = get_davinci_version() + "-studio"
full_version, trimmed_version = get_davinci_version()
if full_version and trimmed_version:
full_version += "-studio"
trimmed_version += "-studio"
try:
start_time, end_time = run_benchmark(
args.app, version, args.benchmark_version)
args.app, trimmed_version, args.benchmark_version)
log_file = find_latest_log()
score = find_score_in_log(log_file)
destination = Path(script_dir) / "run" / os.path.split(log_file)[1]
@@ -165,7 +177,7 @@ def main():
"end_time": seconds_to_milliseconds(end_time),
"test": "PugetBench",
"test_parameter": test,
"app_version": version,
"app_version": full_version,
"benchmark_version": args.benchmark_version,
"pugetbench_version": get_pugetbench_version(),
"unit": "Score",

View File

@@ -3,11 +3,12 @@ import re
import os
from pathlib import Path
import win32api
import csv
def get_latest_benchmark_by_version(benchmark_name: str):
"""Get the latest benchmark version, prioritizing beta if it's newer."""
valid_names = ['photoshop', 'premierepro', 'aftereffects', 'resolve']
valid_names = ['photoshop', 'premierepro', 'aftereffects', 'lightroom', 'resolve']
if benchmark_name not in valid_names:
raise ValueError("Invalid benchmark name")
@@ -60,34 +61,58 @@ def find_latest_log():
def find_score_in_log(log_path):
"""find score in pugetbench log file"""
with open(log_path, 'r', encoding="utf-8") as file:
for line in file:
score = is_score_line(line)
if score is not None:
return score
"""Return a single PugetBench overall score, preferring Standard > Extended > Basic."""
scores = {}
with open(log_path, newline='', encoding="utf-8") as f:
reader = csv.reader(f)
for row in reader:
if not row:
continue
label = row[0].strip()
# Only process rows that begin with "Overall Score"
if not label.startswith("Overall Score"):
continue
# Find the first numeric field
for field in row:
cleaned = field.replace(",", "").strip()
if cleaned.isdigit():
scores[label] = int(cleaned)
break
# Priority order — return the first one found
priority = [
"Overall Score (Standard)",
"Overall Score (Extended)",
"Overall Score (Basic)",
]
for key in priority:
if key in scores:
return scores[key]
return None
def is_score_line(line):
"""check if string is a score using regex"""
regex_pattern = r"^Overall Score.+,+(\d+),+"
match = re.search(regex_pattern, line)
if match and len(match.groups()) > 0:
return match.group(1)
return None
def get_photoshop_version() -> tuple[str, str]:
"""Get the installed Adobe Photoshop version string, prioritizing Beta versions."""
base_path = r"C:\Program Files\Adobe"
# Check if Adobe folder exists
if not os.path.exists(base_path):
print("Adobe directory not found.")
return None
def get_photoshop_version() -> str:
"""Get the current installed Adobe Premiere Pro version string."""
base_path = "C:\\Program Files\\Adobe"
# Look for Adobe Premiere Pro folders
# Look for Adobe Photoshop folders
possible_versions = sorted(
[d for d in os.listdir(base_path) if "Adobe Photoshop" in d],
reverse=True # Prioritize newer versions
)
for folder in possible_versions:
exe_path = os.path.join(base_path, folder, "Photoshop.exe")
if os.path.exists(exe_path):
@@ -96,13 +121,19 @@ def get_photoshop_version() -> str:
exe_path, "\\VarFileInfo\\Translation"
)[0]
str_info_path = f"\\StringFileInfo\\{lang:04X}{codepage:04X}\\ProductVersion"
return win32api.GetFileVersionInfo(exe_path, str_info_path)
full_version = win32api.GetFileVersionInfo(exe_path, str_info_path)
# Trim to major.minor
parts = full_version.split(".")
major_minor = ".".join(parts[:2]) if len(parts) >= 2 else full_version
return full_version, major_minor
except Exception as e:
print(f"Error reading version from {exe_path}: {e}")
return None # No valid installation found
def get_aftereffects_version() -> str:
return None, None
def get_aftereffects_version() -> tuple[str, str]:
"""Get the installed Adobe After Effects version string, prioritizing Beta versions."""
base_path = r"C:\Program Files\Adobe"
@@ -131,23 +162,34 @@ def get_aftereffects_version() -> str:
if info:
lang, codepage = info[0]
str_info_path = f"\\StringFileInfo\\{lang:04X}{codepage:04X}\\ProductVersion"
return str(win32api.GetFileVersionInfo(exe_path, str_info_path))
full_version = str(win32api.GetFileVersionInfo(exe_path, str_info_path))
# Trim to major.minor
parts = full_version.split(".")
major_minor = ".".join(parts[:2]) if len(parts) >= 2 else full_version
return full_version, major_minor
except Exception as e:
print(f"Error reading version from {exe_path}: {e}")
return None # No valid installation found
return None, None
def get_premierepro_version() -> str:
def get_premierepro_version() -> tuple[str, str]:
"""Get the current installed Adobe Premiere Pro version string."""
base_path = "C:\\Program Files\\Adobe"
base_path = r"C:\Program Files\Adobe"
# Check if Adobe folder exists
if not os.path.exists(base_path):
print("Adobe directory not found.")
return None
# Look for Adobe Premiere Pro folders
possible_versions = sorted(
[d for d in os.listdir(base_path) if "Adobe Premiere Pro" in d],
reverse=True # Prioritize newer versions
)
for folder in possible_versions:
exe_path = os.path.join(base_path, folder, "Adobe Premiere Pro.exe")
if os.path.exists(exe_path):
@@ -156,27 +198,80 @@ def get_premierepro_version() -> str:
exe_path, "\\VarFileInfo\\Translation"
)[0]
str_info_path = f"\\StringFileInfo\\{lang:04X}{codepage:04X}\\ProductVersion"
return win32api.GetFileVersionInfo(exe_path, str_info_path)
full_version = win32api.GetFileVersionInfo(exe_path, str_info_path)
# Trim to major.minor
parts = full_version.split(".")
major_minor = ".".join(parts[:2]) if len(parts) >= 2 else full_version
return full_version, major_minor
except Exception as e:
print(f"Error reading version from {exe_path}: {e}")
return None # No valid installation found
return None, None
def get_lightroom_version() -> tuple[str, str]:
"""Get the current installed Adobe Lightroom Classic version string."""
base_path = r"C:\Program Files\Adobe"
# Check if Adobe folder exists
if not os.path.exists(base_path):
print("Adobe directory not found.")
return None
# Look for Adobe Lightroom Classic folders
possible_versions = sorted(
[d for d in os.listdir(base_path) if "Adobe Lightroom Classic" in d],
reverse=True # Prioritize newer versions
)
for folder in possible_versions:
exe_path = os.path.join(base_path, folder, "Lightroom.exe")
if os.path.exists(exe_path):
try:
lang, codepage = win32api.GetFileVersionInfo(
exe_path, "\\VarFileInfo\\Translation"
)[0]
str_info_path = f"\\StringFileInfo\\{lang:04X}{codepage:04X}\\ProductVersion"
full_version = win32api.GetFileVersionInfo(exe_path, str_info_path)
# Trim to major.minor
parts = full_version.split(".")
major_minor = ".".join(parts[:2]) if len(parts) >= 2 else full_version
return full_version, major_minor
except Exception as e:
print(f"Error reading version from {exe_path}: {e}")
return None, None
def get_davinci_version() -> str:
"""get current photoshop version string"""
path = "C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\Resolve.exe"
def get_davinci_version() -> tuple[str, str]:
"""Get the current installed Davinci Resolve Studio version string."""
path = r"C:\Program Files\Blackmagic Design\DaVinci Resolve\Resolve.exe"
if not os.path.exists(path):
print("DaVinci Resolve executable not found.")
return None, None
try:
lang, codepage = win32api.GetFileVersionInfo(
path, "\\VarFileInfo\\Translation")[0]
path, "\\VarFileInfo\\Translation"
)[0]
str_info_path = f"\\StringFileInfo\\{lang:04X}{codepage:04X}\\ProductVersion"
return win32api.GetFileVersionInfo(path, str_info_path)
full_version = win32api.GetFileVersionInfo(path, str_info_path)
# Trim to major.minor
parts = full_version.split(".")
major_minor = ".".join(parts[:2]) if len(parts) >= 2 else full_version
return full_version, major_minor
except Exception as e:
print(e)
return None
print(f"Error reading version from {path}: {e}")
return None, None
def get_pugetbench_version() -> str:
"""get current premiere pro version string"""
"""Get the current installed PugetBench version string."""
path = "C:\\Program Files\\PugetBench for Creators\\PugetBench for Creators.exe"
try:
lang, codepage = win32api.GetFileVersionInfo(
@@ -185,4 +280,4 @@ def get_pugetbench_version() -> str:
return win32api.GetFileVersionInfo(path, str_info_path)
except Exception as e:
print(e)
return None
return None