diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py index 5a3a9a301f..3c67a5482b 100644 --- a/validate/launcher/baseclasses.py +++ b/validate/launcher/baseclasses.py @@ -1486,7 +1486,7 @@ class _TestsLauncher(Loggable): def _load_testsuites(self): testsuites = set() for testsuite in self.options.testsuites: - if os.path.exists(testsuite): + if testsuite.endswith('.py') and os.path.exists(testsuite): testsuite = os.path.abspath(os.path.expanduser(testsuite)) loaded_module = self._load_testsuite([testsuite]) else: diff --git a/validate/launcher/config.py.in b/validate/launcher/config.py.in index 51a5e585fb..f0e3c22cf3 100644 --- a/validate/launcher/config.py.in +++ b/validate/launcher/config.py.in @@ -20,4 +20,5 @@ LIBDIR = r'@LIBDIR@' DATADIR = r'@DATADIR@' BUILDDIR = r'@BUILDDIR@' +SRCDIR = r'@SRCDIR@' GST_VALIDATE_TESTSUITE_VERSION = '@GST_VALIDATE_TESTSUITE_VERSION@' diff --git a/validate/launcher/main.py b/validate/launcher/main.py index 1470d62e51..da0270dfff 100644 --- a/validate/launcher/main.py +++ b/validate/launcher/main.py @@ -141,8 +141,6 @@ if "--help" not in sys.argv: QA_ASSETS = "gst-integration-testsuites" MEDIAS_FOLDER = "medias" DEFAULT_GST_QA_ASSETS_REPO = "https://gitlab.freedesktop.org/gstreamer/gst-integration-testsuites.git" -DEFAULT_TESTSUITES_DIRS = [os.path.join( - DEFAULT_MAIN_DIR, QA_ASSETS, "testsuites")] def download_assets(options): @@ -210,7 +208,7 @@ class LauncherConfig(Loggable): # paths passed with --media-path, and not defined by a testsuite self.user_paths = [] self.paths = [] - self.testsuites_dirs = DEFAULT_TESTSUITES_DIRS + self.testsuites_dirs = utils.DEFAULT_TESTSUITES_DIRS self.clone_dir = None @@ -286,7 +284,10 @@ class LauncherConfig(Loggable): if self.no_color: utils.desactivate_colors() if self.clone_dir is None: - self.clone_dir = os.path.join(self.main_dir, QA_ASSETS) + if not utils.USING_SUBPROJECT: + self.clone_dir = os.path.join(self.main_dir, QA_ASSETS) + else: + self.clone_dir = self.main_dir if not isinstance(self.paths, list): self.paths = [self.paths] @@ -299,14 +300,15 @@ class LauncherConfig(Loggable): if self.generate_info_full is True: self.generate_info = True - if self.sync_all is True or self.force_sync is True: - self.sync = True + if not utils.USING_SUBPROJECT: + if self.sync_all is True or self.force_sync is True: + self.sync = True - if not self.sync and not os.path.exists(self.clone_dir) and \ - self.clone_dir == os.path.join(self.clone_dir, MEDIAS_FOLDER): - printc("Media path (%s) does not exists. Forgot to run --sync ?" - % self.clone_dir, Colors.FAIL, True) - return False + if not self.sync and not os.path.exists(self.clone_dir) and \ + self.clone_dir == os.path.join(self.clone_dir, MEDIAS_FOLDER): + printc("Media path (%s) does not exists. Forgot to run --sync ?" + % self.clone_dir, Colors.FAIL, True) + return False if (self.main_dir != DEFAULT_MAIN_DIR or self.clone_dir != QA_ASSETS): local_clone_dir = os.path.join( @@ -481,7 +483,7 @@ class LauncherConfig(Loggable): " Default is %s" % DEFAULT_MAIN_DIR) dir_group.add_argument("--testsuites-dir", dest="testsuites_dirs", action='append', help="Directory where to look for testsuites. Default is %s" - % DEFAULT_TESTSUITES_DIRS) + % utils.DEFAULT_TESTSUITES_DIRS) dir_group.add_argument("-o", "--output-dir", dest="output_dir", help="Directory where to store logs and rendered files. Default is MAIN_DIR") dir_group.add_argument("-l", "--logs-dir", dest="logsdir", @@ -579,7 +581,7 @@ def main(libsdir): global LIBSDIR LIBSDIR = libsdir - DEFAULT_TESTSUITES_DIRS.append(os.path.join(LIBSDIR, "testsuites")) + utils.DEFAULT_TESTSUITES_DIRS.append(os.path.join(LIBSDIR, "testsuites")) os.environ["GST_VALIDATE_APPS_DIR"] = os.path.join( LIBSDIR, "apps") + os.pathsep + os.environ.get("GST_VALIDATE_APPS_DIR", "") diff --git a/validate/launcher/meson.build b/validate/launcher/meson.build index 6dccf8f861..b767956868 100644 --- a/validate/launcher/meson.build +++ b/validate/launcher/meson.build @@ -3,6 +3,7 @@ _launcherdir = get_option('libdir') + '/gst-validate-launcher/python/launcher/' launcher_configure = configuration_data() launcher_configure.set('GST_VALIDATE_TESTSUITE_VERSION', '@0@'.format(TESTSUITE_VERSION)) launcher_configure.set('BUILDDIR', meson.build_root()) +launcher_configure.set('SRCDIR', meson.source_root()) launcher_configure.set('DATADIR', join_paths(get_option('prefix'), get_option('datadir'))) launcher_configure.set('LIBDIR', join_paths(get_option('prefix'), get_option('libdir'))) diff --git a/validate/launcher/utils.py b/validate/launcher/utils.py index 00122a33b0..a8925f8d25 100644 --- a/validate/launcher/utils.py +++ b/validate/launcher/utils.py @@ -44,9 +44,18 @@ from xml.etree import ElementTree GST_SECOND = int(1000000000) DEFAULT_TIMEOUT = 30 -DEFAULT_MAIN_DIR = os.environ.get('GST_VALIDATE_LAUNCHER_MAIN_DIR', os.path.join(os.path.expanduser("~"), "gst-validate")) -DEFAULT_GST_QA_ASSETS = os.path.join( - DEFAULT_MAIN_DIR, "gst-integration-testsuites") + +DEFAULT_MAIN_DIR = os.path.join(config.BUILDDIR, "subprojects", "gst-integration-testsuites") +DEFAULT_GST_QA_ASSETS = os.path.join(config.SRCDIR, "subprojects", "gst-integration-testsuites") +USING_SUBPROJECT = os.path.exists(os.path.join(config.BUILDDIR, "subprojects", "gst-integration-testsuites")) +if not USING_SUBPROJECT: + DEFAULT_MAIN_DIR = os.path.join(os.path.expanduser("~"), "gst-validate") + DEFAULT_GST_QA_ASSETS = os.path.join(DEFAULT_MAIN_DIR, "gst-integration-testsuites") + +DEFAULT_MAIN_DIR = os.environ.get('GST_VALIDATE_LAUNCHER_MAIN_DIR', DEFAULT_MAIN_DIR) +DEFAULT_TESTSUITES_DIRS = [os.path.join(DEFAULT_GST_QA_ASSETS, "testsuites")] + + DISCOVERER_COMMAND = "gst-discoverer-1.0" # Use to set the duration from which a test is considered as being 'long' LONG_TEST = 40