[PATCH 3/3] tests: add pause.test

Dmitry V. Levin ldv at altlinux.org
Thu Apr 28 01:56:58 UTC 2016


On Wed, Apr 27, 2016 at 04:54:21PM +0800, Fei Jie wrote:
> * tests/pause.c: New file.
> * tests/pause.test: New test.
> * tests/.gitignore: Add pause.
> * tests/Makefile.am (check_PROGRAMS): Likewise.
> (DECODER_TESTS): Add pause.test.

Thanks.  I've applied a heavily edited version of this test.

[...]
> diff --git a/tests/pause.c b/tests/pause.c
> new file mode 100644
> index 0000000..286b6ca
> --- /dev/null
> +++ b/tests/pause.c
> @@ -0,0 +1,32 @@
> +#include "tests.h"
> +#include <sys/syscall.h>
> +
> +#ifdef __NR_pause
> +
> +# include <signal.h>
> +# include <stdio.h>
> +# include <unistd.h>
> +
> +void
> +sig_handler(int sig)
> +{
> +}
> +
> +int
> +main(void)
> +{
> +    signal(SIGALRM, sig_handler);

What if this signal is blocked?

> +    alarm(3);

Why 3?

> +    pause();
> +    printf("pause() = ? ERESTARTNOHAND"
> +	       " (To be restarted if no handler)\n");

-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160428/2523515b/attachment.bin>


More information about the Strace-devel mailing list