[dia: 60/105] #19: Make run_dia.sh a "test" script.



commit dd83175c26305a48a2456621285672b6317e8f63
Author: Eduard Nicodei <eddnicodei gmail com>
Date:   Fri Jan 4 18:50:40 2019 +0000

    #19: Make run_dia.sh a "test" script.
    
      - This is because it is mainly used for testing.

 meson.build                    |  3 ++-
 tests/meson.build              |  3 +++
 run_dia.sh => tests/run_dia.sh | 10 +++++++++-
 3 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index 9ce9a783..360b4d4a 100644
--- a/meson.build
+++ b/meson.build
@@ -87,7 +87,8 @@ subdir('tests')
 
 # Convenience target
 run_target('run',
-    command: [find_program('run_dia.sh')],
+    command: [run_dia],
     depends: rundeps,
 )
+
 meson.add_install_script('meson-helpers/post-install.py', datadir)
diff --git a/tests/meson.build b/tests/meson.build
index 4344282e..025316a5 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,3 +1,6 @@
+
+run_dia = find_program('run_dia.sh')
+
 # TODO: minimise code duplication.
 if host_machine.system() != 'windows'
   bb = executable(
diff --git a/run_dia.sh b/tests/run_dia.sh
old mode 100644
new mode 100755
similarity index 60%
rename from run_dia.sh
rename to tests/run_dia.sh
index d9ab0e2e..1538b264
--- a/run_dia.sh
+++ b/tests/run_dia.sh
@@ -1,8 +1,16 @@
 #!/usr/bin/env sh
+if [ ! -d "${MESON_SOURCE_ROOT}" ]; then
+    echo "Please supply MESON_SOURCE_ROOT variable"
+    exit 1
+fi
+if [ ! -d "${MESON_BUILD_ROOT}" ]; then
+    echo "Please supply MESON_BUILD_ROOT variable"
+    exit 2
+fi
 export DIA_BASE_PATH="${MESON_SOURCE_ROOT}"
 export DIA_LIB_PATH="${MESON_BUILD_ROOT}/objects/:${MESON_BUILD_ROOT}/plug-ins"
 export DIA_SHAPE_PATH="${MESON_SOURCE_ROOT}/shapes/"
 export DIA_SHEET_PATH="${MESON_BUILD_ROOT}/sheets"
 export DIA_XSLT_PATH="${MESON_SOURCE_ROOT}/plug-ins/xslt/"
 export DIA_PYTHON_PATH="${MESON_SOURCE_ROOT}/plug-ins/python/"
-${MESON_BUILD_ROOT}/app/dia
+${MESON_BUILD_ROOT}/app/dia "$@"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]