[Libreoffice-commits] dev-tools.git: qa/checkreg.config qa/checkreg.sh

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon May 13 12:01:36 UTC 2019


 qa/checkreg.config |   16 +++++++++
 qa/checkreg.sh     |   85 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 101 insertions(+)

New commits:
commit 22b5621eec10045f15374c7a406888489e3f2389
Author:     Ilmari Lauhakangas <ilmari.lauhakangas at libreoffice.org>
AuthorDate: Mon Apr 22 16:54:59 2019 +0300
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Mon May 13 14:01:18 2019 +0200

    Script for checking fileopen/filesave regressions
    
    Uses command line conversion to PDF. Works on *nix and cygwin.
    
    Change-Id: I3af0cc842ff83b3212771f74958bdff4f724a2b0
    Reviewed-on: https://gerrit.libreoffice.org/71069
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
    Tested-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/qa/checkreg.config b/qa/checkreg.config
new file mode 100644
index 0000000..0ceebea
--- /dev/null
+++ b/qa/checkreg.config
@@ -0,0 +1,16 @@
+# Configuration file for checkreg.sh regression checking script.
+# outDir works with or without a trailing slash.
+# Note: on Windows, with versions older than 6.3, you cannot use
+# a drive root like c:/ as the outdir. This is a bug in LibreOffice.
+
+declare -A versions
+
+# Windows cygwin example, note the forward slashes in outDir:
+#versions[330]="$(cygpath -u "C:\libo33\program\soffice.exe")"
+#versions[bibi43]="$(cygpath -u "Z:\bibisect-win32-4.3\instdir\program\soffice.exe")"
+#versions[master]="$(cygpath -u "C:\Program Files\LibreOfficeDev 6\program\soffice.exe")"
+#outDir="c:/users/test/downloads/outdir"
+
+# Linux example:
+#versions[master]="/home/test/libreoffice/instdir/program/soffice"
+#outDir="/home/test/libobugs/outdir"
diff --git a/qa/checkreg.sh b/qa/checkreg.sh
new file mode 100755
index 0000000..5146168
--- /dev/null
+++ b/qa/checkreg.sh
@@ -0,0 +1,85 @@
+#!/bin/bash
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+### DESCRIPTION
+#
+# This script is for triaging fileopen and filesave bugs in LibreOffice
+# using command line conversion.
+# It expects a checkreg.config file, where you specify the LibreOffice
+# executables, version identifiers and the output directory.
+# It produces PDFs with the version identifier appended to the file name.
+# In case of filesave, the saved documents are likewise left in the output directory.
+# It works in *nix systems and cygwin on Windows. It is not POSIX-compatible (using arrays).
+# You can use it with bibisect repos just as well as versions installed in parallel.
+
+usage="
+To get PDFs of fileopen with different versions into the specified outdir, run with
+./checkreg.sh open /path/to/file.ext
+To get PDFs of filesave to original format, run with
+./checkreg.sh save /path/to/file.ext
+To get PDFs of filesave to a different format, run with a third argument
+./checkreg.sh save /path/to/file.ext odt
+In cygwin, give input file argument in the format 'c:\users\test\downloads\myfile.docx'
+"
+if [ ! "$2" ]; then
+    echo "$usage"
+    exit 1
+fi
+dir="$(dirname "${BASH_SOURCE[0]}")"
+. "$dir"/checkreg.config
+convType="$1"
+inputFile="$2"
+if [[ "$3" && $convType == "save" ]]; then
+    fileType="$3"
+else
+    fileType="${inputFile##*.}"
+fi
+# file name and path with extension removed
+pathNoExt="${inputFile%.*}"
+# file name with extension removed
+nameNoExt="$(basename "${pathNoExt}")"
+# directory name with no filename and no trailing slash
+inputDir="$(dirname "${inputFile}")"
+# add a trailing slash to outDir, if needed
+[[ "${outDir}" != */ ]] && outDir="${outDir}/"
+for version in "${!versions[@]}";
+do
+    verName="${pathNoExt}$version.${inputFile##*.}"
+    pdfName="${nameNoExt}.pdf"
+    pdfTarget="${nameNoExt}$version.pdf"
+    if [[ "$3" && $convType == "save" ]]; then
+        verBase="$(basename "${pathNoExt}$version.$fileType")"
+    else
+        verBase="$(basename "${verName}")"
+    fi
+    if [[ $convType == "open" ]]; then
+        # if version starts with 3, we use a single dash for the switches
+        if [[ ${version::1} == "3" ]]; then
+            "${versions[$version]}" -headless -nolockcheck -convert-to pdf -outdir "${outDir}" "${inputFile}"
+        else
+            "${versions[$version]}" --headless --nolockcheck --convert-to pdf --outdir "${outDir}" "${inputFile}"
+        fi
+        if ! mv "${outDir}${pdfName}" "${outDir}${pdfTarget}"; then
+            echo "PDF creation for version $version failed"
+            rm "${outDir}.~lock.${nameNoExt}.pdf#"
+        fi
+    elif [[ $convType == "save" ]]; then
+        cp "${inputFile}" "${verName}";
+        echo "Converting version $version to ${fileType}"
+        if [[ ${version::1} == "3" ]]; then
+            "${versions[$version]}" -headless -nolockcheck -convert-to "${fileType}" -outdir "${outDir}" "${verName}"
+            "${versions[$version]}" -headless -nolockcheck -convert-to pdf -outdir "${outDir}" "${outDir}${verBase}"
+        else
+            "${versions[$version]}" --headless --nolockcheck --convert-to "${fileType}" --outdir "${outDir}" "${verName}"
+            "${versions[$version]}" --headless --nolockcheck --convert-to pdf --outdir "${outDir}" "${outDir}${verBase}"
+        fi
+        rm "${verName}"
+    fi
+done
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list