POSIX Signature Test for wait.h (GCI2018)
Joel Sherrill
joel at rtems.org
Wed Dec 12 21:21:53 UTC 2018
This is close but has a few minor things.
Initialize infop = {0} gets rid of compilation errors on Linux.
waitid() is not prototyped by RTEMS. File a POSIX-Compliance ticket for
this and put it in the section of methods tracked by tickets.
Add a blank line before the return.
No need to initailization a variable which is passed by address (&var).
Please tidy up and resubmit.
--joel
On Wed, Dec 12, 2018 at 3:14 AM Abhimanyu Raghuvanshi <
abhimanyuraghuvanshi29 at gmail.com> wrote:
> Patch attached
>
> ======================
> From 54e11c76b2e112c3b0e33838d0057b335d6d4e43 Mon Sep 17 00:00:00 2001
> From: ABR290B <abhimanyuraghuvanshi29 at gmail.com>
> Date: Wed, 12 Dec 2018 14:42:53 +0530
> Subject: [PATCH] POSIX Signature Test for wait.h (GCI2018)
>
> ---
> testsuites/psxtests/Makefile.am | 5 ++-
> testsuites/psxtests/psxhdrs/wait/wait.c | 35 ++++++++++++++++++++
> testsuites/psxtests/psxhdrs/wait/waitid.c | 38 ++++++++++++++++++++++
> testsuites/psxtests/psxhdrs/wait/waitpid.c | 38 ++++++++++++++++++++++
> 4 files changed, 115 insertions(+), 1 deletion(-)
> create mode 100644 testsuites/psxtests/psxhdrs/wait/wait.c
> create mode 100644 testsuites/psxtests/psxhdrs/wait/waitid.c
> create mode 100644 testsuites/psxtests/psxhdrs/wait/waitpid.c
>
> diff --git a/testsuites/psxtests/Makefile.am
> b/testsuites/psxtests/Makefile.am
> index 3dd8fe0139..1ad3078261 100644
> --- a/testsuites/psxtests/Makefile.am
> +++ b/testsuites/psxtests/Makefile.am
> @@ -1815,7 +1815,10 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
> psxhdrs/setjmp/longjmp.c \
> psxhdrs/setjmp/setjmp.c \
> psxhdrs/setjmp/siglongjmp.c \
> - psxhdrs/setjmp/sigsetjmp.c
> + psxhdrs/setjmp/sigsetjmp.c \
> + psxhdrs/wait/wait.c \
> + psxhdrs/wait/waitid.c \
> + psxhdrs/wait/waitpid.c
>
> ## Not supported by RTEMS, but POSIX API Compliance tests exist.
> ## lib_a_SOURCES += psxhdrs/ulimit/ulimit.c
> diff --git a/testsuites/psxtests/psxhdrs/wait/wait.c
> b/testsuites/psxtests/psxhdrs/wait/wait.c
> new file mode 100644
> index 0000000000..30408e86d3
> --- /dev/null
> +++ b/testsuites/psxtests/psxhdrs/wait/wait.c
> @@ -0,0 +1,35 @@
> +/**
> + * @file
> + * @brief wait() API Conformance Test
> + */
> +
> +/*
> + * COPYRIGHT (c) 2018.
> + * Abhimanyu Raghuvanshi
> + *
> + * Permission to use, copy, modify, and/or distribute this software
> + * for any purpose with or without fee is hereby granted.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
> + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
> + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
> AUTHOR
> + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
> + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
> + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
> + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
> SOFTWARE.
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
> +#include <sys/types.h>
> +#include <sys/wait.h>
> +
> +int test(void);
> +
> +int test(void)
> +{
> + int pid = 1234;
> + return wait(&pid) != -1;
> +}
> \ No newline at end of file
> diff --git a/testsuites/psxtests/psxhdrs/wait/waitid.c
> b/testsuites/psxtests/psxhdrs/wait/waitid.c
> new file mode 100644
> index 0000000000..8f20f24466
> --- /dev/null
> +++ b/testsuites/psxtests/psxhdrs/wait/waitid.c
> @@ -0,0 +1,38 @@
> +/**
> + * @file
> + * @brief waitid() API Conformance Test
> + */
> +
> +/*
> + * COPYRIGHT (c) 2018.
> + * Abhimanyu Raghuvanshi
> + *
> + * Permission to use, copy, modify, and/or distribute this software
> + * for any purpose with or without fee is hereby granted.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
> + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
> + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
> AUTHOR
> + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
> + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
> + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
> + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
> SOFTWARE.
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
> +#include <sys/types.h>
> +#include <sys/wait.h>
> +
> +int test(void);
> +
> +int test(void)
> +{
> + idtype_t P_PID = 1;
> + id_t id = 0;
> + siginfo_t infop = {0,0,0};
> + int pid = 1234;
> + return waitid(P_PID, id, &infop, pid) != -1;
> +}
> \ No newline at end of file
> diff --git a/testsuites/psxtests/psxhdrs/wait/waitpid.c
> b/testsuites/psxtests/psxhdrs/wait/waitpid.c
> new file mode 100644
> index 0000000000..4a95f8528e
> --- /dev/null
> +++ b/testsuites/psxtests/psxhdrs/wait/waitpid.c
> @@ -0,0 +1,38 @@
> +/**
> + * @file
> + * @brief waitpid() API Conformance Test
> + */
> +
> +/*
> + * COPYRIGHT (c) 2018.
> + * Abhimanyu Raghuvanshi
> + *
> + * Permission to use, copy, modify, and/or distribute this software
> + * for any purpose with or without fee is hereby granted.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
> + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
> + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
> AUTHOR
> + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
> + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
> + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
> + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
> SOFTWARE.
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
> +#include <sys/types.h>
> +#include <sys/wait.h>
> +
> +int test(void);
> +
> +int test(void)
> +{
> + pid_t pid = 2;
> + int WEXITSTATUS = 1;
> + int wcontinued = 0;
> +
> + return waitpid(pid, &WEXITSTATUS, wcontinued) != -1;
> +}
> \ No newline at end of file
> --
> 2.19.1.windows.1
> =====================================
>
>
> ABR
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20181212/342ad283/attachment-0002.html>
More information about the devel
mailing list