mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Make it easier to run tests from within UI
This commit is contained in:
@@ -314,6 +314,28 @@ void PythonContext::GlobalInit()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if RENDERDOC_STABLE_BUILD == 0
|
||||
// if we're running in the git checkout and we can find the test scripts, add that location to the
|
||||
// path
|
||||
{
|
||||
QDir bin = QFileInfo(QCoreApplication::applicationFilePath()).absoluteDir();
|
||||
|
||||
QString testpath = QDir::cleanPath(bin.absoluteFilePath(lit("../../util/test")));
|
||||
|
||||
if(QDir(testpath).exists(lit("run_tests.py")))
|
||||
{
|
||||
PyObject *syspath = PyObject_GetAttrString(sysobj, "path");
|
||||
|
||||
PyObject *str = PyUnicode_FromString(testpath.toUtf8().data());
|
||||
|
||||
PyList_Append(syspath, str);
|
||||
|
||||
Py_DecRef(str);
|
||||
Py_DecRef(syspath);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// set up PySide
|
||||
#if PYSIDE2_ENABLED
|
||||
{
|
||||
|
||||
@@ -188,13 +188,7 @@ class Iter_Test(rdtest.TestCase):
|
||||
|
||||
self.controller.SetFrameEvent(draw.eventId, True)
|
||||
|
||||
def iter_test(self, path):
|
||||
try:
|
||||
self.controller = rdtest.open_capture(path)
|
||||
except RuntimeError as err:
|
||||
rdtest.log.print("Skipping. Can't open {}: {}".format(path, err))
|
||||
return
|
||||
|
||||
def iter_test(self):
|
||||
# Handy tweaks when running locally to disable certain things
|
||||
|
||||
action_chance = 0.1 # Chance of doing anything at all
|
||||
@@ -239,8 +233,6 @@ class Iter_Test(rdtest.TestCase):
|
||||
|
||||
draw = draw.next
|
||||
|
||||
self.controller.Shutdown()
|
||||
|
||||
def run(self):
|
||||
dir_path = self.get_ref_path('', extra=True)
|
||||
|
||||
@@ -253,8 +245,22 @@ class Iter_Test(rdtest.TestCase):
|
||||
|
||||
rdtest.log.print('Iterating {}'.format(file.name))
|
||||
|
||||
self.iter_test(file.path)
|
||||
try:
|
||||
self.controller = rdtest.open_capture(file.path)
|
||||
except RuntimeError as err:
|
||||
rdtest.log.print("Skipping. Can't open {}: {}".format(file.path, err))
|
||||
continue
|
||||
|
||||
self.iter_test()
|
||||
|
||||
self.controller.Shutdown()
|
||||
|
||||
rdtest.log.success("Iterated {}".format(file.name))
|
||||
|
||||
rdtest.log.success("Iterated all files")
|
||||
|
||||
# Useful for calling from within the UI
|
||||
def run_external(self, controller: rd.ReplayController):
|
||||
self.controller = controller
|
||||
|
||||
self.iter_test()
|
||||
|
||||
Reference in New Issue
Block a user