git: 41e03b46dab4 - main - stress2: Fix warning about unused variable. Remove debug "date"

From: Peter Holm <pho_at_FreeBSD.org>
Date: Fri, 16 Aug 2024 07:20:40 UTC
The branch main has been updated by pho:

URL: https://cgit.FreeBSD.org/src/commit/?id=41e03b46dab43dfb30b025302ec2df52c8f34d04

commit 41e03b46dab43dfb30b025302ec2df52c8f34d04
Author:     Peter Holm <pho@FreeBSD.org>
AuthorDate: 2024-08-16 07:19:51 +0000
Commit:     Peter Holm <pho@FreeBSD.org>
CommitDate: 2024-08-16 07:19:51 +0000

    stress2: Fix warning about unused variable. Remove debug "date"
---
 tools/test/stress2/misc/sigreturn3.sh | 5 ++---
 tools/test/stress2/misc/sigreturn4.sh | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/tools/test/stress2/misc/sigreturn3.sh b/tools/test/stress2/misc/sigreturn3.sh
index fbb19d87cb6e..271ade287e9a 100755
--- a/tools/test/stress2/misc/sigreturn3.sh
+++ b/tools/test/stress2/misc/sigreturn3.sh
@@ -56,6 +56,7 @@ cat > /tmp/$prog.c <<EOF
 #include <fcntl.h>
 #include <libutil.h>
 #include <pthread.h>
+#include <pthread_np.h>
 #include <pwd.h>
 #include <signal.h>
 #include <stdio.h>
@@ -92,10 +93,9 @@ static void *
 calls(void *arg __unused)
 {
 	time_t start;
-	int i;
 
 	start = time(NULL);
-	for (i = 0; time(NULL) - start < 10; i++) {
+	while (time(NULL) - start < 10) {
 		arc4random_buf(r, sizeof(r));
 		alarm(1);
 		syscall(SYS_sigreturn, r);
@@ -176,7 +176,6 @@ cc -o $prog -Wall -Wextra -O0 $prog.c -lpthread || exit 1
 start=`date +%s`
 while [ $((`date +%s` - start)) -lt 300 ]; do
 	./$prog > /dev/null 2>&1
-	date +%T
 done
 rm -f /tmp/$prog /tmp/$ptog.c /tmp/$prog.core
 exit 0
diff --git a/tools/test/stress2/misc/sigreturn4.sh b/tools/test/stress2/misc/sigreturn4.sh
index f7916dc3b1ee..9e2a6a32715c 100755
--- a/tools/test/stress2/misc/sigreturn4.sh
+++ b/tools/test/stress2/misc/sigreturn4.sh
@@ -110,10 +110,10 @@ calls(void *arg __unused)
 {
 	time_t start;
 	ucontext_t uc;
-	int i, n;
+	int n;
 
 	start = time(NULL);
-	for (i = 0; time(NULL) - start < 10; i++) {
+	while (time(NULL) - start < 10) {
 		n = 0;
 		if (getcontext(&uc) == -1)
 			err(1, "getcontext");
@@ -202,7 +202,6 @@ cc -o $prog -Wall -Wextra -O0 $prog.c -lpthread || exit 1
 start=`date +%s`
 while [ $((`date +%s` - start)) -lt 300 ]; do
 	./$prog > /dev/null 2>&1
-	date +%T
 done
 rm -f /tmp/$prog /tmp/$ptog.c /tmp/$prog.core
 exit 0