mirror of
https://github.com/LTTLabsOSS/markbench-tests.git
synced 2026-01-08 21:48:00 -05:00
misc cleanup (#84)
* remove inline pylint * cspell * pylint import * pylint flac * pylint ycruncher
This commit is contained in:
14
F1_22/f1.py
14
F1_22/f1.py
@@ -9,7 +9,6 @@ from f1_22_utils import get_resolution
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], ".."))
|
||||
|
||||
#pylint: disable=wrong-import-position
|
||||
from harness_utils.keras_service import KerasService
|
||||
from harness_utils.steam import exec_steam_run_command, get_steamapps_common_path
|
||||
from harness_utils.output import (
|
||||
@@ -22,25 +21,24 @@ from harness_utils.output import (
|
||||
)
|
||||
from harness_utils.misc import remove_files
|
||||
from harness_utils.process import terminate_processes
|
||||
#pylint: enable=wrong-import-position
|
||||
|
||||
SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
|
||||
LOG_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, "run")
|
||||
STEAM_GAME_ID = 1692250
|
||||
VIDEO_PATH = os.path.join(get_steamapps_common_path(), "videos")
|
||||
|
||||
skippable = [
|
||||
intro_videos = [
|
||||
os.path.join(VIDEO_PATH, "attract.bk2"),
|
||||
os.path.join(VIDEO_PATH, "cm_f1_sting.bk2"),
|
||||
]
|
||||
|
||||
|
||||
def navigate_overlay():
|
||||
"""Simulate inputs to navigate ingame overlay."""
|
||||
# if steam ingame overlay is disabled it will be a an okay to press
|
||||
"""Simulate inputs to navigate in-game overlay."""
|
||||
# if steam in-game overlay is disabled it will be a an okay to press
|
||||
if kerasService.look_for_word("okay", attempts=5, interval=1):
|
||||
user.press("enter")
|
||||
# if steam ingame overlay is enabled we have to press escape and enter
|
||||
# if steam in-game overlay is enabled we have to press escape and enter
|
||||
elif kerasService.look_for_word("please", attempts=5, interval=1):
|
||||
user.press("esc")
|
||||
time.sleep(0.5)
|
||||
@@ -102,7 +100,7 @@ def navigate_menu():
|
||||
def run_benchmark():
|
||||
"""Runs the actual benchmark."""
|
||||
setup_start_time = time.time()
|
||||
remove_files(skippable)
|
||||
remove_files(intro_videos)
|
||||
exec_steam_run_command(STEAM_GAME_ID)
|
||||
|
||||
time.sleep(20)
|
||||
@@ -174,8 +172,6 @@ try:
|
||||
}
|
||||
|
||||
write_report_json(LOG_DIRECTORY, "report.json", report)
|
||||
|
||||
#pylint: disable=broad-exception-caught
|
||||
except Exception as e:
|
||||
logging.error("Something went wrong running the benchmark!")
|
||||
logging.exception(e)
|
||||
|
||||
@@ -9,7 +9,6 @@ from f1_23_utils import get_resolution
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], ".."))
|
||||
|
||||
# pylint: disable=wrong-import-position
|
||||
from harness_utils.steam import exec_steam_run_command, get_app_install_location
|
||||
from harness_utils.keras_service import KerasService
|
||||
from harness_utils.misc import remove_files
|
||||
@@ -22,7 +21,6 @@ from harness_utils.output import (
|
||||
DEFAULT_LOGGING_FORMAT,
|
||||
DEFAULT_DATE_FORMAT,
|
||||
)
|
||||
# pylint: enable=wrong-import-position
|
||||
|
||||
SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
|
||||
LOG_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, "run")
|
||||
@@ -30,7 +28,7 @@ PROCESS_NAME = "F1_23"
|
||||
STEAM_GAME_ID = 2108330
|
||||
VIDEO_PATH = os.path.join(get_app_install_location(STEAM_GAME_ID), "videos")
|
||||
|
||||
skippable = [
|
||||
intro_videos = [
|
||||
os.path.join(VIDEO_PATH, "attract.bk2"),
|
||||
os.path.join(VIDEO_PATH, "cm_f1_sting.bk2")
|
||||
]
|
||||
@@ -159,7 +157,7 @@ def navigate_menu():
|
||||
|
||||
def run_benchmark():
|
||||
"""Runs the actual benchmark."""
|
||||
remove_files(skippable)
|
||||
remove_files(intro_videos)
|
||||
exec_steam_run_command(STEAM_GAME_ID)
|
||||
setup_start_time = time.time()
|
||||
time.sleep(2)
|
||||
@@ -232,7 +230,6 @@ try:
|
||||
}
|
||||
|
||||
write_report_json(LOG_DIRECTORY, "report.json", report)
|
||||
#pylint: disable=broad-exception-caught
|
||||
except Exception as e:
|
||||
logging.error("Something went wrong running the benchmark!")
|
||||
logging.exception(e)
|
||||
|
||||
@@ -8,7 +8,7 @@ import pydirectinput as user
|
||||
from utils import read_resolution
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
#pylint: disable=wrong-import-position
|
||||
|
||||
from harness_utils.steam import exec_steam_run_command, get_app_install_location
|
||||
from harness_utils.misc import remove_files
|
||||
from harness_utils.process import terminate_processes
|
||||
@@ -21,7 +21,6 @@ from harness_utils.output import (
|
||||
DEFAULT_DATE_FORMAT,
|
||||
)
|
||||
from harness_utils.keras_service import KerasService
|
||||
#pylint: enable=wrong-import-position
|
||||
|
||||
SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
|
||||
LOG_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, "run")
|
||||
@@ -141,7 +140,6 @@ try:
|
||||
}
|
||||
|
||||
write_report_json(LOG_DIRECTORY, "report.json", report)
|
||||
#pylint: disable=broad-exception-caught
|
||||
except Exception as e:
|
||||
logging.error("Something went wrong running the benchmark!")
|
||||
logging.exception(e)
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
"directx",
|
||||
"Dota",
|
||||
"flac",
|
||||
"Forza",
|
||||
"fromy",
|
||||
"HIWORD",
|
||||
"Jcraft",
|
||||
"Keras",
|
||||
@@ -20,11 +22,15 @@
|
||||
"OPTIX",
|
||||
"psutil",
|
||||
"pycache",
|
||||
"Returnal",
|
||||
"RLCS",
|
||||
"RTSS",
|
||||
"tlou",
|
||||
"turbopolsa",
|
||||
"twwh",
|
||||
"Unigine",
|
||||
"vsix"
|
||||
"vsix",
|
||||
"ycruncher"
|
||||
],
|
||||
"ignoreRegExpList": [
|
||||
"import .*"
|
||||
|
||||
@@ -9,7 +9,7 @@ from cyberpunk_utils import copy_no_intro_mod, get_args, read_current_resolution
|
||||
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
#pylint: disable=wrong-import-position
|
||||
|
||||
from harness_utils.keras_service import KerasService
|
||||
from harness_utils.output import (
|
||||
setup_log_directory,
|
||||
@@ -19,7 +19,6 @@ from harness_utils.output import (
|
||||
DEFAULT_DATE_FORMAT)
|
||||
from harness_utils.process import terminate_processes
|
||||
from harness_utils.steam import exec_steam_game
|
||||
#pylint: enable=wrong-import-position
|
||||
|
||||
STEAM_GAME_ID = 1091500
|
||||
SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
|
||||
@@ -134,7 +133,6 @@ try:
|
||||
}
|
||||
|
||||
write_report_json(LOG_DIRECTORY, "report.json", report)
|
||||
#pylint: disable=broad-exception-caught
|
||||
except Exception as e:
|
||||
logging.error("Something went wrong running the benchmark!")
|
||||
logging.exception(e)
|
||||
|
||||
@@ -7,7 +7,7 @@ import sys
|
||||
from dota2_utils import console_command, get_resolution, copy_replay, copy_config, get_args
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
#pylint: disable=wrong-import-position
|
||||
|
||||
from harness_utils.output import (
|
||||
setup_log_directory,
|
||||
write_report_json,
|
||||
|
||||
@@ -13,7 +13,6 @@ import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
#pylint: disable=wrong-import-position
|
||||
|
||||
USERNAME = os.getlogin()
|
||||
SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
@@ -8,7 +8,6 @@ from subprocess import Popen
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], ".."))
|
||||
|
||||
# pylint: disable=wrong-import-position
|
||||
from flac_utils import download_flac, flac_folder_exists
|
||||
from harness_utils.output import DEFAULT_LOGGING_FORMAT, setup_log_directory
|
||||
|
||||
@@ -35,9 +34,8 @@ command = f'{ABS_EXECUTABLE_PATH}'
|
||||
|
||||
command = command.rstrip()
|
||||
start_time = time.time()
|
||||
process = Popen(executable=command, args=[],
|
||||
cwd=os.path.dirname(os.path.realpath(__file__)))
|
||||
EXIT_CODE = process.wait()
|
||||
with Popen(executable=command, args=[], cwd=script_dir) as process:
|
||||
EXIT_CODE = process.wait()
|
||||
|
||||
if EXIT_CODE > 0:
|
||||
logging.error("Test failed!")
|
||||
@@ -48,7 +46,7 @@ score = round((end_time - start_time), 3)
|
||||
logging.info("Benchmark took %s seconds", score)
|
||||
if EXIT_CODE > 0:
|
||||
logging.error("Test failed!")
|
||||
exit(EXIT_CODE)
|
||||
sys.exit(EXIT_CODE)
|
||||
|
||||
report = {
|
||||
"score": score,
|
||||
|
||||
@@ -10,7 +10,6 @@ from forza5_utils import read_resolution
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
|
||||
# pylint: disable=wrong-import-position
|
||||
from harness_utils.output import (
|
||||
format_resolution,
|
||||
seconds_to_milliseconds,
|
||||
@@ -23,7 +22,6 @@ from harness_utils.process import terminate_processes
|
||||
from harness_utils.rtss import start_rtss_process, copy_rtss_profile
|
||||
from harness_utils.steam import exec_steam_run_command
|
||||
from harness_utils.keras_service import KerasService
|
||||
# pylint: enable=wrong-import-position
|
||||
|
||||
STEAM_GAME_ID = 1551360
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
@@ -62,7 +60,7 @@ def run_benchmark():
|
||||
logging.info("Game didn't start.")
|
||||
sys.exit(1)
|
||||
|
||||
logging.info("Accessibilty found pressing X to continue.")
|
||||
logging.info("Accessibility found pressing X to continue.")
|
||||
user.press("x")
|
||||
time.sleep(2)
|
||||
|
||||
@@ -148,7 +146,6 @@ try:
|
||||
}
|
||||
|
||||
write_report_json(LOG_DIRECTORY, "report.json", report)
|
||||
#pylint: disable=broad-exception-caught
|
||||
except Exception as e:
|
||||
logging.error("Something went wrong running the benchmark!")
|
||||
logging.exception(e)
|
||||
|
||||
@@ -9,7 +9,6 @@ from red_dead_redemption_2_utils import get_resolution
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
|
||||
#pylint: disable=wrong-import-position
|
||||
from harness_utils.output import (
|
||||
format_resolution,
|
||||
seconds_to_milliseconds,
|
||||
@@ -20,7 +19,6 @@ from harness_utils.output import (
|
||||
)
|
||||
from harness_utils.process import terminate_processes
|
||||
from harness_utils.steam import exec_steam_run_command
|
||||
#pylint: enable=wrong-import-position
|
||||
|
||||
STEAM_GAME_ID = 1174180
|
||||
PROCESS_NAME = "RDR2"
|
||||
@@ -93,7 +91,6 @@ try:
|
||||
}
|
||||
|
||||
write_report_json(LOG_DIRECTORY, "report.json", report)
|
||||
#pylint: disable=broad-exception-caught
|
||||
except Exception as e:
|
||||
logging.error("Something went wrong running the benchmark!")
|
||||
logging.exception(e)
|
||||
|
||||
@@ -9,7 +9,6 @@ from returnal_utils import get_resolution, get_args
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
|
||||
# pylint: disable=wrong-import-position
|
||||
from harness_utils.keras_service import KerasService
|
||||
from harness_utils.output import (
|
||||
format_resolution,
|
||||
@@ -25,7 +24,6 @@ from harness_utils.steam import (
|
||||
exec_steam_run_command,
|
||||
get_steamapps_common_path,
|
||||
)
|
||||
# pylint: enable=wrong-import-position
|
||||
|
||||
STEAM_GAME_ID = 1649240
|
||||
SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
|
||||
@@ -39,7 +37,7 @@ VIDEO_PATH = os.path.join(get_steamapps_common_path(), "Returnal", "Returnal", "
|
||||
|
||||
user.FAILSAFE = False
|
||||
|
||||
skippable_videos = [
|
||||
intro_videos = [
|
||||
os.path.join(VIDEO_PATH, "Logos_PC.mp4"),
|
||||
os.path.join(VIDEO_PATH, "Logos_PC_UW21.mp4"),
|
||||
os.path.join(VIDEO_PATH, "Logos_PC_UW32.mp4"),
|
||||
@@ -87,7 +85,7 @@ def navigate_options_menu() -> None:
|
||||
def run_benchmark() -> tuple[float]:
|
||||
"""Run the benchmark"""
|
||||
logging.info("Removing intro videos")
|
||||
remove_files(skippable_videos)
|
||||
remove_files(intro_videos)
|
||||
|
||||
logging.info("Starting game")
|
||||
exec_steam_run_command(STEAM_GAME_ID)
|
||||
@@ -159,8 +157,6 @@ try:
|
||||
}
|
||||
|
||||
write_report_json(LOG_DIRECTORY, "report.json", report)
|
||||
|
||||
#pylint: disable=broad-exception-caught
|
||||
except Exception as e:
|
||||
logging.error("Something went wrong running the benchmark!")
|
||||
logging.exception(e)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"""Utility functions supporting Returnal test script."""
|
||||
from argparse import ArgumentParser
|
||||
import os
|
||||
import re
|
||||
|
||||
|
||||
@@ -25,16 +24,6 @@ def get_resolution(config_path: str) -> tuple[int]:
|
||||
return (height, width)
|
||||
|
||||
|
||||
def remove_intro_videos(file_paths: list[str]) -> None:
|
||||
"""Removes given video file paths"""
|
||||
for video in file_paths:
|
||||
try:
|
||||
os.remove(video)
|
||||
except FileNotFoundError:
|
||||
# If file not found, it has likely already been deleted before.
|
||||
pass
|
||||
|
||||
|
||||
def get_args() -> any:
|
||||
"""Get command line arguments"""
|
||||
parser = ArgumentParser()
|
||||
|
||||
@@ -6,10 +6,10 @@ from subprocess import Popen
|
||||
import pyautogui as gui
|
||||
import pydirectinput as user
|
||||
import sys
|
||||
from utils import get_resolution, copy_replay, find_rocketleague_executable, get_args
|
||||
from rocket_league_utils import get_resolution, copy_replay, find_rocketleague_executable, get_args
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
#pylint: disable=wrong-import-position
|
||||
|
||||
from harness_utils.output import (
|
||||
setup_log_directory,
|
||||
write_report_json,
|
||||
|
||||
@@ -8,7 +8,7 @@ import pydirectinput as user
|
||||
from the_last_of_us_part_i_utils import get_args, get_resolution
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
#pylint: disable=wrong-import-position
|
||||
|
||||
from harness_utils.keras_service import KerasService
|
||||
from harness_utils.output import (
|
||||
format_resolution,
|
||||
@@ -23,7 +23,6 @@ from harness_utils.steam import (
|
||||
get_registry_active_user,
|
||||
exec_steam_run_command,
|
||||
)
|
||||
#pylint: enable=wrong-import-position
|
||||
|
||||
STEAM_GAME_ID = 1888930
|
||||
SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
|
||||
@@ -136,7 +135,6 @@ try:
|
||||
}
|
||||
|
||||
write_report_json(LOG_DIRECTORY, "report.json", report)
|
||||
#pylint: disable=broad-exception-caught
|
||||
except Exception as e:
|
||||
logging.error("Something went wrong running the benchmark!")
|
||||
logging.exception(e)
|
||||
|
||||
@@ -9,7 +9,7 @@ import pydirectinput as user
|
||||
from twwh3_utils import read_current_resolution
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
# pylint: disable=wrong-import-position
|
||||
|
||||
from harness_utils.process import terminate_processes
|
||||
from harness_utils.output import (
|
||||
format_resolution,
|
||||
@@ -21,7 +21,6 @@ from harness_utils.output import (
|
||||
)
|
||||
from harness_utils.steam import get_app_install_location
|
||||
from harness_utils.keras_service import KerasService
|
||||
# pylint: enable=wrong-import-position
|
||||
|
||||
SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
|
||||
LOG_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, "run")
|
||||
@@ -182,7 +181,6 @@ try:
|
||||
}
|
||||
|
||||
write_report_json(LOG_DIRECTORY, "report.json", report)
|
||||
#pylint: disable=broad-exception-caught
|
||||
except Exception as e:
|
||||
logging.error("Something went wrong running the benchmark!")
|
||||
logging.exception(e)
|
||||
|
||||
@@ -9,10 +9,8 @@ from subprocess import Popen
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], ".."))
|
||||
|
||||
# pylint: disable=wrong-import-position
|
||||
from ycruncher_utils import YCRUNCHER_FOLDER_NAME, download_ycruncher, ycruncher_folder_exists
|
||||
|
||||
|
||||
ABS_EXECUTABLE_PATH = os.path.join(os.path.dirname(
|
||||
os.path.realpath(__file__)), YCRUNCHER_FOLDER_NAME, "y-cruncher.exe")
|
||||
|
||||
@@ -42,8 +40,8 @@ arg_string = ['skip-warnings', 'bench', '5b', '-o',
|
||||
os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run')]
|
||||
|
||||
logging.info(arg_string)
|
||||
process = Popen(executable=command, args=arg_string)
|
||||
EXIT_CODE = process.wait()
|
||||
with Popen(executable=command, args=arg_string) as process:
|
||||
EXIT_CODE = process.wait()
|
||||
|
||||
if EXIT_CODE > 0:
|
||||
logging.error("Test failed!")
|
||||
|
||||
Reference in New Issue
Block a user