summaryrefslogtreecommitdiff
path: root/lib/tests
AgeCommit message (Collapse)Author
2021-04-23gitignore: Remove various .gitignore filesPetri Latvala
Now that autotools is gone and you always build to a dedicated build directory with meson, we can remove .gitignore files that only had the purpose of ignoring built binaries in the source directories. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Arkadiusz Hiler <arek@hiler.eu> Reviewed-by: Arkadiusz Hiler <arek@hiler.eu>
2021-03-23meson: Drop ':' in test namesArkadiusz Hiler
Since meson 0.56 colons are used to filter tests by subproject, and if we use them in test names we get: DEPRECATION: ":" is not allowed in test name Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Arkadiusz Hiler <arek@hiler.eu> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2021-01-30meson: Turn on -WerrorAshutosh Dixit
We can choose which compile warnings to enable, but once they are enabled treat all warnings as error. This enforces stricter checks against compile warnings creeping in. v2: Fix redefinition warning errors from i915/gem_userptr_blits v3: Fix the even more pedantic clang compilation v4: Do not alter whitespace in lib/tests/igt_describe! Note: clang does not build assembler/ Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2020-06-22igt/core: Disallow igt_require/skip in non-main threadsArkadiusz Hiler
Handling magic control blocks and longjmp() out of them in threads is hard. The test should state the requirements before it starts spinning threads. Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-06-22lib/core: Handle asserts in threadsArkadiusz Hiler
Since IGT is using magic control blocks (igt_subtest et al.) asserts jump out the them using longjmp() causing a bunch of confusing messages and occasionally crashing the whole process. This is not the behavior we want :-) With this patch: 1. simple_main, dynamic and subtest each clears the thread failure state at the start 2. each of those blocks also asserts no thread failures at the end 3. igt_assert() in non-main thread prints out the error + stacktrace and marks that we have failed thread Issue: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/55 Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-06-04lib/igt_core: Don't kill the world after a failed forkArkadiusz Hiler
If we fail to fork (e.g. due to restrictive limits) -1 gets written as PID of our child and we assert out. The cleanup that happens afterwards tries to kill all our children, which ends up in kill(-1, SIGKILL) which is not good. This patch makes sure of two things: * -1 doesn't get written down as our child * when we are killing children we make sure that pid > 0 Reported-by: Fei Yang <fei.yang@intel.com> Cc: Michael Hebenstreit <michael.hebenstreit@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Tested-by: Michael Hebenstreit <michael.hebenstreit@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-05-05lib/tests: Add tests for magic control blocks nestingArkadiusz Hiler
Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-03-23lib: Make it possible to abort the whole execution from inside of a testArkadiusz Hiler
igt_abort_on_f() is introduced which does very little cleanup and causes a hard exit() of the test binary with a unique exit code (IGT_EXIT_ABORT). The exit code informs the monitoring process that there is a critical issue with the testing environment which may have an impact on the results if testing continues. v2: Add a meta_test Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-03-23lib/tests: Add support for redirecting fork output to /dev/nullArkadiusz Hiler
Trying to read interleaved writes is a bit tricky, so let's just use /dev/null if we care about contents on only one of those pipes. Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-03-23lib/tests: Extract fork helpersArkadiusz Hiler
Because of excessive 'copy and paste' we ended up with multiple copies of almost the same fork helper. This patch extracts the do_fork helper out and switches all the tests over to it. Additionally, preemptively I have extracted the more fancy fork helper that captures stderr/out + related functions out of igt_describe tests. Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-03-20lib/tests/igt_describe: Use __FILE__ in JUST_C_OUTPUT and DESCRIBE_ALL_OUTPUTLyude Paul
We currently manually specify the name of the source file by-hand here, however this causes problems if the user tries to build with compile flags like -fdebug-prefix-map since the source file names will then differ from what's hardcoded here - causing tests to fail. So, fix that by using __FILE__ instead. Signed-off-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-02-19tools: add i915 perf recorder toolLionel Landwerlin
A tool recording i915-perf data along with device description & timestamp correlation points for mapping data to CPU tracepoints. The format is mostly described in perf_data.h. v2: Autotools support Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Acked-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Petri Latvala <petri.latvala@intel.com>
2020-02-05lib: Kill residual children at the end of a subtestChris Wilson
Ensure that we tidy up all the excess children left behind by a failing subtest, we do not want them loitering into the next! v2: Behead the undead plague, and throw in a bonus lib/tests Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2019-11-19Rename dynamic subtest blocksPetri Latvala
The final naming for the magic block identifiers is: igt_subtest_with_dynamic("do-stuff-on-things") { for_each_thing(x) { igt_dynamic_f("%s", x->name) { do_stuff(x); } } } Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: Katarzyna Dec <katarzyna.dec@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-11-15lib/tests: Test that igt_describe works with dynamic subtestsPetri Latvala
v2: Also test that calling igt_describe in a dynamic context asserts Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-11-15lib/tests: Unit tests for dynamic subtestsPetri Latvala
Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-08-15lib/tests/igt_audio: silence uninitialized variable warningSimon Ser
GCC doesn't seem smart enough to figure out that everything is fine. Let's just initialize the variable to silence the warning. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-08-15lib/igt_kms: drop EDID_LENGTH, replace with EDID_BLOCK_SIZESimon Ser
EDID_LENGTH is misleading because EDIDs are a variable size (they contain one or more 128-byte EDID blocks). This commit renames it to EDID_BLOCK_SIZE which makes it clear users need to call edid_get_size to get the total size. The declaration has also been moved to igt_edid. ("Size" has been chosen over "length" because it's clearer that it's a number of bytes, not a number of elements) Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-08-15lib/igt_kms: use struct edid instead of unsigned charSimon Ser
This has several advantages: * No more need to convert back and forth between these two (everybody should use struct edid, the exception being lib/tests/igt_edid which performs sanity checks) * Makes it clearer that users can call edid_get_size on a returned EDID blob * Improves type safety (it's more obvious is a random blob is used as an EDID) Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-07-11lib/tests/igt_edid: check number of extensionsSimon Ser
Make sure we don't miss an extension by verifying the EDID field. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-07-11lib/igt_kms: add igt_kms_get_3d_edidSimon Ser
This replaces kmstest_edid_add_3d. The previous code for generating CEA extensions can be removed. The old and new generated EDIDs are byte-to-byte equal. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2019-07-08lib/igt_core: Add support for subtest descriptionsArkadiusz Hiler
This patch adds igt_description() which attaches a description to the following igt_subtest or igt_subtest_group block. Descriptions are accessible via './test --describe[=pattern]' Subtest description is its own igt_describe as well as igt_describes of all the parenting igt_subtest_groups, starting from the outermost scope. Examples of code and produced outputs are included in lib/test/igt_describe.c and as a documentation comment on igt_describe() macro. v2: address Simon's review Cc: Simon Ser <simon.ser@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Simon Ser <simon.ser@intel.com>
2019-07-05lib/igt_kms: use igt_edid to generate a 4K EDIDSimon Ser
The new EDID has been byte-by-byte checked to be exactly the same as before. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2019-06-12lib/tests/igt_audio: fix bad-function-cast warningSimon Ser
Cast a variable instead of the return value of the function. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-06-12lib/tests/igt_audio: add phaseshift detection testSimon Ser
Truncate a few samples in the middle of the signal, and make sure the detection fails. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-06-12lib/tests/igt_audio: add a test holding a sampleSimon Ser
Make sure holding a sample in the input signal makes audio_signal_detect fail. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-06-06lib/igt_core: reserve long options for individual testsLucas De Marchi
Start the core options from 500 so the individual tests can have their own options starting from 0. This makes it easier to set the long options without conflicting. 500 is just a magic number, higher than any ascii char that could be used in the individual test. While at it, fix the coding style to use tab rather than space. v2: also fix the test for conflicting args Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2019-06-04lib/igt_kms: introduce igt_kms_get_hdmi_audio_edidSimon Ser
This new function uses igt_edid to generate an EDID suitable for testing HDMI audio. It's imported from kms_chamelium with minor edits, it's used there and in kms_hdmi_inject. A (unexported for now) generate_hdmi_audio_edid function enables generation of EDIDs with arbitrary SAD and speaker blocks. This obsoletes kmstest_edid_add_audio. The sanity check for the HDMI audio EDID has been moved from lib/tests/igt_hdmi_inject.c to lib/tests/igt_edid.c. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-06-04lib/tests/igt_edid: introduce EDID sanity checksSimon Ser
The idea is to make sure we don't completely break EDIDs by performing some basic sanity-checking in lib tests. The test currently only checks the base and alt EDIDs. More EDIDs will be added in the future: HDMI audio, 4K, 3D and so on. The logic is mostly borrowed from lib/tests/igt_hdmi_inject.c. This patch is part of the "let's unify igt_edid and igt_hdmi_inject" series. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-06-04lib/tests/igt_audio: add test with an extra frequencySimon Ser
Make sure it fails. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-06-04lib/tests/igt_audio: add test with missing frequencySimon Ser
Make sure detection fails. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-06-04lib/igt_audio: add basic audio_signal_detect testsSimon Ser
This adds three basic library tests for igt_audio's audio_signal_detect: one that checks that detection works with the generated signal unchanged, and two that check that detection properly fails with a silent/noise input signal. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
2019-05-23lib/igt_core: Rework extra options conflicts handlingArkadiusz Hiler
This started simple, as a fixup for a warning: In file included from ../lib/drmtest.h:39, from ../lib/igt_core.c:60: ../lib/igt_core.c: In function ‘common_init’: ../lib/igt_core.h:891:24: warning: ‘%s’ directive argument is null [-Wformat-overflow=] 891 | #define igt_warn(f...) igt_log(IGT_LOG_DOMAIN, IGT_LOG_WARN, f) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/igt_core.c:704:4: note: in expansion of macro ‘igt_warn’ 704 | igt_warn("Conflicting long and short option values between --%s and -%s\n", | ^~~~~~~~ ../lib/igt_core.c:704:73: note: format string is defined here 704 | igt_warn("Conflicting long and short option values between --%s and -%s\n", | ^~ But it ended up doing the following things: 1. Promote all igt_warns to _critical and assert afterwards. 2. Use for loop instead of a while-doing-for's-job. 3. Streamline calculation of the option list sizes. 4. Add checks for long option names. 5. Log about "'val' representation" instead of confusing "value". 6. Log correct things so we won't %s on a NULL. 7. Write tests to confirm that it works. Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
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>