Skip to contentSkip to conversation

snd_timer: check if file /dev/snd/timer exist before opening

PATCH New Li Wang 2 participants 3 messages Jul 17, 2019

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 snd_timer: check if file /dev/snd/timer exist before opening

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.

Cc Michael Moese <[email protected]>
---
 testcases/kernel/sound/snd_timer01.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
testcases/kernel/sound/snd_timer01.c +6 -1
index 36f0ce9fd..f62696659 100644
@@ -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));
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 snd_timer: check if file /dev/snd/timer exist before opening

Hi!

Quoted 6 lines

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.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#2 lore raw

PATCH 1/1 snd_timer: check if file /dev/snd/timer exist before opening

Quoted 10 lines · Cyril Hrubis

Hi!

Quoted 6 lines

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.

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190717/f7ff84db/attachment.htm>