mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-10 01:16:18 +00:00
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>
This commit is contained in:
parent
9edf293c45
commit
2442f595d2
@ -34,6 +34,7 @@
|
|||||||
* 4. Test a crashing subtest preceeding a passing subtest is reported.
|
* 4. Test a crashing subtest preceeding a passing subtest is reported.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -57,11 +58,15 @@ bool runc;
|
|||||||
char test[] = "test";
|
char test[] = "test";
|
||||||
char *argv_run[] = { test };
|
char *argv_run[] = { test };
|
||||||
|
|
||||||
|
static void crashme(void)
|
||||||
|
{
|
||||||
|
raise(SIGSEGV);
|
||||||
|
}
|
||||||
|
|
||||||
static int do_fork(void)
|
static int do_fork(void)
|
||||||
{
|
{
|
||||||
int pid, status;
|
int pid, status;
|
||||||
int argc;
|
int argc;
|
||||||
void (*crashme)(void) = NULL;
|
|
||||||
|
|
||||||
switch (pid = fork()) {
|
switch (pid = fork()) {
|
||||||
case -1:
|
case -1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user