summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2011-03-24test: when unit tests are enabled, build them during "make"Peter Hutterer2-4/+4
Catch compiler errors that were otherwise only spotted on make check. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2011-03-18test: git ignore the list test executableGaetan Nadon1-1/+1
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Keith Packard <keithp@keithp.com>
2011-03-18Add generalized unit test support using util-macros.Gaetan Nadon2-2/+10
A handful of modules have begun adding unit test programs. These macros will help providing a consistent interface which will help package builders and developers to manage the functionality. XORG_ENABLE_UNIT_TESTS will turn on/off unit testing, regardless of how it is implemented. The default (yes/no) can be specified by each module. It can be used by itself if glib or -wrap support is not needed. XORG_WITH_GLIB will probe the system for glib-2.0. A different version can be specified in each module. It will consult XORG_ENABLE_UNIT_TESTS but can be used by itself in contexts other then unit testing. The default (yes/no) can be specified by each module. XORG_LD_WRAP will probe the linker for -wrap support. It will consult XORG_ENABLE_UNIT_TESTS but can be used by itself in contexts other then unit testing. configure options: --enable-unit-tests Enable building unit test cases (default: auto) --with-glib Use GLib library for unit testing (default: auto) Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Keith Packard <keithp@keithp.com>
2011-03-14test: add some tests for basic list manipulation.Peter Hutterer2-1/+178
This has less purpose as a test but more as documentation on how to actually use the differnent list calls. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-23Merge branch 'mi-cleanup' into nextPeter Hutterer3-2/+141
2011-02-22Move master/lastSlave out of the union into separate fields.Peter Hutterer2-2/+2
The removal of the double-use will cause some suble bugs as some conditions to check for the dev->u.master case were broken and also evaluated as true if lastSlave was set (instead of master). Also breaks the input ABI. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2011-02-22test: write some event → XI1 conversion tests.Peter Hutterer1-0/+139
Don't test everything, but hey, life is short and I'm trying to have one. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-02-17Input: Allow EventToCore to return multiple eventsDaniel Stone1-29/+39
Some event types (notably Expose and GraphicsExpose) require multiple events, a la XI 1.x. Bring the EventToCore API in line with EventToXI's and allow it to generate multiple events. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-01-07Merge branch 'for-peter' of git://people.freedesktop.org/~daniels/xserver ↵Peter Hutterer3-28/+31
into for-keith
2011-01-07input: add valuator_mask_free() to free a valuator mask.Peter Hutterer1-1/+2
Expecting the caller to free the mask requires us to keep it in a single memory block (which may be an issue lateron), aside from leaving the API asymetrical. Provide valuator_mask_free() to free the memory and reset the mask pointer to NULL. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Fernando Carrijo <fcarrijo@freedesktop.org> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-01-06Test: Input: Test up to supported server, not protocol, eventsDaniel Stone1-9/+9
When building against a newer inputproto, the server may support fewer than XI_LASTEVENT events. We already have XI2LASTEVENT for the highest event number supported by the server, so use that instead. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-01-06Test: Input: Check flags on DeviceEventDaniel Stone1-1/+11
Add initial validation of acceptable flags for XI2 device events, and make sure they're swapped. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-01-06Test: Input: Add helper function for failing EventToCoreDaniel Stone1-18/+11
We have quite a few tests which involve checking that EventToCore fails for specific events, so refactor them into a separate function. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-11-26include: let BitIsOn() return a boolean value.Peter Hutterer1-0/+16
Simply returning the mask bit breaks checks like BitIsOn(mask, 0) != BitIsOn(mask, 1); as used in 048e93593e3f7a99a7d2a219e1ce2bdc9d407807. The naming of this macro suggests that it should return boolean values anyway. This patch also adds a few simple tests for these macros to make sure they don't accidentally break in the future. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Pat Kane <pekane52@gmail.com> Reviewed-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-11-24test: reduce range of byte-padding macro tests.Peter Hutterer1-17/+54
Byte padding and conversion is interesting for the rage of 0-8 bytes, and then interesting towards the end of the valid range (INT_MAX - 7 and INT_MAX - 3). Note: this changes the upper range for pad_to_int32() and bytes_to_int32() from the previous (INT_MAX - 4) to (INT_MAX - 3). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Julien Cristau <jcristau@debian.org>
2010-11-24test: compare byte padding macros against the expected bytes.Peter Hutterer1-0/+3
We calculate the expected bytes for each value, let's use it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Julien Cristau <jcristau@debian.org>
2010-11-12test: Fix missing xkbsrv.h include.Cyril Brulebois1-0/+1
Otherwise, building fails with CFLAGS="-Wall -Werror" this way: | protocol-common.c: In function ‘init_simple’: | protocol-common.c:159: error: implicit declaration of function ‘XkbInitPrivates’ | protocol-common.c:159: error: nested extern declaration of ‘XkbInitPrivates’ Signed-off-by: Cyril Brulebois <kibi@debian.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-11Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into ↵Peter Hutterer1-0/+2
input-api Conflicts: dix/getevents.c hw/xfree86/common/xf86Xinput.h Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-25test: valuator_mode tests.Peter Hutterer1-0/+33
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22input: remove "mode" field from ValuatorClassRec.Peter Hutterer1-1/+1
We have per-axis mode now. For those bits that still need it (XI 1.x), assume that the first axis holds the device's mode. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22test: input - set valuators mask for event to core conversionChase Douglas1-0/+2
Commit de8be07cc0a8163b6ef04455706fd5ca2cebe587 adds a requirement to event to core conversion that at least one of the X or Y valuators are set in the valuator mask. This commit fixes the event conversion test to be compliant. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-22test: valuator_mask tests.Peter Hutterer1-0/+77
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-13test: Fix make distcheck when not building unit testsJeremy Huddleston1-2/+1
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-11xfree86: Match devices based on USB IDDan Nicholson1-0/+12
Sometimes the vendor and product names aren't specific enough to target a USB device, so expose the numeric codes in the ID. A MatchUSBID entry has been added that supports shell pattern matching when fnmatch(3) is available. For example: MatchUSBID "046d:*" The IDs are stored in lowercase hex separated by a ':' like "lsusb" or "lspci -n". Signed-off-by: Dan Nicholson <dbn.lists@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-11xfree86: Match devices based on PnP IDDan Nicholson1-0/+12
Serial input devices lack properties such as product or vendor name. This makes matching InputClass sections difficult. Add a MatchPnPID entry to test against the PnP ID of the device. The entry supports a shell pattern match on platforms that support fnmatch(3). For example: MatchPnPID "WACf*" A match type for non-path pattern matching, match_pattern, has been added. The difference between this and match_path_pattern is the FNM_PATHNAME flag in fnmatch(3). Signed-off-by: Dan Nicholson <dbn.lists@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-07If XTest is always required, then eliminate the XTest devPrivateKeith Packard2-2/+0
The internals of XTest are used by Xi and Xkb, and both Xi and Xkb are always required, so it makes little sense to have XTest place data in a devPrivate, especially a devPrivate which is only available when the XTest extension is enabled. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-06Initialize private keys in test suiteKeith Packard2-2/+15
Make sure all of the private keys used by the test code are initialized before being used. Signed-off-by: Keith Packard <keithp@keithp.com> Tested-by: Robert Hooker <sarvatt@ubuntu.com>
2010-05-28test: fix up InputAttributes helper function test.Peter Hutterer1-1/+8
Just some extra clarification as pointed out by Dan Nicholson, and that memcpy should have been a memcmp. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
2010-05-26Ignore build products in the server's test suite.Jamey Sharp1-0/+13
Signed-off-by: Jamey Sharp <jamey@minilop.net> Cc: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-25dix: add helper functions to duplicate and free InputAttributes.Peter Hutterer1-0/+102
No special memory handling is used to give drivers the maximum flexibility with the data. Drivers should be able to call realloc on the product string if needed and perform similar operations. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-14test/xi2: Initialize predefined atoms before XInputExtensionInit.Jamey Sharp1-0/+1
XInputExtensionInit calls MakeAtom, which doesn't work without the atoms table initialized. Signed-off-by: Jamey Sharp <jamey@minilop.net> Cc: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-13Replace X-allocation functions with their C89 counterpartsMikhail Gusarov2-11/+11
The only remaining X-functions used in server are XNF*, the rest is converted to plain alloc/calloc/realloc/free/strdup. X* functions are still exported from server and x* macros are still defined in header file, so both ABI and API are not affected by this change. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-30Merge remote branch 'whot/for-keith'Keith Packard1-8/+8
2010-04-28test: Fix linking of wrapped functions in XI2 tests.Rami Ylimäki1-8/+8
Running "make check" will lead to build problems in scratchbox. Building the first test that wraps dixLookupWindow fails because symbol __real_dixLookupWindow can't be resolved. Defining wrapping options as linker options instead of compiler options makes everything build nicely in scratchbox. Signed-off-by: Rami Ylimäki <ext-rami.ylimaki@nokia.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-26dix and others: remove unused arraySize field from ScreenInfoTiago Vignatti2-2/+0
Bizarre. This seems to never be used before. I left the field in ScreenInfo, with another name. So, stop looking at it. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
2010-01-27dix: EventToCore needs to copy the root window too.Peter Hutterer1-1/+3
This value isn't actually set for normal events but it saves us some work for the record extension support. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-12-22test/xi2: fail if xi2 class type is garbage. (#25492)Peter Hutterer1-0/+3
If the keycode range exceeds the allowable length, memory gets overwritten. Catch this case by making sure that only allowed class types are present. X.Org Bug 25492 <http://bugs.freedesktop.org/show_bug.cgi?id=25492> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-12-23test/xi2: fix maximum max_keycode (bug#25492)Julien Cristau1-1/+1
The number of keycodes needs to be lower than 0xFFFD so that the length field of xXIKeyInfo doesn't overflow. Signed-off-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-11-25Xi: when deleting all properties, reset property handler to NULL.Peter Hutterer1-0/+54
Trying to unregister property handlers during the device closure process leads to invalid memory accesses. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2009-11-11.gitignore: use common defaults with custom section #24239Gaetan Nadon1-0/+2
Using common defaults will reduce errors and maintenance. Only the very small or inexistent custom section need periodic maintenance when the structure of the component changes. Do not edit defaults. Reviewed-By: Jeremy Huddleston <jeremyhu@apple.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-10-06Add platform tests for Dtrace linker magicAlan Coopersmith2-2/+2
Replaces special handling for Xquartz DDX and scales better to handling the multiple platforms that now have some level of Dtrace support available. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2009-09-24Fix build of unit tests when dtrace probes are enabledAlan Coopersmith2-0/+8
ar loses the dtrace probe magic when building static libraries, so we have to link with the .O files in order to resolve the dtrace probe symbols. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-09-16Fix num_masks/length overflow test for XiSelectEventsAlan Coopersmith1-1/+2
Have to set windowid to a valid value first, since that check appears earlier in the code than the masks/length check. Also have to have data[] set large enough so that reading mask data for 0xFFFF masks doesn't overflow past the end of the array into uninitialized data. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-16test_convert_XIRawEvent: Don't write more data than the struct holdsAlan Coopersmith1-1/+1
sizeof(in.valuators.mask) * 8 == 40, but the valuators arrays only holds 36 entries, so the test was smashing the stack when 36 < i < 40 (leading to core dumps on Solaris x86, since the return address was overwritten with an invalid pointer). Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-16Remove stray semi-colon in protocol-common.cAlan Coopersmith1-1/+1
Caused Sun compilers to issue warning: "protocol-common.c", line 141: warning: syntax error: empty declaration Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03test: add protocol testing for XIWarpPointer.Peter Hutterer2-0/+220
TODO: some way to check src_x/y coordinates would be good. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03test: expose the default screen to tests, some cleanup work.Peter Hutterer4-12/+26
Provide common #define for invalid window IDs. Init the sprite's hotPhys, provide a common #define for the initial sprite position. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03Xi: if XISetEventMask fails, return this to the client.Peter Hutterer2-2/+3
The only failure point can be a BadAlloc. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03Xi: fix broken swap code in XISelectEvents request processing.Peter Hutterer1-1/+1
The pointer advanced 12 bytes too short. Rather unfortunate if both the code and the test have the same bug. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03test: fix request length calculation, add length tests for XISelectEventsPeter Hutterer1-2/+17
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>