summaryrefslogtreecommitdiff
path: root/lib/igt_core.c
AgeCommit message (Collapse)Author
2015-04-14lib: use a critical warning when unable to open a data fileThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-14lib: use test failure status for igt_set_timeoutThomas Wood
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-14lib: add a define for test failure exit statusThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-02tests: install test programs to libexecJoonas Lahtinen
Install the test programs by default so that they can be packaged. Tested with the testdisplay test so that it still runs after the modifications as it depends on a data file to be present. Need to pass -r option to enable QR code display on success (PNG data file). Packaging is useful when building a complete software stack for a DUT from scratch. This should bring us closer to achieving a built-from-scratch testing workflow. Package maintainers can always decide to ignore the installed files. v2: - Install more tests including scripts and their data v3: - Add clarification to commit message about why we do this. (Chris Wilson & Thomas Wood) - Change libexec into pkglibexec to comply to standard (Thomas Wood) - Do not install $(common_files). (Thomas Wood) - Make it really obvious the installed files are tests by using tests directory name to avoid any confusion with packagers. v4: - Fixed commit message. v5: - Add file locator helper to retain backwards compatibility. (Thomas Wood) - Test with testdisplay -r option that draws the .png file. Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Thomas Wood <thomas.wood@intel.com> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-26igt.cocci: check the return values of various functionsThomas Wood
Add rules to fix unused-result warnings when compiling with _FORTIFY_SOURCE defined and apply them to the library and tests. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-26lib: print a stack trace when a test assertion failsThomas Wood
Add an optional dependency on libunwind to print stack traces when a test assertion fails. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-26igt/gem_concurrent_blit: Separate out the combinatorial explosionChris Wilson
Apparently nobody else likes testing and debugging GEM coherency issues. However, this also means that QA is skipping these vital tests. Split out a set of canaries into igt/gem_concurrent_blit and keep the rest in igt/gem_concurrent_all. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89497 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-26lib/core: Silence internally used signalsChris Wilson
We use SIGTERM to kill off child processes. We use it a lot. Reporting everytime we use it is just spam. Treat the similar user signals (SIGINT, SIGQUIT and the should-never-have-been SIGPIPE) similarly to reduce noise. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Thomas Wood <thomas.wood@intel.com>
2015-03-23lib/core: add interactive debug point to igt_failDaniel Vetter
Useful for inspecting the screen state in kms tests when they fail. Also move the screen clearing in kms_cursor_crc to the bottom. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-03-12lib: move igt_interactive_debug into igt_core.cThomas Wood
igt_interactive_debug should be defined in igt_core.c, rather than the header, to avoid it being defined more than once. Reported-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-06lib/core: Make the start of the debug output more clearChris Wilson
I missed the quiet "Log start" between the test failure and the debug output (and so was very confused by the repetition). You have to shout at me! v2: Thomas suggested I make the end of the logging clear as well. Since I completely missed that there was a end marker, he must be right! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Thomas Wood <thomas.wood@intel.com>
2015-02-27lib/igt_core: don't add newlines in logging functionsDaniel Vetter
igt_kms extensively uses line continuation when dumping state updates at the debug level. They got badly mangled with the recent changes to for the log handling functions. Two separate fixes: - Don't prepend domain and other metainformation when it's just a continuation line. - Dont add newlines when dumping the log recorder. If someone interleaves different log level messages this will go awry, but really just don't do that. Cc: Thomas Wood <thomas.wood@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-02-25lib: print the signal name to stderr when handling a signalThomas Wood
Print the received signal name to stderr when handling a signal. This uses an array of handled signal names since strsignal() only provides descriptions. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-25lib: remove handled option arguments from argvThomas Wood
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-25lib: use defines for igt_simple_init and igt_subtest_initThomas Wood
Using defines removes an extra function call and prepares for changes to the command line argument handling. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-17lib: print recent log messages to stderr when a test or subtest failsThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-17lib: add a ring buffer for log entriesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-09lib: add exit status message to simple testsThomas Wood
Add an exit status message to simple tests, similar to the one printed for subtests. This includes the test outcome and the time taken to run the test. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-09lib: add subtest start and exit status code messages to debug outputThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-09lib: validate subtest namesThomas Wood
Subtest names should only contain '-', '_' and alphanumeric characters. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-09lib: print warning and critical messages when listing subtestsThomas Wood
These messages are sent to stderr and could indicate an issue when enumerating subtests. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-09lib: warning messages should be sent to stderrThomas Wood
This is a regression from commit df11a0f (lib: add a critical warning level). Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-01-20lib: s/IGT_DEBUG_INTERACTIVE/--interactive-debug=varRodrigo Vivi
Use cmdline variable for interactive debug instead of env var. v2: Make interactive-debug domain optional and use "all" when not set. Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-01-16lib: use critical log level for assertion failure messagesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-01-16lib: add a critical warning levelThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-01-06Don't try to use CLOCK_MONOTONIC_COARSE on OS'es that don't support itAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-01-06Provide sighandler_t fallback for non-GNU-libc platformsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-01-06Need to #include <libgen.h> for basename() on SolarisAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-01-06Use pthread calls instead of raw syscalls on non-Linux systemsAlan Coopersmith
Raw system calls aren't portable to other kernels. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-01-05lib/core: Fix compile error from rebasingChris Wilson
s/KMSG_INFO/KERN_INFO/ Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-05lib/core: Show the exitcode in kmsg as wellChris Wilson
This provides symmetry with logging the start of the test via kmsg. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-12lib: fix a few documentation warningsThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-12-11lib: add optional log domain filteringThomas Wood
v2: add an "application" filter for the default domain (used by applications) Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-12-11lib: introduce log domainsThomas Wood
Log domains can be used to identify the source of log messages, such as the test being run or the helper library. v2: Add separate domains for different parts of the helper library and use an empty default domain for applications. Expand the log output to include the process name and the log level of the message in addition to the domain and pid. Print the expanded message only for warning and debug messages. v3: check for glibc before using program_invocation_short_name Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-12-04docs: add a glossary of test name termsThomas Wood
Add a glossary of test name terms based on the details in tests/NAMING-CONVENTION. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-25lib: ensure subtests are not added to simple testsThomas Wood
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-13lib: only skip subsequent tests if a timeout occurs outside of a subtestThomas Wood
Make timeout behaviour more consistent with igt_fail, where subsequent subtests are only skipped if the failure occurs outside of a subtest. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85718 Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-06lib: add the ability to include a description with a testThomas Wood
The IGT_TEST_DESCRIPTION macro can be used to define a description for a test. v2: Remove semicolon from end of macro (Damien Lespiau) Add API documentation for the macro. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-10-01lib/igt_core.c: disable lowmemorykiller during testsTim Gore
Several IGT tests cycle through a lot of GEM memory and when running these tests on Android they tend to get killed by the lowmemorykiller. The lowmemorykiller really is not usefull in this context and is just preventing the test from doing its job. This commit adds a function to disable the lowmemorykiller by writing "9999" to its oom adj parameter, which means it will never "select" any process to kill. The normal linux oom killer is still there to protect the kernel. The low memory killer is disabled during the common init function and then re-enabled by the exit handler. To make this work for single tests the exit handler is now installed in the common init function also so that it is invoked for all tests. This is just a hack to get round the fact that the i915 driver uses the concept of purgeable memory which is not understood by the lowmemorykiller. If this ever gets fixed then this patch can be removed. Signed-off-by: Tim Gore <tim.gore@intel.com> [danvet: A bit of polish (coding style, static and rename check_igt_exit to common_exit_handler, drop the is_disabled check since we only call this once now).] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-09-30lib: ensure any buffers are flushed before forkThomas Wood
Flush any buffers before forking to prevent duplicated output. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-09-30doc: various spelling and typo fixesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-09-29lib/igt_core: make single/simple tests use igt_exitTim Gore
Currently tests that use igt_simple_main will simply call "exit()" if they pass, making it difficult to ensure that any required cleanup is done. At present this is not an issue, but it will be when I submit a patch to turn off the lowmemorykiller for all tests. Signed-off-by: Tim Gore <tim.gore@intel.com> [danvet: Also update api docs.] Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2014-09-06core: Display subtest walltimeChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-04igt_core: zero exit_handler_count before forkingPaulo Zanoni
If we don't reset exit_handler_count before forking, we may have a case where the forked process is killed before it even does "exit_handler_count = 0": in that case, it is still finishing forking. When that happens, we may end up calling our exit handlers. On the specific bug I'm investigating, we call igt_reset_connnectors(), which ends up in a deadlock inside malloc_atfork. If we attach gdb to the forked process and get a backtrace, we have: (gdb) bt 0 __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95 1 0x00007f15634d36bf in _L_lock_10524 () from /lib/x86_64-linux-gnu/libc.so.6 2 0x00007f15634d12ef in malloc_atfork (sz=139729840351352, caller=<optimized out>) at arena.c:181 3 0x00007f15640466a1 in drmMalloc () from /usr/lib/x86_64-linux-gnu/libdrm.so.2 4 0x00007f1564049ad7 in drmModeGetResources () from /usr/lib/x86_64-linux-gnu/libdrm.so.2 5 0x0000000000408f84 in igt_reset_connectors () at igt_kms.c:1656 6 0x00000000004092dc in call_exit_handlers (sig=15) at igt_core.c:1130 7 fatal_sig_handler (sig=15) at igt_core.c:1154 8 <signal handler called> 9 0x00007f15634cce60 in ptmalloc_unlock_all2 () at arena.c:298 10 0x00007f156350ca3f in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/x86_64/../fork.c:188 11 0x000000000040a029 in __igt_fork_helper (proc=proc@entry=0x610fc4 <signal_helper>) at igt_core.c:910 12 0x000000000040459d in igt_fork_signal_helper () at igt_aux.c:110 13 0x0000000000402ab7 in __real_main63 () at bug.c:76 14 0x000000000040296e in main (argc=<optimized out>, argv=<optimized out>) at bug.c:63 After doing some searches for "stuck at malloc_atfork", it seems to me we probably shouldn't be doing any malloc calls at this point of the code, so the best way to do that is to make sure we can't really run the exit handlers. So on this patch, instead of resetting the exit handlers after forking, we reset them before forking, and then restore the original value on the parent process. I can reproduce this problem by running "./kms_flip --run-subtest 2x-flip-vs-modeset" under an infinite loop. Usually after a few hundred calls, we end up stuck on the deadlock mentioned above. QA says this problem happens every time, but I'm not sure what is the difference between our environments that makes the race condition so much easier for them. The kms_flip.c problem can be considered a regression introduced by: commit eef768f283466b6d7cb3f08381f72ccf3951dc99 Author: Thomas Wood <thomas.wood@intel.com> Date: Wed Jun 18 14:28:43 2014 +0100 tests: enable extra connectors in kms_flip and kms_pipe_crc_basic even though this commit is not the one that introduced the real problem. It is also possible to reproduce this problem with a few modifications to template.c: - Add a call to igt_enable_connectors() inside the first fixture. - Add igt_fork_signal_helper() and igt_stop_signal_helper() calls around subtest B. Note that the crucial piece is that the parent actively kills helper children, and if we skip tests this can happen _really_ fast. See e.g. commit a031a1bf93b828585e7147f06145fc5030814547 Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Fri Sep 13 16:43:22 2013 +0200 lib/drmtest: ducttape over fork race for past hilarity in this area. Cc: Thomas Wood <thomas.wood@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81367 Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-07-30core: Add all kernel log levelsChris Wilson
And notice that INFO is 6 not 5. This is because I had intended to use KERN_NOTICE anyway... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-30lib: check test options for conflictsThomas Wood
Check any test specific options for conflicts with the standard set of options. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-30lib: avoid getopt value conflicts with testsThomas Wood
Most tests use a printable character as the value for getopt to return, so avoid conflicts by using non-printing values for the standard options. v2: fix "-h" short option Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-25core: Inject program name into dmesgChris Wilson
Write the program name if !list_only so that we associate oops with simple tests. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-25core: Improve phrasing for test requirementsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-24core: Inject subtest message into dmesgChris Wilson
One of the side-effects we test for are kernel oops and knowing the guilty subtest can help speed up debugging. We can write to /dev/kmsg to inject messages into dmesg, so let's do so before the start of every test. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>