Commit Graph

18 Commits (master)

Author SHA1 Message Date
Pierre Le Marre e325e65eb8 Add test_unit to all tests
Currently it only ensure we do not buffer `stdout`.
2024-02-21 06:26:36 +01:00
Ran Benita f9858bf5b9 test: move mkdir & mkdtemp calls to common place and fix them on MSVC
Signed-off-by: Ran Benita <ran@unusedvar.com>
2022-09-24 12:31:53 +03:00
Ran Benita 4d8293901b utils: move some MSVC compat stuff to common place
Signed-off-by: Ran Benita <ran@unusedvar.com>
2022-09-24 12:31:53 +03:00
Peter Hutterer 41a7c975f8 Add asprintf_safe helper function
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-13 18:41:00 +10:00
Adrian Perez de Castro 5354dee2f7 MSVC: Use <io.h> as an alternative for <unistd.h>
Only the input/output functions from <unistd.h> options are used, so
using <io.h> when building with MSVC should be enough. The inclusion
of the header in context-priv.c does not seem to be needed (tested
on GNU/Linux) and so it is removed.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-12-28 16:12:15 +02:00
Ran Benita f967d46b65 test/context: use a more portable directory-exists check
MSVC doesn't have opendir/closedir.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-12-27 15:47:49 +02:00
Ran Benita 40aab05e77 build: include config.h manually
Previously we included it with an `-include` compiler directive. But
that's not portable. And it's better to be explicit anyway.

Every .c file should have `include "config.h"` first thing.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-12-27 13:09:11 +02:00
Peter Hutterer 255200faa7 test: add test for the various default include paths
All tests create a temporary directory, set up the environment for that
directory and then check the include paths for the presence of that directory,
ideally in the right position of the list.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-31 19:29:30 +02:00
Ran Benita c00ea5ff8e atom: really work with non-NUL-terminated strings
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-07-22 11:02:20 +03:00
Daniel Stone 54f95f496f test: Add flags argument to test_get_context()
Allowing overriding of environment suppression, at first.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-03-19 10:28:23 +00:00
Ran Benita b21107056e Organize src/ and test/ headers
- Add context.h and move context-related functions from xkb-priv.h to
  it.
- Move xkb_context definition back to context.c.
- Add keysym.h and move keysym upper/lower/keypad from xkb-priv.h to it.
- Rename xkb-priv.h to map.h since it only contains keymap-related
  definitions and declarations now.
- Remove unnecessary includes and some and some other small cleanups.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-16 15:20:18 +03:00
Daniel Stone ce2e4899b5 test: Add extremely rudimentary include path test
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-08-08 16:23:30 +02:00
Daniel Stone ca7927ae60 context test: Use test_get_context()
So we don't die if we haven't got a valid global include path.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-27 11:59:55 +02:00
Daniel Stone 7b00485a6b Rename 'ctx' back to 'context' in external API
Still keep things as 'ctx' internally so we don't have to worry about
typing it too often, but rename the user-visible API back as it was
kinda ugly.

This partially reverts e7bb1e5f.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-11 15:03:43 +01:00
Ran Benita e7bb1e5fd9 Shorten context to ctx
(This breaks the API.)

"context" is really annoying to type all the time (and we're going to
type it a lot more :). "ctx" is clear, concise and common in many other
libraries. Use it!

Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Fix for xkb -> keymap change.]
2012-05-09 17:52:26 +01:00
Daniel Stone c358428009 Add flags to context creation
None defined as yet, but why not.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 17:51:16 +01:00
Ran Benita 4b49e0a117 Overhaul test suite
Rewrite all of the current tests in the following ways:
- Instead of the current mix of C and shell, just use single-process
  pure C file per test. All of the .sh files are removed, but everything
  that was tested is ported.
- Instead of handling the test logs ourselves, use Automake's
  "parallel-test" mechanism. This will create a single log file for each
  test with it's stdout+stderr, and a top level "test-suite.log" file
  for all the failed tests.
- The "parallel-tests" directive also makes the test run in parallel,
  so "make check" runs faster.
- Also use the "color-tests" directive to have the "make check" output
  colorized. Who doesn't like to see PASS in green?
- All of the test data files are moved into the test/data subdirectory.
  That way we can just put the directory in EXTRA_DIST and forget about
  it.
- The test/Makefile.am file is consolidated into the main Makefile.am,
  for a completely non-recursive build.

Right now the tests are completely independent and just use simple
assert()'s. More sophistication can be added as needed.

It should also be noted that it's still possible to use shell, python,
etc. if a test wants more flexibility than C can provide, just do as
before.

Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Updated for xkb_keymap changes.]
2012-04-09 14:21:47 +01:00
Daniel Stone 3e9dd7512c Add new context API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 16:59:01 +01:00