[dia] tests: move loop from export_test.sh into meson



commit 14402a89ab405230707467b77d7605c53191fac4
Author: Zander Brown <zbrown gnome org>
Date:   Mon Sep 20 02:37:29 2021 +0100

    tests: move loop from export_test.sh into meson
    
    This way we have several 10 second tests instead of one giant test that
    always times out
    
    Of course they still fail

 tests/exports/exports_test.sh | 42 ++++++++++++++++++++----------------------
 tests/exports/meson.build     | 42 ++++++++++++++++++++++++++++++++----------
 2 files changed, 52 insertions(+), 32 deletions(-)
---
diff --git a/tests/exports/exports_test.sh b/tests/exports/exports_test.sh
index 2f5d6e49b..ea08afba9 100755
--- a/tests/exports/exports_test.sh
+++ b/tests/exports/exports_test.sh
@@ -1,7 +1,5 @@
 #!/usr/bin/env sh
 
-EXPORT_PLUGINS="cgm dxf eps eps-builtin fig mp plt hpgl png jpg shape svg tex wpg"
-
 RUN_DIA=$1
 
 if [ ! -f "$RUN_DIA" ]; then
@@ -11,26 +9,26 @@ fi
 
 FAILED=0
 TEMP_DIR=$(mktemp -d)
-for FILTER in ${EXPORT_PLUGINS}; do
-    for FILE in *.dia; do
-        DIA_BASENAME=$(basename "${FILE}" .dia)
-        OUTPUT=${TEMP_DIR}/${DIA_BASENAME}.${FILTER}
-        EXPECTED_OUTPUT=${FILTER}/${DIA_BASENAME}.${FILTER}
-        if ! ${RUN_DIA} -t ${FILTER} -e ${OUTPUT} ${FILE}; then
-            echo ${FILTER} failed for ${FILE};
-            rm -r ${TEMP_DIR}
-            exit 1
-        elif [ ! -f ${OUTPUT} ]; then
-            echo Unable to find output file ${OUTPUT}
-            rm -r ${TEMP_DIR}
-            exit 2
-        elif ! diff -q ${OUTPUT} ${EXPECTED_OUTPUT}; then
-            echo "FAILED: ${FILTER} output different from expected for ${FILE}"
-            #TODO: currently this fails almost all testcases.  Why?
-            FAILED=3
-        fi;
-    done;
-done
+
+FILTER=$2
+for FILE in *.dia; do
+    DIA_BASENAME=$(basename "${FILE}" .dia)
+    OUTPUT=${TEMP_DIR}/${DIA_BASENAME}.${FILTER}
+    EXPECTED_OUTPUT=${FILTER}/${DIA_BASENAME}.${FILTER}
+    if ! ${RUN_DIA} -t ${FILTER} -e ${OUTPUT} ${FILE}; then
+        echo ${FILTER} failed for ${FILE};
+        rm -r ${TEMP_DIR}
+        exit 1
+    elif [ ! -f ${OUTPUT} ]; then
+        echo Unable to find output file ${OUTPUT}
+        rm -r ${TEMP_DIR}
+        exit 2
+    elif ! diff -q ${OUTPUT} ${EXPECTED_OUTPUT}; then
+        echo "FAILED: ${FILTER} output different from expected for ${FILE}"
+        #TODO: currently this fails almost all testcases.  Why?
+        FAILED=3
+    fi;
+done;
 
 rm -r ${TEMP_DIR}
 
diff --git a/tests/exports/meson.build b/tests/exports/meson.build
index 7fe300921..a4f4da025 100644
--- a/tests/exports/meson.build
+++ b/tests/exports/meson.build
@@ -1,10 +1,32 @@
-test('exports',
-    find_program('exports_test.sh'),
-    args: [
-        # TODO: We don't need to specify full_path().  See
-        # https://github.com/mesonbuild/meson/issues/2681
-        diaapp.full_path()
-    ],
-    workdir: meson.current_source_dir(),
-    env: run_env,
-)
+export_plugins = [
+    'cgm',
+    'dxf',
+    'eps',
+    'eps-builtin',
+    'fig',
+    'mp',
+    'plt',
+    'hpgl',
+    'png',
+    'jpg',
+    'shape',
+    'svg',
+    'tex',
+    'wpg',
+]
+
+export_script = find_program('exports_test.sh')
+
+foreach plugin : export_plugins
+    test('exports-' + plugin,
+        export_script,
+        args: [
+            # TODO: We don't need to specify full_path().  See
+            # https://github.com/mesonbuild/meson/issues/2681
+            diaapp.full_path(),
+            plugin,
+        ],
+        workdir: meson.current_source_dir(),
+        env: run_env,
+    )
+endforeach


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