Identify the demos binary in scripts, and allow manual configuration

This commit is contained in:
baldurk
2019-05-23 11:07:37 +01:00
parent eb6f04f941
commit efb8788c52
3 changed files with 56 additions and 7 deletions
+2
View File
@@ -189,6 +189,8 @@ def run_tests(test_include: str, test_exclude: str, in_process: bool, slow_tests
log.comment("driver={}".format(driver))
log.print("Demos running from {}".format(util.get_demos_binary()))
layerInfo = rd.VulkanLayerRegistrationInfo()
if rd.NeedVulkanLayerRegistration(layerInfo):
log.print("Vulkan layer needs to be registered: {}".format(str(layerInfo.flags)))
+35
View File
@@ -2,6 +2,8 @@ import sys
import os
import re
import time
import struct
import platform
import hashlib
import zipfile
from typing import Tuple, List
@@ -27,6 +29,7 @@ _data_dir = os.path.realpath('data')
_data_extra_dir = os.path.realpath('data_extra')
_temp_dir = os.path.realpath('tmp')
_test_name = 'Unknown_Test'
_demos_bin = os.path.realpath('demos_x64')
def set_root_dir(path: str):
@@ -54,6 +57,34 @@ def set_temp_dir(path: str):
_temp_dir = os.path.abspath(path)
def set_demos_binary(path: str):
global _demos_bin
if path == "":
# Try to guess where the demos binary might be, but if we can't find it fall back to just trying it in PATH
if struct.calcsize("P") == 8:
_demos_bin = 'demos_x64'
else:
_demos_bin = 'demos_x86'
if platform.system() == 'Windows':
_demos_bin += '.exe'
# Try a few common locations
attempts = [
os.path.join(get_root_dir(), _demos_bin), # in the root (default for Windows)
os.path.join(get_root_dir(), 'build', _demos_bin), # in a build folder (potential for linux)
os.path.join(get_root_dir(), 'demos', _demos_bin), # in the demos folder (ditto)
os.path.join(get_root_dir(), 'demos', 'build', _demos_bin), # in build in the demos folder (ditto)
]
for attempt in attempts:
if os.path.exists(attempt):
_demos_bin = os.path.abspath(attempt)
break
else:
_demos_bin = os.path.abspath(path)
def set_current_test(name: str):
global _test_name
_test_name = name
@@ -91,6 +122,10 @@ def get_tmp_dir():
return _temp_dir
def get_demos_binary():
return _demos_bin
def get_tmp_path(name: str):
os.makedirs(os.path.join(_temp_dir, _test_name), exist_ok=True)
return os.path.join(_temp_dir, _test_name, name)
+19 -7
View File
@@ -2,6 +2,8 @@ import argparse
import os
import sys
script_dir = os.path.realpath(os.path.dirname(__file__))
parser = argparse.ArgumentParser()
parser.add_argument('-r', '--renderdoc',
help="The location of the renderdoc library to use", type=str)
@@ -17,14 +19,16 @@ parser.add_argument('--in-process',
help="Lists the tests available to run", action="store_true")
parser.add_argument('--slow-tests',
help="Run potentially slow tests", action="store_true")
parser.add_argument('--data', default="data",
parser.add_argument('--data', default=os.path.join(script_dir, "data"),
help="The folder that reference data is in. Will not be modified.", type=str)
parser.add_argument('--data-extra', default="data_extra",
parser.add_argument('--demos-binary', default="",
help="The path to the built demos binary.", type=str)
parser.add_argument('--data-extra', default=os.path.join(script_dir, "data_extra"),
help="The folder that extra reference data is in (typically very large captures that aren't part "
"of the normal repo). Will not be modified.", type=str)
parser.add_argument('--artifacts', default="artifacts",
parser.add_argument('--artifacts', default=os.path.join(script_dir, "artifacts"),
help="The folder to put output artifacts in. Will be completely cleared.", type=str)
parser.add_argument('--temp', default="tmp",
parser.add_argument('--temp', default=os.path.join(script_dir, "tmp"),
help="The folder to put temporary run data in. Will be completely cleared.", type=str)
parser.add_argument('--debugger',
help="Enable debugger mode, exceptions are not caught by the framework.", action="store_true")
@@ -56,6 +60,13 @@ if args.pyrenderdoc is not None:
sys.path.insert(0, os.path.realpath(os.path.dirname(__file__)))
data_path = os.path.realpath(args.data)
data_extra_path = os.path.realpath(args.data_extra)
temp_path = os.path.realpath(args.temp)
demos_binary = args.demos_binary
if demos_binary != "":
demos_binary = os.path.realpath(demos_binary)
os.chdir(sys.path[0])
artifacts_dir = os.path.realpath(args.artifacts)
@@ -88,9 +99,10 @@ if args.list:
rdtest.set_root_dir(os.path.realpath(os.path.dirname(__file__)))
rdtest.set_artifact_dir(artifacts_dir)
rdtest.set_data_dir(os.path.realpath(args.data))
rdtest.set_data_extra_dir(os.path.realpath(args.data_extra))
rdtest.set_temp_dir(os.path.realpath(args.temp))
rdtest.set_data_dir(data_path)
rdtest.set_data_extra_dir(data_extra_path)
rdtest.set_temp_dir(temp_path)
rdtest.set_demos_binary(demos_binary)
# debugger option implies in-process test running
if args.debugger: