diff --git a/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp b/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp index 1b59dd556..b06249b41 100644 --- a/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp +++ b/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp @@ -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 { diff --git a/util/test/tests/Iter_Test.py b/util/test/tests/Iter_Test.py index 7ee2848b6..85f6b9e01 100644 --- a/util/test/tests/Iter_Test.py +++ b/util/test/tests/Iter_Test.py @@ -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()