coreutils provides a timeout command. Use that instead of (badly) inventing our
own version of it. This "timeout" command seems to be new. Let's hope everyone
has it and think about alternative solutions only when needed.
Fixes: https://github.com/awesomeWM/awesome/issues/1075
Signed-off-by: Uli Schlachter <psychon@znc.in>
When awesome exits with a non-zero code, this is something interesting that we
should log. Do so.
The "set +e" / "set -e" dance is required so that we do not abort because the
wait builtin returns a non-zero code.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This script runs under "set -e", so any command exiting with a non-zero status
makes it abort. However, we do not care about failures from grep to find
anything, so handle that case gracefully.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Before this commit: When we are GC'ing an object, we clear its metatable, since
otherwise crashes could occur in various places. This means that if someone
tries to use such an object, they get an unhelpful error message like "attempt
to index userdata object" and they don't understand what the problem is. Also,
this means that foo.valid does not actually work after GC.
This commit changes this behaviour. Instead of setting an empty metatable, we
now create a metatable with an __index and __newindex method. These metamethods
produce better error messages that they sat the underlying object was already
garbage collected. Better yet, the __index metamethod makes foo.valid be false
instead of causing an error, so that the existing machinery for detecting
invalid objects continues to work.
This commit also adds a functional test that verifies this behaviour.
Signed-off-by: Uli Schlachter <psychon@znc.in>
To ensure that some features such as SNID rules work, we need
to ensure that the screen isn't set by other code paths. Only
a single algorithm can be executed for the screen. As soon
as many algorithms are executed on events such as "manage", it
will most likely regress again.
This commit make sure of that by disabling the default normal source
of c.screen. After that, any other c.screen changes can be
considered bugs.
The code was written so that it assumes that disconnecting the last signal also
removed the corresponding entry in the signal array. This lead e.g. to an
index-out-of-bounds access in some cases.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The "test launching client on a specific screen" suit is very slow.
However, it is also necessary to avoid issues such as #1069 or #154
from regressing again.
This is a temporary fix until a faster test client "daemon" is
developped.
While testing using "the real deal" and with all the tests would be
better, it would add a lot of complexity to the testing framework.
This module generate multiple multi-screen scenarios and some obvious
issues that they can cause. Over time, as more steps are added, it
will provide "good enough" testing for multiple screens.
Individual test suits can require() this utility to replicate their
steps for each multi-screen scenarios.
This uses the new support introduced in f0f31bc305 in the docs and in
tests/run.sh, removing an useless use of cat/echo.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The build is no longer aborted when one of the "example tests" produces a
message on stderr. However, on Travis this requirement is still made. This
should catch "bad errors" via Travis while not breaking the build for users.
Fixes: https://github.com/awesomeWM/awesome/issues/821
Signed-off-by: Uli Schlachter <psychon@znc.in>
Running the tests sadly takes much to long. Since I don't have a good idea what
to do about this (I'd like to run all tests in a single Lua process, but that
doesn't seem to be possible easily), instead let's just make it more explicit
what is being done. This commit prints a message for each test that is being
run.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Now that tests are no longer scanned for recursively, the hack of passing values
back and forth via the environment is no longer needed and can be removed.
While at it, this also exchanges the "useless use of regex" for an explicit
string replacement.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Instead of recursively walking the directory tree, this commit makes the code us
GLOB_RECURSE to find all files and then handles them on after another.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The namespace of e.g. "tests/examples/awful/mouse/coords.lua" is "_awful_mouse".
This is purely based on the path of the file.
Previously, this was computed while recursively scanning the directory tree.
This commit instead moves this to an extra function that handles this task.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Previously, while recursively scanning the directory tree, the code in here also
scanned for template.lua files and remembered the latest one it found. This
commit adds a function which finds the right template.lua for a given file name,
making this search explicit and easier to understand.
Signed-off-by: Uli Schlachter <psychon@znc.in>
There was a problem that the examples were considered to have failed as soon as
they produced any kind of output, but there were legitimate cases of warnings
being printed that triggered these checks. Commit 4819be4f4f used a
regular expression to detect and ignore this warnings.
This commit reverts the above commit and instead silences the warnings by
monkey-patching the function that prints the warnings into a no-op.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The requirement to call add_signal() was added to catch typos. However, this
requirement became increasingly annoying with property::<name> signals and e.g.
gears.object allowing arbitrary properties to be changed.
All of this ended up in a single commit because tests/examples fails if I first
let add_signal() emit a deprecation warning.
Signed-off-by: Uli Schlachter <psychon@znc.in>
There was a race with autofocus. To overcome this, add another step that tests
that moving the client back to a visible tag and focusing it updates
_NET_CURRENT_DESKTOP. Afterwards, we kill the client so that it can no longer
interfere.
Signed-off-by: Uli Schlachter <psychon@znc.in>
As the documentation generation insert increasingly large ammount
of code into the lua files, the coverage data is getting less and
less accurate. This try to fix this by only collecting such data
after the `configure_file` calls are done.
kill is a wrapper around the POSIX kill() function and unix_signal is a table
that maps signal numbers to their names and signal names to their numeric value.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Apparently, there is such thing as not leaking enough...
Also try to clear the widgets from mywibox. This seem to help.
Time will tell.
Fixes#914, unfixes #808
Currently, tests/run.sh expects the directory layout that our wrapper Makefile
sets up before running CMake. This commit adds support for any other directory
configuration as well.
Signed-off-by: Uli Schlachter <psychon@znc.in>
GDK_SCALE=1 is needed to overwrite other settings that people might have which
would make geometry-related tests fail.
NO_AT_BRIDGE=1 gets rid of the following message that I am seeing:
** (lua:8321): WARNING **: Error retrieving accessibility bus address:
org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not
provided by any .service files
Signed-off-by: Uli Schlachter <psychon@znc.in>
Any clients with these tags end up somewhere random (the first tag on the first
remaining screen). This certainly can be improved in the future, but at least
this is a start.
Signed-off-by: Uli Schlachter <psychon@znc.in>
GtkApplication does magic like ensuring that the application ID is unique and
there is only a single instance of each application running. We don't want nor
need that for the tests.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Startup notification support in urxvt is optional while GTK always supports
startup notification. Thus, use the new GTK-based test client for the SN tests.
Fixes: https://github.com/awesomeWM/awesome/issues/848
Signed-off-by: Uli Schlachter <psychon@znc.in>
Tags are accessible as s.tags on a screen object. Yup, that's harder to find
than a variable that is defined in the default config, but such is life.
Now that awful.rules supports specifying tags by name, I guess that the number
one reason for needing the tags table is gone.
Signed-off-by: Uli Schlachter <psychon@znc.in>
There was a regression when refactoring the API. It was no longer
possible to disable the automatic tag selection.
Due to recent changes, it was no longer possible to disable the
default tag selection handler. This commit extend the already
existing request::tag mechanism to let handlers select the tags.