Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package xwmfs for openSUSE:Factory checked in at 2022-05-05 23:06:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xwmfs (Old) and /work/SRC/openSUSE:Factory/.xwmfs.new.1538 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xwmfs" Thu May 5 23:06:56 2022 rev:7 rq:975079 version:0.91 Changes: -------- --- /work/SRC/openSUSE:Factory/xwmfs/xwmfs.changes 2021-04-12 15:49:52.345272699 +0200 +++ /work/SRC/openSUSE:Factory/.xwmfs.new.1538/xwmfs.changes 2022-05-05 23:07:32.129642841 +0200 @@ -1,0 +2,12 @@ +Thu May 05 07:53:47 UTC 2022 - matthias.gerst...@suse.com + +- Update to version v0.91: + * autotools: only add increased warning flags if --enable-dev is set + * configure.ac: update to current autotools versions + * Mutex.cxx: fix invalid stack access in DEBUG_MUTEX case + * test base: use unpredictable temporary directory for testing + * test base: try from a list of X11 programs for testing, otherwise fail + * global: python scripts: adjust coding style to Python PIP + * ILogger: fix warn() wrapper to return actual m_warn, no m_err + +------------------------------------------------------------------- Old: ---- xwmfs-0.90-dist.tar.gz New: ---- xwmfs-0.91-dist.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xwmfs.spec ++++++ --- /var/tmp/diff_new_pack.gaNf54/_old 2022-05-05 23:07:32.625643460 +0200 +++ /var/tmp/diff_new_pack.gaNf54/_new 2022-05-05 23:07:32.629643465 +0200 @@ -1,7 +1,7 @@ # # spec file for package xwmfs # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -23,7 +23,7 @@ BuildRequires: gcc-c++ BuildRequires: libX11-devel Requires: fuse -Version: 0.90 +Version: 0.91 Release: 0 URL: https://github.com/gerstner-hub/xwmfs Summary: A file system for accessing X server and window manager features ++++++ _service ++++++ --- /var/tmp/diff_new_pack.gaNf54/_old 2022-05-05 23:07:32.661643505 +0200 +++ /var/tmp/diff_new_pack.gaNf54/_new 2022-05-05 23:07:32.665643510 +0200 @@ -2,7 +2,7 @@ <service name="tar_scm" mode="disabled"> <param name="url">https://github.com/gerstner-hub/xwmfs</param> <param name="scm">git</param> - <param name="revision">v0.90</param> + <param name="revision">v0.91</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> </service> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.gaNf54/_old 2022-05-05 23:07:32.681643530 +0200 +++ /var/tmp/diff_new_pack.gaNf54/_new 2022-05-05 23:07:32.685643534 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/gerstner-hub/xwmfs</param> - <param name="changesrevision">ef5e263f6586a1949cd8ce495edb1f3dad352d0c</param></service></servicedata> + <param name="changesrevision">503f4268d73498a0e2fef1b7747adcb2e4e5b010</param></service></servicedata> (No newline at EOF) ++++++ xwmfs-0.90-dist.tar.gz -> xwmfs-0.91-dist.tar.gz ++++++ ++++ 6744 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xwmfs-0.90/AUTHORS new/xwmfs-0.91/AUTHORS --- old/xwmfs-0.90/AUTHORS 2017-02-22 21:00:00.000000000 +0100 +++ new/xwmfs-0.91/AUTHORS 2022-05-04 19:23:31.000000000 +0200 @@ -1 +1,2 @@ +Bert Gijsbers (gijsb...@science.uva.nl) Matthias Gerstner (matthias.gerst...@nefkom.net) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xwmfs-0.90/ChangeLog new/xwmfs-0.91/ChangeLog --- old/xwmfs-0.90/ChangeLog 2021-04-09 20:18:31.000000000 +0200 +++ new/xwmfs-0.91/ChangeLog 2022-05-04 19:26:21.000000000 +0200 @@ -1,3 +1,15 @@ +2022-05-04 Matthias Gerstner <matthias.gerst...@nefkom.net> + + version 0.91 + + - Fix non-symptomatic programming error detected by gcc-12. + - Apply PEP coding standard to all Python scripts, require Python3 by + default, make tests a bit more robust. + - Update to current Autotools versions. + - Don't apply compiler policy by default (especially -Werror), instead + only increase compiler diagnostic and policy if the new + `--enable-dev` switch is passed. + 2021-04-09 Matthias Gerstner <matthias.gerst...@nefkom.net> version 0.90 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xwmfs-0.90/configure.ac new/xwmfs-0.91/configure.ac --- old/xwmfs-0.90/configure.ac 2021-04-09 20:19:06.000000000 +0200 +++ new/xwmfs-0.91/configure.ac 2022-05-04 19:54:32.000000000 +0200 @@ -1,22 +1,22 @@ dnl process this file with autoconf to produce a configure script. dnl we want to have a current autoconf for producing the configure script -AC_PREREQ(2.61) +AC_PREREQ([2.71]) dnl Our wmfs application -AC_INIT([xwmfs], [0.90], [matthias.gerst...@nefkom.net]) +AC_INIT([xwmfs],[0.91],[matthias.gerst...@nefkom.net]) dnl Stores some generated files in a separate directory for cleaner structure AC_CONFIG_AUX_DIR(config_aux) dnl produces config.h to be the config header produced by configure -AC_CONFIG_HEADER(config.h) +AC_CONFIG_HEADERS([config.h]) dnl pull in automake in a current version AM_INIT_AUTOMAKE([1.10.1 gnu]) dnl check for C and C++ compilers (we need a C99 compiler for fuse structure setup) -AC_PROG_CC_C99 +AC_PROG_CC AC_PROG_CXX dnl check for asciidoc availibility, optional @@ -33,6 +33,9 @@ AM_CONDITIONAL([IS_GCC], $is_gcc) +AC_ARG_ENABLE(dev, AS_HELP_STRING([--enable-dev],[set extra developer mode options like -Werror compiler flags]), [enable_dev=${enableval}]) +AM_CONDITIONAL(DEV, test "${enable_dev}" = "yes") + dnl we need fuse dnl AC_CHECK_LIB([fuse], [fuse_main], [], [AC_MSG_ERROR([You need the fuse userspace library to build this package])]) PKG_CHECK_MODULES([fuse], [ fuse >= 2.8.1 ]) @@ -50,8 +53,9 @@ dnl We need to specify an output file for every single Makefile that is generated in the project dnl (i.e. for every subdirectory, too) -AC_OUTPUT([ +AC_CONFIG_FILES([ src/Makefile docs/Makefile tests/Makefile ]) +AC_OUTPUT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xwmfs-0.90/src/Makefile.am new/xwmfs-0.91/src/Makefile.am --- old/xwmfs-0.90/src/Makefile.am 2021-03-21 13:05:17.000000000 +0100 +++ new/xwmfs-0.91/src/Makefile.am 2022-05-04 19:17:55.000000000 +0200 @@ -32,13 +32,18 @@ # we need x11 and fuse xwmfs_DEPENDENCIES = x11 fuse # makes it possible to include headers from fuse or x11, to select a recent fuse API version -AM_CFLAGS = -Wall -Werror -Wextra -Wnull-dereference -Wdouble-promotion -Wshadow -Wformat=2 -I${top_srcdir}/src/ -DFUSE_USE_VERSION=26 @fuse_CFLAGS@ @x11_CFLAGS@ +AM_CFLAGS = -DFUSE_USE_VERSION=26 @fuse_CFLAGS@ @x11_CFLAGS@ -I${top_srcdir}/src +if DEV +AM_CFLAGS += -Wall -Werror -Wextra -Wnull-dereference -Wdouble-promotion -Wshadow -Wformat=2 + # add some more advanced warnings for gcc if IS_GCC AM_CFLAGS += -Wduplicated-cond -Wduplicated-branches -Wlogical-op else AM_CFLAGS += -Wno-unused-parameter -endif +endif # IS_GCC +endif # DEV + AM_CXXFLAGS =${AM_CFLAGS} -std=c++11 # use this instead of AM_LDFLAGS to have the libraries appear AFTER the object # files. Otherwise we get trouble on distros where as-needed linking is diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xwmfs-0.90/src/common/ILogger.hxx new/xwmfs-0.91/src/common/ILogger.hxx --- old/xwmfs-0.90/src/common/ILogger.hxx 2021-03-18 12:46:33.000000000 +0100 +++ new/xwmfs-0.91/src/common/ILogger.hxx 2022-02-14 23:06:49.000000000 +0100 @@ -59,7 +59,7 @@ std::ostream& warn() { return getStream( - *m_err, "Warning: ", Color::YELLOW, + *m_warn, "Warning: ", Color::YELLOW, m_warn_enabled, m_warn_is_tty ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xwmfs-0.90/src/common/Mutex.cxx new/xwmfs-0.91/src/common/Mutex.cxx --- old/xwmfs-0.90/src/common/Mutex.cxx 2021-03-18 12:48:28.000000000 +0100 +++ new/xwmfs-0.91/src/common/Mutex.cxx 2022-05-04 18:46:05.000000000 +0200 @@ -1,54 +1,73 @@ +#include <stdlib.h> + #include "common/Mutex.hxx" namespace xwmfs { +namespace { + +::pthread_mutexattr_t debug_attr; +bool debug_attr_initialized = false; + #ifndef NDEBUG -static const bool DEBUG_MUTEX = true; +constexpr bool DEBUG_MUTEX = true; #else -static const bool DEBUG_MUTEX = false; +constexpr bool DEBUG_MUTEX = false; #endif -Mutex::Mutex() -{ - ::pthread_mutexattr_t* attr = nullptr; - - if( DEBUG_MUTEX ) - { - ::pthread_mutexattr_t debug_attr; - if( ::pthread_mutexattr_init(&debug_attr) != 0 ) - { - xwmfs_throw( - xwmfs::SystemException("Error creating debug mutex attribute") - ); - } - - if( ::pthread_mutexattr_settype( - &debug_attr, PTHREAD_MUTEX_ERRORCHECK - ) != 0 ) - { - xwmfs_throw( - xwmfs::SystemException("Error setting debug mutex type") - ); - } +void cleanupDebug() { + if (!DEBUG_MUTEX) + return; + else if (!debug_attr_initialized) + return; + + const int attr_destr_res = ::pthread_mutexattr_destroy( + &debug_attr + ); + assert( ! attr_destr_res ); + debug_attr_initialized = false; +} +void checkInitDebug() { + if (!DEBUG_MUTEX) + return; + else if (debug_attr_initialized) + return; - attr = &debug_attr; + if( ::pthread_mutexattr_init(&debug_attr) != 0 ) + { + xwmfs_throw( + xwmfs::SystemException("Error creating debug mutex attribute") + ); } - if( ::pthread_mutex_init(&m_pmutex, attr) != 0 ) + if( ::pthread_mutexattr_settype( + &debug_attr, PTHREAD_MUTEX_ERRORCHECK + ) != 0 ) { xwmfs_throw( - xwmfs::SystemException("Error creating mutex" ) + xwmfs::SystemException("Error setting debug mutex type") ); } - if( DEBUG_MUTEX ) + atexit(cleanupDebug); + debug_attr_initialized = true; +} + +} // end anon ns + +Mutex::Mutex() +{ + checkInitDebug(); + ::pthread_mutexattr_t* attr = DEBUG_MUTEX ? &debug_attr : nullptr; + + + if( ::pthread_mutex_init(&m_pmutex, attr) != 0 ) { - const int attr_destr_res = ::pthread_mutexattr_destroy( - attr + xwmfs_throw( + xwmfs::SystemException("Error creating mutex" ) ); - assert( ! attr_destr_res ); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xwmfs-0.90/tests/base/base.py new/xwmfs-0.91/tests/base/base.py --- old/xwmfs-0.90/tests/base/base.py 2017-11-08 20:19:44.000000000 +0100 +++ new/xwmfs-0.91/tests/base/base.py 2022-05-04 18:36:20.000000000 +0200 @@ -1,314 +1,327 @@ -from __future__ import print_function -import os, sys -import subprocess +#!/usr/bin/python3 + +import argparse import atexit +import os +import shutil +import subprocess +import sys +import tempfile import time -import argparse + + +def printe(*args, **kwargs): + kwargs['file'] = sys.stderr + print(*args, **kwargs) + class File(object): - def __init__(self, path): + def __init__(self, path): - self.m_path = path + self.m_path = path - def exists(self): + def exists(self): - return os.path.exists(self.m_path) + return os.path.exists(self.m_path) - def read(self): - with open(self.m_path, 'r') as fd: - return fd.read().strip() + def read(self): + with open(self.m_path, 'r') as fd: + return fd.read().strip() - def write(self, what): + def write(self, what): - with open(self.m_path, 'w') as fd: - fd.write(what) + with open(self.m_path, 'w') as fd: + fd.write(what) + + def __str__(self): + return self.m_path - def __str__(self): - return self.m_path class DirBase(object): - def __init__(self, path): + def __init__(self, path): - self.m_path = path - - def getFile(self, which): + self.m_path = path - return File(self.getPath(which)) - - def getPath(self, which): + def getFile(self, which): - return os.path.join(self.m_path, which) + return File(self.getPath(which)) -class Window(DirBase): + def getPath(self, which): - def __init__(self, _id): + return os.path.join(self.m_path, which) - self.m_id = _id - DirBase.__init__(self, self.getDir()) - @classmethod - def setBase(self, base): - self.m_base = base +class Window(DirBase): - def getDir(self): + def __init__(self, _id): - windir = os.path.join(self.m_base.m_windows, self.m_id) + self.m_id = _id + DirBase.__init__(self, self.getDir()) - if not os.path.isdir(windir): - print("Test window directory", windir, "is not existing?") - sys.exit(1) + @classmethod + def setBase(self, base): + self.m_base = base - return windir + def getDir(self): - def __str__(self): - return os.path.basename(self.m_id) + windir = os.path.join(self.m_base.m_windows, self.m_id) -class ManagerDir(DirBase): + if not os.path.isdir(windir): + printe("Test window directory", windir, "is not existing?") + sys.exit(1) - def __init__(self, path): + return windir - DirBase.__init__(self, path) + def __str__(self): + return os.path.basename(self.m_id) -class TestBase(object): +class ManagerDir(DirBase): + + def __init__(self, path): - def setupParser(self): + DirBase.__init__(self, path) - self.m_parser = argparse.ArgumentParser("xwmfs unit test") - self.m_parser.add_argument( - "-l", "--logfile", - help = "Path to write xwmfs logs to" - ) +class TestBase(object): - self.m_parser.add_argument( - "-d", "--debug", - help = "Run xwmfs with debugging extras", - action = 'store_true' - ) + def setupParser(self): - self.m_parser.add_argument( - "-b", "--binary", - help = "Location of the xwmfs executable to test", - default = None - ) + self.m_parser = argparse.ArgumentParser("xwmfs unit test") - def parseArgs(self): + self.m_parser.add_argument( + "-l", "--logfile", + help="Path to write xwmfs logs to" + ) - self.m_args = self.m_parser.parse_args() + self.m_parser.add_argument( + "-d", "--debug", + help="Run xwmfs with debugging extras", + action='store_true' + ) - def __init__(self): + self.m_parser.add_argument( + "-b", "--binary", + help="Location of the xwmfs executable to test", + default=None + ) - self.setupParser() - self.m_res = 0 + def parseArgs(self): - atexit.register(self._cleanup) - self.m_proc = None - self.m_test_window = None - self.m_mount_dir = "/tmp/xwmfs" - Window.setBase(self) + self.m_args = self.m_parser.parse_args() - def _cleanup(self): + def __init__(self): - if self.m_proc: - self.m_proc.terminate() - self.m_proc.wait() - os.rmdir(self.m_mount_dir) + self.setupParser() + self.m_res = 0 - if self.m_test_window: - self.closeTestWindow() + atexit.register(self._cleanup) + self.m_proc = None + self.m_test_window = None + self.m_tmp_dir = tempfile.TemporaryDirectory() + self.m_mount_dir = self.m_tmp_dir.name + Window.setBase(self) - def getBinary(self): + def _cleanup(self): - xwmfs = os.environ.get("XWMFS", None) + if self.m_proc: + self.m_proc.terminate() + self.m_proc.wait() + os.rmdir(self.m_mount_dir) - if self.m_args.binary: - ret = self.m_args.binary - elif xwmfs: - ret = xwmfs - else: - ret = None + if self.m_test_window: + self.closeTestWindow() - if not ret: - print("Expecting path to xwmfs binary as parameter or in the XWMFS environment variable") - sys.exit(1) + def getBinary(self): - if not os.path.isfile(ret): - print("Not a regular file:", ret) - sys.exit(1) + xwmfs = os.environ.get("XWMFS", None) - return ret + if self.m_args.binary: + ret = self.m_args.binary + elif xwmfs: + ret = xwmfs + else: + ret = None + if not ret: + printe("Expecting path to xwmfs binary as parameter or in the XWMFS environment variable") + sys.exit(1) - def logSetting(self): + if not os.path.isfile(ret): + printe("Not a regular file:", ret) + sys.exit(1) - return "111{}".format( - "1" if self.m_args.debug else "0" - ) - - def extraSettings(self): + return ret - debug_opts = [ "--xsync" ] - # [ "-o", "debug" ] + def logSetting(self): - return debug_opts if self.m_args.debug else [] + return "111{}".format( + "1" if self.m_args.debug else "0" + ) - def mount(self): + def extraSettings(self): - if os.path.exists(self.m_mount_dir): - print("Refusing to operate on existing mount dir", self.m_mount_dir) - sys.exit(1) + debug_opts = ["--xsync"] + # ["-o", "debug"] - os.makedirs(self.m_mount_dir) + return debug_opts if self.m_args.debug else [] - self.m_proc = subprocess.Popen( - [ - self.m_xwmfs, "-f", - "--logger={}".format(self.logSetting()), - ] + self.extraSettings() + [ self.m_mount_dir ] - ) + def mount(self): - while len(os.listdir(self.m_mount_dir)) == 0: + self.m_proc = subprocess.Popen( + [ + self.m_xwmfs, "-f", + "--logger={}".format(self.logSetting()), + ] + self.extraSettings() + [self.m_mount_dir] + ) - # poll until the directory is actually mounted - try: - res = self.m_proc.wait(timeout = 0.25) - print("Failed to mount xwmfs, exited with", res) - sys.exit(1) - except subprocess.TimeoutExpired: - pass + while len(os.listdir(self.m_mount_dir)) == 0: - def unmount(self): + # poll until the directory is actually mounted + try: + res = self.m_proc.wait(timeout=0.25) + printe("Failed to mount xwmfs, exited with", res) + sys.exit(1) + except subprocess.TimeoutExpired: + pass - self.m_proc.terminate() + def unmount(self): - res = self.m_proc.wait() - self.m_proc = None + self.m_proc.terminate() - os.rmdir(self.m_mount_dir) + res = self.m_proc.wait() + self.m_proc = None - if res != 0: - print("xwmfs exited with non-zero code of", res) - sys.exit(res) + os.rmdir(self.m_mount_dir) - def run(self): + if res != 0: + printe("xwmfs exited with non-zero code of", res) + sys.exit(res) - if not "DISPLAY" in os.environ: - # don't fail tests because of a missing DISPLAY. this - # is typically the case on automated build servers and - # alike. our tests are mor for interactive testing. + def run(self): - # according to autotools documentation this is the - # exit code to signal a skipped test: + if "DISPLAY" not in os.environ: + # don't fail tests because of a missing DISPLAY. this + # is typically the case on automated build servers and + # alike. our tests are mor for interactive testing. - # https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html - return 77 + # according to autotools documentation this is the + # exit code to signal a skipped test: - self.parseArgs() - self.m_xwmfs = self.getBinary() - self.mount() - self.m_windows = os.path.join(self.m_mount_dir, "windows") - self.m_mgr = ManagerDir(os.path.join(self.m_mount_dir, "wm")) + # https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html + return 77 - self.test() + self.parseArgs() + self.m_xwmfs = self.getBinary() + self.mount() + self.m_windows = os.path.join(self.m_mount_dir, "windows") + self.m_mgr = ManagerDir(os.path.join(self.m_mount_dir, "wm")) - self.unmount() + self.test() - return self.m_res + self.unmount() - def getWindowList(self): + return self.m_res - return [ Window(w) for w in os.listdir(self.m_windows) ] + def getWindowList(self): - def getTestWindow(self): + return [Window(w) for w in os.listdir(self.m_windows)] - our_id = os.environ.get("WINDOWID", None) + def getTestWindow(self): - if our_id: - return Window(our_id) + our_id = os.environ.get("WINDOWID", None) - # otherwise just the first one we approach - return Window(self.getWindowList()[0]) + if our_id: + return Window(our_id) - def createTestWindow(self, required_files = []): - # creates a new window and returns its window ID + # otherwise just the first one we approach + return Window(self.getWindowList()[0]) - # this currently assumes an xterm executable is around + def createTestWindow(self, required_files=[]): + # creates a new window and returns its window ID - if self.m_test_window: - raise Exception("Double create of test window, without closeTestWindow()") + # this currently assumes an xterm executable is around - print("Creating test window") - try: - self.m_test_window = subprocess.Popen("xterm") - except Exception as e: - print("Failed to run xterm to create a test window") - raise + if self.m_test_window: + raise Exception("Double create of test window, without closeTestWindow()") - diff = set() + print("Creating test window") + PROG_CANDS = ("xterm", "st", "xclock") + for prog in PROG_CANDS: + prog = shutil.which(prog) + if not prog: + continue - our_win = None + try: + self.m_test_window = subprocess.Popen(prog) + break + except Exception: + printe(f"Failed to run {prog} to create a test window", file=sys.stderr) + raise + else: + raise Exception(f"Failed to find X11 test program to create a test window. Looked for any of {PROG_CANDS}") - while not our_win: + our_win = None - windows = self.getWindowList() + while not our_win: - for window in windows: - pid = window.getFile("pid") - try: - pid = int(pid.read()) - except Exception as e: - # race condition, no PID yet - continue + windows = self.getWindowList() - if pid == self.m_test_window.pid: - our_win = window - break - else: - time.sleep(0.25) + for window in windows: + pid = window.getFile("pid") + try: + pid = int(pid.read()) + except Exception: + # race condition, no PID yet + continue - print("Created window", our_win, "waiting for", required_files) + if pid == self.m_test_window.pid: + our_win = window + break + else: + time.sleep(0.25) - for req in required_files: - wf = our_win.getFile(req) + print("Created window", our_win, "waiting for", required_files) - count = 0 + for req in required_files: + wf = our_win.getFile(req) - print("Waiting for", req, "file") - while not wf.exists(): - count += 1 - time.sleep(0.25) + count = 0 - if count >= 50: - raise Exception("Required window file '{}' did not appear".format(req)) + print("Waiting for", req, "file") + while not wf.exists(): + count += 1 + time.sleep(0.25) - print("All files present") + if count >= 50: + raise Exception("Required window file '{}' did not appear".format(req)) - # wait for the window to become mapped - mapped = our_win.getFile("mapped") + print("All files present") - while mapped.read() != "1": - time.sleep(0.25) + # wait for the window to become mapped + mapped = our_win.getFile("mapped") - return our_win + while mapped.read() != "1": + time.sleep(0.25) - def closeTestWindow(self): - # waits for a previously created test window to exit + return our_win - self.m_test_window.kill() - self.m_test_window.wait() - self.m_test_window = None + def closeTestWindow(self): + # waits for a previously created test window to exit - def getManagerFile(self, which): + self.m_test_window.kill() + self.m_test_window.wait() + self.m_test_window = None - return self.m_mgr.getFile(which) + def getManagerFile(self, which): - def setGoodResult(self, text): - print("Good:", text) + return self.m_mgr.getFile(which) - def setBadResult(self, text): - print("Bad:", text) - self.m_res = 1 + def setGoodResult(self, text): + print("Good:", text) + def setBadResult(self, text): + print("Bad:", text) + self.m_res = 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xwmfs-0.90/tests/test_events.py new/xwmfs-0.91/tests/test_events.py --- old/xwmfs-0.90/tests/test_events.py 2017-04-25 23:10:05.000000000 +0200 +++ new/xwmfs-0.91/tests/test_events.py 2022-05-04 18:26:19.000000000 +0200 @@ -1,86 +1,84 @@ #!/usr/bin/env python3 -from __future__ import print_function -import os, sys -import time +import sys from base.base import TestBase # tests whether some typical events and corner cases with events are # recognized + class EventsTest(TestBase): - def __init__(self): + def __init__(self): - TestBase.__init__(self) - self.m_event_file = None + TestBase.__init__(self) + self.m_event_file = None - def waitEvent(self, name): + def waitEvent(self, name): - while True: + while True: - line = self.m_event_file.readline() + line = self.m_event_file.readline() - if not line: - raise Exception("EOF on event file") + if not line: + raise Exception("EOF on event file") - if line.strip() != name: - print("Other event:", line) - else: - print("Caught expected event", line) - break - else: - sys.stdout.flush() + if line.strip() != name: + print("Other event:", line) + else: + print("Caught expected event", line) + break + else: + sys.stdout.flush() - def testNameEvent(self): + def testNameEvent(self): - name_path = self.m_new_win.getFile("name") - new_name = "somename" - name_path.write(new_name) - self.waitEvent("name") - if name_path.read() != new_name: - self.setBadResult("Didn't yield the expected name") + name_path = self.m_new_win.getFile("name") + new_name = "somename" + name_path.write(new_name) + self.waitEvent("name") + if name_path.read() != new_name: + self.setBadResult("Didn't yield the expected name") - def testDesktopEvent(self): + def testDesktopEvent(self): - desktop_path = self.m_new_win.getFile("desktop") - num_desktops = self.getManagerFile("number_of_desktops") - num_desktops = int(num_desktops.read()) + desktop_path = self.m_new_win.getFile("desktop") + num_desktops = self.getManagerFile("number_of_desktops") + num_desktops = int(num_desktops.read()) - if num_desktops <= 1: - raise Exception("Too few desktops to test, need at least two") + if num_desktops <= 1: + raise Exception("Too few desktops to test, need at least two") - count = 0 + cur_desktop = int(desktop_path.read()) - cur_desktop = int(desktop_path.read()) + for i in range(num_desktops): + if i != cur_desktop: + new_desktop = i + break - for i in range(num_desktops): - if i != cur_desktop: - new_desktop = i - break + desktop_path.write(str(new_desktop)) + self.waitEvent("desktop") - desktop_path.write(str(new_desktop)) - self.waitEvent("desktop") + def testDestroyEvent(self): - def testDestroyEvent(self): + self.closeTestWindow() + self.waitEvent("destroyed") - self.closeTestWindow() - self.waitEvent("destroyed") + def test(self): - def test(self): + self.m_new_win = self.createTestWindow( + required_files=["pid", "name", "desktop"] + ) + self.m_event_file = open(self.m_new_win.getPath("events"), 'r') - self.m_new_win = self.createTestWindow( - required_files = ["pid", "name", "desktop"] - ) - self.m_event_file = open(self.m_new_win.getPath("events"), 'r') + print("Testing name change event") + self.testNameEvent() + print("Testing desktop change event") + self.testDesktopEvent() + print("Testing destroy event") + self.testDestroyEvent() + self.m_event_file.close() - print("Testing name change event") - self.testNameEvent() - print("Testing desktop change event") - self.testDesktopEvent() - print("Testing destroy event") - self.testDestroyEvent() - self.m_event_file.close() et = EventsTest() res = et.run() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xwmfs-0.90/tests/test_name_update.py new/xwmfs-0.91/tests/test_name_update.py --- old/xwmfs-0.90/tests/test_name_update.py 2017-04-25 23:10:10.000000000 +0200 +++ new/xwmfs-0.91/tests/test_name_update.py 2022-05-04 18:26:42.000000000 +0200 @@ -1,45 +1,46 @@ #!/usr/bin/env python3 -from __future__ import print_function -import os, sys +from base.base import TestBase import random +import sys import time -from base.base import TestBase # tests whether changing a window name is reflected in the file system + class NameUpdateTest(TestBase): - def __init__(self): + def __init__(self): + + TestBase.__init__(self) - TestBase.__init__(self) + def test(self): - def test(self): + test_window = self.getTestWindow() + namefile = test_window.getFile("name") - test_window = self.getTestWindow() - namefile = test_window.getFile("name") + current_name = namefile.read() + print("Current name of", test_window, "=", current_name) - current_name = namefile.read() - print("Current name of", test_window, "=", current_name) + new_name = "random-name-" + str(random.randint(1, 999)) + namefile.write(new_name) + print("Changed name to", new_name) - new_name = "random-name-" + str(random.randint(1, 999)) - namefile.write(new_name) - print("Changed name to", new_name) + # give X some time to dispatch updates + time.sleep(1) - # give X some time to dispatch updates - time.sleep(1) + orig_name = current_name + current_name = namefile.read() - orig_name = current_name - current_name = namefile.read() + if current_name == new_name: + self.setGoodResult("New name found in FS") + else: + self.setBadResult("New name not reflected in file!") - if current_name == new_name: - self.setGoodResult("New name found in FS") - else: - self.setBadResult("New name not reflected in file!") + # reset original name + namefile.write(orig_name) + print("Reset to", orig_name) - # reset original name - namefile.write(orig_name) - print("Reset to", orig_name) nut = NameUpdateTest() res = nut.run()