Date: Sun, 4 Jul 2021 06:55:40 -0700 (PDT) From: "Rodney W. Grimes" <freebsd@gndrsh.dnsmgr.net> To: Peter Holm <pho@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 5bd70f050072 - main - stress2: Improve cleanup code Message-ID: <202107041355.164Dtexu021027@gndrsh.dnsmgr.net> In-Reply-To: <202107020525.1625PhAd078350@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> The branch main has been updated by pho: > > URL: https://cgit.FreeBSD.org/src/commit/?id=5bd70f050072bced1f0b7a566932857b3dd506ef > > commit 5bd70f050072bced1f0b7a566932857b3dd506ef > Author: Peter Holm <pho@FreeBSD.org> > AuthorDate: 2021-07-02 05:22:18 +0000 > Commit: Peter Holm <pho@FreeBSD.org> > CommitDate: 2021-07-02 05:22:18 +0000 > > stress2: Improve cleanup code > --- > tools/test/stress2/misc/mmap3.sh | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/tools/test/stress2/misc/mmap3.sh b/tools/test/stress2/misc/mmap3.sh > index bc5905dd920e..9175b77842f3 100755 > --- a/tools/test/stress2/misc/mmap3.sh > +++ b/tools/test/stress2/misc/mmap3.sh > @@ -42,11 +42,12 @@ while [ `date '+%s'` -lt $((start + 5 * 60)) ]; do > ./mmap3 > done > echo "Expect Segmentation faults" > +trap "rm -f /tmp/mmap3.0*" EXIT INT > start=`date '+%s'` > while [ `date '+%s'` -lt $((start + 5 * 60)) ]; do > ./mmap3 random > done > -rm -f mmap3 mmap3.core /tmp/mmap.0* > +rm -f mmap3 mmap3.core /tmp/mmap3.0* I have never liked the use of * in a "cleanup" when there is more information about the form of the file name: mmap3.??????.???? would be better, and it also fixes the assumption that there is always a leading zero, which the format string does not specify (yes, it says to leading zero fill, but that does not mean it shall always start with a zero). A more precise: mmap3.[0-9][0-9][0-9][0-9][0-9][0-9].[0-9][0-9][0-9][0-9] could also be used, but is kinda long winded. > exit > > EOF > @@ -102,7 +103,7 @@ work(int nr) > p = (void *)STARTADDR; > len = ADRSPACE; > > - sprintf(path, "/tmp/mmap.%06d.%04d", getpid(), nr); > + sprintf(path, "/tmp/mmap3.%06d.%04d", getpid(), nr); > if ((fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0622)) == -1) > err(1,"open()"); > if (ftruncate(fd, len) == -1) > -- Rod Grimes rgrimes@freebsd.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107041355.164Dtexu021027>