39 Commits

Author SHA1 Message Date
Daniel Stone
f735015ed3 lib/tests: Add igt_assert_*() self-tests
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-11-03 19:46:11 +00:00
Thomas Wood
2442f595d2 lib/tests: explicitly raise SIGSEGV
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-09-24 14:23:44 +01:00
Derek Morton
d524a964fc benckmarks/Android.mk: Fix building benchmarks for Android
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-13 11:28:22 +01:00
Daniel Vetter
370c989723 lib/core: Add optional reason for timeout failure
"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-08-12 14:46:40 +02:00
Chris Wilson
0705ce6d15 igt/stats: Fixup tests to compile after interface changes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-19 18:19:29 +01:00
Damien Lespiau
0a01a190f6 build: Add DEBUG_FLAGS to tools and self-tests
Makes using GDB better on those binaries.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-07-02 11:20:42 +01:00
Damien Lespiau
46f277b90b stats: Exercise the reallocation paths
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 19:05:41 +01:00
Damien Lespiau
66e0bf66da stats: Spwan igt_init_with_size() from igt_init()
It's all about good looking APIs.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 19:05:41 +01:00
Damien Lespiau
817ea87b6e stats: Test we do correctly invalidate the sorted array
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-27 16:46:37 +01:00
Damien Lespiau
fabde384a3 stats: Add support for the interquartile range (IQR)
IQR is a good measure of dispersion.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:04:08 +01:00
Damien Lespiau
1b8997b3f8 stats: Add support for quartiles (and thus median)
More stuff, quite useful characteristics of a dataset.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:04:08 +01:00
Damien Lespiau
2fe286985f stats: Use igt_assert_eq_double() when asserting on doubles
Lucky enough to have exact values, == works!

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:04:08 +01:00
Damien Lespiau
0e4c175e04 stats: Add igt_stats_get_range()
Somewhat useful, for instance to size an histogram.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:04:07 +01:00
Damien Lespiau
4a89a841a1 stats: Add functions to retrieve min/max values of the dataset
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:04:07 +01:00
Damien Lespiau
87009f3d7b stats: Factor out a fixture to initialize stats
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-27 16:04:07 +01:00
Damien Lespiau
da123adeae stats: Add a getter for the population property
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:04:07 +01:00
Damien Lespiau
3a5cf84317 stats: Add a way to specify if the data set is a population or a sample
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-27 16:04:07 +01:00
Damien Lespiau
203c3841fc stats: Zero the whole structure at init() time
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-27 16:04:07 +01:00
Damien Lespiau
76ea7b9133 tests/stats: Make sure we properly invalidate the cached mean
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>
2015-06-27 16:03:27 +01:00
Damien Lespiau
515cec1210 stats: Add a way to retrieve the standard deviation
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:03:27 +01:00
Damien Lespiau
9986282c2b tests/igt_stats: Call igt_stats_fini() to not leak the array
Sure, it'll be freed at exit(), but might as well be a bit pedantic.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:03:27 +01:00
Damien Lespiau
e55a11d3eb stats: Be more precise and talk about mean, not average
There are several types of averages eg. mean, median and mode.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:03:27 +01:00
Damien Lespiau
06f5f7065f lib: Add a tiny utility function to compute averages
The master plan would be to get a bit more stats in it, at least the
standard deviation and confidence interval. Just need the average for
now.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-25 17:22:03 +01:00
Derek Morton
a5633c406c lib/tests/igt_segfault Add unit test to test segfault handling
Unit test to check a segfaulting subtest is handled correctly.

v2: Added script to check subtest results
v3: Removed script. Updated test to use fork to monitor return status.
v4: Added igt_segfault to .gitignore

Signed-off-by: Derek Morton <derek.j.morton@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-06-15 15:45:55 +02:00
Derek Morton
88c9a82318 lib: Enable building unit tests on android
Add a make file for android so the unit tests can be built.
Enabled asserts for the library code so the unit test behaviour
is correct.

Signed-off-by: Derek Morton <derek.j.morton@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-05-27 16:17:05 +01:00
Thomas Wood
e72686b83b tests: create a single combined test list
All tests now respond in a consistent way such that separate lists for
tests with and without subtests are no longer necessary.

v2: fix other references to the test list

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-14 17:43:05 +01:00
Thomas Wood
cff102ebb2 lib: use test failure status for igt_set_timeout
Use a failure status code for timeout to avoid confusion between tests
that take too long to execute versus a failure due to an operation
taking longer than expected.

v2: Add a "timed out" message before exiting. (Daniel Vetter)
    Fix the timeout library check by disabling hard errors in xfail
    tests, since these share the same exit status as test failure.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-14 17:43:05 +01:00
Thomas Wood
2f0e3cdcab lib/tests: add missing library flags
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-30 17:36:16 +01:00
Thomas Wood
d9224c3479 lib/tests: update .gitignore 2015-02-25 16:59:22 +00:00
Thomas Wood
8fb19782f8 lib: remove handled option arguments from argv
Remove options from argv that have been handled by getopt to allow
additional non-option parameters to be processed in the test application.

This fixes issues when using options such as --debug with tests that accept
additional non-option parameters.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-25 16:48:25 +00:00
Thomas Wood
38a0c41340 lib/tests: check that invalid subtest names are rejected
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-09 14:39:41 +00:00
Thomas Wood
f0516f3d35 lib/tests: verify subtest enumeration output
Check that the subtest list is not empty if using --list-subtests
returns with an exit code of 0, and that the list is empty if it returns
with 79.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-09 14:39:41 +00:00
Thomas Wood
dbac905600 lib: ensure subtests are not added to simple tests
Simple tests do not support subtests, so fail if igt_subtest is used in
one.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-25 15:18:48 +00:00
Thomas Wood
34424138bc lib/tests: add a test for igt_set_timeout
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-13 14:27:57 +00:00
Thomas Wood
b441e6ac2a lib/tests: don't use hard error status to indicate test failure
An exit status of 99 is reported separately in the test summary as an
error, rather than as a test failure.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-06 11:39:43 +00:00
Thomas Wood
03a4ad16d1 lib/tests: fix tests and test list location
The igt_command_line.sh script was moved by commit 685e577 (Move library
selftests to lib/tests), but the location of the tests and the test
lists was not updated.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-06 11:39:02 +00:00
Thomas Wood
5a61421a02 lib/tests: use the "check_" prefix for tests
The "check_" prefix ensures the test programs are not installed and are
only built when "make check" is run.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-10-29 17:26:38 +00:00
Thomas Wood
b78d142a15 build: fix distcheck
Fix distcheck issues introduced by commit 685e577 (Move library
selftests to lib/tests).

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-10-29 17:26:34 +00:00
Daniel Vetter
685e57736a Move library selftests to lib/tests
Again they're not really igt testcases so are in the way of
running spatch unconditionally. Move them someplace else.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-10-29 13:29:32 +01:00