* [LTP] [PATCH 1/2] gettimeofday01: Convert to new API
@ 2023-12-18 6:21 Yang Xu
2023-12-18 6:21 ` [LTP] [PATCH 2/2] gettimeofday02: Convert docs to docparse Yang Xu
2023-12-18 8:47 ` [LTP] [PATCH 1/2] gettimeofday01: Convert to new API Li Wang
0 siblings, 2 replies; 7+ messages in thread
From: Yang Xu @ 2023-12-18 6:21 UTC (permalink / raw)
To: ltp
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
.../syscalls/gettimeofday/gettimeofday01.c | 103 ++----------------
1 file changed, 12 insertions(+), 91 deletions(-)
diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c
index f9acb9665..84e98fd9a 100644
--- a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c
+++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c
@@ -1,107 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
*
* Copyright (c) International Business Machines Corp., 2001
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- * the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Copyright (c) Linux Test Project, 2001-2023
*/
-/*
- * NAME
- * gettimeofday01.c
- *
+/*\
* DESCRIPTION
- * Testcase to check that gettimeofday(2) sets errno to EFAULT.
- *
- * ALGORITHM
- * Call gettimeofday() with an invalid buffer, and expect EFAULT to be
- * set in errno.
*
- * HISTORY
- * 07/2001 Ported by Wayne Boyer
+ * Test for EFAULT error.
*
- * RESTRICTIONS
- * NONE
+ * - gettimeofday fail with EFAULT when one of tv or tz pointed outside the accessible
+ * address space
*/
-#include <sys/time.h>
-#include <errno.h>
-#include "test.h"
-#include <unistd.h>
+#include "tst_test.h"
#include "lapi/syscalls.h"
-char *TCID = "gettimeofday01";
-int TST_TOTAL = 1;
-
-#if !defined UCLINUX
-
-void cleanup(void);
-void setup(void);
-
-int main(int ac, char **av)
-{
- int lc;
- int ret;
-
- tst_parse_opts(ac, av, NULL, NULL);
-
- setup();
-
- for (lc = 0; TEST_LOOPING(lc); lc++) {
- tst_count = 0;
-
- TEST(tst_syscall(__NR_gettimeofday, (void *)-1, (void *)-1));
-
- /* gettimeofday returns an int, so we need to turn the long
- * TEST_RETURN into an int to test with */
- ret = TEST_RETURN;
- if (ret != -1) {
- tst_resm(TFAIL,
- "call succeeded unexpectedly (got back %i, wanted -1)",
- ret);
- continue;
- }
-
- if (TEST_ERRNO == EFAULT)
- tst_resm(TPASS,
- "gettimeofday(2) set the errno EFAULT correctly");
- else
- tst_resm(TFAIL,
- "gettimeofday(2) didn't set errno to EFAULT, errno=%i (%s)",
- errno, strerror(errno));
- }
-
- cleanup();
- tst_exit();
-}
-
-void setup(void)
-{
-
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- TEST_PAUSE;
-}
-
-void cleanup(void)
+static void verify_gettimeofday(void)
{
+ TST_EXP_FAIL(tst_syscall(__NR_gettimeofday, (void *)-1, (void *)-1), EFAULT);
}
-#else
-int main(void)
-{
- tst_brkm(TCONF, "gettimeofday EFAULT check disabled on uClinux");
-}
-#endif
+static struct tst_test test = {
+ .test_all = verify_gettimeofday,
+};
--
2.39.3
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread* [LTP] [PATCH 2/2] gettimeofday02: Convert docs to docparse
2023-12-18 6:21 [LTP] [PATCH 1/2] gettimeofday01: Convert to new API Yang Xu
@ 2023-12-18 6:21 ` Yang Xu
2023-12-18 8:47 ` Li Wang
2023-12-18 12:45 ` Petr Vorel
2023-12-18 8:47 ` [LTP] [PATCH 1/2] gettimeofday01: Convert to new API Li Wang
1 sibling, 2 replies; 7+ messages in thread
From: Yang Xu @ 2023-12-18 6:21 UTC (permalink / raw)
To: ltp
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
index 7c462cc29..fcd027df5 100644
--- a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
+++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
@@ -4,13 +4,12 @@
* Copyright (C) 2017 Cyril Hrubis <chrubis@suse.cz>
*/
-/*
+/*\
* DESCRIPTION
- * Check if gettimeofday is monotonous
+ * Check if gettimeofday is monotonous during 10s
*
- * ALGORITHM
- * Call gettimeofday() to get a t1 (fist value)
- * call it again to get t2, see if t2 < t1, set t2 = t1, repeat for 10 sec
+ * - Call gettimeofday() to get a t1 (fist value)
+ * - Call it again to get t2, see if t2 < t1, set t2 = t1, repeat for 10 sec
*/
#include <stdint.h>
--
2.39.3
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 2/2] gettimeofday02: Convert docs to docparse
2023-12-18 6:21 ` [LTP] [PATCH 2/2] gettimeofday02: Convert docs to docparse Yang Xu
@ 2023-12-18 8:47 ` Li Wang
2023-12-18 12:45 ` Petr Vorel
1 sibling, 0 replies; 7+ messages in thread
From: Li Wang @ 2023-12-18 8:47 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
Reviewed-by: Li Wang <liwang@redhat.com>
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 2/2] gettimeofday02: Convert docs to docparse
2023-12-18 6:21 ` [LTP] [PATCH 2/2] gettimeofday02: Convert docs to docparse Yang Xu
2023-12-18 8:47 ` Li Wang
@ 2023-12-18 12:45 ` Petr Vorel
2023-12-19 2:07 ` Yang Xu (Fujitsu)
1 sibling, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2023-12-18 12:45 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
> testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
> diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
> index 7c462cc29..fcd027df5 100644
> --- a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
> +++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
> @@ -4,13 +4,12 @@
> * Copyright (C) 2017 Cyril Hrubis <chrubis@suse.cz>
> */
> -/*
> +/*\
> * DESCRIPTION
FYI this needs to be [Description] to have unified formatting in generated docs
(bold). I fixed it together with gettimeofday01.c.
Kind regards,
Petr
> - * Check if gettimeofday is monotonous
> + * Check if gettimeofday is monotonous during 10s
> *
> - * ALGORITHM
> - * Call gettimeofday() to get a t1 (fist value)
> - * call it again to get t2, see if t2 < t1, set t2 = t1, repeat for 10 sec
> + * - Call gettimeofday() to get a t1 (fist value)
> + * - Call it again to get t2, see if t2 < t1, set t2 = t1, repeat for 10 sec
> */
> #include <stdint.h>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 2/2] gettimeofday02: Convert docs to docparse
2023-12-18 12:45 ` Petr Vorel
@ 2023-12-19 2:07 ` Yang Xu (Fujitsu)
0 siblings, 0 replies; 7+ messages in thread
From: Yang Xu (Fujitsu) @ 2023-12-19 2:07 UTC (permalink / raw)
To: pvorel@suse.cz; +Cc: ltp@lists.linux.it
Hi Petr,
>> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>> ---
>> testcases/kernel/syscalls/gettimeofday/gettimeofday02.c | 9 ++++-----
>> 1 file changed, 4 insertions(+), 5 deletions(-)
>
>> diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
>> index 7c462cc29..fcd027df5 100644
>> --- a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
>> +++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
>> @@ -4,13 +4,12 @@
>> * Copyright (C) 2017 Cyril Hrubis <chrubis@suse.cz>
>> */
>
>> -/*
>> +/*\
>> * DESCRIPTION
> FYI this needs to be [Description] to have unified formatting in generated docs
> (bold). I fixed it together with gettimeofday01.c.
>
Thanks, I will pay attention next time.
Best Regards
Yang Xu
> Kind regards,
> Petr
>
>> - * Check if gettimeofday is monotonous
>> + * Check if gettimeofday is monotonous during 10s
>> *
>> - * ALGORITHM
>> - * Call gettimeofday() to get a t1 (fist value)
>> - * call it again to get t2, see if t2 < t1, set t2 = t1, repeat for 10 sec
>> + * - Call gettimeofday() to get a t1 (fist value)
>> + * - Call it again to get t2, see if t2 < t1, set t2 = t1, repeat for 10 sec
>> */
>
>> #include <stdint.h>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 1/2] gettimeofday01: Convert to new API
2023-12-18 6:21 [LTP] [PATCH 1/2] gettimeofday01: Convert to new API Yang Xu
2023-12-18 6:21 ` [LTP] [PATCH 2/2] gettimeofday02: Convert docs to docparse Yang Xu
@ 2023-12-18 8:47 ` Li Wang
2023-12-18 9:31 ` Yang Xu (Fujitsu)
1 sibling, 1 reply; 7+ messages in thread
From: Li Wang @ 2023-12-18 8:47 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
On Mon, Dec 18, 2023 at 4:16 PM Yang Xu <xuyang2018.jy@fujitsu.com> wrote:
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>
Reviewed-by: Li Wang <liwang@redhat.com>
But I would suggest adding more coverage on ERRORS in this test.
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-12-19 2:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-18 6:21 [LTP] [PATCH 1/2] gettimeofday01: Convert to new API Yang Xu
2023-12-18 6:21 ` [LTP] [PATCH 2/2] gettimeofday02: Convert docs to docparse Yang Xu
2023-12-18 8:47 ` Li Wang
2023-12-18 12:45 ` Petr Vorel
2023-12-19 2:07 ` Yang Xu (Fujitsu)
2023-12-18 8:47 ` [LTP] [PATCH 1/2] gettimeofday01: Convert to new API Li Wang
2023-12-18 9:31 ` Yang Xu (Fujitsu)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.