* [LTP] [PATCH] snd_timer: check if file /dev/snd/timer exist before opening
@ 2019-07-17 7:21 Li Wang
2019-07-17 9:03 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Li Wang @ 2019-07-17 7:21 UTC (permalink / raw)
To: ltp
1. check if /dev/snd/timer exist
2. add tst_fzsync_pair_reset(&fzsync_pair, NULL) to reset variables
needed by fzsync. Especially for pair->exec_time_start, we use it to
control the test time in case that the execution loops timed out on
slow machine.
Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Michael Moese <mmoese@suse.de>
---
testcases/kernel/sound/snd_timer01.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/sound/snd_timer01.c b/testcases/kernel/sound/snd_timer01.c
index 36f0ce9fd..f62696659 100644
--- a/testcases/kernel/sound/snd_timer01.c
+++ b/testcases/kernel/sound/snd_timer01.c
@@ -67,6 +67,9 @@ static void *ioctl_thread(void *unused)
static void setup(void)
{
+ if(access("/dev/snd/timer", F_OK))
+ tst_brk(TCONF, "The file '/dev/snd/timer' is not exist");
+
tst_fzsync_pair_init(&fzsync_pair);
tst_taint_init(TST_TAINT_W | TST_TAINT_D);
snd_fd = SAFE_OPEN("/dev/snd/timer",
@@ -75,7 +78,8 @@ static void setup(void)
static void cleanup(void)
{
- SAFE_CLOSE(snd_fd);
+ if (snd_fd > 0)
+ SAFE_CLOSE(snd_fd);
}
static void run(void)
@@ -95,6 +99,7 @@ static void run(void)
iov.iov_base = read_buf;
iov.iov_len = sizeof(read_buf) - 1;
+ tst_fzsync_pair_reset(&fzsync_pair, NULL);
while (tst_fzsync_run_a(&fzsync_pair)) {
nz = 0;
memset(read_buf, 0, sizeof(read_buf));
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH] snd_timer: check if file /dev/snd/timer exist before opening
2019-07-17 7:21 [LTP] [PATCH] snd_timer: check if file /dev/snd/timer exist before opening Li Wang
@ 2019-07-17 9:03 ` Cyril Hrubis
2019-07-17 9:27 ` Li Wang
0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2019-07-17 9:03 UTC (permalink / raw)
To: ltp
Hi!
> 1. check if /dev/snd/timer exist
>
> 2. add tst_fzsync_pair_reset(&fzsync_pair, NULL) to reset variables
> needed by fzsync. Especially for pair->exec_time_start, we use it to
> control the test time in case that the execution loops timed out on
> slow machine.
This is obviously OK, acked.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] snd_timer: check if file /dev/snd/timer exist before opening
2019-07-17 9:03 ` Cyril Hrubis
@ 2019-07-17 9:27 ` Li Wang
0 siblings, 0 replies; 3+ messages in thread
From: Li Wang @ 2019-07-17 9:27 UTC (permalink / raw)
To: ltp
On Wed, Jul 17, 2019 at 5:03 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> Hi!
> > 1. check if /dev/snd/timer exist
> >
> > 2. add tst_fzsync_pair_reset(&fzsync_pair, NULL) to reset variables
> > needed by fzsync. Especially for pair->exec_time_start, we use it to
> > control the test time in case that the execution loops timed out on
> > slow machine.
>
> This is obviously OK, acked.
>
Pushed, thanks.
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190717/f7ff84db/attachment.htm>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-17 9:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-17 7:21 [LTP] [PATCH] snd_timer: check if file /dev/snd/timer exist before opening Li Wang
2019-07-17 9:03 ` Cyril Hrubis
2019-07-17 9:27 ` Li Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox