summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2021-04-20test: print the layout-tester progress bar to stdout by defaultPeter Hutterer1-2/+2
tqdm prints to stderr by default but we're using that for failed keymap compiles (which are the ones that really matter). Plus, whether we're using tqdm is dependent on isatty(sys.stdout) anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-20test: add an LVO argument to the XKB layout testerPeter Hutterer1-1/+15
Slightly easier to debug if we can have it only parse one single layout. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-20test: print the compiled keymaps to a given directoryPeter Hutterer1-2/+35
With --keymap-output-dir, the given directory will contain a list of files named after the layout + variant ('us', 'us(euro)', ...) that contain the keymaps for each variant + option combination compiled. This is still a lot, but better to sift through hundreds of keymaps than tens of thousands. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-20test: rework the output for the xkeyboard-config layout testerPeter Hutterer1-74/+111
The previous output is largely unusable. The result in the CI test runs is a 6GB file with every compiled keymap in it and while we can grep for ERROR, it's not particularly useful. Let's change this and print out YAML instead - that can be machine-processed. This patch adds a new parent class that prints itself in YAML format, the tool invocations are child classes of that class. The result looks like this: Example output: - rmlvo: ["evdev", "pc105", "us", "haw", "grp:rwin_switch"] cmd: "xkbcli-compile-keymap --verbose --rules evdev --model pc105 --layout us --variant haw --options grp:rwin_switch" status: 0 - rmlvo: ["evdev", "pc105", "us", "foo", ""] cmd: "xkbcli-compile-keymap --verbose --rules evdev --model pc105 --layout us --variant foo" status: 1 error: "failed to compile keymap" Special status codes are: 99 for "unrecognized keysym" and 90 for "Cannot open display" in the setxkbmap case. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-20test: add proper --verbose handling to the xkeyboard-config testerPeter Hutterer1-11/+22
Instead of defaulting to verbose on/off depending on isatty, make it an argument instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-01keysym: avoid strtoul in xkb_keysym_from_nameRan Benita1-0/+11
Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-03-30keysym: properly handle overflow in 0x keysym namesRan Benita1-0/+4
Relatedly, strtoul allows a lot of unwanted stuff (spaces, +/- sign, thousand seperators), we really ought not use it. But that's for another time. Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-03-30test: move an assert up to before the strlen() usePeter Hutterer1-1/+2
../../../test/keysym.c:80:24: warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker] (unsigned) strlen(expected)); Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-19test: fix missing va_end in case of test failuresPeter Hutterer1-6/+15
Found by coverity Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-22test: add a keysym testerPeter Hutterer1-0/+71
A simple script that creates a new layout with the given keysym replacing TLDE. Then we compile a keymap and search for the keysym being assigned to TLDE and bail if that fails. The list of keysyms is manually maintained but we only need to add one or two to spot-check whenever the xorgproto is updated. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-23test: fix interactive evdev test invocationPeter Hutterer1-1/+1
rmlvos is the parent list which then fails during a list join because, well, it's a list of lists. Fixes #206 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-23test: fill in srcdir/builddir when not set in the environmentPeter Hutterer1-2/+13
Makes this test easier to run from the commandline. Where either of top_srcdir or top_builddir isn't set, fill them in from the CWD or fail otherwise. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-23keymap-dump: follow xkbcomp in printing affect=both in pointer actionsRan Benita2-8/+8
It is equivalent to nothing but good to match up. Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-11-23test/data: update host.xkb to match keymap-dump styleRan Benita1-311/+311
This is needed for fixing the x11comp test. Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-10-20test: catch unrecognized keysyms in the xkeyboard-config testPeter Hutterer1-0/+7
Prompted by https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/127 We run the keymap tool with --verbose which will print the messages from the compiler to the log file as well. And then we can search for the warning regarding an unrecognized keysym and fail our test based on that.
2020-10-20xkbcomp: where a keysym cannot be resolved, set it to NoSymbolPeter Hutterer2-2/+68
Where resolve_keysym fails we warn but use the otherwise uninitialized variable as our keysym. That later ends up in the keymap as random garbage hex value. Simplest test case, set this in the 'us' keymap: key <TLDE> { [ xyz ] }; And without this patch we get random garbage: ./build/xkbcli-compile-keymap --layout us | grep TLDE: key <TLDE> { [ 0x018a5cf0 ] }; With this patch, we now get NoSymbol: ./build/xkbcli-compile-keymap --layout us | grep TLDE: key <TLDE> { [ NoSymbol ] };
2020-09-08test/tool-option-parsing: skip testing of disabled toolsRan Benita1-28/+24
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-08test/tool-option-parsing: switch from pytest to unittestRan Benita1-196/+173
For me, installing pytest for libxkbcommon is a bit problematic, so I end up skipping it which is not great. Switch to unittest which is built in to Python. It's not as nice as pytest but good enough in this case. Note: I was too lazy to switch the plain asserts to unittest assertions... Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-07test/tool-option-parsing: keep isolated by using our own test dataRan Benita1-1/+6
Make it possible to run the test on all machines. Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-07test: include unstd.h in the registry test to cut down the MacOS warningsPeter Hutterer1-0/+3
mkdtmp, rmdir and unlink are in unstd.h on MacOS. Since including that it doesn't hurt us on Linux, let's do it without ifdefs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-07test/data: add rule registry filesRan Benita5-0/+18176
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-07test/data: sync from xkeyboard-config 2.30Ran Benita28-863/+1635
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-07test/data: change quartz.xkb from CRLF to LFRan Benita1-1139/+1139
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-07test: fix the xkbcli --version testPeter Hutterer1-1/+1
Fixes https://github.com/xkbcommon/libxkbcommon/issues/185 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-30Add /etc/xkb as extra lookup path for system data filesPeter Hutterer1-0/+2
This completes the usual triplet of configuration locations available for most processes: - vendor-provided data files in /usr/share/X11/xkb - system-specific data files in /etc/xkb - user-specific data files in $XDG_CONFIG_HOME/xkb The default lookup order user, system, vendor, just like everything else that uses these conventions. For include directives in rules files, the '%E' resolves to that path. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-29test: fix the xkeyboard-config testPeter Hutterer1-2/+1
'xkbcli compile-keymap' doesn't work unless we ninja install first. But for a test that's to be run from the test directory, that's not a useful option so let's call the binary directly. The script adds the meson builddir to the PATH anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-27test: ignore the real XDG_CONFIG_HOME during testsPeter Hutterer1-1/+8
Let's not have our tests fail if the user has an incompatible $XDG_CONFIG_HOME/xkb directory. libxkbcommon has fallbacks when XDG_CONFIG_HOME isn't set so we need to override this with a real directory instead of just unsetting it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-27tools/interactive-evdev: fixup 64bff65Ran Benita1-0/+1
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25test/tool-option-parsing: remove --kccgst test, it's private for nowRan Benita1-2/+2
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25tools: run test-tool-option-parsing.py like a regular testRan Benita1-0/+302
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25tools: install our tools as xkbcli subcommandsPeter Hutterer1-1/+2
The xkbcli tool usage help is ifdef'd out where the tool isn't built but the man page always includes all tools. Easier that way. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25test: make the symbols-leak-test executablePeter Hutterer1-0/+0
Python leaks like crazy when run under valgrind. But if we make the script executable **and** it has uses the env invocation (i.e. #!/usr/bin/env python3), the leaks disappear. This is not the case for a shebang of /usr/bin/python3. Why exactly this is the case I'm not sure but executables we plan to run should have the exec bit set. So this is a janitor patch with the nice side effect of fixing our valgrind runs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-22PACKAING: remove bashRan Benita1-1/+0
Converted to Python. Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-22test: fix Windows CI by rewriting symbols-leak-test from bash to pythonRan Benita2-19/+63
The CI started installing some wrapper instead of a real bash which is what gets found. See: https://github.com/actions/virtual-environments/pull/1081 Given meson is written in python, it should always be available hopefully. Disabled valgrind wrapper for now because it now also applies to the python interpreter which leaks like a sieve. Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-13Add asprintf_safe helper functionPeter Hutterer4-14/+11
We only ever care about whether we error out or not, so let's wrap this into something more sane. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-06Add libxkbregistry to query available RMLVOPeter Hutterer1-0/+843
This library is the replacement for clients parsing evdev.xml directly. Instead, they should use the API here so that in the future we may even be able to swap evdev.xml for a more suitable data format. The library parses through evdev.xml (using libxml2) and - if requested - through evdev.extras.xml as well. The merge approach is optimised for the default case where we have a system-installed rules XML and another file in $XDG_CONFIG_DIR that adds a few entries. We load the system file first, then append any custom ones to that. It's not possible to overwrite the MLVO list provided by the system files - if you want to do that, get the change upstream. XML validation is handled through the DTD itself which means we only need to check for a nonempty name, everything else the DTD validation should complain about. The logging system is effectively identical to xkbcommon. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-06utils: add streq_null() for streq that allows NULL valuesPeter Hutterer1-0/+6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-06Add a snprintf_safe() helper functionPeter Hutterer1-0/+50
Returns true on success or false on error _or_ truncation. Since truncation is almost always an error anyway, we might as well make this easier to check. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-01test: fix the xkeyboard-config test for the prefixed tool namePeter Hutterer1-1/+1
Regression introduced in 362130debb5d90d77f0d4f7549880b5f9699f647 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25test: drop some now-obsolete functionsPeter Hutterer2-137/+0
These were moved to tools/tools-common.c and now that all tools are switched over, they're no longer needed. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25tools: move the remaining tools from test to herePeter Hutterer3-1627/+0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25test: disentangle interactive-wayland from the test headersPeter Hutterer1-6/+6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25test: untangle interactive-x11 from the test headersPeter Hutterer1-6/+6
Use the new tools headers and create a custom internal lib for the x11 tool. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25test: untangle interactive-evdev from the test headersPeter Hutterer3-39/+32
Move (sometimes duplicate) the required bits into new shared files tools-common.(c|h) that are compiled into the internal tools library. Rename the test_foo() functions to tools_foo() and in one case just copy the code of the keymap compile function to the tool. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25test: simplify error handling in interactive-evdevPeter Hutterer1-31/+20
Passing -errno around and having separate labels depending on failure types is superfluous here. All the unref calls can handle NULL and nothing cares about errno once we're out of the immediate scope. So let's simplify this and deal with 0 and 1 only. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25Move the various tools to a tools/ directoryPeter Hutterer4-538/+0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25test: how-to-type: prefer local headers over system onesPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25test: untangle rmlvo-to-kccgst from the test headersPeter Hutterer1-2/+1
Using test helpers to init the context gives it fairly specific behavior; unless the user sets the right environment variables and/or calls it from the right PWD, it may or may not include the test data. Let's drop this behavior, make it a default tool to compile a keymap. If there is a specific need to modify the include paths, we can add this later. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25test: untangle print-compiled-keymap from the test headersPeter Hutterer1-3/+15
Commit 16c84cdd819db516fff089c76b99248fb7dd4e8c removed the getopt handling for RMLVO arguments, so now this tool only takes a keymap file and compiles it. Using test helpers to init the context gives it fairly specific behavior; unless the user sets the right environment variables and/or calls it from the right PWD, it may or may not include the test data. Let's drop this behavior, make it a default tool to compile a keymap. If there is a specific need to modify the include paths, we can add this later. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25test: simplify an exit pathPeter Hutterer1-8/+6
The unref() functions take NULL as argument, so we don't need different labels for every possible exit path. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>