diff --git a/.github/workflows/el6.yml b/.github/workflows/el6.yml new file mode 100644 index 00000000..05dc8e50 --- /dev/null +++ b/.github/workflows/el6.yml @@ -0,0 +1,185 @@ +name: Enterprise Linux 6 CI/CD + +on: + push: + branches: ["**"] + pull_request: + branches: ["**"] + workflow_dispatch: + +jobs: + build-and-package-el6: + name: Build and package on Enterprise Linux 6 (${{ matrix.arch }}) + # Run on the Ubuntu host so that actions/checkout (Node 20) works; all + # CentOS 6 work is done via explicit `docker run centos:6` invocations + # below. Using `container:` at job level would inject Node 20 into the + # CentOS 6 container, which fails because CentOS 6 ships glibc 2.12 and + # Node 20 requires glibc >= 2.17. + runs-on: ubuntu-latest + permissions: + contents: read + strategy: + matrix: + arch: [x86_64, i686] + + steps: + - name: Checkout source + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Write shared CentOS 6 vault repo helper + run: | + # CentOS 6 reached EOL; vault.centos.org returns 403 on HTTP so HTTPS + # is required. The x86_64 vault repos are correct for both arches: + # CentOS 6 multilib ships i686 packages in the same repositories. + # Use printf to avoid a nested heredoc that would break YAML parsing. + cat > "$RUNNER_TEMP/setup-el6-repos.sh" << 'SETUP' + setup_centos6_vault_repos() { + printf '%s\n' \ + '[base]' \ + 'name=CentOS-6 - Base' \ + 'baseurl=https://vault.centos.org/6.10/os/x86_64/' \ + 'gpgcheck=1' \ + 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6' \ + '' \ + '[updates]' \ + 'name=CentOS-6 - Updates' \ + 'baseurl=https://vault.centos.org/6.10/updates/x86_64/' \ + 'gpgcheck=1' \ + 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6' \ + '' \ + '[extras]' \ + 'name=CentOS-6 - Extras' \ + 'baseurl=https://vault.centos.org/6.10/extras/x86_64/' \ + 'gpgcheck=1' \ + 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6' \ + > /etc/yum.repos.d/CentOS-Base.repo + } + SETUP + + - name: Build and test inside CentOS 6 container + run: | + cat > "$RUNNER_TEMP/build-el6.sh" << 'SCRIPT' + set -ex + # shellcheck source=/dev/null + . /setup-el6-repos.sh + setup_centos6_vault_repos + + # Install base build dependencies + yum install -y \ + gcc make autoconf automake libtool pkgconfig perl \ + libX11-devel libXtst-devel texinfo rpm-build git + + # 32-bit (i686) extras and compiler wrapper + if [ "$TARGET_ARCH" = "i686" ]; then + # libgcc.i686 provides /lib/libgcc_s.so.1 needed by gcc -m32 + yum install -y \ + libgcc.i686 glibc-devel.i686 \ + libX11-devel.i686 libXtst-devel.i686 + # Provide i686-redhat-linux-gnu-gcc so --host= works with autoconf + printf '#!/bin/sh\nexec gcc -m32 "$@"\n' \ + > /usr/local/bin/i686-redhat-linux-gnu-gcc + chmod +x /usr/local/bin/i686-redhat-linux-gnu-gcc + ln -sf /usr/local/bin/i686-redhat-linux-gnu-gcc \ + /usr/local/bin/i686-redhat-linux-gnu-g++ + # CFLAGS/LDFLAGS are for this build+test step only. + # The RPM step drives -m32 via rpmbuild --define "optflags ..." + # so these are intentionally not set there. + export CFLAGS="-m32 -march=i686 -mtune=generic" + export LDFLAGS="-m32" + CONFIGURE_HOST="--host=i686-redhat-linux-gnu --build=x86_64-redhat-linux-gnu" + else + CONFIGURE_HOST="" + fi + + cd /workspace + make -f Makefile.cvs generate + # word-split of $CONFIGURE_HOST is intentional (empty or two flags) + # shellcheck disable=SC2086 + ./configure --disable-gui --disable-doc --disable-xinput2 \ + $CONFIGURE_HOST + make + make -C cnee/src man + chmod +x tests/e2e_cnee.sh + ./tests/e2e_cnee.sh ./cnee/src/cnee + SCRIPT + docker run --rm \ + -e TARGET_ARCH="${{ matrix.arch }}" \ + -v "$PWD:/workspace" \ + -v "$RUNNER_TEMP/build-el6.sh:/build.sh:ro" \ + -v "$RUNNER_TEMP/setup-el6-repos.sh:/setup-el6-repos.sh:ro" \ + centos:6 bash /build.sh + + - name: Create source distribution + run: | + XNEE_VERSION=$(grep 'AC_INIT' configure.in \ + | awk 'BEGIN {FS=","} { print $2 }' \ + | tr -d ' ') + # git safe.directory was added in git 2.35.2; ignore errors on older git. + git config --global --add safe.directory "$(pwd)" 2>/dev/null || true + git archive --prefix="xnee-${XNEE_VERSION}/" HEAD \ + | gzip > "xnee-${XNEE_VERSION}.tar.gz" + + - name: Build RPM inside CentOS 6 container + run: | + cat > "$RUNNER_TEMP/rpm-el6.sh" << 'SCRIPT' + set -ex + # shellcheck source=/dev/null + . /setup-el6-repos.sh + setup_centos6_vault_repos + + yum install -y \ + gcc make autoconf automake libtool pkgconfig perl \ + libX11-devel libXtst-devel texinfo rpm-build + + if [ "$TARGET_ARCH" = "i686" ]; then + yum install -y \ + libgcc.i686 glibc-devel.i686 \ + libX11-devel.i686 libXtst-devel.i686 + printf '#!/bin/sh\nexec gcc -m32 "$@"\n' \ + > /usr/local/bin/i686-redhat-linux-gnu-gcc + chmod +x /usr/local/bin/i686-redhat-linux-gnu-gcc + ln -sf /usr/local/bin/i686-redhat-linux-gnu-gcc \ + /usr/local/bin/i686-redhat-linux-gnu-g++ + fi + + cd /workspace + XNEE_VERSION=$(grep 'AC_INIT' configure.in \ + | awk 'BEGIN {FS=","} { print $2 }' | tr -d ' ') + XNEE_RELEASE=1 + mkdir -p "$HOME/rpmbuild"/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + cp "xnee-${XNEE_VERSION}.tar.gz" "$HOME/rpmbuild/SOURCES/" + sed \ + -e "s/XNEE_VERSION/${XNEE_VERSION}/g" \ + -e "s/XNEE_RELEASE/${XNEE_RELEASE}/g" \ + build/SPECS/cnee-el6.spec \ + > "$HOME/rpmbuild/SPECS/cnee.spec" + + if [ "$TARGET_ARCH" = "i686" ]; then + # Set host to i686 so %configure uses our wrapper gcc. + # Do not export CFLAGS/LDFLAGS here to avoid polluting %configure. + rpmbuild -ba \ + --define "_host i686-redhat-linux-gnu" \ + --define "_host_alias i686-redhat-linux-gnu" \ + --define "_target_cpu i686" \ + --define "optflags -O2 -g -m32 -march=i686 -mtune=generic" \ + "$HOME/rpmbuild/SPECS/cnee.spec" + else + rpmbuild -ba "$HOME/rpmbuild/SPECS/cnee.spec" + fi + + find "$HOME/rpmbuild/RPMS" "$HOME/rpmbuild/SRPMS" -name "*.rpm" \ + -exec cp {} /workspace/ \; + SCRIPT + docker run --rm \ + -e TARGET_ARCH="${{ matrix.arch }}" \ + -v "$PWD:/workspace" \ + -v "$RUNNER_TEMP/rpm-el6.sh:/rpm.sh:ro" \ + -v "$RUNNER_TEMP/setup-el6-repos.sh:/setup-el6-repos.sh:ro" \ + centos:6 bash /rpm.sh + + - name: Upload RPM artifact + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4 + with: + name: cnee-el6-${{ matrix.arch }}-rpm + path: "*.rpm" + if-no-files-found: error diff --git a/.github/workflows/el8.yml b/.github/workflows/el8.yml new file mode 100644 index 00000000..d54a40a2 --- /dev/null +++ b/.github/workflows/el8.yml @@ -0,0 +1,95 @@ +name: Enterprise Linux 8 CI/CD + +on: + push: + branches: ["**"] + pull_request: + branches: ["**"] + workflow_dispatch: + +jobs: + build-and-package-el8: + name: Build and package on Enterprise Linux 8 + runs-on: ubuntu-latest + permissions: + contents: read + container: + image: almalinux:8 + + steps: + - name: Enable PowerTools and install build dependencies + run: | + dnf install -y dnf-plugins-core + dnf config-manager --set-enabled powertools + dnf install -y \ + gcc \ + make \ + autoconf \ + automake \ + libtool \ + pkgconfig \ + perl \ + libX11-devel \ + libXtst-devel \ + texinfo \ + rpm-build \ + git \ + xorg-x11-server-Xvfb + + - name: Checkout source + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Build XNee + run: | + make -f Makefile.cvs generate + ./configure --disable-gui --disable-doc --disable-xinput2 + make + make -C cnee/src man + + - name: Run e2e tests + run: | + chmod +x tests/e2e_cnee.sh + ./tests/e2e_cnee.sh ./cnee/src/cnee + + - name: Create source distribution + run: | + XNEE_VERSION=$(grep 'AC_INIT' configure.in \ + | awk 'BEGIN {FS=","} { print $2 }' \ + | tr -d ' ') + # Inside the AlmaLinux container git runs as root while the checkout + # directory is owned by the runner user – mark it safe to allow + # git archive to work. + git config --global --add safe.directory "$(pwd)" + # Use git archive to avoid the doc/Makefile.am dia→png generation + # that make dist triggers even with --disable-doc. + git archive --prefix="xnee-${XNEE_VERSION}/" HEAD \ + | gzip > "xnee-${XNEE_VERSION}.tar.gz" + + - name: Build RPM package + run: | + XNEE_VERSION=$(grep 'AC_INIT' configure.in \ + | awk 'BEGIN {FS=","} { print $2 }' \ + | tr -d ' ') + XNEE_RELEASE=1 + + mkdir -p "$HOME/rpmbuild"/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + + cp "xnee-${XNEE_VERSION}.tar.gz" "$HOME/rpmbuild/SOURCES/" + + sed \ + -e "s/XNEE_VERSION/${XNEE_VERSION}/g" \ + -e "s/XNEE_RELEASE/${XNEE_RELEASE}/g" \ + build/SPECS/cnee-el8.spec \ + > "$HOME/rpmbuild/SPECS/cnee.spec" + + rpmbuild -ba "$HOME/rpmbuild/SPECS/cnee.spec" + + # Copy built binary RPMs and SRPM to the workspace for artifact upload + find "$HOME/rpmbuild/RPMS" "$HOME/rpmbuild/SRPMS" -name "*.rpm" -exec cp {} . \; + + - name: Upload RPM artifact + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4 + with: + name: cnee-el8-rpm + path: "*.rpm" + if-no-files-found: error diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..cd7bbdc1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,77 @@ +# Autoconf / Automake generated files +Makefile +Makefile.in +aclocal.m4 +autom4te.cache/ +autotools/compile +autotools/config.guess +autotools/config.sub +autotools/depcomp +autotools/install-sh +autotools/ltmain.sh +autotools/mdate-sh +autotools/missing +autotools/texinfo.tex +config.h +config.h.in~ +config.log +config.status +configure +libtool +stamp-h.in +stamp-h1 + +# Build artifacts +*.o +*.lo +*.la +*.a +*.so +*.so.* +.libs/ +.deps/ + +# Generated binaries +cnee/src/cnee +gnee/src/gnee +pnee/src/pnee +libxnee/test/libtest +libxnee/test/testcallback +libxnee/test/testdisplay +libxnee/test/testfeedback +libxnee/test/testprint +libxnee/test/testsetget + +# Generated documentation +cnee/src/cnee.1 +cnee/src/cnee.texi +cnee/src/cnee.texinfo +cnee/src/cnee.info +man/xnee.1 +gnee/man/gnee.1 +pnee/man/pnee.1 +doc/xnee.info +doc/xnee.info-* + +# Autoconf backup files +configure~ +config.h.in~ + +# Generated data files +share/xnee.sh +examples/simple_bash.sh + +# Distribution archives +*.tar.gz +*.tar.bz2 +config.xnee + +# RPM build outputs +*.rpm + +# texinfo version stamp (generated by make) +doc/stamp-vti + +# make dist extraction directories +xnee-*/ +Xnee-*.tar.gz diff --git a/INSTALL b/INSTALL old mode 100644 new mode 100755 index 23e5f25d..2a116bd4 --- a/INSTALL +++ b/INSTALL @@ -1,236 +1,383 @@ Installation Instructions ************************* -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free + Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free Software Foundation, Inc. -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +GNU Xnee 4.0 +============ + + This is GNU Xnee version 4.0. GNU Xnee is a suite of programs that +can record, replay, and distribute user actions under the X11 +environment. It consists of a library (libxnee), a command-line tool +(cnee/xnee), and optionally a graphical front-end (gnee). + + For Xnee-specific build options, see the 'README' file. Commonly +used configure flags include: + + --disable-gui do not build the gnee graphical front-end + --disable-doc skip building the documentation + --enable-gnome-applet build the pnee GNOME panel applet Basic Installation ================== -These are generic installation instructions. + Briefly, the shell command './configure && make && make install' +should configure, build, and install this package. The following +more-detailed instructions are generic; see the 'README' file for +instructions specific to this package. Some packages provide this +'INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. - The `configure' shell script attempts to guess correct values for + The 'configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that +those values to create a 'Makefile' in each directory of the package. +It may also create one or more '.h' files containing system-dependent +definitions. Finally, it creates a shell script 'config.status' that you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). +file 'config.log' containing compiler output (useful mainly for +debugging 'configure'). - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is -disabled by default to prevent problems with accidental use of stale -cache files.) + It can also use an optional file (typically called 'config.cache' and +enabled with '--cache-file=config.cache' or simply '-C') that saves the +results of its tests to speed up reconfiguring. Caching is disabled by +default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can +to figure out how 'configure' could check whether to do them, and mail +diffs or instructions to the address given in the 'README' so they can be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you +some point 'config.cache' contains results you don't want to keep, you may remove or edit it. - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. + The file 'configure.ac' (or 'configure.in') is used to create +'configure' by a program called 'autoconf'. You need 'configure.ac' if +you want to change it or regenerate 'configure' using a newer version of +'autoconf'. -The simplest way to compile this package is: + The simplest way to compile this package is: - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. + 1. 'cd' to the directory containing the package's source code and type + './configure' to configure the package for your system. - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. + Running 'configure' might take a while. While running, it prints + some messages telling which features it is checking for. - 2. Type `make' to compile the package. + 2. Type 'make' to compile the package. - 3. Optionally, type `make check' to run any self-tests that come with - the package. + 3. Optionally, type 'make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. - 4. Type `make install' to install the programs and any data files and - documentation. + 4. Type 'make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the 'make install' phase executed with root + privileges. - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly + 5. Optionally, type 'make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior 'make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing 'make clean'. To also remove the + files that 'configure' created (so you can compile the package for + a different kind of computer), type 'make distclean'. There is + also a 'make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. + 7. Often, you can also type 'make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide 'make + distcheck', which can by used by developers to test that all other + targets like 'make install' and 'make uninstall' work correctly. + This target is generally not run by end users. + Compilers and Options ===================== -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. + Some systems require unusual options for compilation or linking that +the 'configure' script does not know about. Run './configure --help' +for details on some of the pertinent environment variables. - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: + You can give 'configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here is +an example: - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + ./configure CC=cc CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== -You can compile the package for more than one kind of computer at the + You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the +own directory. To do this, you can use GNU 'make'. 'cd' to the directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. +the 'configure' script. 'configure' automatically checks for the source +code in the directory that 'configure' is in and in '..'. This is known +as a "VPATH" build. + + With a non-GNU 'make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use 'make distclean' before +reconfiguring for another architecture. - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple '-arch' options to the +compiler but only a single '-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the 'lipo' tool if you have problems. Installation Names ================== -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. + By default, 'make install' installs the package's commands under +'/usr/local/bin', include files under '/usr/local/include', etc. You +can specify an installation prefix other than '/usr/local' by giving +'configure' the option '--prefix=PREFIX', where PREFIX must be an +absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses +pass the option '--exec-prefix=PREFIX' to 'configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. +options like '--bindir=DIR' to specify different values for particular +kinds of files. Run 'configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the default +for these options is expressed in terms of '${prefix}', so that +specifying just '--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to 'configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +'make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, 'make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +'${prefix}'. Any directories that were specified during 'configure', +but not in terms of '${prefix}', must each be overridden at install time +for the entire installation to be relocated. The approach of makefile +variable overrides for each directory variable is required by the GNU +Coding Standards, and ideally causes no recompilation. However, some +platforms have known limitations with the semantics of shared libraries +that end up requiring recompilation when using this method, particularly +noticeable in packages that use GNU Libtool. + + The second method involves providing the 'DESTDIR' variable. For +example, 'make install DESTDIR=/alternate/directory' will prepend +'/alternate/directory' before all installation names. The approach of +'DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of '${prefix}' +at 'configure' time. Optional Features ================= -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving 'configure' the +option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. + + Some packages pay attention to '--enable-FEATURE' options to +'configure', where FEATURE indicates an optional part of the package. +They may also pay attention to '--with-PACKAGE' options, where PACKAGE +is something like 'gnu-as' or 'x' (for the X Window System). The +'README' should mention any '--enable-' and '--with-' options that the package recognizes. - For packages that use the X Window System, `configure' can usually + For packages that use the X Window System, 'configure' can usually find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. +you can use the 'configure' options '--x-includes=DIR' and +'--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of 'make' will be. For these packages, running './configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with 'make V=1'; while running './configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with 'make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC +is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX 'make' updates targets which have the same timestamps as their +prerequisites, which makes it generally unusable when shipped generated +files such as 'configure' are involved. Use GNU 'make' instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its '' header file. The option '-nodtk' can be used as a +workaround. If GNU CC is not installed, it is therefore recommended to +try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put '/usr/ucb' early in your 'PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in '/usr/bin'. So, if you need '/usr/ucb' +in your 'PATH', put it _after_ '/usr/bin'. + + On Haiku, software installed for all users goes in '/boot/common', +not '/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common Specifying the System Type ========================== -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: + There may be some features 'configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, 'configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +'--build=TYPE' option. TYPE can either be a short name for the system +type, such as 'sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: - OS KERNEL-OS + OS + KERNEL-OS - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't + See the file 'config.sub' for the possible values of each field. If +'config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will +use the option '--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. +eventually be run) with '--host=TYPE'. Sharing Defaults ================ -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. + If you want to set default values for 'configure' scripts to share, +you can create a site shell script called 'config.site' that gives +default values for variables like 'CC', 'cache_file', and 'prefix'. +'configure' looks for 'PREFIX/share/config.site' if it exists, then +'PREFIX/etc/config.site' if it exists. Or, you can set the +'CONFIG_SITE' environment variable to the location of the site script. +A warning: not all 'configure' scripts look for a site script. Defining Variables ================== -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run + Variables not defined in a site shell script can be set in the +environment passed to 'configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: +them in the 'configure' command line, using 'VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: +causes the specified 'gcc' to be used as the C compiler (unless it is +overridden in the site shell script). - /bin/bash ./configure CONFIG_SHELL=/bin/bash +Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an +Autoconf limitation. Until the limitation is lifted, you can use this +workaround: -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. + CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash -`configure' Invocation +'configure' Invocation ====================== -`configure' recognizes the following options to control how it operates. + 'configure' recognizes the following options to control how it +operates. + +'--help' +'-h' + Print a summary of all of the options to 'configure', and exit. -`--help' -`-h' - Print a summary of the options to `configure', and exit. +'--help=short' +'--help=recursive' + Print a summary of the options unique to this package's + 'configure', and exit. The 'short' variant lists options used only + in the top level, while the 'recursive' variant lists options also + present in any nested packages. -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' +'--version' +'-V' + Print the version of Autoconf used to generate the 'configure' script, and exit. -`--cache-file=FILE' +'--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to + traditionally 'config.cache'. FILE defaults to '/dev/null' to disable caching. -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. +'--config-cache' +'-C' + Alias for '--cache-file=config.cache'. -`--quiet' -`--silent' -`-q' +'--quiet' +'--silent' +'-q' Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error + suppress all normal output, redirect it to '/dev/null' (any error messages will still be shown). -`--srcdir=DIR' +'--srcdir=DIR' Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. + 'configure' can determine that directory automatically. + +'--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: for + more details, including other options available for fine-tuning the + installation locations. -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. +'--no-create' +'-n' + Run the configure checks, but stop before creating any output + files. +'configure' also accepts some other, not widely useful, options. Run +'configure --help' for more details. diff --git a/Makefile.am b/Makefile.am index b1b2ca12..1b346a03 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ SUBDIRS = libxnee cnee gnee pnee ${DOC_DIR} share examples sessions pixmap man AUTOMAKE_OPTIONS = gnu -EXTRA_DIST = Makefile.xnee Makefile.cvs autotools/* projects/test.xnp sessions/example1.xns README README.debian README.cvs BUGS FAQ EXAMPLES doc/Makefile.am doc/Makefile.in ChangeLog build/autobuild.sh +EXTRA_DIST = Makefile.xnee Makefile.cvs projects/test.xnp sessions/example1.xns README README.debian README.cvs BUGS FAQ EXAMPLES doc/Makefile.am doc/Makefile.in ChangeLog build/autobuild.sh diff --git a/README b/README index f78aa010..090809c2 100644 --- a/README +++ b/README @@ -31,17 +31,17 @@ A Gnome Panel Applet To build these three programs do the following: ============================================== -Building from dist file (e.g xnee-3.02.tar.gz): +Building from dist file (e.g xnee-4.0.tar.gz): ----------------------------------------------- #Unzip the source file -gunzip xnee-3.02.tar.gz +gunzip xnee-4.0.tar.gz #Untar the source file -tar xvf xnee-3.02.tar +tar xvf xnee-4.0.tar #Enter the Xnee directory -cd xnee-3.02 +cd xnee-4.0 #Generate the makefiles and build ./configure diff --git a/build/SPECS/cnee-el6.spec b/build/SPECS/cnee-el6.spec new file mode 100644 index 00000000..cfe883b6 --- /dev/null +++ b/build/SPECS/cnee-el6.spec @@ -0,0 +1,64 @@ +%define packname xnee +%define cliname cnee + +Name: %{cliname} +Version: XNEE_VERSION +Release: XNEE_RELEASE%{?dist} +Summary: X11 event recorder, replayer and distributor (command line tool) + +License: GPLv3+ +URL: https://www.gnu.org/software/xnee +Source0: https://ftp.gnu.org/pub/gnu/xnee/%{packname}-%{version}.tar.gz + +BuildRequires: gcc +BuildRequires: make +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +BuildRequires: pkgconfig +BuildRequires: libX11-devel%{?_isa} +BuildRequires: libXtst-devel%{?_isa} +BuildRequires: texinfo +BuildRequires: perl + +Requires: libX11%{?_isa} +Requires: libXtst%{?_isa} + +%description +GNU Xnee is a suite of programs that can record, replay and distribute +user actions under the X11 environment. Think of it as a macro recorder +for X11. + +This package contains the command line tool cnee, which allows scripting +and automation of X11 input event recording and replaying. + +%prep +%setup -q -n %{packname}-%{version} + +%build +make -f Makefile.cvs generate +%configure \ + --disable-gui \ + --disable-doc \ + --disable-xinput2 +make %{?_smp_mflags} +make -C cnee/src man + +%install +make install DESTDIR=%{buildroot} + +mkdir -p %{buildroot}%{_datadir}/xnee/projects +install -m 644 projects/*.xnp %{buildroot}%{_datadir}/xnee/projects/ + +%files +%doc COPYING AUTHORS ChangeLog INSTALL NEWS README TODO EXAMPLES FAQ BUGS +%{_bindir}/cnee +%{_mandir}/man1/cnee.1* +%{_mandir}/man1/xnee.1* +%{_datadir}/xnee/ +%{_datadir}/pixmaps/xnee.xpm +%{_datadir}/pixmaps/xnee.png +%exclude %{_libdir}/libtestcb.* + +%changelog +# end of file diff --git a/build/SPECS/cnee-el8.spec b/build/SPECS/cnee-el8.spec new file mode 100644 index 00000000..61c24b94 --- /dev/null +++ b/build/SPECS/cnee-el8.spec @@ -0,0 +1,65 @@ +%define packname xnee +%define cliname cnee + +Name: %{cliname} +Version: XNEE_VERSION +Release: XNEE_RELEASE%{?dist} +Summary: X11 event recorder, replayer and distributor (command line tool) + +License: GPL-3.0-or-later +URL: https://www.gnu.org/software/xnee +Source0: https://ftp.gnu.org/pub/gnu/xnee/%{packname}-%{version}.tar.gz + +BuildRequires: gcc +BuildRequires: make +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +BuildRequires: pkgconfig +BuildRequires: libX11-devel%{?_isa} +BuildRequires: libXtst-devel%{?_isa} +BuildRequires: texinfo +BuildRequires: perl + +Requires: libX11%{?_isa} +Requires: libXtst%{?_isa} + +%description +GNU Xnee is a suite of programs that can record, replay and distribute +user actions under the X11 environment. Think of it as a macro recorder +for X11. + +This package contains the command line tool cnee, which allows scripting +and automation of X11 input event recording and replaying. + +%prep +%setup -q -n %{packname}-%{version} + +%build +make -f Makefile.cvs generate +%configure \ + --disable-gui \ + --disable-doc \ + --disable-xinput2 +%make_build +make -C cnee/src man + +%install +%make_install + +mkdir -p %{buildroot}%{_datadir}/xnee/projects +install -m 644 projects/*.xnp %{buildroot}%{_datadir}/xnee/projects/ + +%files +%license COPYING +%doc AUTHORS ChangeLog INSTALL NEWS README TODO EXAMPLES FAQ BUGS +%{_bindir}/cnee +%{_mandir}/man1/cnee.1* +%{_mandir}/man1/xnee.1* +%{_datadir}/xnee/ +%{_datadir}/pixmaps/xnee.xpm +%{_datadir}/pixmaps/xnee.png +%exclude %{_libdir}/libtestcb.* + +%changelog +# end of file diff --git a/cnee/Makefile.am b/cnee/Makefile.am index 0402d558..3c8d65a6 100644 --- a/cnee/Makefile.am +++ b/cnee/Makefile.am @@ -4,7 +4,7 @@ LIBSEMA=${LIBSEMA} SUBDIRS = src -EXTRA_DIST = Makefile.cnee Makefile.cvs autotools/* \ +EXTRA_DIST = Makefile.cnee Makefile.cvs \ test/bin/new_script.sh \ test/etc/base_funs \ test/test_all.sh \ diff --git a/cnee/include/cnee_demo.h b/cnee/include/cnee_demo.h index 84ff8e3d..f6159230 100644 --- a/cnee/include/cnee_demo.h +++ b/cnee/include/cnee_demo.h @@ -32,6 +32,9 @@ int cnee_demonstration (xnee_data *xd); +int +cnee_record_replay (xnee_data *xd); + #endif /* CNEE_DEMO_H */ diff --git a/cnee/src/Makefile.am b/cnee/src/Makefile.am index d418404d..7bcc469e 100644 --- a/cnee/src/Makefile.am +++ b/cnee/src/Makefile.am @@ -91,9 +91,9 @@ man: ./$(CNEE)$(EXEEXT) @echo "Generating man page file from: $(CNEE)$(EXEEXT)" ./$(CNEE)$(EXEEXT) --manpage > cnee.1 @echo "Generating texi file from: $(CNEE)$(EXEEXT)" - ./$(CNEE)$(EXEEXT) --texipage > cnee.texinfo + ./$(CNEE)$(EXEEXT) --texipage > cnee.texi @echo "Generating info file from cnee.texi" - $(MAKEINFO) cnee.info + $(MAKEINFO) cnee.texi cnee.1: $(CNEE)$(EXEEXT) diff --git a/cnee/src/cnee_demo.c b/cnee/src/cnee_demo.c index d12d5e49..2f2784cb 100644 --- a/cnee/src/cnee_demo.c +++ b/cnee/src/cnee_demo.c @@ -32,12 +32,12 @@ #include "libxnee/xnee_alloc.h" #include "libxnee/xnee_xinput.h" +#include "cnee.h" #include "parse.h" #include "cnee_strings.h" #define CNEE_DEMO_DELAYED_START 3 -xnee_option_t *cnee_options ; static char * cnee_get_default_filename() diff --git a/config.h.in b/config.h.in index 8d0c7b32..a81398fd 100644 --- a/config.h.in +++ b/config.h.in @@ -64,9 +64,6 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME -/* Define to the home page for this package. */ -#undef PACKAGE_URL - /* Define to the version of this package. */ #undef PACKAGE_VERSION diff --git a/config.xnee b/config.xnee deleted file mode 100644 index e76edd11..00000000 --- a/config.xnee +++ /dev/null @@ -1,81 +0,0 @@ -/* config.h. Generated by configure. */ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* config.h. - * - * - * - * - * - * Copied to make it possible to use custom Makefile.xnee - * - * - * - */ - - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -/* #undef HAVE_DOPRNT */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDARG_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_VARARGS_H */ - -/* Define to 1 if you have the `vprintf' function. */ -#define HAVE_VPRINTF 1 - -/* Name of package */ -#define PACKAGE "Xnee" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "bug-xnee@gnu.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "Xnee" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Xnee 2.03" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "xnee" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.03" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "2.03" - -/* Define to 1 if the X Window System is missing or not being used. */ -#define X_DISPLAY_MISSING 1 diff --git a/configure.in b/configure.in index 0da50c8f..4507fa70 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -AC_INIT(Xnee,3.20,bug-xnee@gnu.org) +AC_INIT(Xnee,4.0,bug-xnee@gnu.org) AC_CONFIG_AUX_DIR(./autotools/) AM_INIT_AUTOMAKE #AB_INIT diff --git a/doc/Makefile.gdoc b/doc/Makefile.gdoc new file mode 100644 index 00000000..cb3d6f55 --- /dev/null +++ b/doc/Makefile.gdoc @@ -0,0 +1,5 @@ +# This file is intentionally left as a no-op. +# Any previous gdoc-specific make variables (gdoc_MANS, gdoc_TEXINFOS, etc.) +# are intentionally left empty because they are unused and not referenced by the build. +gdoc_MANS = +gdoc_TEXINFOS = diff --git a/doc/version.texi b/doc/version.texi index 0aa6f685..b52f74b0 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 10 February 2012 -@set UPDATED-MONTH February 2012 -@set EDITION 3.11.90 -@set VERSION 3.11.90 +@set UPDATED 4 March 2026 +@set UPDATED-MONTH March 2026 +@set EDITION 4.0 +@set VERSION 4.0 diff --git a/doc/xnee.1 b/doc/xnee.1 index c9c24f5b..690513c8 100644 --- a/doc/xnee.1 +++ b/doc/xnee.1 @@ -1,4 +1,4 @@ -.\" Copyright Henrik Sandklef 2007 +.\" Copyright Henrik Sandklef 2007, 2026 .\" .\" This file is part of GNU Xnee. .\" @@ -17,7 +17,7 @@ .\" Free Software Foundation, Inc., 59 Temple Place - Suite 330, .\" Boston, MA 02111-1307, USA. .\" -.TH "XNEE" 1 2007 "GNU Xnee" +.TH "XNEE" 1 2026 "GNU Xnee" .SH "NAME" GNU Xnee records, replays or distributes X11 data .sp diff --git a/gnee/man/gnee.1.in b/gnee/man/gnee.1.in index 638158ea..a9b4fb8e 100644 --- a/gnee/man/gnee.1.in +++ b/gnee/man/gnee.1.in @@ -1,4 +1,4 @@ -.\" Copyright Henrik Sandklef 2007 +.\" Copyright Henrik Sandklef 2007, 2026 .\" .\" This file is part of GNU Xnee. .\" @@ -17,7 +17,7 @@ .\" Free Software Foundation, Inc., 59 Temple Place - Suite 330, .\" Boston, MA 02111-1307, USA. .\" -.TH "GNEE" 1 2007 "Xnee" +.TH "GNEE" 1 2026 "Xnee" .SH "NAME" gnee record, replays or distributes X11 data .SH "SYNOPSIS" @@ -25,16 +25,16 @@ gnee record, replays or distributes X11 data .sp .SH "DESCRIPTION" .B gnee -is the grapgical frontend to GNU Xnee. If you want more information +is the graphical frontend to GNU Xnee. If you want more information about GNU Xnee read the GNU Xnee manual and the cnee info pages. GNU -Xnee consists of a command lie program (cnee), a graphical frontend +Xnee consists of a command line program (cnee), a graphical frontend (gnee) and a Gnome Panel Applet (pnee). .SH "AUTHOR" Henrik Sandklef. .SH "REPORTING BUGS" Report bugs in the program to bug-xnee@gnu.org. .SH "COPYRIGHT" -Copyright (C) 2006, 2007 Henrik Sandklef. +Copyright (C) 2006, 2007, 2026 Henrik Sandklef. This is free software; see the source for copying conditions. There is NO warranty;not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH "SEE ALSO" .BR cnee(info), cnee(1), Xnee(info) diff --git a/libxnee/Makefile.am b/libxnee/Makefile.am index 17dfcb62..42f68985 100644 --- a/libxnee/Makefile.am +++ b/libxnee/Makefile.am @@ -2,6 +2,6 @@ SUBDIRS = src test AUTOMAKE_OPTIONS = gnu -EXTRA_DIST = autotools/* +EXTRA_DIST = diff --git a/libxnee/include/libxnee/xnee.h b/libxnee/include/libxnee/xnee.h index a41b29f0..ccee6a6b 100755 --- a/libxnee/include/libxnee/xnee.h +++ b/libxnee/include/libxnee/xnee.h @@ -102,7 +102,7 @@ enum return_values XNEE_REPLAY_BACKEND_FAILURE , XNEE_OVERRIDE_DISPLAY_FAILURE , XNEE_LAST_ERROR - } _return_values; + }; @@ -112,7 +112,7 @@ enum bool_string_values XNEE_BOOL_IMPLICIT_TRUE, XNEE_BOOL_EXPLICIT_TRUE, XNEE_BOOL_ERROR - } _bool_string_values; + }; enum xnee_protocol_data_numbers { @@ -125,14 +125,14 @@ enum xnee_protocol_data_numbers XNEE_PROTO_XINPUT_EVENT_MASTER, XNEE_PROTO_XINPUT_EVENT_SLAVE, XNEE_PROTO_LAST - } _xnee_protocol_data_numbers; + }; enum xnee_replay_backend { XNEE_REPLAY_XNEE = 0, XNEE_REPLAY_SWINPUT, XNEE_REPLAY_LAST - } _xnee_replay_backend; + }; /** * \brief simply a X error. @@ -240,7 +240,7 @@ enum XNEE_INTERNAL_OPTION, XNEE_OBSOLETE_OPTION, XNEE_RETYPE_OPTION - } xnee_option_type; + }; enum @@ -248,7 +248,7 @@ enum XNEE_OVERRIDE_DISPLAY_NONE, XNEE_OVERRIDE_DISPLAY_DATA, XNEE_OVERRIDE_DISPLAY_CONTROL - } xnee_override_display; + }; typedef struct { diff --git a/libxnee/include/libxnee/xnee_grab.h b/libxnee/include/libxnee/xnee_grab.h index 6c4e1465..95da8c87 100644 --- a/libxnee/include/libxnee/xnee_grab.h +++ b/libxnee/include/libxnee/xnee_grab.h @@ -64,7 +64,7 @@ enum XNEE_GRAB_KM_PRESS, XNEE_GRAB_KM_RELEASE, XNEE_GRAB_MOUSE - } xnee_grab_modifiers_control ; + }; int xnee_save_or_print(xnee_data *xd, KeyCode kc, int mode); diff --git a/libxnee/include/libxnee/xnee_internal.h b/libxnee/include/libxnee/xnee_internal.h index f80daea0..fe26b94b 100644 --- a/libxnee/include/libxnee/xnee_internal.h +++ b/libxnee/include/libxnee/xnee_internal.h @@ -104,7 +104,7 @@ enum _xnee_data_types { XNEE_NEW_WINDOW_DATA, XNEE_PREDEF_EVENTS, XNEE_NO_DATA -} xnee_data_types ; +}; /* ** Do NOT edit ** */ enum _xnee_mode { @@ -114,7 +114,7 @@ enum _xnee_mode { XNEE_RETYPER , XNEE_DISTRIBUTOR , XNEE_SYNTAX_CHECKER -} xnee_mode ; +}; @@ -206,7 +206,7 @@ enum xnee_resolution_states XNEE_RESOLUTION_UNSET = -1, XNEE_RESOLUTION_USED = 0, XNEE_RESOLUTION_UNUSED = 1 - } _xnee_resolution_states; + }; /* * Grab modes/actions @@ -222,7 +222,7 @@ enum xnee_grab_modes XNEE_GRAB_NODATA = 0, XNEE_GRAB_SET = 1, XNEE_GRAB_UNKOWN = 15 - } _xnee_grab_modes; + }; /* * continue_process commnd enum @@ -233,7 +233,7 @@ enum cont_proc_commands XNEE_PROCESS_INC , XNEE_PROCESS_DEC , XNEE_PROCESS_GET - } _cont_proc_commands; + }; typedef void (*callback_ptr)( XPointer, XRecordInterceptData *); typedef callback_ptr *callback_ptrptr; diff --git a/libxnee/include/libxnee/xnee_window.h b/libxnee/include/libxnee/xnee_window.h index 0ca49587..5b95ef60 100644 --- a/libxnee/include/libxnee/xnee_window.h +++ b/libxnee/include/libxnee/xnee_window.h @@ -46,7 +46,7 @@ enum { XNEE_WINDOW_RECEIVED, XNEE_WINDOW_SESSION - } xnee_window_types; + }; int diff --git a/man/xnee.1.in b/man/xnee.1.in index 162051a4..a05a69e3 100644 --- a/man/xnee.1.in +++ b/man/xnee.1.in @@ -1,4 +1,4 @@ -.\" Copyright Henrik Sandklef 2007 +.\" Copyright Henrik Sandklef 2007, 2026 .\" .\" This file is part of GNU Xnee. .\" @@ -17,7 +17,7 @@ .\" Free Software Foundation, Inc., 59 Temple Place - Suite 330, .\" Boston, MA 02111-1307, USA. .\" -.TH "XNEE" 1 2007 "GNU Xnee" +.TH "XNEE" 1 2026 "GNU Xnee" .SH "NAME" GNU Xnee records, replays or distributes X11 data .sp @@ -26,7 +26,7 @@ The program suite GNU Xnee can record and replay an X session. GNU Xnee also has Xnee gets copies of X protocol data from the X server. These are either printed to file ( record mode) or replayed and synchronised (replay mode). During record and replay cnee can distribute the record/replayed events to multiple displays. .SH "MANUAL" -.B For more information, read the GNU Xnee manual ot the xnee info page +.B For more information, read the GNU Xnee manual or the xnee info page .SH "VERSION" Xnee man page, __VERSION_TAG__ .SH "NOTES" diff --git a/pnee/man/pnee.1.in b/pnee/man/pnee.1.in index 2bb63884..167b29b2 100644 --- a/pnee/man/pnee.1.in +++ b/pnee/man/pnee.1.in @@ -1,4 +1,4 @@ -.\" Copyright Henrik Sandklef 2007 +.\" Copyright Henrik Sandklef 2007, 2026 .\" .\" This file is part of GNU Xnee. .\" @@ -17,7 +17,7 @@ .\" Free Software Foundation, Inc., 59 Temple Place - Suite 330, .\" Boston, MA 02111-1307, USA. .\" -.TH "PNEE" 1 2007 "Xnee" +.TH "PNEE" 1 2026 "Xnee" .SH "NAME" pnee record, replays or distributes X11 data .SH "SYNOPSIS" @@ -25,15 +25,15 @@ pnee record, replays or distributes X11 data .sp .SH "DESCRIPTION" .B pnee -is a Gnome Panel Aplet and should be started as such. GNU Xnee -consists of a command lie program (cnee), a graphical frontend (gnee) +is a Gnome Panel Applet and should be started as such. GNU Xnee +consists of a command line program (cnee), a graphical frontend (gnee) and a Gnome Panel Applet (pnee). .SH "AUTHOR" Henrik Sandklef. .SH "REPORTING BUGS" Report bugs in the program to bug-xnee@gnu.org. .SH "COPYRIGHT" -Copyright (C) 2006, 2007 Henrik Sandklef. +Copyright (C) 2006, 2007, 2026 Henrik Sandklef. This is free software; see the source for copying conditions. There is NO warranty;not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH "SEE ALSO" .BR cnee(info), cnee(1), Xnee(info) diff --git a/share/xnee.sh.in1 b/share/xnee.sh.in1 index 6d291cca..9056af59 100644 --- a/share/xnee.sh.in1 +++ b/share/xnee.sh.in1 @@ -81,9 +81,9 @@ xnee_init_fifo() xnee_init_fifo_obsolete() { - rm -f $MY_FIFO - touch $MY_FIFO - $CNEE --replay --file $MY_FIFO & + rm -f "$MY_FIFO" + touch "$MY_FIFO" + "$CNEE" --replay --file "$MY_FIFO" & CNEE_PID=$! } @@ -109,9 +109,9 @@ xnee_init_file() xnee_init_file_obsolete() { - rm -f $MY_FIFO - mkfifo $MY_FIFO - (tail -f $MY_FIFO | $CNEE --replay --file stdin) & + rm -f "$MY_FIFO" + mkfifo "$MY_FIFO" + (tail -f "$MY_FIFO" | "$CNEE" --replay --file stdin) & CNEE_PID=$! } @@ -133,8 +133,8 @@ xnee_init_file_obsolete() ######################################################################## xnee_write() { -# echo "$*" >> $MY_FIFO - echo "$*" | $CNEE --replay --file stdin +# echo "$*" >> "$MY_FIFO" + echo "$*" | "$CNEE" --replay --file stdin } diff --git a/tests/e2e_cnee.sh b/tests/e2e_cnee.sh new file mode 100755 index 00000000..7637666c --- /dev/null +++ b/tests/e2e_cnee.sh @@ -0,0 +1,469 @@ +#!/bin/sh +# End-to-end tests for cnee (the command-line front-end of GNU Xnee) +# +# These tests cover all functionality exercisable without a live X11 display: +# - Binary basics: --version, --help, --flags, --manpage +# - X11 name lookups: event, request, error name/number queries +# - Session settings: print-settings, write-settings, project round-trip +# - File I/O options: --out-file, --err-file +# - Recording limits: --events-to-record, --data-to-record, --seconds-to-record +# - Replay thresholds: --max-threshold, --min-threshold +# - Short option aliases +# +# When Xvfb is available the following are also tested end-to-end: +# - Record: connects to virtual display, records events, writes session file +# - Replay: connects to virtual display, replays a recorded session file +# +# Usage: +# ./tests/e2e_cnee.sh [path/to/cnee] +# +# Exit code: 0 = all tests pass, non-zero = at least one test failed. + +############################################################################## +# Setup +############################################################################## + +CNEE="${1:-./cnee/src/cnee}" + +if [ ! -x "$CNEE" ]; then + echo "ERROR: cnee binary not found at: $CNEE" + echo "Build the project first: make -f Makefile.cvs generate && ./configure --disable-gui --disable-doc --disable-xinput2 && make" + exit 1 +fi + +PASS=0 +FAIL=0 +if ! TMPDIR_E2E=$(mktemp -d); then + echo "ERROR: Failed to create temporary directory for end-to-end tests." >&2 + exit 1 +fi +trap 'rm -rf "$TMPDIR_E2E" || true; [ -n "$XVFB_PID" ] && kill "$XVFB_PID" 2>/dev/null || true' EXIT + +############################################################################## +# Helper functions +############################################################################## + +pass() { + PASS=$((PASS + 1)) + printf " [PASS] %s\n" "$1" +} + +fail() { + FAIL=$((FAIL + 1)) + printf " [FAIL] %s\n" "$1" + if [ -n "$2" ]; then + printf " Expected: %s\n" "$2" + printf " Got: %s\n" "$3" + fi +} + +# assert_exit_zero +assert_exit_zero() { + _desc="$1"; shift + "$@" >/dev/null 2>&1 + _ret=$? + if [ "$_ret" -eq 0 ]; then + pass "$_desc" + else + fail "$_desc" "exit 0" "exit $_ret" + fi +} + +# assert_output_contains +assert_output_contains() { + _desc="$1"; _pat="$2"; shift 2 + _out=$("$@" 2>&1) + _ere_pat=$(printf '%s\n' "$_pat" | sed 's/\\|/|/g') + if echo "$_out" | grep -Eq "$_ere_pat"; then + pass "$_desc" + else + fail "$_desc" "output matching '$_ere_pat'" "$(echo "$_out" | head -n 3)" + fi +} + +# assert_output_equals +assert_output_equals() { + _desc="$1"; _exp="$2"; shift 2 + _out=$("$@" 2>&1 | tr -d '\n') + if [ "$_out" = "$_exp" ]; then + pass "$_desc" + else + fail "$_desc" "$_exp" "$_out" + fi +} + +# assert_line_count +assert_line_count() { + _desc="$1"; _min="$2"; shift 2 + _count=$("$@" 2>&1 | grep -cE "^[0-9]+") + if [ "$_count" -ge "$_min" ]; then + pass "$_desc" + else + fail "$_desc" "at least $_min numbered lines" "$_count lines" + fi +} + +############################################################################## +# Test group 1: Binary basics +############################################################################## + +echo "" +echo "=== Group 1: Binary basics ===" + +assert_exit_zero "cnee --version exits 0" "$CNEE" --version +assert_output_contains "cnee --version prints 'xnee'" "Xnee\|xnee" "$CNEE" --version +assert_output_contains "cnee --version prints a version number" "[0-9]\.[0-9]" "$CNEE" --version + +assert_exit_zero "cnee -V (short) exits 0" "$CNEE" -V +assert_output_contains "cnee -V prints same output as --version" "Xnee\|xnee" "$CNEE" -V + +assert_exit_zero "cnee --help exits 0" "$CNEE" --help +assert_output_contains "cnee --help prints USAGE line" "USAGE" "$CNEE" --help +assert_output_contains "cnee --help describes the tool" "record" "$CNEE" --help +assert_output_contains "cnee --help mentions --replay option" "replay" "$CNEE" --help + +assert_exit_zero "cnee -h (short) exits 0" "$CNEE" -h +assert_output_contains "cnee -h prints same content as --help" "USAGE" "$CNEE" -h + +assert_exit_zero "cnee --flags exits 0" "$CNEE" --flags +assert_output_contains "cnee --flags lists --display" "display" "$CNEE" --flags +assert_output_contains "cnee --flags lists --out-file" "out-file" "$CNEE" --flags + +assert_exit_zero "cnee --manpage exits 0" "$CNEE" --manpage +assert_output_contains "cnee --manpage outputs troff .TH header" "\.TH" "$CNEE" --manpage +assert_output_contains "cnee --manpage contains .SH NAME section" "\.SH" "$CNEE" --manpage +assert_output_contains "cnee --manpage contains CNEE name" "CNEE\|cnee" "$CNEE" --manpage + +############################################################################## +# Test group 2: X11 event name/number lookups +############################################################################## + +echo "" +echo "=== Group 2: X11 event name/number lookups ===" + +assert_exit_zero "cnee --print-event-names exits 0" "$CNEE" --print-event-names +assert_output_contains "cnee --print-event-names has table header" "number.*name\|X11 Event" "$CNEE" --print-event-names +assert_output_contains "cnee --print-event-names lists KeyPress (02)" "02.*KeyPress" "$CNEE" --print-event-names +assert_output_contains "cnee --print-event-names lists KeyRelease (03)" "03.*KeyRelease" "$CNEE" --print-event-names +assert_output_contains "cnee --print-event-names lists ButtonPress (04)" "04.*ButtonPress" "$CNEE" --print-event-names +assert_output_contains "cnee --print-event-names lists ButtonRelease (05)" "05.*ButtonRelease" "$CNEE" --print-event-names +assert_output_contains "cnee --print-event-names lists MotionNotify (06)" "06.*MotionNotify" "$CNEE" --print-event-names +assert_output_contains "cnee --print-event-names lists MappingNotify (34)" "34.*MappingNotify" "$CNEE" --print-event-names +assert_line_count "cnee --print-event-names lists >=33 events" 33 "$CNEE" --print-event-names + +assert_exit_zero "cnee -pens (short) exits 0" "$CNEE" -pens +assert_output_contains "cnee -pens outputs same as --print-event-names" "KeyPress" "$CNEE" -pens + +# Bidirectional lookups: number -> name +assert_exit_zero "cnee --print-event-name 2 exits 0" "$CNEE" --print-event-name 2 +assert_output_equals "cnee --print-event-name 2 returns KeyPress" "KeyPress" "$CNEE" --print-event-name 2 + +assert_exit_zero "cnee --print-event-name 6 exits 0" "$CNEE" --print-event-name 6 +assert_output_equals "cnee --print-event-name 6 returns MotionNotify" "MotionNotify" "$CNEE" --print-event-name 6 + +# Bidirectional lookups: name -> number +assert_exit_zero "cnee --print-event-name KeyPress exits 0" "$CNEE" --print-event-name KeyPress +assert_output_equals "cnee --print-event-name KeyPress returns 2" "2" "$CNEE" --print-event-name KeyPress + +assert_exit_zero "cnee --print-event-name MotionNotify exits 0" "$CNEE" --print-event-name MotionNotify +assert_output_equals "cnee --print-event-name MotionNotify returns 6" "6" "$CNEE" --print-event-name MotionNotify + +############################################################################## +# Test group 3: X11 request name/number lookups +############################################################################## + +echo "" +echo "=== Group 3: X11 request name/number lookups ===" + +assert_exit_zero "cnee --print-request-names exits 0" "$CNEE" --print-request-names +assert_output_contains "cnee --print-request-names has table header" "X11 Request\|number.*name" "$CNEE" --print-request-names +assert_output_contains "cnee --print-request-names lists X_CreateWindow (01)" "01.*X_CreateWindow" "$CNEE" --print-request-names +assert_output_contains "cnee --print-request-names lists X_MapWindow (08)" "08.*X_MapWindow" "$CNEE" --print-request-names +assert_output_contains "cnee --print-request-names lists X_DestroyWindow (04)" "04.*X_DestroyWindow" "$CNEE" --print-request-names +assert_line_count "cnee --print-request-names lists >=100 requests" 100 "$CNEE" --print-request-names + +assert_exit_zero "cnee -prns (short) exits 0" "$CNEE" -prns +assert_output_contains "cnee -prns outputs same as --print-request-names" "X_CreateWindow" "$CNEE" -prns + +# Bidirectional lookups +assert_exit_zero "cnee --print-request-name 1 exits 0" "$CNEE" --print-request-name 1 +assert_output_equals "cnee --print-request-name 1 returns X_CreateWindow" "X_CreateWindow" "$CNEE" --print-request-name 1 + +assert_exit_zero "cnee --print-request-name X_CreateWindow exits 0" "$CNEE" --print-request-name X_CreateWindow +assert_output_equals "cnee --print-request-name X_CreateWindow returns 1" "1" "$CNEE" --print-request-name X_CreateWindow + +assert_exit_zero "cnee --print-request-name 8 exits 0" "$CNEE" --print-request-name 8 +assert_output_equals "cnee --print-request-name 8 returns X_MapWindow" "X_MapWindow" "$CNEE" --print-request-name 8 + +############################################################################## +# Test group 4: X11 error name/number lookups +############################################################################## + +echo "" +echo "=== Group 4: X11 error name/number lookups ===" + +assert_exit_zero "cnee --print-error-names exits 0" "$CNEE" --print-error-names +assert_output_contains "cnee --print-error-names has table header" "X11 Error\|number.*name" "$CNEE" --print-error-names +assert_output_contains "cnee --print-error-names lists Success (00)" "00.*Success" "$CNEE" --print-error-names +assert_output_contains "cnee --print-error-names lists BadValue (02)" "02.*BadValue" "$CNEE" --print-error-names +assert_output_contains "cnee --print-error-names lists BadWindow (03)" "03.*BadWindow" "$CNEE" --print-error-names +assert_output_contains "cnee --print-error-names lists BadDrawable (09)" "09.*BadDrawable" "$CNEE" --print-error-names +assert_line_count "cnee --print-error-names lists >=17 errors" 17 "$CNEE" --print-error-names + +assert_exit_zero "cnee -perns (short) exits 0" "$CNEE" -perns +assert_output_contains "cnee -perns outputs same as --print-error-names" "BadValue" "$CNEE" -perns + +# Bidirectional lookups +assert_exit_zero "cnee --print-error-name 2 exits 0" "$CNEE" --print-error-name 2 +assert_output_equals "cnee --print-error-name 2 returns BadValue" "BadValue" "$CNEE" --print-error-name 2 + +assert_exit_zero "cnee --print-error-name BadValue exits 0" "$CNEE" --print-error-name BadValue +assert_output_equals "cnee --print-error-name BadValue returns 2" "2" "$CNEE" --print-error-name BadValue + +assert_exit_zero "cnee --print-error-name BadWindow exits 0" "$CNEE" --print-error-name BadWindow +assert_output_equals "cnee --print-error-name BadWindow returns 3" "3" "$CNEE" --print-error-name BadWindow + +############################################################################## +# Test group 5: X11 data name lookups +############################################################################## + +echo "" +echo "=== Group 5: X11 data name lookups ===" + +assert_exit_zero "cnee --print-data-names exits 0" "$CNEE" --print-data-names +assert_output_contains "cnee --print-data-names includes event data" "KeyPress\|MotionNotify" "$CNEE" --print-data-names +assert_line_count "cnee --print-data-names lists >=100 entries" 100 "$CNEE" --print-data-names + +assert_exit_zero "cnee -pdn (short) exits 0" "$CNEE" -pdn +assert_output_contains "cnee -pdn outputs same as --print-data-names" "KeyPress" "$CNEE" -pdn + +############################################################################## +# Test group 6: Session settings (--print-settings) +############################################################################## + +echo "" +echo "=== Group 6: Session settings (--print-settings) ===" + +assert_exit_zero "cnee --print-settings exits 0" "$CNEE" --print-settings + +# Default settings are present +assert_output_contains "cnee --print-settings includes Displays section" "Displays" "$CNEE" --print-settings +assert_output_contains "cnee --print-settings includes Files section" "Files" "$CNEE" --print-settings +assert_output_contains "cnee --print-settings includes thresholds" "threshold" "$CNEE" --print-settings + +# Record limit options are reflected in settings +assert_output_contains "--events-to-record is reflected in settings" "events-to-record.*1000" \ + "$CNEE" --events-to-record 1000 --print-settings + +assert_output_contains "--data-to-record is reflected in settings" "data-to-record.*500" \ + "$CNEE" --data-to-record 500 --print-settings + +assert_output_contains "--seconds-to-record is reflected in settings" "seconds-to-record.*30" \ + "$CNEE" --seconds-to-record 30 --print-settings + +# Multiple record limits can be combined +assert_output_contains "combined record limits: events" "events-to-record.*100" \ + "$CNEE" --events-to-record 100 --data-to-record 200 --seconds-to-record 60 --print-settings +assert_output_contains "combined record limits: data" "data-to-record.*200" \ + "$CNEE" --events-to-record 100 --data-to-record 200 --seconds-to-record 60 --print-settings +assert_output_contains "combined record limits: seconds" "seconds-to-record.*60" \ + "$CNEE" --events-to-record 100 --data-to-record 200 --seconds-to-record 60 --print-settings + +# Threshold options +assert_output_contains "--max-threshold is reflected in settings" "max-threshold 50" \ + "$CNEE" --max-threshold 50 --print-settings +assert_output_contains "--min-threshold is reflected in settings" "min-threshold 5" \ + "$CNEE" --min-threshold 5 --print-settings +assert_output_contains "--max-threshold and --min-threshold combined" "max-threshold 100" \ + "$CNEE" --max-threshold 100 --min-threshold 10 --print-settings +assert_output_contains "--max-threshold and --min-threshold combined min" "min-threshold 10" \ + "$CNEE" --max-threshold 100 --min-threshold 10 --print-settings + +# File output options +assert_output_contains "--out-file is reflected in settings" "out-file.*e2e_test.xns" \ + "$CNEE" --out-file /tmp/e2e_test.xns --print-settings +assert_output_contains "--err-file is reflected in settings" "err-file.*e2e_err.log" \ + "$CNEE" --err-file /tmp/e2e_err.log --print-settings + +############################################################################## +# Test group 7: write-settings / project round-trip +############################################################################## + +echo "" +echo "=== Group 7: write-settings / project round-trip ===" + +SETTINGS_FILE="$TMPDIR_E2E/cnee_settings.xnp" + +assert_exit_zero "cnee --write-settings creates file" \ + "$CNEE" --write-settings "$SETTINGS_FILE" + +if [ -s "$SETTINGS_FILE" ]; then + pass "cnee --write-settings creates a non-empty file" +else + fail "cnee --write-settings creates a non-empty file" "non-empty file exists" "file missing or empty" +fi + +# Write settings with specific values, then read them back +ROUNDTRIP_FILE="$TMPDIR_E2E/roundtrip.xnp" +"$CNEE" --max-threshold 77 --min-threshold 11 --write-settings "$ROUNDTRIP_FILE" >/dev/null 2>&1 + +assert_output_contains "write-settings persists max-threshold" "max-threshold 77" \ + cat "$ROUNDTRIP_FILE" +assert_output_contains "write-settings persists min-threshold" "min-threshold 11" \ + cat "$ROUNDTRIP_FILE" + +# Load the written file back via --project and verify settings are restored +assert_output_contains "project round-trip: max-threshold survives reload" "max-threshold 77" \ + "$CNEE" --project "$ROUNDTRIP_FILE" --print-settings +assert_output_contains "project round-trip: min-threshold survives reload" "min-threshold 11" \ + "$CNEE" --project "$ROUNDTRIP_FILE" --print-settings + +# Write-settings records file/display info as comments in the output file +OUTFILE_SETTINGS="$TMPDIR_E2E/outfile_settings.xnp" +"$CNEE" --out-file /tmp/cnee_rec.xns --write-settings "$OUTFILE_SETTINGS" >/dev/null 2>&1 +assert_output_contains "write-settings records out-file in settings file" "out-file.*cnee_rec.xns" \ + cat "$OUTFILE_SETTINGS" +assert_output_contains "write-settings includes events-to-record in settings file" "events-to-record" \ + cat "$OUTFILE_SETTINGS" + +############################################################################## +# Test group 8: Short option aliases +############################################################################## + +echo "" +echo "=== Group 8: Short option aliases ===" + +assert_output_contains "cnee -pens = --print-event-names (KeyPress)" "KeyPress" "$CNEE" -pens +assert_output_contains "cnee -perns = --print-error-names (BadValue)" "BadValue" "$CNEE" -perns +assert_output_contains "cnee -prns = --print-request-names (X_CreateWindow)" "X_CreateWindow" "$CNEE" -prns +assert_output_contains "cnee -pdn = --print-data-names (KeyPress)" "KeyPress" "$CNEE" -pdn +assert_output_contains "cnee -V = --version (xnee)" "xnee" "$CNEE" -V +assert_output_contains "cnee -h = --help (USAGE)" "USAGE" "$CNEE" -h + +############################################################################## +# Test group 9: Record / Replay with virtual X display (Xvfb) +############################################################################## + +echo "" +echo "=== Group 9: Record / Replay with virtual X display ===" + +XVFB_BIN=$(command -v Xvfb 2>/dev/null) +if [ -z "$XVFB_BIN" ]; then + echo " [SKIP] Xvfb not found — skipping record/replay live tests" + echo " Install Xvfb (xorg-x11-server-Xvfb on EL8, xvfb on Debian)" + echo " to enable end-to-end record/replay coverage." +else + # Find a free display number by trying :99, :98 … down + VDISPLAY="" + for _d in 99 98 97 96; do + if ! test -S "/tmp/.X11-unix/X${_d}" 2>/dev/null && \ + ! test -f "/tmp/.X${_d}-lock" 2>/dev/null; then + VDISPLAY=":${_d}" + break + fi + done + + if [ -z "$VDISPLAY" ]; then + echo " [SKIP] Could not find a free display number for Xvfb" + else + # Start a headless virtual X server + "$XVFB_BIN" "$VDISPLAY" -screen 0 1024x768x24 >/dev/null 2>&1 & + XVFB_PID=$! + sleep 1 # give Xvfb time to initialise + + RECORD_FILE="$TMPDIR_E2E/cnee_record.xns" + REPLAY_STDERR="$TMPDIR_E2E/replay_stderr.txt" + + # ------------------------------------------------------------------ + # Record: run cnee --record for 2 seconds; no real user is present so + # the session file will contain only the session header (0 events), + # but the important thing is that cnee connects, starts the RECORD + # extension and exits cleanly. + # ------------------------------------------------------------------ + DISPLAY="$VDISPLAY" "$CNEE" \ + --record \ + --keyboard \ + --mouse \ + --seconds-to-record 2 \ + --out-file "$RECORD_FILE" \ + --display "$VDISPLAY" >/dev/null 2>&1 + _rec_exit=$? + + if [ "$_rec_exit" -eq 0 ]; then + pass "cnee --record exits 0 on virtual display" + else + fail "cnee --record exits 0 on virtual display" "exit 0" "exit $_rec_exit" + fi + + if [ -f "$RECORD_FILE" ]; then + pass "cnee --record creates the output session file" + else + fail "cnee --record creates the output session file" "file exists" "file not found" + fi + + if grep -q "Xnee program" "$RECORD_FILE" 2>/dev/null; then + pass "recorded session file contains Xnee program header" + else + fail "recorded session file contains Xnee program header" \ + "Xnee program in header" "header line missing" + fi + + if grep -q "Xnee version" "$RECORD_FILE" 2>/dev/null; then + pass "recorded session file contains version information" + else + fail "recorded session file contains version information" \ + "Xnee version in header" "version line missing" + fi + + if grep -q "[Dd]isplay" "$RECORD_FILE" 2>/dev/null; then + pass "recorded session file contains display information" + else + fail "recorded session file contains display information" \ + "display info in header" "not found" + fi + + # ------------------------------------------------------------------ + # Replay: replay the just-recorded session file back into the same + # virtual display. Use -ns (no-synchronise) so cnee does not block + # waiting for the replayed application to catch up. + # ------------------------------------------------------------------ + DISPLAY="$VDISPLAY" "$CNEE" \ + --replay \ + -f "$RECORD_FILE" \ + --display "$VDISPLAY" \ + -ns >/dev/null 2>"$REPLAY_STDERR" + _rep_exit=$? + + if [ "$_rep_exit" -eq 0 ]; then + pass "cnee --replay exits 0 on virtual display" + else + fail "cnee --replay exits 0 on virtual display" "exit 0" "exit $_rep_exit" + fi + + if ! grep -qi \ + "can't open display\|cannot open display\|unable to open display" \ + "$REPLAY_STDERR" 2>/dev/null; then + pass "cnee --replay connects to virtual display successfully" + else + fail "cnee --replay connects to virtual display successfully" \ + "no display error" "$(head -n 3 "$REPLAY_STDERR")" + fi + + kill "$XVFB_PID" 2>/dev/null + wait "$XVFB_PID" 2>/dev/null + fi +fi + +############################################################################## +# Summary +############################################################################## + +echo "" +echo "==========================================" +echo " Results: $PASS passed, $FAIL failed" +echo "==========================================" + +if [ "$FAIL" -gt 0 ]; then + exit 1 +fi +exit 0