From nobody Wed Oct 18 06:55:44 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S9M7N3217z4xct2; Wed, 18 Oct 2023 06:55:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S9M7N2PFYz3RxW; Wed, 18 Oct 2023 06:55:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697612144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3jmLI9GtA2xmBCS6KppE+hSzhTlzG7B4KyGz6rd7NaA=; b=Wd6oMrgWkG2CbA95r/C+rwa1OZbV999AV03JXicKXaA1682IDNWM5dVO8bHBNYUqHushz7 R07/sreYzT7JtOGAKOkJURt/iQr9DL37hs6TDSqLGZf9OOlCwuoA2eRG2ba3++iZWVGse9 GKia5WDOeluHEsnID/Z1yaVqDzdRSbANBlob3xKpVDEWIB/cII21x5UWYA3/OGkrnfBJvK d4eNAnO10AioJRYUDYqLmY9iE4LZjSsMXkbTsccLSzUaOn90tA8cwz8DX6uU6cNT39O7Ic ghTuenKKYIqz1lE6w1qYRR14pUcP0TX+VkgUugpybl6Qn6dgVdBA5QsBovzWjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697612144; a=rsa-sha256; cv=none; b=risH5PrjsqHZEGiCzt2fQax63PVusM4ogNhAmBnKHg9quyVZnYr+n6TdeIjb0FJ4NBLuMr k0WglTG9hg+ChPZnnksqca8yLmzZfAn5n7QeWuOV24VtAjU1zx00V6V+BjzHT05CoH/VuB MKPKLNkpAAvPyBeANzvJJ4oUgaviFBU8Q/Zuq6oz0lyB66537DsDXkzl2Nu9caVdFNCc08 EEA7MjupG9UFePhBSiT0SNcpstS6jjhbbW4YR44K2R9eFWIGeiLJQ0ad1lrZvwYonxCs1S Obc+SwrmiJTVU4fqKIXInXrizAr+4tIJehPiw5ZY4X70Zq+Hn2TtilZ2dQYByQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697612144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3jmLI9GtA2xmBCS6KppE+hSzhTlzG7B4KyGz6rd7NaA=; b=VMShCiN6SMqB6Jry4dZtG9WibmJlLBFhJh1M7QQkESyQ9yfamFIsC4cuEeE7grL1UqtYRh e0uAWueayhn2BAQk5aNkly6DKDhfqPAP2WfSS6vkYZgzOK9594Lyd8xumNbhRLkp1TqE9I A2ZqXmd1+ln9zaeD8I0DjKo8CNghJrQU/QhPMYIeq3MO3C5FaJdZnNffJWpHjrOO48t7TK x7zq4hoxxdW/PahRDu9BWsZL/e1jfejcsqtUXnRB44+RbEIMspQWvpTFgDnVhqOz1LxNWj naJjzdI11RowHTLx/PomJRRhR/4iGyFZK8B/WT5MLm4ioghpqM6JJ7hSBenbxw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S9M7N1Pt7zxCM; Wed, 18 Oct 2023 06:55:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39I6ti30026110; Wed, 18 Oct 2023 06:55:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39I6titH026107; Wed, 18 Oct 2023 06:55:44 GMT (envelope-from git) Date: Wed, 18 Oct 2023 06:55:44 GMT Message-Id: <202310180655.39I6titH026107@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: ef1dad6d83ff - main - stress2: Fix "-Wunused-but-set-variable" warnings List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ef1dad6d83ff662ed211433ac2e5805bae5d04e9 Auto-Submitted: auto-generated The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=ef1dad6d83ff662ed211433ac2e5805bae5d04e9 commit ef1dad6d83ff662ed211433ac2e5805bae5d04e9 Author: Peter Holm AuthorDate: 2023-10-18 06:54:38 +0000 Commit: Peter Holm CommitDate: 2023-10-18 06:54:38 +0000 stress2: Fix "-Wunused-but-set-variable" warnings --- tools/test/stress2/misc/exlock2.sh | 15 +++++---------- tools/test/stress2/misc/fcntl2.sh | 2 ++ tools/test/stress2/misc/fifo2.sh | 8 ++++---- tools/test/stress2/misc/mmap18.sh | 13 ++++--------- tools/test/stress2/misc/mmap32.sh | 5 ++--- tools/test/stress2/misc/poll2.sh | 4 ++-- tools/test/stress2/misc/procfs4.sh | 7 +++---- tools/test/stress2/misc/sendfile25.sh | 4 +--- tools/test/stress2/misc/setsockopt2.sh | 3 +++ 9 files changed, 26 insertions(+), 35 deletions(-) diff --git a/tools/test/stress2/misc/exlock2.sh b/tools/test/stress2/misc/exlock2.sh index 58a49919d86a..e1760cc52a4d 100755 --- a/tools/test/stress2/misc/exlock2.sh +++ b/tools/test/stress2/misc/exlock2.sh @@ -68,6 +68,7 @@ EOF #include static _Atomic(int) *share; +static int debug; /* Set to "1" for debug output */ static int quit; static char file[80]; @@ -101,9 +102,8 @@ test1(void) ; /* wait for test2 to signal "done" */ close(fd); } -#if defined(DEBUG) - fprintf(stderr, "%s: n = %d\n", __func__, n); -#endif + if (debug != 0) + fprintf(stderr, "%s: n = %d\n", __func__, n); _exit(0); } @@ -114,17 +114,15 @@ test2(void) struct flock fl; struct stat st; time_t start; - int e, fd, n; + int e, fd; e = 0; fd = 0; - n = 0; start = time(NULL); while (time(NULL) - start < RUNTIME) { share[SYNC] = 1; if ((fd = open(file, O_RDWR)) == -1) goto out; - n++; memset(&fl, 0, sizeof(fl)); fl.l_start = 0; fl.l_len = 0; @@ -151,12 +149,9 @@ out: share[SYNC] = 0; usleep(100); } -#if defined(DEBUG) - if (e != 0) { + if (debug != 0 && e != 0) system("ps -Uroot | grep -v grep | grep /tmp/exlock2 | "\ "awk '{print $1}' | xargs procstat -f"); - } -#endif share[SYNC] = 0; _exit(e); diff --git a/tools/test/stress2/misc/fcntl2.sh b/tools/test/stress2/misc/fcntl2.sh index 80be1bd05e5a..acb161fd0523 100755 --- a/tools/test/stress2/misc/fcntl2.sh +++ b/tools/test/stress2/misc/fcntl2.sh @@ -150,6 +150,8 @@ test(void) } close(fd); unlink(file); + if (success == 0) + fprintf(stderr, "No calls to fcntl() succeeded.\n"); _exit(0); } diff --git a/tools/test/stress2/misc/fifo2.sh b/tools/test/stress2/misc/fifo2.sh index 9e4a7e632e9d..4a7b986931d9 100755 --- a/tools/test/stress2/misc/fifo2.sh +++ b/tools/test/stress2/misc/fifo2.sh @@ -96,6 +96,7 @@ EOF #include #define N (128 * 1024 / (int)sizeof(u_int32_t)) +static int debug; /* Set to 1 for debug output */ u_int32_t r[N]; static void @@ -143,11 +144,10 @@ calls(void *arg __unused) arg6 = makearg(); arg7 = makearg(); -#if 0 - fprintf(stderr, "%2d : syscall(%3d, %lx, %lx, %lx, %lx, %lx, %lx, %lx)\n", - i, SYS_open, arg1, arg2, arg3, arg4, arg5, arg6, arg7); + if (debug != 0) + fprintf(stderr, "%2d : syscall(%3d, %lx, %lx, %lx, %lx, %lx, %lx, %lx)\n", + i, SYS_open, arg1, arg2, arg3, arg4, arg5, arg6, arg7); usleep(100000); -#endif alarm(1); syscall(SYS_open, arg1, arg2, arg3, arg4, arg5, arg6, arg7); } diff --git a/tools/test/stress2/misc/mmap18.sh b/tools/test/stress2/misc/mmap18.sh index 065b5bb7df6c..f2b19c07fe60 100755 --- a/tools/test/stress2/misc/mmap18.sh +++ b/tools/test/stress2/misc/mmap18.sh @@ -89,6 +89,7 @@ EOF static u_int32_t r[N]; static void *p; +static int debug; /* set to 1 for debug output */ static unsigned long makearg(void) @@ -176,11 +177,9 @@ tmlock(void *arg __unused) if (munlock(makeptr(), len) == 0) n++; } -#if defined(DEBUG) - if (n < 10) + if (debug != 0 && n < 10) fprintf(stderr, "Note: tmlock() only succeeded %d " "times.\n", n); -#endif return (NULL); } @@ -202,11 +201,9 @@ tmprotect(void *arg __unused) n++; usleep(1000); } -#if defined(DEBUG) - if (n < 10) + if (debug != 0 && n < 10) fprintf(stderr, "Note: tmprotect() only succeeded %d " "times.\n", n); -#endif return (NULL); } @@ -226,11 +223,9 @@ tmlockall(void *arg __unused) munlockall(); usleep(1000); } -#if defined(DEBUG) - if (n < 10) + if (debug != 0 && n < 10) fprintf(stderr, "Note: tmlockall() only succeeded %d " "times.\n", n); -#endif return (NULL); } diff --git a/tools/test/stress2/misc/mmap32.sh b/tools/test/stress2/misc/mmap32.sh index a775b756084e..334327a85989 100755 --- a/tools/test/stress2/misc/mmap32.sh +++ b/tools/test/stress2/misc/mmap32.sh @@ -62,6 +62,7 @@ EOF #include #define N 4096 +static int debug; /* set to 1 for debug output */ static uint32_t r[N]; static unsigned long @@ -133,10 +134,8 @@ fuzz(int arg, void *addr, size_t len, int prot, int flags, int fd, n++; } } -#if defined(DEBUG) - if (n == 0 && arg != 5) + if (debug != 0 &&n == 0 && arg != 5) fprintf(stderr, "%s(%d) failed\n", __func__, arg); -#endif exit(0); } diff --git a/tools/test/stress2/misc/poll2.sh b/tools/test/stress2/misc/poll2.sh index 7c0aff9c78ca..aa5ad5f995dd 100755 --- a/tools/test/stress2/misc/poll2.sh +++ b/tools/test/stress2/misc/poll2.sh @@ -136,11 +136,11 @@ static void * pl(void *data __unused) { struct pollfd pfd; - int i, r; + int r; pfd.fd = fds[0]; pfd.events = POLLIN; - for (i = 0; done == 0; i++) { + while (done == 0) { pfd.fd = fds[0]; pfd.events = POLLIN; pthread_set_name_np(pthread_self(), "pl-idle"); diff --git a/tools/test/stress2/misc/procfs4.sh b/tools/test/stress2/misc/procfs4.sh index ffa812a7f73d..18e5c0a6f803 100755 --- a/tools/test/stress2/misc/procfs4.sh +++ b/tools/test/stress2/misc/procfs4.sh @@ -68,6 +68,7 @@ EOF #define MAXRUN 1200 #define PARALLEL 10 +static int debug; /* Set to 1 for debug output */ char *files[] = { "cmdline", "ctl", @@ -116,10 +117,8 @@ test(void) close(fd); } kill(p, SIGHUP); -#if 0 - if (opens < 1) - fprintf(stderr, "Warn %d open(s) for pid %d\n", opens, getpid()); -#endif + if (debug != 0 && opens == 0) + fprintf(stderr, "No ioctl() calls succeeded.\n"); } for (i = 0; i < 64; i++) diff --git a/tools/test/stress2/misc/sendfile25.sh b/tools/test/stress2/misc/sendfile25.sh index fa2e2b8687cd..ae755bf1d4df 100755 --- a/tools/test/stress2/misc/sendfile25.sh +++ b/tools/test/stress2/misc/sendfile25.sh @@ -105,7 +105,7 @@ reader(void) { int on; socklen_t len; struct sockaddr_in inetaddr, inetpeer; - int n, t, *buf, fd; + int n, *buf, fd; on = 1; if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) @@ -132,7 +132,6 @@ reader(void) { (struct sockaddr *)&inetpeer, &len)) < 0) err(1, "accept(), %s:%d", __FILE__, __LINE__); - t = 0; if ((buf = malloc(bufsize)) == NULL) err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__); @@ -142,7 +141,6 @@ reader(void) { for (;;) { if ((n = read(msgsock, buf, bufsize)) < 0) err(1, "read(), %s:%d", __FILE__, __LINE__); - t += n; if (n == 0) break; diff --git a/tools/test/stress2/misc/setsockopt2.sh b/tools/test/stress2/misc/setsockopt2.sh index 44ed98320404..13cc3175cce3 100755 --- a/tools/test/stress2/misc/setsockopt2.sh +++ b/tools/test/stress2/misc/setsockopt2.sh @@ -86,6 +86,7 @@ EOF #include #include +static int debug; /* set to 1 for debug output */ static volatile u_int *share; #define PARALLEL 128 @@ -165,6 +166,8 @@ bad: if (waitpid(pid, NULL, 0) != pid) err(1, "waitpid(%d)", pid); } + if (debug != 0 && success == 0) + fprintf(stderr, "No calls to connect() succeded.\n"); _exit(0); }