summaryrefslogtreecommitdiff
path: root/lib/tests
AgeCommit message (Collapse)Author
2019-05-10lib/tests/igt_subtest_group: Operate within defined behaviorArkadiusz Hiler
Quoting lib/igt_core.c: * - Code blocks with magic control flow are implemented with setjmp() and * longjmp(). This applies to #igt_fixture and #igt_subtest blocks and all the * three variants to finish test: igt_success(), igt_skip() and igt_fail(). * Mostly this is of no concern, except when such a control block changes * stack variables defined in the same function as the control block resides. * Any store/load behaviour after a longjmp() is ill-defined for these * variables. Avoid such code. * * Quoting the man page for longjmp(): * * "The values of automatic variables are unspecified after a call to * longjmp() if they meet all the following criteria:" * - "they are local to the function that made the corresponding setjmp() call; * - "their values are changed between the calls to setjmp() and longjmp(); and * - "they are not declared as volatile." igt_subtest_group test uses two local variables for tracking the state of execution, making sure that skips are working correctly. We can just make them volatile to be back on the defined grounds. v2: comment on the volatiles as suggested by Simon Ser Cc: Simon Ser <simon.ser@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Simon Ser <simon.ser@intel.com>
2019-02-21lib/tests: Use ARRAY_SIZEDaniel Vetter
Except in igt_simulation.c where we use tricks and intentionally only want part of the array in some cases. Suggested-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2019-02-20lib/tests: Add testcase for nonexisting subtest nameDaniel Vetter
While at it, convert the existing testcase for invalid subtest names to a positive one. This is the only thing the invalid subtest checking for all tests did cover, which wasn't covered through some other checks already. Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2019-02-20lib/tests: Convert no_exit tests into positive testsDaniel Vetter
This way we can make sure they die with an assert, which is what we want. Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2019-02-20lib/tests: add internal_assert_wexited/wsignaledDaniel Vetter
And convert everything over. igt_segfault needed a bit of care to differentiate between a real death-by-signal and igt_exit mapping a child process signal death to an exit code. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2019-02-20lib/tests: Add header for common helpersDaniel Vetter
Start with internal_assert, more will follow. While at it, use internal_assert everywhere (except where we check exit status, those will get dedicated assert checks). Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2019-02-15lib: Make sure we leak no child processesDaniel Vetter
There's a lot more ways to leak children than igt_fork, some even handrolled. So check for that. Also have a nice littel testcase for that too. v2: Don't hang if there's a leaked child process (Chris). Has the added benefit that my library unit test also gets faster! v3: Rebase. Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2019-02-15tests/i915_missed_irq: Don't leave the hang detector hangingDaniel Vetter
Spotted by my new "are there any child processes left?" check in igt_exit - we need to put all the igt_require before we start any real test logic. v2: Rebase. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2019-02-15lib/tests: make sure igt_skip in igt_fork is forbiddenDaniel Vetter
Another corner case to check. v2: Rebase. Note that we still have the SIG + 128 exit code, that's how igt_waitchildren forwards child death to the parent's exit code. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2019-02-15lib/tests: Check that igt_assert forwards correctly through igt_forkDaniel Vetter
Note that without the igt_waitchildren nothing at all gets forwarded, maybe we should check for left-behind children somewhere on subtest exit. v2: Drop NIH exit status handling (Chris). Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2019-02-15lib/tests: Drop NIH exit status handlingDaniel Vetter
Spotted by Chris. Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2019-02-11lib/tests: Drop automake supportDaniel Vetter
Really not needed if we check this with meson. Acked-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2019-01-29automake: Ditch all EXTRA_DIST directivesDaniel Vetter
We're not using automake to build tarballs anymore. Acked-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2018-07-25build: provide include for missing syscallsLucas De Marchi
Add directory with README file to allow missing syscalls to be defined. The syscalls themselves will be provided in follow up patches. v2: add support to autotools Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Acked-by: Antonio Argenziano <antonio.argenziano@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2017-12-21meson: Don't install selfcheck binariesPetri Latvala
Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2017-12-08debugger/overlay/tools: make sure to include embedded drm-uapi headersLionel Landwerlin
Headers from lib/ depend on drm uapi headers. Since we started embedding them, let's make sure to pull them first. We still depend on libdrm in places, we don't want the system headers from libdrm to be included prior to the embedded ones. v2: Fix debugger/overlay (Lionel) v3: More fixes in lib/tests (Lionel) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-11-29igt: Remove Android supportArkadiusz Hiler
This patch gets rid of the Android support, deleting all the hacks and moving code around to the places it belongs. Android build is not really maintained properly and rots rather fast. With recent push for Meson here and Android going for Soong it will only accelerate. It's a good time to drop the illusion of providing any support. Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Kalyan Kondapally <kalyan.kondapally@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Acked-by: Petri Latvala <petri.latvala@intel.com>
2017-10-02meson: Distribute meson build system filesPetri Latvala
Signed-off-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-09-08meson: basic build system supportDaniel Vetter
Why? Because it's fast. Like really, really fast. Some data (from a snb laptop, so rather lower-powered): - Incremental build after $ touch lib/igt_core.c with meson: 0.6s It notices that the symbol list of the libigt.so hasn't changed and doesn't bother re-linking the almost 300 binaries we have. make -j 6 for the same scenario takes 44s. - Incremental build with nothing changed: make: 0.7s, meson: 0.2s This means stuff like --disable-git-hash is entirely pointless with meson, it's faster than a make ever can be (with 0.6s). - Reconfigure stage: ninja reconfigure 0.8s vs. ./configure 8.6s) - Running tests, after a full build: ninja test 6s vs. make check 24s - Full build (i.e. including ./autogen.sh respectively meson build), including tests, from a pristine git checkout. automake 2m49s vs. meson 44s. Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Eric Anholt <eric@anholt.net> Cc: Daniel Stone <daniel@fooishbar.org> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2017-09-08build: remove _GNU_SOURCE from source filesDaniel Vetter
We are, the build system takes care of that. Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-09-08build: Define _GNU_SOURCE in Makefile.amDaniel Vetter
In meson I want to just set this everywhere (no reason not to), and doing so will allow us to clean up a few things. But that means autofoo needs to follow suit. v2: Rebase. Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2017-08-14lib: Add igt_can_fail()Daniel Vetter
Useful to make sure folks use library helpers correctly. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-06-07Android.mk: Use drm stubsArkadiusz Hiler
Use drm stubs that sit under lib/stubs. Also drop strange, nonexistent additions to LOCAL_C_INCLUDES. Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-04-20lib/tests: Add kmstest_edid_add_* selftestsAbdiel Janulgue
Sanity check the edid block generation capabilities. Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
2016-09-01autotools/: Allow check target to be invoked w/o the need to issue a build.Marius Vlad
We need to have the test list generated before running the check target. Migrated igt_command_line.sh to tests/ from lib/tests/, which allows to building the tests and execute the script. This would allow cleaning followed by a make check. Also assembler/ directory needs also to be adjusted in order for this to work. Kept the possibility to invoke tests/igt_command_line.sh to determine which test is failing. Signed-off-by: Marius Vlad <marius.c.vlad@intel.com> Url: https://patchwork.freedesktop.org/series/6539/ Reviewed-By: Chris Wilson <chris@chris-wilson.co.uk>
2016-09-01lib: Make igt_command_line.sh selftest standaloneChris Wilson
Allow the casual user to run igt_command_line.sh to discover what make check is complaining about. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-04lib/tests/Makefile: Replace automake specific names of listings in ↵Robert Foss
Makefile.sources Replace the automake specific names of listings with something that isn't automake specific. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-03-19lib/igt_aux: Divert ioctls for signal injectionChris Wilson
To simplify and speed up running interruptible tests, use a custom ioctl() function that control the signaling and detect when we need no more iterations to trigger an interruption. We use a realtime timer to inject the signal after a certain delay, increasing the delay on every loop to try and exercise different code paths within the function. The first delay is very short such that we hopefully enter the kernel with a pending signal. Clients should use struct igt_sigiter iter = {}; while (igt_sigiter_repeat(&iter, enable_interrupts=true)) do_test() to automatically repeat the test until we can inject no more signals into the ioctls. This is condensed into a macro igt_interruptible(enable_interrupts=true) do_test(); for convenience. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-19lib/tests: More igt_subtest_group checksDaniel Vetter
... for some cases discussed with Chris on irc. We seem to get them all right. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-03-19lib: Add igt_subtest_groupDaniel Vetter
Useful for creating common setup code in igt_fixture which is only needed by a subset of tests. And since I'm a good citizen it comes with a library testcase/example included. v2: Make testcase nastier to ensure a subtest group SKIPS when it's parent is skipping already. I accidentally got this right, but let's make sure. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-03-08lib: Unit test for exit handlerDaniel Vetter
Checks that - exit handlers are run only once, even when registered multiple times. - run in reverse order - actually run for all ways a test could exit. This is prep work to extend exit handlers to also work in a subtest aware way. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-11-03lib/tests: Add igt_assert_*() self-testsDaniel Stone
Make sure our igt_assert variants are doing something that looks vaguely like the right thing. Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-09-24lib/tests: explicitly raise SIGSEGVThomas Wood
Dereferencing a NULL pointer is undefined behaviour and may not always result in a segmentation fault. Explicitly raise the SIGSEGV signal to test handling of this signal. v2: include signal.h (Derek Morton) Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-13benckmarks/Android.mk: Fix building benchmarks for AndroidDerek Morton
The commit "benchmarks: Do not install to system-wide bin/" changed the benchmark file list from bin_PROGRAMS to benchmarks_PROGRAMS. However Android.mk was not updated, resulting in IGT failing to build for Android. This commit adds that change. It also adds LOCAL_MODULE_PATH to specify where the built benchmarks should be put. v2: I discovered that the existing definitions of LOCAL_MODULE_PATH were creating what should have been an invalid path. Not sure how it was ever working previously, but fixed now. Signed-off-by: Derek Morton <derek.j.morton@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-12lib/core: Add optional reason for timeout failureDaniel Vetter
"Timed out" isn't a terribly informative message, allow users to set something more informative. Inspired by a request from Jesse. Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-07-19igt/stats: Fixup tests to compile after interface changesChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-02build: Add DEBUG_FLAGS to tools and self-testsDamien Lespiau
Makes using GDB better on those binaries. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27stats: Exercise the reallocation pathsDamien Lespiau
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27stats: Spwan igt_init_with_size() from igt_init()Damien Lespiau
It's all about good looking APIs. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27stats: Test we do correctly invalidate the sorted arrayDamien Lespiau
Chris had a doubt, and I was lazy and didn't do a similar test for the quartiles/median than for the mean (test_invalidate_mean()). Plug that gap. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27stats: Add support for the interquartile range (IQR)Damien Lespiau
IQR is a good measure of dispersion. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27stats: Add support for quartiles (and thus median)Damien Lespiau
More stuff, quite useful characteristics of a dataset. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27stats: Use igt_assert_eq_double() when asserting on doublesDamien Lespiau
Lucky enough to have exact values, == works! Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27stats: Add igt_stats_get_range()Damien Lespiau
Somewhat useful, for instance to size an histogram. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27stats: Add functions to retrieve min/max values of the datasetDamien Lespiau
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27stats: Factor out a fixture to initialize statsDamien Lespiau
We're going to use this simple fixture once more, might as well make a function instead of copy/pasting code. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27stats: Add a getter for the population propertyDamien Lespiau
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27stats: Add a way to specify if the data set is a population or a sampleDamien Lespiau
This changes how we compute the variance. We want an unbiased variance when reasoning about a sample. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27stats: Zero the whole structure at init() timeDamien Lespiau
Because the structure started small, I initialized every member directly, but that means that the new fields added weren't properly initialized (sigh!). Zero the whole thing first then. Also, the punishment for introducing a bug should be to write the corresponding unit test. It's not a perfect one, but I'll take it. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27tests/stats: Make sure we properly invalidate the cached meanDamien Lespiau
Sure, that's an implementation details, but make sure we do recompute the mean when we add a new value. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>