summaryrefslogtreecommitdiff
path: root/test/rulescomp.c
AgeCommit message (Collapse)AuthorFilesLines
2012-09-24API: add _context prefix to log-related functionsRan Benita1-6/+6
This is to follow the general scheme set by all of the other API functions. Since no one is using these functions yet, we don't (actually better not) add the old names to xkbcommon-compat.h. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-24Don't choke on RMLVO layout string with holesRan Benita1-0/+3
This old rules parser gives the same kccgst here, so in the interest of staying compatible we shouldn't fix it there. Similarly we shouldn't touch ParseIncludeMap, so this is the best place to handle this. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-24Don't use xkbcommon-compat names in internal codeRan Benita1-2/+2
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-17symbols: fix buffer overflow with illegal explicit groupRan Benita1-0/+3
Trying ''./test/interactive -l us:5' causes us to crash. The <layout>:<N> syntax says to put this layout at the N'th level. However the code (inherited from xkbcomp) doesn't check that the group is valid, and then happily indexes keyi->groups with it, which has a static size of XKB_NUM_GROUPS (the SetExplicitGroup function assumes the index is valid). So any value a user might put there > 4 makes nice things happen. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-16Organize src/ and test/ headersRan Benita1-3/+0
- 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-12Copyright updatesDaniel Stone1-12/+9
With Dan Nicholson's permission (via email), update his copyright and license statements to the standard X.Org boilerplate MIT license, as both myself and Ran have been using. Clean up my copyright declarations (in some cases to correct ownership), and add copyright/license statements from myself and/or Ran where appropriate. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-09-03Don't printf NULL stringsRan Benita1-1/+2
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-03log: replace "priority" by "level" everywhereRan Benita1-3/+3
Now that we don't use syslog, "level" does sound more commonplace. We should change it while there is still nobody using it. Also leave some space between the integers of the xkb_log_level enum values, if we ever need to shove more in between. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-09-01rulescomp: remove bad failtestsRan Benita1-10/+13
Since we now handle empty model/layout, the last couple of tests should not fail. The reason they do is bacause they try to use a non-existent "base" rules file. When the file is brought in these tests do not fail. Since we already test for non-existent rules file, we can remove them, and refine the other tests a bit. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-08Add xkb_log_level enum rather than using syslogDaniel Stone1-0/+8
Instead of relying on people including syslog.h, add our own XKB_LOG_LEVEL_* defines. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-08-08test: Minimise includesDaniel Stone1-1/+0
Mostly from functions which used to use file functions directly, but now use test.h wrappers. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-08-08Add support for default rules/model/layoutDaniel Stone1-1/+0
Right now it just comes from build-time, but eventually this should be sourced from configuration files at runtime too. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-27utils: add/replace string equality macrosRan Benita1-1/+1
It's more tidy and less error prone, since we use strcasecmp == 0 a lot. We replace strcmp == 0 by streq, strcasecmp == 0 by istreq, uStrCasePrefix by istreq_prefix and uDupString by strdup_safe. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-07-17Run source tree through uncrustifyDaniel Stone1-24/+24
.uncrustify.cfg committed for future reference also, but had to manually fix up a few things: it really likes justifying struct initialisers. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-13rulescomp: Fix benchmark runsDaniel Stone1-6/+6
We'd accidentally inverted silent vs. non-silent compilation, which would skew the benchmark pretty badly, but also forgot to change base to evdev for the rules here. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-12Import dataset into test/data/Daniel Stone1-2/+2
Use a self-contained dataset instead of relying on a globally-installed set. Data taken from xkeyboard-config 2.5.1. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-12Add a library of common test functionsDaniel Stone1-45/+39
Including creating a context (will come in useful soon), opening and reading files, and compiling keymaps. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-20Don't run the benchmark by defaultRan Benita1-1/+3
For people running 'make check' on every compilation, this can be a nuisance. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-18Add benchmarking test to rulescompDaniel Stone1-7/+46
Apparently it only takes us 8ms to build keymaps. Nice! Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-11Rename 'ctx' back to 'context' in external APIDaniel Stone1-6/+6
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-09Shorten context to ctxRan Benita1-6/+6
(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-09Change all 'xkb' xkb_keymap names to 'keymap'Daniel Stone1-4/+4
To make it a bit more clear what it actually is. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08Add flags to context creationDaniel Stone1-1/+1
None defined as yet, but why not. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08Add flags to keymap compilation entrypointsDaniel Stone1-1/+1
No use as yet, but might as well ... Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08Uncomment sections of test/rulescomp.cRan Benita1-4/+0
Fixes an 'unused' warning. There seems to be nothing wrong with these sections though, all the tests pass. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-01Remove unused 'which' and 'merge' argumentsRan Benita1-1/+5
Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Updated for xkb_desc -> xkb_keymap changes.]
2012-04-09Overhaul test suiteRan Benita1-22/+30
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-09Rename xkb_desc to xkb_keymapDaniel Stone1-1/+1
struct xkb_desc was just a hangover from the old XkbDescRec, which isn't a very descriptive name. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-29Tests: Release context on failure to build keymapDaniel Stone1-0/+1
No practical effect since they exit(1) regardless, but it keeps valgrind happy. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27Use xkb_contexts in keymap compilationDaniel Stone1-2/+8
Primarily for the include path, but also for the logging in future. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27Define our own None atom valueRan Benita1-1/+0
Since we define our own xkb_atom_t type, it makes sense not to use the X11/X.h None value. This way we can also remove a lot of X11 includes. Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27Move utils.{c,h} to be used by the entire projectRan Benita1-1/+1
This is a first step for making consistent use of utils.h also outside of xkbcomp/ . Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-22Rename keymap allocation APIDaniel Stone1-3/+3
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15tests: Free returned XKB mapDaniel Stone1-0/+2
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15Move include path from X11/extensions/ to xkbcommon/Daniel Stone1-1/+1
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-07-02Rename XkbRMLVOSet to struct xkb_rule_namesKristian Høgsberg1-1/+1
2010-07-02Rename public entry points to lowercase and underscoreKristian Høgsberg1-1/+1
2010-07-02Compile with -fvisibility=hidden when possibleKristian Høgsberg1-2/+0
2010-07-02Pull in enough structs and defines from XKBstr.h to only need XKB.hKristian Høgsberg1-3/+1
We want to move away from sharing implementation structs and let libX11 and libxkbcommon use each their own set of structs.
2010-06-30Make XkbcInitAtoms() call optionalKristian Høgsberg1-1/+0
2010-06-22Allow external atom databasesDaniel Stone1-1/+1
Allow people to plug in an external atom database (e.g. the X server's), so we don't have to migrate our own atoms over later. We are a bit over-keen on atoms at the moment, so it does pollute the atom database a bit though. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-04-09test: Remove extraneous includesDan Nicholson1-3/+4
These programs don't actually use the internal API.
2009-04-08Change CompileKeymapFromRules to take XkbRMLVOSetDan Nicholson1-8/+7
Let's use a nice interface now that it's available from XKBrulescommon.h.
2009-04-08Remove all non-public API from XKBcommon.h headerDan Nicholson1-1/+3
The noble intention was to expose all the new API and new generic types in the split out kbproto headers through XKBcommon.h. It turns out that would be a massive amount of work in the server. Someday, but first just wedging in XkbCompileKeymap* would be good. Most of the API is in new internal xkb*.h headers. In order to allow the XKBcommon.h header to be used from the server, we can't pull in other headers from kbproto since the server has its own copies. However, types that are different (XkbDescRec, XkbAction) still have Xkbc equivalents here, and I think they should be used in the server.
2009-04-04rulescomp: Remove unneeded APIDan Nicholson1-4/+0
2009-04-04Test compiler to simulate xkbcomp usageDan Nicholson1-0/+68
Added a test program, rulescomp, which takes a RMLVO set and generates a XkbcDescPtr. This is essentially what the xserver will do, except that we still need to access some xkbcomp internal API to make it work.