mirror of
https://github.com/LTTLabsOSS/markbench-tests.git
synced 2026-01-10 22:48:18 -05:00
Added collection of artifacts
Added artifact collecting for video configuration
This commit is contained in:
@@ -6,6 +6,8 @@ from subprocess import Popen
|
||||
import pyautogui as gui
|
||||
import pydirectinput as user
|
||||
import sys
|
||||
import getpass
|
||||
from pathlib import Path
|
||||
from rocket_league_utils import get_resolution, copy_replay, find_rocketleague_executable, get_args
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], '..'))
|
||||
@@ -17,14 +19,19 @@ from harness_utils.output import (
|
||||
seconds_to_milliseconds,
|
||||
DEFAULT_LOGGING_FORMAT,
|
||||
DEFAULT_DATE_FORMAT)
|
||||
from harness_utils.misc import press_n_times
|
||||
from harness_utils.process import terminate_processes
|
||||
from harness_utils.keras_service import KerasService
|
||||
from harness_utils.artifacts import ArtifactManager, ArtifactType
|
||||
|
||||
SCRIPT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
|
||||
LOG_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, "run")
|
||||
USERNAME = getpass.getuser()
|
||||
CONFIG_PATH = Path(f"C:\\Users\\{USERNAME}\\Documents\\My Games\\Rocket League\\TAGame\\Config\\TASystemSettings.ini")
|
||||
PROCESS_NAME = "rocketleague.exe"
|
||||
EXECUTABLE_PATH = find_rocketleague_executable()
|
||||
GAME_ID = "9773aa1aa54f4f7b80e44bef04986cea%3A530145df28a24424923f5828cc9031a1%3ASugar?action=launch&silent=true"
|
||||
am = ArtifactManager(LOG_DIRECTORY)
|
||||
|
||||
setup_log_directory(LOG_DIRECTORY)
|
||||
|
||||
@@ -176,9 +183,38 @@ def run_benchmark():
|
||||
elapsed_test_time = round((test_end_time - test_start_time), 2)
|
||||
logging.info("Benchmark took %f seconds", elapsed_test_time)
|
||||
|
||||
user.press("esc")
|
||||
time.sleep(0.4)
|
||||
press_n_times("down", 3, 0.5)
|
||||
time.sleep(0.2)
|
||||
user.press("enter")
|
||||
time.sleep(0.4)
|
||||
|
||||
result = kerasService.look_for_word("video", attempts=10, interval=1)
|
||||
if not result:
|
||||
logging.info("Couldn't find the video tab. Did the settings menu open?")
|
||||
sys.exit(1)
|
||||
|
||||
gui.moveTo(result["x"], result["y"])
|
||||
time.sleep(0.2)
|
||||
gui.mouseDown()
|
||||
time.sleep(0.2)
|
||||
gui.mouseUp()
|
||||
time.sleep(1)
|
||||
result = kerasService.look_for_word("basic", attempts=10, interval=1)
|
||||
if not result:
|
||||
logging.info("Couldn't find the basic settings header. Did Keras click correctly?")
|
||||
sys.exit(1)
|
||||
else:
|
||||
logging.info("Seen the video settings, capturing the data.")
|
||||
am.take_screenshot("video.png", ArtifactType.CONFIG_IMAGE, "Screenshot of the display settings")
|
||||
|
||||
am.copy_file(CONFIG_PATH, ArtifactType.CONFIG_TEXT, "TASystemSettings.ini")
|
||||
|
||||
logging.info("Run completed. Closing game.")
|
||||
time.sleep(2)
|
||||
terminate_processes(PROCESS_NAME)
|
||||
am.create_manifest()
|
||||
return test_start_time, test_end_time
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user