From owner-svn-src-projects@freebsd.org Sat Jul 20 05:21:18 2019 Return-Path: Delivered-To: svn-src-projects@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E44FB52B2 for ; Sat, 20 Jul 2019 05:21:18 +0000 (UTC) (envelope-from asomers@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 397096DCA4; Sat, 20 Jul 2019 05:21:18 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 120615145; Sat, 20 Jul 2019 05:21:18 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6K5LItP057910; Sat, 20 Jul 2019 05:21:18 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6K5LEc7057891; Sat, 20 Jul 2019 05:21:14 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201907200521.x6K5LEc7057891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 20 Jul 2019 05:21:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r350163 - projects/fuse2/tests/sys/fs/fusefs X-SVN-Group: projects X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: projects/fuse2/tests/sys/fs/fusefs X-SVN-Commit-Revision: 350163 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 397096DCA4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jul 2019 05:21:18 -0000 Author: asomers Date: Sat Jul 20 05:21:13 2019 New Revision: 350163 URL: https://svnweb.freebsd.org/changeset/base/350163 Log: fusefs: fix warnings in the tests reported by GCC Sponsored by: The FreeBSD Foundation Modified: projects/fuse2/tests/sys/fs/fusefs/Makefile projects/fuse2/tests/sys/fs/fusefs/allow_other.cc projects/fuse2/tests/sys/fs/fusefs/default_permissions.cc projects/fuse2/tests/sys/fs/fusefs/destroy.cc projects/fuse2/tests/sys/fs/fusefs/dev_fuse_poll.cc projects/fuse2/tests/sys/fs/fusefs/interrupt.cc projects/fuse2/tests/sys/fs/fusefs/io.cc projects/fuse2/tests/sys/fs/fusefs/mockfs.cc projects/fuse2/tests/sys/fs/fusefs/mockfs.hh projects/fuse2/tests/sys/fs/fusefs/notify.cc projects/fuse2/tests/sys/fs/fusefs/opendir.cc projects/fuse2/tests/sys/fs/fusefs/read.cc projects/fuse2/tests/sys/fs/fusefs/readdir.cc projects/fuse2/tests/sys/fs/fusefs/readlink.cc projects/fuse2/tests/sys/fs/fusefs/releasedir.cc projects/fuse2/tests/sys/fs/fusefs/setattr.cc projects/fuse2/tests/sys/fs/fusefs/statfs.cc projects/fuse2/tests/sys/fs/fusefs/write.cc projects/fuse2/tests/sys/fs/fusefs/xattr.cc Modified: projects/fuse2/tests/sys/fs/fusefs/Makefile ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/Makefile Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/Makefile Sat Jul 20 05:21:13 2019 (r350163) @@ -64,6 +64,8 @@ TEST_METADATA+= timeout=10 FUSEFS= ${SRCTOP}/sys/fs/fuse MOUNT= ${SRCTOP}/sbin/mount +# Suppress warnings that GCC generates for the libc++ and gtest headers. +CWARNFLAGS.gcc+= -Wno-placement-new -Wno-attributes -Wno-class-memaccess CXXFLAGS+= -I${SRCTOP}/tests CXXFLAGS+= -I${FUSEFS} CXXFLAGS+= -I${MOUNT} Modified: projects/fuse2/tests/sys/fs/fusefs/allow_other.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/allow_other.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/allow_other.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -131,8 +131,6 @@ TEST_F(AllowOther, creds) */ TEST_F(AllowOther, privilege_escalation) { - const static char FULLPATH[] = "mountpoint/some_file.txt"; - const static char RELPATH[] = "some_file.txt"; int fd1, status; const static uint64_t ino = 42; const static uint64_t fh = 100; @@ -220,8 +218,6 @@ TEST_F(NoAllowOther, disallowed) */ TEST_F(NoAllowOther, disallowed_beneath_root) { - const static char FULLPATH[] = "mountpoint/some_dir"; - const static char RELPATH[] = "some_dir"; const static char RELPATH2[] = "other_dir"; const static uint64_t ino = 42; const static uint64_t ino2 = 43; @@ -291,7 +287,7 @@ TEST_F(NoAllowOther, setextattr) ssize_t r; r = extattr_set_file(FULLPATH, ns, "foo", - (void*)value, value_len); + (const void*)value, value_len); if (r >= 0) { fprintf(stderr, "should've failed\n"); return(1); Modified: projects/fuse2/tests/sys/fs/fusefs/default_permissions.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/default_permissions.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/default_permissions.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -231,7 +231,7 @@ static gid_t excluded_group() gid_t newgid, groups[ngroups]; getgrouplist(getlogin(), getegid(), groups, &ngroups); - for (newgid = 0; newgid >= 0; newgid++) { + for (newgid = 0; ; newgid++) { bool belongs = false; for (i = 0; i < ngroups; i++) { @@ -1090,7 +1090,8 @@ TEST_F(Setextattr, ok) expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid()); expect_setxattr(0); - r = extattr_set_file(FULLPATH, ns, "foo", (void*)value, value_len); + r = extattr_set_file(FULLPATH, ns, "foo", (const void*)value, + value_len); ASSERT_EQ(value_len, r) << strerror(errno); } @@ -1106,8 +1107,8 @@ TEST_F(Setextattr, eacces) expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1); expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, 0); - ASSERT_EQ(-1, - extattr_set_file(FULLPATH, ns, "foo", (void*)value, value_len)); + ASSERT_EQ(-1, extattr_set_file(FULLPATH, ns, "foo", (const void*)value, + value_len)); ASSERT_EQ(EACCES, errno); } @@ -1124,8 +1125,8 @@ TEST_F(Setextattr, system) expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1); expect_lookup(RELPATH, ino, S_IFREG | 0666, UINT64_MAX, geteuid()); - ASSERT_EQ(-1, - extattr_set_file(FULLPATH, ns, "foo", (void*)value, value_len)); + ASSERT_EQ(-1, extattr_set_file(FULLPATH, ns, "foo", (const void*)value, + value_len)); ASSERT_EQ(EPERM, errno); } @@ -1144,7 +1145,8 @@ TEST_F(Setextattr, user) expect_lookup(RELPATH, ino, S_IFREG | 0666, UINT64_MAX, 0); expect_setxattr(0); - r = extattr_set_file(FULLPATH, ns, "foo", (void*)value, value_len); + r = extattr_set_file(FULLPATH, ns, "foo", (const void*)value, + value_len); ASSERT_EQ(value_len, r) << strerror(errno); } Modified: projects/fuse2/tests/sys/fs/fusefs/destroy.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/destroy.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/destroy.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -110,10 +110,10 @@ TEST_F(Death, unsent_operations) * One thread's operation will be sent to the daemon and block, and the * other's will be stuck in the message queue. */ - ASSERT_EQ(0, pthread_create(&th0, NULL, open_th, (void*)FULLPATH0)) - << strerror(errno); - ASSERT_EQ(0, pthread_create(&th1, NULL, open_th, (void*)FULLPATH1)) - << strerror(errno); + ASSERT_EQ(0, pthread_create(&th0, NULL, open_th, + __DECONST(void*, FULLPATH0))) << strerror(errno); + ASSERT_EQ(0, pthread_create(&th1, NULL, open_th, + __DECONST(void*, FULLPATH1))) << strerror(errno); /* Wait for the first thread to block */ sem_wait(&sem); Modified: projects/fuse2/tests/sys/fs/fusefs/dev_fuse_poll.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/dev_fuse_poll.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/dev_fuse_poll.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -204,12 +204,12 @@ TEST_F(Kqueue, data) access("mountpoint/bar", F_OK); access("mountpoint/baz", F_OK); ASSERT_EQ(0, pthread_create(&th0, NULL, statter, - (void*)"mountpoint/foo")) << strerror(errno); + __DECONST(void*, "mountpoint/foo"))) << strerror(errno); EXPECT_EQ(0, sem_wait(&sem0)) << strerror(errno); ASSERT_EQ(0, pthread_create(&th1, NULL, statter, - (void*)"mountpoint/bar")) << strerror(errno); + __DECONST(void*, "mountpoint/bar"))) << strerror(errno); ASSERT_EQ(0, pthread_create(&th2, NULL, statter, - (void*)"mountpoint/baz")) << strerror(errno); + __DECONST(void*, "mountpoint/baz"))) << strerror(errno); nap(); // Allow th1 and th2 to send their ops to the daemon EXPECT_EQ(0, sem_post(&sem1)) << strerror(errno); Modified: projects/fuse2/tests/sys/fs/fusefs/interrupt.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/interrupt.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/interrupt.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -520,7 +520,8 @@ TEST_F(Intr, in_kernel_nonrestartable) setup_interruptor(self, true); - r = extattr_set_fd(fd1, ns, "foo", (void*)value, value_len); + r = extattr_set_fd(fd1, ns, "foo", (const void*)value, value_len); + EXPECT_NE(0, r); EXPECT_EQ(EINTR, errno); /* Unstick the daemon */ @@ -664,12 +665,11 @@ TEST_F(Intr, priority) Sequence seq; uint64_t ino1 = 43; uint64_t mkdir_unique; - pthread_t self, th0; + pthread_t th0; sem_t sem0, sem1; ASSERT_EQ(0, sem_init(&sem0, 0, 0)) << strerror(errno); ASSERT_EQ(0, sem_init(&sem1, 0, 0)) << strerror(errno); - self = pthread_self(); EXPECT_LOOKUP(FUSE_ROOT_ID, RELDIRPATH0) .WillOnce(Invoke(ReturnErrno(ENOENT))); Modified: projects/fuse2/tests/sys/fs/fusefs/io.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/io.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/io.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -266,7 +266,7 @@ void do_mapread(ssize_t size, off_t offs) ASSERT_NE(p, MAP_FAILED) << strerror(errno); control_buf = malloc(size); - ASSERT_NE(NULL, control_buf) << strerror(errno); + ASSERT_NE(nullptr, control_buf) << strerror(errno); ASSERT_EQ(size, pread(m_control_fd, control_buf, size, offs)) << strerror(errno); @@ -283,9 +283,9 @@ void do_read(ssize_t size, off_t offs) ssize_t r; test_buf = malloc(size); - ASSERT_NE(NULL, test_buf) << strerror(errno); + ASSERT_NE(nullptr, test_buf) << strerror(errno); control_buf = malloc(size); - ASSERT_NE(NULL, control_buf) << strerror(errno); + ASSERT_NE(nullptr, control_buf) << strerror(errno); errno = 0; r = pread(m_test_fd, test_buf, size, offs); @@ -314,7 +314,7 @@ void do_mapwrite(ssize_t size, off_t offs) map_size = pg_offset + size; buf = (char*)malloc(size); - ASSERT_NE(NULL, buf) << strerror(errno); + ASSERT_NE(nullptr, buf) << strerror(errno); for (i=0; i < size; i++) buf[i] = random(); @@ -344,7 +344,7 @@ void do_write(ssize_t size, off_t offs) long i; buf = (char*)malloc(size); - ASSERT_NE(NULL, buf) << strerror(errno); + ASSERT_NE(nullptr, buf) << strerror(errno); for (i=0; i < size; i++) buf[i] = random(); Modified: projects/fuse2/tests/sys/fs/fusefs/mockfs.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/mockfs.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/mockfs.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -564,7 +564,7 @@ int MockFS::notify_inval_inode(ino_t ino, off_t off, s return 0; } -int MockFS::notify_store(ino_t ino, off_t off, void* data, ssize_t size) +int MockFS::notify_store(ino_t ino, off_t off, const void* data, ssize_t size) { std::unique_ptr out(new mockfs_buf_out); Modified: projects/fuse2/tests/sys/fs/fusefs/mockfs.hh ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/mockfs.hh Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/mockfs.hh Sat Jul 20 05:21:13 2019 (r350163) @@ -375,7 +375,7 @@ class MockFS { * @param data Pointer to the data to cache * @param len Size of data */ - int notify_store(ino_t ino, off_t off, void* data, ssize_t size); + int notify_store(ino_t ino, off_t off, const void* data, ssize_t size); /* * Request handler Modified: projects/fuse2/tests/sys/fs/fusefs/notify.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/notify.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/notify.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -129,7 +129,7 @@ struct store_args { ino_t nodeid; off_t offset; ssize_t size; - void* data; + const void* data; }; static void* inval_inode(void* arg) { @@ -433,7 +433,7 @@ TEST_F(Notify, DISABLED_store_with_blank_cache) sa.nodeid = ino; sa.offset = 0; sa.size = size1; - sa.data = (void*)CONTENTS1; + sa.data = (const void*)CONTENTS1; ASSERT_EQ(0, pthread_create(&th0, NULL, store, &sa)) << strerror(errno); pthread_join(th0, &thr0_value); EXPECT_EQ(0, (intptr_t)thr0_value); Modified: projects/fuse2/tests/sys/fs/fusefs/opendir.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/opendir.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/opendir.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -151,5 +151,5 @@ TEST_F(Opendir, opendir) })); errno = 0; - EXPECT_NE(NULL, opendir(FULLPATH)) << strerror(errno); + EXPECT_NE(nullptr, opendir(FULLPATH)) << strerror(errno); } Modified: projects/fuse2/tests/sys/fs/fusefs/read.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/read.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/read.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -765,7 +765,7 @@ TEST_F(Read, cache_block) const char *contents1 = CONTENTS0 + bufsize; contents = (char*)calloc(1, filesize); - ASSERT_NE(NULL, contents); + ASSERT_NE(nullptr, contents); memmove(contents, CONTENTS0, strlen(CONTENTS0)); expect_lookup(RELPATH, ino, filesize); @@ -880,7 +880,7 @@ TEST_P(ReadAhead, readahead) { off_t offs; contents = (char*)malloc(filesize); - ASSERT_NE(NULL, contents); + ASSERT_NE(nullptr, contents); memset(contents, 'X', filesize); rbuf = (char*)calloc(1, bufsize); Modified: projects/fuse2/tests/sys/fs/fusefs/readdir.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/readdir.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/readdir.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -90,11 +90,11 @@ TEST_F(Readdir, dots) errno = 0; dir = opendir(FULLPATH); - ASSERT_NE(NULL, dir) << strerror(errno); + ASSERT_NE(nullptr, dir) << strerror(errno); errno = 0; de = readdir(dir); - ASSERT_NE(NULL, de) << strerror(errno); + ASSERT_NE(nullptr, de) << strerror(errno); EXPECT_EQ(2ul, de->d_fileno); /* * fuse(4) doesn't actually set d_off, which is ok for now because @@ -107,14 +107,14 @@ TEST_F(Readdir, dots) errno = 0; de = readdir(dir); - ASSERT_NE(NULL, de) << strerror(errno); + ASSERT_NE(nullptr, de) << strerror(errno); EXPECT_EQ(3ul, de->d_fileno); //EXPECT_EQ(3000, de->d_off); EXPECT_EQ(DT_DIR, de->d_type); EXPECT_EQ(1, de->d_namlen); EXPECT_EQ(0, strcmp(".", de->d_name)); - ASSERT_EQ(NULL, readdir(dir)); + ASSERT_EQ(nullptr, readdir(dir)); ASSERT_EQ(0, errno); leakdir(dir); @@ -141,11 +141,11 @@ TEST_F(Readdir, eio) errno = 0; dir = opendir(FULLPATH); - ASSERT_NE(NULL, dir) << strerror(errno); + ASSERT_NE(nullptr, dir) << strerror(errno); errno = 0; de = readdir(dir); - ASSERT_EQ(NULL, de); + ASSERT_EQ(nullptr, de); ASSERT_EQ(EIO, errno); leakdir(dir); @@ -259,9 +259,9 @@ TEST_F(Readdir, nodots) errno = 0; dir = opendir(FULLPATH); - ASSERT_NE(NULL, dir) << strerror(errno); + ASSERT_NE(nullptr, dir) << strerror(errno); errno = 0; - ASSERT_EQ(NULL, readdir(dir)); + ASSERT_EQ(nullptr, readdir(dir)); ASSERT_EQ(0, errno); leakdir(dir); @@ -318,12 +318,12 @@ TEST_F(Readdir, seekdir) errno = 0; dir = opendir(FULLPATH); - ASSERT_NE(NULL, dir) << strerror(errno); + ASSERT_NE(nullptr, dir) << strerror(errno); for (i=0; i < 128; i++) { errno = 0; de = readdir(dir); - ASSERT_NE(NULL, de) << strerror(errno); + ASSERT_NE(nullptr, de) << strerror(errno); EXPECT_EQ(2 + (ino_t)i, de->d_fileno); } bookmark = telldir(dir); @@ -331,13 +331,13 @@ TEST_F(Readdir, seekdir) for (; i < 232; i++) { errno = 0; de = readdir(dir); - ASSERT_NE(NULL, de) << strerror(errno); + ASSERT_NE(nullptr, de) << strerror(errno); EXPECT_EQ(2 + (ino_t)i, de->d_fileno); } seekdir(dir, bookmark); de = readdir(dir); - ASSERT_NE(NULL, de) << strerror(errno); + ASSERT_NE(nullptr, de) << strerror(errno); EXPECT_EQ(130ul, de->d_fileno); leakdir(dir); @@ -366,9 +366,9 @@ TEST_F(Readdir_7_8, nodots) errno = 0; dir = opendir(FULLPATH); - ASSERT_NE(NULL, dir) << strerror(errno); + ASSERT_NE(nullptr, dir) << strerror(errno); errno = 0; - ASSERT_EQ(NULL, readdir(dir)); + ASSERT_EQ(nullptr, readdir(dir)); ASSERT_EQ(0, errno); leakdir(dir); Modified: projects/fuse2/tests/sys/fs/fusefs/readlink.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/readlink.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/readlink.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -113,7 +113,7 @@ TEST_F(PushSymlinksIn, readlink) out.header.len = sizeof(out.header) + strlen(dst) + 1; })); - ASSERT_NE(NULL, getcwd(wd, sizeof(wd))) << strerror(errno); + ASSERT_NE(nullptr, getcwd(wd, sizeof(wd))) << strerror(errno); len = snprintf(want, sizeof(want), "%s/mountpoint%s", wd, dst); ASSERT_LE(0, len) << strerror(errno); Modified: projects/fuse2/tests/sys/fs/fusefs/releasedir.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/releasedir.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/releasedir.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -71,10 +71,10 @@ TEST_F(ReleaseDir, dup) expect_releasedir(ino, ReturnErrno(0)); dir = opendir(FULLPATH); - ASSERT_NE(NULL, dir) << strerror(errno); + ASSERT_NE(nullptr, dir) << strerror(errno); dir2 = fdopendir(dup(dirfd(dir))); - ASSERT_NE(NULL, dir2) << strerror(errno); + ASSERT_NE(nullptr, dir2) << strerror(errno); ASSERT_EQ(0, closedir(dir)) << strerror(errno); ASSERT_EQ(0, closedir(dir2)) << strerror(errno); @@ -92,7 +92,7 @@ TEST_F(ReleaseDir, ok) expect_releasedir(ino, ReturnErrno(0)); dir = opendir(FULLPATH); - ASSERT_NE(NULL, dir) << strerror(errno); + ASSERT_NE(nullptr, dir) << strerror(errno); ASSERT_EQ(0, closedir(dir)) << strerror(errno); } Modified: projects/fuse2/tests/sys/fs/fusefs/setattr.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/setattr.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/setattr.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -449,16 +449,16 @@ TEST_F(Setattr, truncate_discards_cached_data) { bool should_have_data = false; w0buf = malloc(w0_size); - ASSERT_NE(NULL, w0buf) << strerror(errno); + ASSERT_NE(nullptr, w0buf) << strerror(errno); memset(w0buf, 'X', w0_size); r0buf = malloc(r0_size); - ASSERT_NE(NULL, r0buf) << strerror(errno); + ASSERT_NE(nullptr, r0buf) << strerror(errno); r1buf = malloc(r1_size); - ASSERT_NE(NULL, r1buf) << strerror(errno); + ASSERT_NE(nullptr, r1buf) << strerror(errno); expected = malloc(r1_size); - ASSERT_NE(NULL, expected) << strerror(errno); + ASSERT_NE(nullptr, expected) << strerror(errno); memset(expected, 0, r1_size); expect_lookup(RELPATH, ino, mode, 0, 1); @@ -580,10 +580,12 @@ TEST_F(Setattr, utimensat) { return (in.header.opcode == FUSE_SETATTR && in.header.nodeid == ino && in.body.setattr.valid == valid && - in.body.setattr.atime == newtimes[0].tv_sec && + (time_t)in.body.setattr.atime == + newtimes[0].tv_sec && in.body.setattr.atimensec == newtimes[0].tv_nsec && - in.body.setattr.mtime == newtimes[1].tv_sec && + (time_t)in.body.setattr.mtime == + newtimes[1].tv_sec && in.body.setattr.mtimensec == newtimes[1].tv_nsec); }, Eq(true)), @@ -633,7 +635,8 @@ TEST_F(Setattr, utimensat_mtime_only) { return (in.header.opcode == FUSE_SETATTR && in.header.nodeid == ino && in.body.setattr.valid == valid && - in.body.setattr.mtime == newtimes[1].tv_sec && + (time_t)in.body.setattr.mtime == + newtimes[1].tv_sec && in.body.setattr.mtimensec == newtimes[1].tv_nsec); }, Eq(true)), Modified: projects/fuse2/tests/sys/fs/fusefs/statfs.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/statfs.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/statfs.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -67,7 +67,7 @@ TEST_F(Statfs, enotconn) m_mock->kill_daemon(); - ASSERT_NE(NULL, getcwd(mp, PATH_MAX)) << strerror(errno); + ASSERT_NE(nullptr, getcwd(mp, PATH_MAX)) << strerror(errno); strlcat(mp, "/mountpoint", PATH_MAX); ASSERT_EQ(0, statfs("mountpoint", &statbuf)) << strerror(errno); @@ -112,7 +112,7 @@ TEST_F(Statfs, enotconn_while_blocked) /* Just block until the daemon dies */ })); - ASSERT_NE(NULL, getcwd(mp, PATH_MAX)) << strerror(errno); + ASSERT_NE(nullptr, getcwd(mp, PATH_MAX)) << strerror(errno); strlcat(mp, "/mountpoint", PATH_MAX); ASSERT_EQ(0, pthread_create(&th0, NULL, statfs_th, (void*)&statbuf)) << strerror(errno); @@ -150,7 +150,7 @@ TEST_F(Statfs, ok) out.body.statfs.st.frsize = 1024; }))); - ASSERT_NE(NULL, getcwd(mp, PATH_MAX)) << strerror(errno); + ASSERT_NE(nullptr, getcwd(mp, PATH_MAX)) << strerror(errno); strlcat(mp, "/mountpoint", PATH_MAX); ASSERT_EQ(0, statfs("mountpoint", &statbuf)) << strerror(errno); EXPECT_EQ(1024ul, statbuf.f_bsize); Modified: projects/fuse2/tests/sys/fs/fusefs/write.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/write.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/write.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -226,7 +226,7 @@ TEST_F(AioWrite, DISABLED_aio_write) iocb.aio_nbytes = bufsize; iocb.aio_fildes = fd; - iocb.aio_buf = (void *)CONTENTS; + iocb.aio_buf = __DECONST(void *, CONTENTS); iocb.aio_offset = offset; iocb.aio_sigevent.sigev_notify = SIGEV_NONE; ASSERT_EQ(0, aio_write(&iocb)) << strerror(errno); @@ -286,9 +286,9 @@ TEST_F(Write, append_to_cached) int fd; oldcontents = (char*)calloc(1, oldsize); - ASSERT_NE(NULL, oldcontents) << strerror(errno); + ASSERT_NE(nullptr, oldcontents) << strerror(errno); oldbuf = (char*)malloc(oldsize); - ASSERT_NE(NULL, oldbuf) << strerror(errno); + ASSERT_NE(nullptr, oldbuf) << strerror(errno); expect_lookup(RELPATH, ino, oldsize); expect_open(ino, 0, 1); @@ -448,9 +448,9 @@ TEST_F(Write, direct_io_short_write_iov) fd = open(FULLPATH, O_WRONLY); EXPECT_LE(0, fd) << strerror(errno); - iov[0].iov_base = (void*)CONTENTS0; + iov[0].iov_base = __DECONST(void*, CONTENTS0); iov[0].iov_len = strlen(CONTENTS0); - iov[1].iov_base = (void*)CONTENTS1; + iov[1].iov_base = __DECONST(void*, CONTENTS1); iov[1].iov_len = strlen(CONTENTS1); ASSERT_EQ(size0, writev(fd, iov, 2)) << strerror(errno); leak(fd); @@ -540,9 +540,9 @@ TEST_F(Write, mmap) len = getpagesize(); zeros = calloc(1, len); - ASSERT_NE(NULL, zeros); + ASSERT_NE(nullptr, zeros); expected = calloc(1, len); - ASSERT_NE(NULL, expected); + ASSERT_NE(nullptr, expected); memmove((uint8_t*)expected + offset, CONTENTS, bufsize); expect_lookup(RELPATH, ino, len); @@ -655,7 +655,7 @@ TEST_F(Write, write_large) halfbufsize = m_mock->m_maxwrite; bufsize = halfbufsize * 2; contents = (int*)malloc(bufsize); - ASSERT_NE(NULL, contents); + ASSERT_NE(nullptr, contents); for (int i = 0; i < (int)bufsize / (int)sizeof(i); i++) { contents[i] = i; } @@ -758,10 +758,10 @@ TEST_F(WriteCluster, clustering) off_t filesize = 5 * bufsize; wbuf = malloc(bufsize); - ASSERT_NE(NULL, wbuf) << strerror(errno); + ASSERT_NE(nullptr, wbuf) << strerror(errno); memset(wbuf, 'X', bufsize); wbuf2x = malloc(2 * bufsize); - ASSERT_NE(NULL, wbuf2x) << strerror(errno); + ASSERT_NE(nullptr, wbuf2x) << strerror(errno); memset(wbuf2x, 'X', 2 * bufsize); expect_lookup(RELPATH, ino, filesize); @@ -805,7 +805,7 @@ TEST_F(WriteCluster, DISABLED_cluster_write_err) off_t filesize = 4 * bufsize; wbuf = malloc(bufsize); - ASSERT_NE(NULL, wbuf) << strerror(errno); + ASSERT_NE(nullptr, wbuf) << strerror(errno); memset(wbuf, 'X', bufsize); expect_lookup(RELPATH, ino, filesize); Modified: projects/fuse2/tests/sys/fs/fusefs/xattr.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/xattr.cc Sat Jul 20 02:53:06 2019 (r350162) +++ projects/fuse2/tests/sys/fs/fusefs/xattr.cc Sat Jul 20 05:21:13 2019 (r350163) @@ -542,12 +542,14 @@ TEST_F(Setxattr, enosys) expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 2); expect_setxattr(ino, "user.foo", value, ReturnErrno(ENOSYS)); - r = extattr_set_file(FULLPATH, ns, "foo", (void*)value, value_len); + r = extattr_set_file(FULLPATH, ns, "foo", (const void*)value, + value_len); ASSERT_EQ(-1, r); EXPECT_EQ(EOPNOTSUPP, errno); /* Subsequent attempts should not query the filesystem at all */ - r = extattr_set_file(FULLPATH, ns, "foo", (void*)value, value_len); + r = extattr_set_file(FULLPATH, ns, "foo", (const void*)value, + value_len); ASSERT_EQ(-1, r); EXPECT_EQ(EOPNOTSUPP, errno); } @@ -567,7 +569,8 @@ TEST_F(Setxattr, enotsup) expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1); expect_setxattr(ino, "user.foo", value, ReturnErrno(ENOTSUP)); - r = extattr_set_file(FULLPATH, ns, "foo", (void*)value, value_len); + r = extattr_set_file(FULLPATH, ns, "foo", (const void*)value, + value_len); ASSERT_EQ(-1, r); EXPECT_EQ(ENOTSUP, errno); } @@ -586,7 +589,8 @@ TEST_F(Setxattr, user) expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1); expect_setxattr(ino, "user.foo", value, ReturnErrno(0)); - r = extattr_set_file(FULLPATH, ns, "foo", (void*)value, value_len); + r = extattr_set_file(FULLPATH, ns, "foo", (const void*)value, + value_len); ASSERT_EQ(value_len, r) << strerror(errno); } @@ -604,7 +608,8 @@ TEST_F(Setxattr, system) expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1); expect_setxattr(ino, "system.foo", value, ReturnErrno(0)); - r = extattr_set_file(FULLPATH, ns, "foo", (void*)value, value_len); + r = extattr_set_file(FULLPATH, ns, "foo", (const void*)value, + value_len); ASSERT_EQ(value_len, r) << strerror(errno); } @@ -629,7 +634,8 @@ TEST_F(RofsXattr, setextattr_erofs) expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1); - r = extattr_set_file(FULLPATH, ns, "foo", (void*)value, value_len); + r = extattr_set_file(FULLPATH, ns, "foo", (const void*)value, + value_len); ASSERT_EQ(-1, r); EXPECT_EQ(EROFS, errno); }