17 Commits

Author SHA1 Message Date
Oscar Mateo
466da453ae gem_flink_race: Assure no pending requests before object counting
Same thing that was done for prime_self_import.

v2: Move igt_drop_caches_set() call inside get_object_count() to make
it clearer why we want this.

Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-05 12:30:40 +01:00
Daniel Vetter
071e9ca1ca lib: add igt_main macro
In the past new testcases with subtest often forgot to add the call to
igt_exit at the end of their main() function. That is now caught with
a bit more obnoxious asserts, but it's still a nuissance.

This little igt_main macro takes care of that (and also of calling the
subtest machinery initialization code correctly).

If no one objects I'll roll this out for all the simple cases (i.e.
those tests that don't have additional argv parsing on top of the
subtest machinery).

v2: Roll it out across the board.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-11-01 21:10:59 +01:00
Daniel Vetter
5951ffb6a0 lib/drmtest: rip out drm_open_any_master
It's unused. Also most of our tests failed to ask for the right type
of drm fd anyway. So it's imo better to just let them fall over when
they don't get master but want it, like they already do today.

This also allows us to garbage-collect the master parameter to
drm_get_card and associated code.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-19 10:34:34 +02:00
Daniel Vetter
a1ca8ef5b1 tests: use igt_exit() consistently with subtests
This is mostly important to get the SKIP reporting right, but I've
found a few stragglers that wanted to get converted over to the igt
result reporting completely.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 16:08:00 +02:00
Daniel Vetter
83440953e5 tests: s/assert/igt_assert
Just a wholesale rollout for now, we can refine later on.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-13 15:07:44 +02:00
Daniel Vetter
1caaf0a6b6 s/drmtest_/igt_/
Requested-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 12:20:22 +02:00
Daniel Vetter
814b135541 s/drmtest_subtest_block/drmtest_subtest/
The _block postfix meant to convey that a C statement/block must
follow can be misread as the verb to block. So drop it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 12:15:16 +02:00
Daniel Vetter
9f6365e4ea lib/drmtest: Add drmtest_subtest_block macro
Doesn't do more than an if (drmtest_run_test(name)) right now, but
as soon as we get a bit of infrastructure to handle test failures and
skipping, this will get more interesting.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:10:26 +02:00
Daniel Vetter
9ff5161354 tests/gem_flink_race: Kill duplicate drm_open_any
Leak test that leaks ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-06 21:59:55 +02:00
Daniel Vetter
db225aa38d tests/gem_flink_race: correct thread count
They all race against each another, no worker-slave relationship
like in the other subtest.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-24 17:04:35 +02:00
Daniel Vetter
bc62a64b8a tests/gem_flink_race: fix up scanf format
Oops, failed to git add.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-24 17:01:11 +02:00
Daniel Vetter
24bbca9237 tests/gem_flink_race: actually make it somewhat useful
- Enable subtest support.

- Add a check for the same flink name in the racing threads, which is
  an issue one of my recent patches actually fixes.

- Add the test I've actually wanted to write which races an flink
  against gem close (with no open in between). That one does indeed
  leak.

- Readd the leak check, but note that this needs a fixed kernel.
  Otherwise the leak counter will be utter garbage.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-24 12:52:01 +02:00
Daniel Vetter
dfe942edec Revert "tests/gem_flink_race: count leaked objects"
This reverts commit bd927662fcfb1443c5982fb04cc694f78e1c8d53.

It's bogus.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-24 09:31:40 +02:00
Daniel Vetter
aaeaca7720 tests/gem_flink_race: check for expected flink failure code
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-24 08:01:35 +02:00
Daniel Vetter
bd927662fc tests/gem_flink_race: count leaked objects
And fail the test if the leak count is bigger than 0.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-24 07:37:45 +02:00
Daniel Vetter
9736fc09e2 tests/gem_flink_race: kill debug printf
Oops.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-24 06:55:10 +02:00
Daniel Vetter
7b5440a09a tests: add gem_flink_race
This exercises a race in the flink name descruction of the current drm
gem core. When racing a gem close with a gem open the open can sneak
in and cause the kernel to leak the flink name and its reference.

This results in leaked gem objects that won't get reaped even at drm
file close time. On my 2 core/4 threads snb machine this leaks on the
order of 1k objects per second.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-23 23:15:12 +02:00