diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:33:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:33:31 +0000 |
commit | a820a96849e295d4abc6238a01c650bf3663b774 (patch) | |
tree | bcebc68af266bfcc779f699ad3d5eeb05b067216 /debian/tests | |
parent | Adding upstream version 1:115.7.0. (diff) | |
download | thunderbird-a820a96849e295d4abc6238a01c650bf3663b774.tar.xz thunderbird-a820a96849e295d4abc6238a01c650bf3663b774.zip |
Adding debian version 1:115.7.0-1~deb12u1.debian/1%115.7.0-1_deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests')
-rwxr-xr-x | debian/tests/check-global-config-path.py | 61 | ||||
-rw-r--r-- | debian/tests/control | 24 | ||||
-rwxr-xr-x | debian/tests/help.sh | 13 | ||||
-rwxr-xr-x | debian/tests/icudatfileTest.sh | 22 | ||||
-rw-r--r-- | debian/tests/idlTest.idl | 10 | ||||
-rwxr-xr-x | debian/tests/idlTest.sh | 51 | ||||
-rwxr-xr-x | debian/tests/soSymlinkTest.sh | 22 | ||||
-rw-r--r-- | debian/tests/xpcshellTest.js | 1 | ||||
-rwxr-xr-x | debian/tests/xpcshellTest.sh | 11 |
9 files changed, 215 insertions, 0 deletions
diff --git a/debian/tests/check-global-config-path.py b/debian/tests/check-global-config-path.py new file mode 100755 index 0000000000..3a2ec7c909 --- /dev/null +++ b/debian/tests/check-global-config-path.py @@ -0,0 +1,61 @@ +#!/usr/bin/python3 + +# Copyright 2021, Carsten Schoenert <carsten.schoenert@t-online.de> +# SPDX-License-Identifier: GPL-2.0+ + +# Simple check if the thunderbird binary is trying to successfully read any +# content of the folder /usr/lib/thunderbird/defaults/syspref which is a +# symlink to /etc/thunderbird/pref/ even if the folder is empty. +# +# Purpose if this check is to ensure we don't have disabled the inclusion of +# this folder for Thunderbird by accident as we ship important default settings +# within this folder. + +import subprocess +import sys + +# Set the CLI call we want to inspect. +command = 'strace -e trace=access thunderbird -h' +pattern = '/usr/lib/thunderbird/defaults/syspref' + +# Setup the sub-process object. +proc = subprocess.Popen(command, + shell=True, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + +# Execute the call. +stdout_value,stderr_value = proc.communicate() + +# Once we have a valid response, split the return output. Currently we are not +# (yet) interested on the content for stdout. +if stdout_value: + stdout_value = stdout_value.split() + +# Processing and output the check. +print(f'\nOutput on stderr for command \'{command}\':\n') + +for line in stderr_value.splitlines(): + print(line.decode('utf-8')) +print() + +print('Analysing strace call:') +for line in stderr_value.splitlines(): + if f'{pattern}' in line.decode('utf-8'): + print(f'\tPattern for accessing \"{pattern}\" found.') + print('\t\t' + '---> ' + line.decode('utf-8')) + if '0' in line.decode('utf-8').split('=')[1].lstrip(): + print(f'\tAccess to folder/symlink \'{pattern}\' marked as successful (found F_OK = 0)') + print('\tCheck SUCCESSFUL!\n') + sys.exit(0) + + else: + print(f'\tFailed to access to folder/symlink \'{pattern}\'!!!') + print('\tCheck FAILED!\n') + sys.exit(1) + +# If we going until here we need to fix something! :-( +print(f'\tPattern for accessing \"{pattern}\" wasn\'t found!!!') +print('\tCheck FAILED!\n') +sys.exit(1) diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000000..559bb955c1 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,24 @@ +Tests: help.sh +Depends: + thunderbird, + xauth, + xvfb, + +Tests: check-global-config-path.py +Depends: + thunderbird, + strace, +Restrictions: allow-stderr +Architecture: amd64 i386 + +#Tests: xpcshellTest.sh +#Depends: thunderbird-dev + +#Tests: idlTest.sh +#Depends: thunderbird-dev, build-essential + +#Tests: icudatfileTest.sh +#Depends: thunderbird-dev + +#Tests: soSymlinkTest.sh +#Depends: thunderbird-dev diff --git a/debian/tests/help.sh b/debian/tests/help.sh new file mode 100755 index 0000000000..79bf075020 --- /dev/null +++ b/debian/tests/help.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +# At least check we can execute the main binary +# to catch missing dependencies +echo -n "Test1: checking help output..." +xvfb-run -a /usr/lib/thunderbird/thunderbird -help >/dev/null +echo "done." + +echo -n "Test2: checking version output..." +xvfb-run -a /usr/lib/thunderbird/thunderbird --version | grep -qs Thunderbird +echo "done." diff --git a/debian/tests/icudatfileTest.sh b/debian/tests/icudatfileTest.sh new file mode 100755 index 0000000000..8e3ec99916 --- /dev/null +++ b/debian/tests/icudatfileTest.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +set -e + +TESTFILE=$(basename $0 .sh) +ICUDATFILE=$(basename /usr/lib/thunderbird/icud*.dat) + +if [ -f "/usr/lib/thunderbird/${ICUDATFILE}" ]; then + echo "Running tests in ${TESTFILE}" + + echo -n "Test1: Check if /usr/lib/thunderbird/${ICUDATFILE} is linked to /usr/share/thunderbird/${ICUDATFILE}..." + if [ "$(readlink -e "/usr/share/thunderbird/${ICUDATFILE}")" = "/usr/lib/thunderbird/${ICUDATFILE}" ]; then + echo "done" + else + echo "No!" + exit 1 + fi +else + echo "Nothing to be done here." +fi + +echo "All Tests in ${TESTFILE} finished succesfully." diff --git a/debian/tests/idlTest.idl b/debian/tests/idlTest.idl new file mode 100644 index 0000000000..148e5d3a4b --- /dev/null +++ b/debian/tests/idlTest.idl @@ -0,0 +1,10 @@ +// Include a file from thunderbird so we're sure these ended up in the right +// location +#include "nsIMsgIncomingServer.idl" + +[scriptable, uuid(1b9d7057-90f5-4ca5-a379-a59aa47acbd2)] +interface IdlTestIncomingServer : nsIMsgIncomingServer +{ + readonly attribute boolean thisIsATest; +}; + diff --git a/debian/tests/idlTest.sh b/debian/tests/idlTest.sh new file mode 100755 index 0000000000..38657399b7 --- /dev/null +++ b/debian/tests/idlTest.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +set -e + +cleanup() { + [ ! -d "${SCRATCHDIR}" ] || rm -rf "${SCRATCHDIR}" +} + +#trap cleanup EXIT + +SCRATCHDIR=`mktemp -d` +TEST_IDL_FILE="debian/tests/idlTest.idl" +TESTFILE=$(basename $0 .sh) + +echo "Running tests in ${TESTFILE}" + +echo -n "Test1: Make sure we can generate typelibs..." +/usr/lib/thunderbird-devel/sdk/bin/typelib.py \ + -I"/usr/lib/thunderbird-devel/idl" \ + -o "${SCRATCHDIR}/test.xpt" \ + "${TEST_IDL_FILE}" +if [ -f "${SCRATCHDIR}/test.xpt" ]; then + echo "done." +else + echo "No!" + echo "Test call successful but no outputfile '${SCRATCHDIR}/test.xpt' found!" + exit 1 +fi + +echo -n "Test2: Make sure we can generate C++ headers..." +/usr/lib/thunderbird-devel/sdk/bin/header.py \ + -I"/usr/lib/thunderbird-devel/idl" \ + -o "${SCRATCHDIR}/test.h" \ + "${TEST_IDL_FILE}" +if [ -f "${SCRATCHDIR}/test.h" ]; then + echo "done." +else + echo "No!" + echo "Test call successful but no outputfile '${SCRATCHDIR}/test.h' found!" + exit 1 +fi + +echo -n "Test3: Compiling generated file..." +g++ -std=c++11 \ + -I/usr/include/thunderbird \ + -I/usr/include/nspr \ + -o "${SCRATCHDIR}/test.o" \ + "${SCRATCHDIR}/test.h" +echo "done." + +echo "All Tests in ${TESTFILE} finished successfully." diff --git a/debian/tests/soSymlinkTest.sh b/debian/tests/soSymlinkTest.sh new file mode 100755 index 0000000000..972f6289c7 --- /dev/null +++ b/debian/tests/soSymlinkTest.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +set -e + +FAIL=0 + +echo "Check for symlinked .so files in dev package..." + +for SOFILE in `ls /usr/lib/thunderbird-devel/sdk/lib/*.so`; do + if [ ! -L ${SOFILE} ]; then + echo ${SOFILE} is not a symlink! + FAIL=1 + fi +done + +echo -n "Test result is " +if [ ${FAIL} -eq 0 ]; then + echo "done." +else + echo "FAILED!" + exit 1 +fi diff --git a/debian/tests/xpcshellTest.js b/debian/tests/xpcshellTest.js new file mode 100644 index 0000000000..806b28998a --- /dev/null +++ b/debian/tests/xpcshellTest.js @@ -0,0 +1 @@ +dump("running xpcshell..."); diff --git a/debian/tests/xpcshellTest.sh b/debian/tests/xpcshellTest.sh new file mode 100755 index 0000000000..f924bc13de --- /dev/null +++ b/debian/tests/xpcshellTest.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +echo -n "Checking if we can run xpcshell..." + +LD_LIBRARY_PATH=/usr/lib/thunderbird/ \ +/usr/lib/thunderbird-devel/sdk/bin/xpcshell \ + -g /usr/share/thunderbird/ debian/tests/xpcshellTest.js + +echo "done." |