From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/4] syscalls/sync01: Remove it
Date: Thu, 12 Nov 2020 11:43:23 +0100 [thread overview]
Message-ID: <20201112104323.GE11365@yuki.lan> (raw)
In-Reply-To: <20201111182557.GA22242@pevik>
Hi!
> > I see no downside in checking for this unexpected negative value,
> > except copy/pasting this test condition in every syscall testcase.
>
> > I don't know the LTP codebase well enough yet, but what would you say
> > is a good way to have this somewhere in the library. A TEST_SYSCALL
> > macro, or something else, which fails if the return value is < -1?
> LGTM. I was thinking about adding it directly into TEST() and define _TEST()
> which would not do that and be used in that few cases which ret < -1 is valid,
> but that would be ugly.
Well it would have to be a set of macros at least since:
* There are different classes of functions by return values
* We have possitive and negative testcases
For example we would have to have two macros for functions that return
file descriptors, one for a cases where we expect the function to return
a valid file descriptor and one when we expect the function to fail.
So it would look like:
TEST_FD(open("/foo/bar", O_RDONLY));
or:
TEST_FAIL(open((void*)-1, O_RDONLY));
The TEST_FD() macro would fail the test if the return value is < 0
And the TEST_FAIL() will fail the test unless we the return value is set
to -1. Maybe we can even have a version with errno as well something as:
TEST_FAIL_ERR(open((void*)-1, O_RDONLY), EFAULT);
--
Cyril Hrubis
chrubis@suse.cz
prev parent reply other threads:[~2020-11-12 10:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-26 5:48 [LTP] [PATCH 1/4] syscalls/sync01: Remove it Yang Xu
2020-10-26 5:48 ` [LTP] [PATCH 2/4] syscalls/sync02: " Yang Xu
2020-10-26 5:48 ` [LTP] [PATCH 3/4] syscalls/sync03: Remove useless judgement Yang Xu
2020-10-26 5:48 ` [LTP] [PATCH 4/4] syscalls/sync: Rename sync03.c to sync01.c Yang Xu
2020-11-04 3:06 ` [LTP] [PATCH 1/4] syscalls/sync01: Remove it Yang Xu
2020-11-06 12:36 ` Cyril Hrubis
2020-11-06 16:14 ` Xiao Yang
2020-11-06 16:47 ` Cyril Hrubis
2020-11-06 23:46 ` Xiao Yang
2020-11-07 0:53 ` Yang Xu
2020-11-07 16:55 ` Petr Vorel
2020-11-09 3:56 ` Xiao Yang
2020-11-09 6:37 ` Petr Vorel
2020-11-09 12:42 ` Cyril Hrubis
2020-11-09 18:15 ` Radoslav Kolev
2020-11-11 18:25 ` Petr Vorel
2020-11-12 10:43 ` Cyril Hrubis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201112104323.GE11365@yuki.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.