mirror of
https://github.com/ivabus/pantry
synced 2024-11-22 08:25:07 +03:00
new file: projects/gnu.org/libsigsegv/package.yml
new file: projects/gnu.org/libsigsegv/test.c
This commit is contained in:
parent
4df2a7c427
commit
fdbfd24285
2 changed files with 61 additions and 0 deletions
26
projects/gnu.org/libsigsegv/package.yml
Normal file
26
projects/gnu.org/libsigsegv/package.yml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
distributable:
|
||||||
|
url: https://ftp.gnu.org/gnu/libsigsegv/libsigsegv-{{version.marketing}}.tar.gz
|
||||||
|
strip-components: 1
|
||||||
|
versions:
|
||||||
|
url: https://ftp.gnu.org/gnu/libsigsegv/
|
||||||
|
match: /libsigsegv-(\d+\.\d+(\.\d+)?).tar.gz/
|
||||||
|
strip:
|
||||||
|
- /^libsigsegv-/
|
||||||
|
- /\.tar\.gz$/
|
||||||
|
build:
|
||||||
|
script:
|
||||||
|
- ./configure $ARGS
|
||||||
|
- make --jobs {{hw.concurrency}}
|
||||||
|
- make --jobs {{hw.concurrency}} check
|
||||||
|
- make --jobs {{hw.concurrency}} install
|
||||||
|
env:
|
||||||
|
ARGS:
|
||||||
|
- --disable-debug
|
||||||
|
- --disable-dependency-tracking
|
||||||
|
- --prefix={{prefix}}
|
||||||
|
- --libdir={{prefix}}/lib
|
||||||
|
- --enable-shared
|
||||||
|
- --enable-relocatable
|
||||||
|
test:
|
||||||
|
- cc test.c -lsigsegv -o test
|
||||||
|
- ./test | grep 'Test passed'
|
35
projects/gnu.org/libsigsegv/test.c
Normal file
35
projects/gnu.org/libsigsegv/test.c
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#include "sigsegv.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
const char *null_pointer = NULL;
|
||||||
|
static int
|
||||||
|
handler(void *fault_address, int serious)
|
||||||
|
{
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
if (open(null_pointer, O_RDONLY) != -1 || errno != EFAULT)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "EFAULT not detected alone");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sigsegv_install_handler(&handler) < 0)
|
||||||
|
exit(2);
|
||||||
|
|
||||||
|
if (open(null_pointer, O_RDONLY) != -1 || errno != EFAULT)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "EFAULT not detected with handler");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Test passed");
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue