diff --git a/validate/configure.ac b/validate/configure.ac index 07eebedf3d..57390e8496 100644 --- a/validate/configure.ac +++ b/validate/configure.ac @@ -240,6 +240,11 @@ dnl LDFLAGS modifier defining exported symbols from built libraries GST_LIB_LDFLAGS="-export-symbols-regex \^[_]?\(gst_\|Gst\|GST_\).*" AC_SUBST(GST_LIB_LDFLAGS) +AM_PATH_PYTHON(2.7.0) +AS_AC_EXPAND(LIBDIR, $libdir) +AC_MSG_NOTICE(Storing library files in $LIBDIR) +AC_CONFIG_FILES([tools/gst-validate-launcher], [chmod +x tools/gst-validate-launcher]) + dnl this really should only contain flags, not libs - they get added before dnl whatevertarget_LIBS and -L flags here affect the rest of the linking @@ -253,6 +258,8 @@ common/m4/Makefile gst/Makefile gst/validate/Makefile tools/Makefile +tools/launcher/Makefile +tools/launcher/apps/Makefile data/Makefile pkgconfig/Makefile pkgconfig/gst-validate-uninstalled.pc diff --git a/validate/tools/Makefile.am b/validate/tools/Makefile.am index 4de7120308..000392e5cf 100644 --- a/validate/tools/Makefile.am +++ b/validate/tools/Makefile.am @@ -1,9 +1,14 @@ +SUBDIRS = \ + launcher bin_PROGRAMS = \ gst-validate-@GST_API_VERSION@ \ gst-validate-transcoding-@GST_API_VERSION@ \ gst-validate-media-check-@GST_API_VERSION@ +bin_SCRIPTS = \ + gst-validate-launcher + AM_CFLAGS = $(GST_ALL_CFLAGS) $(GST_PBUTILS_CFLAGS) $(GST_VIDEO_CFLAGS) LDADD = $(top_builddir)/gst/validate/libgstvalidate-@GST_API_VERSION@.la $(GST_PBUTILS_LIBS) $(GST_LIBS) $(GST_VIDEO_LIBS) @@ -11,4 +16,4 @@ gst_validate_@GST_API_VERSION@_SOURCES = gst-validate.c gst_validate_transcoding_@GST_API_VERSION@_SOURCES = gst-validate-transcoding.c gst_validate_media_check_@GST_API_VERSION@_SOURCES = gst-validate-media-check.c -CLEANFILES = +CLEANFILES = $(bin_SCRIPTS) diff --git a/validate/tools/gst-validate-launcher.py b/validate/tools/gst-validate-launcher.in similarity index 86% rename from validate/tools/gst-validate-launcher.py rename to validate/tools/gst-validate-launcher.in index 26f26fb308..15cba8e839 100644 --- a/validate/tools/gst-validate-launcher.py +++ b/validate/tools/gst-validate-launcher.in @@ -1,6 +1,6 @@ #!/usr//bin/python # -# Copyright (c) 2013,Thibault Saunier +# Copyright (c) 2014,Thibault Saunier # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -18,15 +18,30 @@ # Boston, MA 02110-1301, USA. import os -import loggable +import sys import urlparse - -from utils import printc, path2url from optparse import OptionParser -from testdefinitions import _TestsLauncher, DEFAULT_GST_QA_ASSETS + +LIBDIR = '@LIBDIR@' + + +def _in_devel(): + root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + return os.path.exists(os.path.join(root_dir, '.git')) + +def _add_gst_launcher_path(): + if not _in_devel(): + root = os.path.join(LIBDIR, 'gst-validate-launcher', 'python') + sys.path.insert(0, root) def main(): + _add_gst_launcher_path() + + from launcher import loggable + from launcher.baseclasses import _TestsLauncher + from launcher.utils import printc, path2url, DEFAULT_GST_QA_ASSETS + parser = OptionParser() # FIXME: #parser.add_option("-g", "--gdb", dest="gdb", @@ -79,10 +94,12 @@ def main(): options.dest = path2url(options.dest) tests_launcher.set_settings(options, args) tests_launcher.list_tests() + if options.list_tests: for test in tests_launcher.tests: printc(test) return 0 + tests_launcher.run_tests() tests_launcher.final_report() return 0 diff --git a/validate/tools/launcher/__init__.py b/validate/tools/launcher/__init__.py new file mode 100644 index 0000000000..30fa4db32c --- /dev/null +++ b/validate/tools/launcher/__init__.py @@ -0,0 +1,18 @@ +#!/usr//bin/python +# +# Copyright (c) 2014,Thibault Saunier +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the +# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301, USA. diff --git a/validate/tools/apps/ges-projects-tests.py b/validate/tools/launcher/apps/ges-launch.py similarity index 98% rename from validate/tools/apps/ges-projects-tests.py rename to validate/tools/launcher/apps/ges-launch.py index fc5c5c6e86..54cd459bff 100644 --- a/validate/tools/apps/ges-projects-tests.py +++ b/validate/tools/launcher/apps/ges-launch.py @@ -21,8 +21,9 @@ import os import urlparse from urllib import unquote from gi.repository import GES, Gst, GLib -from testdefinitions import GstValidateTest, DEFAULT_GST_QA_ASSETS, TestsManager -from utils import MediaFormatCombination, get_profile, Result, get_current_position, get_current_size +from baseclasses import GstValidateTest, TestsManager +from utils import MediaFormatCombination, get_profile, Result, get_current_position, \ + get_current_size, DEFAULT_GST_QA_ASSETS DURATION_TOLERANCE = Gst.SECOND / 2 DEFAULT_GES_LAUNCH = "ges-launch-1.0" diff --git a/validate/tools/apps/gst-validate.py b/validate/tools/launcher/apps/gst-validate.py similarity index 98% rename from validate/tools/apps/gst-validate.py rename to validate/tools/launcher/apps/gst-validate.py index 0b83a603d1..5e31bdf0d1 100644 --- a/validate/tools/apps/gst-validate.py +++ b/validate/tools/launcher/apps/gst-validate.py @@ -22,8 +22,10 @@ import subprocess import ConfigParser from loggable import Loggable -from testdefinitions import GstValidateTest, TestsManager, DEFAULT_TIMEOUT -from utils import MediaFormatCombination, get_profile, path2url, Result, get_current_position, get_current_size +from baseclasses import GstValidateTest, TestsManager +from utils import MediaFormatCombination, get_profile,\ + path2url, get_current_position, get_current_size, \ + DEFAULT_TIMEOUT DEFAULT_GST_VALIDATE = "gst-validate-1.0" diff --git a/validate/tools/testdefinitions.py b/validate/tools/launcher/baseclasses.py similarity index 97% rename from validate/tools/testdefinitions.py rename to validate/tools/launcher/baseclasses.py index f6159d30cd..aec1468acb 100644 --- a/validate/tools/testdefinitions.py +++ b/validate/tools/launcher/baseclasses.py @@ -24,15 +24,11 @@ import re import time import subprocess import reporters -from loggable import Loggable +from loggable import Loggable from optparse import OptionGroup -from utils import mkdir, Result, Colors, printc +from utils import mkdir, Result, Colors, printc, DEFAULT_TIMEOUT -DEFAULT_TIMEOUT = 10 - -DEFAULT_GST_QA_ASSETS = os.path.join(os.path.expanduser('~'), "Videos", - "gst-qa-assets") class Test(Loggable): @@ -300,7 +296,8 @@ class _TestsLauncher(object): env = globals().copy() d = os.path.dirname(__file__) for f in os.listdir(os.path.join(d, "apps")): - execfile(os.path.join(d, "apps", f), env) + if f.endswith(".py"): + execfile(os.path.join(d, "apps", f), env) self.testers = [i() for i in get_subclasses(TestsManager, env)] diff --git a/validate/tools/loggable.py b/validate/tools/launcher/loggable.py similarity index 100% rename from validate/tools/loggable.py rename to validate/tools/launcher/loggable.py diff --git a/validate/tools/reporters.py b/validate/tools/launcher/reporters.py similarity index 100% rename from validate/tools/reporters.py rename to validate/tools/launcher/reporters.py diff --git a/validate/tools/utils.py b/validate/tools/launcher/utils.py similarity index 97% rename from validate/tools/utils.py rename to validate/tools/launcher/utils.py index 5b5de2f738..159da2c005 100644 --- a/validate/tools/utils.py +++ b/validate/tools/launcher/utils.py @@ -24,6 +24,9 @@ import urlparse GST_SECOND = 1000000000 +DEFAULT_TIMEOUT = 10 +DEFAULT_GST_QA_ASSETS = os.path.join(os.path.expanduser('~'), "Videos", + "gst-qa-assets") class Result(object):