[pitivi] Make ptvenv --check run make check
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Make ptvenv --check run make check
- Date: Fri, 15 Jul 2016 15:56:36 +0000 (UTC)
commit 2d96880f090fea5aa866164d62f02cc7fc95b7d3
Author: Thibault Saunier <tsaunier gnome org>
Date: Sat Jul 9 08:58:20 2016 -0400
Make ptvenv --check run make check
And fix make check running when pitivi has not bin built
build/flatpak/pitivi-flatpak | 70 +++++++++++++++++-------------------
build/flatpak/pitivi.template.json | 1 +
pitivi/configure.py.in | 1 +
tests/__init__.py | 51 +++++++++++---------------
4 files changed, 56 insertions(+), 67 deletions(-)
---
diff --git a/build/flatpak/pitivi-flatpak b/build/flatpak/pitivi-flatpak
index f8af79b..022ef3c 100755
--- a/build/flatpak/pitivi-flatpak
+++ b/build/flatpak/pitivi-flatpak
@@ -249,6 +249,31 @@ then
fi
fi
+function run_in_sandbox {
+ $FLATPAK build --socket=x11 --socket=session-bus --socket=pulseaudio \
+ --share=network \
+ --env=GST_PLUGIN_SYSTEM_PATH= \
+ --env=GST_CHECKS=$GST_CHECKS \
+ --env=GST_PRESET_PATH=/app/share/gstreamer-1.0/presets/:/app/share/pitivi/gstpresets/:$GST_PRESET_PATH \
+ --env=GST_ENCODING_TARGET_PATH=/app/share/pitivi/gstpresets/:$GST_ENCODING_TARGET_PATH \
+ --env=GST_DEBUG=$GST_DEBUG \
+ --env=GST_PLUGIN_SYSTEM_PATH= \
+ --env=GST_VALIDATE=$GST_VALIDATE \
+ --env=GST_VALIDATE_LAUNCHER_DEBUG=$GST_VALIDATE_LAUNCHER_DEBUG \
+ --env=PITIVI_DEBUG=$PITIVI_DEBUG \
+ --env=PITIVI_DEVELOPMENT=1 \
+ --env=DISPLAY=$DISPLAY \
+ --env=GST_DEBUG_DUMP_DOT_DIR=$GST_DEBUG_DUMP_DOT_DIR \
+ $PREFIX $SCRIPTDIR/enter-env "$@" || exit 1
+}
+
+function build_local_repo {
+ echo "-> Building $APPLICATION_NAME from current repository"
+ cd $APPLICATION_REPOSITORY
+ run_in_sandbox "./configure --prefix=/app --libdir=lib" || exit 1
+ run_in_sandbox make ||exit 1
+}
+
# Install needed runtimes
if [ -n "$DEVEL" ]
then
@@ -372,9 +397,7 @@ then
then
if [ -z "$APP_INSTALLED" ] && [ -z "$USE_REMOTE" ]
then
- cd $APPLICATION_REPOSITORY
- $FLATPAK run --branch=$BRANCH -d --command="./configure" $APPLICATION_REF_NAME
- $FLATPAK run --branch=$BRANCH -d --command="make" $APPLICATION_REF_NAME
+ build_local_repo
fi
echo "=============================="
@@ -413,49 +436,22 @@ then
if [ -z $BUNDLE ] || [ -n "$CHECK" ]
then
- echo "-> Building $APPLICATION_NAME from current repository"
- cd $APPLICATION_REPOSITORY && $FLATPAK build --env=PYTHON=python3 $PREFIX ./configure --prefix=/app
--libdir=lib || exit 1
- $FLATPAK build --env=PYTHON=python3 $PREFIX make || exit 1
+ build_local_repo
fi
fi
# Launch development environment if we are not updating it and not creating a bundle
- if [ -z $BUNDLE ] && [ -z $UPDATE ]
+ if [ -z $BUNDLE ] && [ -z $UPDATE ] && [ -z $CHECK ]
then
- $FLATPAK build --socket=x11 --socket=session-bus --socket=pulseaudio \
- --share=network \
- --env=GST_PLUGIN_SYSTEM_PATH= \
- --env=GST_CHECKS=$GST_CHECKS \
- --env=GST_PRESET_PATH=/app/share/gstreamer-1.0/presets/:/app/share/pitivi/gstpresets/:$GST_PRESET_PATH
\
- --env=GST_ENCODING_TARGET_PATH=/app/share/pitivi/gstpresets/:$GST_ENCODING_TARGET_PATH \
- --env=GST_DEBUG=$GST_DEBUG \
- --env=GST_PLUGIN_SYSTEM_PATH= \
- --env=GST_VALIDATE=$GST_VALIDATE \
- --env=GST_VALIDATE_LAUNCHER_DEBUG=$GST_VALIDATE_LAUNCHER_DEBUG \
- --env=PITIVI_DEBUG=$PITIVI_DEBUG \
- --env=PITIVI_DEVELOPMENT=1 \
- --env=DISPLAY=$DISPLAY \
- --env=GST_DEBUG_DUMP_DOT_DIR=$GST_DEBUG_DUMP_DOT_DIR \
- $PREFIX $SCRIPTDIR/enter-env "$@"
-
- exit $exitcode
+ run_in_sandbox "$@"
fi
if [ -n "$CHECK" ]
then
- echo "Running tests with nosetests"
- $FLATPAK build --socket=x11 --socket=session-bus --socket=pulseaudio \
- --share=network \
- --env=GST_DEBUG=$GST_DEBUG \
- --env=GST_CHECKS=$GST_CHECKS \
- --env=GST_PLUGIN_SYSTEM_PATH= \
- --env=GST_VALIDATE=$GST_VALIDATE \
- --env=GST_VALIDATE_LAUNCHER_DEBUG=$GST_VALIDATE_LAUNCHER_DEBUG \
- --env=PITIVI_DEBUG=$PITIVI_DEBUG \
- --env=PITIVI_DEVELOPMENT=1 \
- --env=DISPLAY=$DISPLAY \
- --env=GST_DEBUG_DUMP_DOT_DIR=$GST_DEBUG_DUMP_DOT_DIR \
- $PREFIX $SCRIPTDIR/enter-env "nosetests --with-xunit $APPLICATION_REPOSITORY/tests/test_*.py"|| exit 1
+ run_in_sandbox "./configure --prefix=/app --libdir=lib -Denable-xunit=true"
+
+ echo "-> Running unit tests"
+ run_in_sandbox "make check"
fi
else
$FLATPAK run org.pitivi.Pitivi
diff --git a/build/flatpak/pitivi.template.json b/build/flatpak/pitivi.template.json
index 1e34bd5..c02d89d 100644
--- a/build/flatpak/pitivi.template.json
+++ b/build/flatpak/pitivi.template.json
@@ -357,6 +357,7 @@
},
{
"name": "pitivi",
+ "config-opts": ["--libdir=lib", "--prefix=/app"],
"build-options" : {
"build-args": ["--share=network"]
},
diff --git a/pitivi/configure.py.in b/pitivi/configure.py.in
index 83979af..7edc088 100644
--- a/pitivi/configure.py.in
+++ b/pitivi/configure.py.in
@@ -41,6 +41,7 @@ APPNAME = '@PACKAGE_NAME@'
APPURL = 'http://www.pitivi.org/'
RELEASES_URL = 'http://pitivi.org/releases.txt'
APPMANUALURL_ONLINE = 'http://www.pitivi.org/manual'
+BUILDDIR = '@BUILDDIR@'
if in_devel():
diff --git a/tests/__init__.py b/tests/__init__.py
index a014377..31e45f9 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -15,48 +15,39 @@ def get_pitivi_dir():
return os.path.abspath(pitivi_dir)
-def get_build_dir():
- """Gets the build directory."""
- from pitivi.configure import in_devel
- if in_devel():
- # It's the same.
- build_dir = get_pitivi_dir()
- else:
- # Probably running make distcheck. The path to the test files
- # is different than the build path, so we must use the current
- # dir which is build_path/tests.
- build_dir = os.path.join(
- os.path.abspath(os.path.curdir), os.path.pardir)
- return os.path.abspath(build_dir)
-
-
-def _prepend_env_path(name, value):
+def _prepend_env_paths(**args):
"""Prepends one or more paths to an environment variable."""
- os.environ[name] = os.pathsep.join(value +
- os.environ.get(name, "").split(
- os.pathsep))
+
+ for name, value in args.items():
+ if not isinstance(value, list):
+ value = [value]
+
+ os.environ[name] = os.pathsep.join(
+ value + os.environ.get(name, "").split(
+ os.pathsep))
def setup():
"""Sets paths and initializes modules, to be able to run the tests."""
res = True
+
# Make available to configure.py the top level dir.
pitivi_dir = get_pitivi_dir()
sys.path.insert(0, pitivi_dir)
- os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)
-
- _prepend_env_path("GST_PRESET_PATH", [
- os.path.join(pitivi_dir, "data", "videopresets"),
- os.path.join(pitivi_dir, "data", "audiopresets")])
-
- _prepend_env_path("GST_ENCODING_TARGET_PATH", [
- os.path.join(pitivi_dir, "data", "encoding-profiles")])
+ from pitivi import configure
# Make available the compiled C code.
- build_dir = get_build_dir()
- libs_dir = os.path.join(build_dir, "pitivi/coptimizations/.libs")
- sys.path.append(libs_dir)
+ sys.path.append(configure.BUILDDIR)
+ subproject_paths = os.path.join(configure.BUILDDIR, "subprojects", "gst-transcoder")
+
+ _prepend_env_paths(LD_LIBRARY_PATH=subproject_paths,
+ GST_PLUGIN_PATH=subproject_paths,
+ GI_TYPELIB_PATH=subproject_paths,
+ GST_PRESET_PATH=[os.path.join(pitivi_dir, "data", "videopresets"),
+ os.path.join(pitivi_dir, "data", "audiopresets")],
+ GST_ENCODING_TARGET_PATH=[os.path.join(pitivi_dir, "data", "encoding-profiles")])
+ os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)
# Make sure the modules are initialized correctly.
from pitivi import check
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]