Make it easier to run tests from within UI

This commit is contained in:
baldurk
2019-09-20 11:20:45 +01:00
parent 2828f194e1
commit c67995b85a
2 changed files with 38 additions and 10 deletions
@@ -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
{
+16 -10
View File
@@ -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()