Date: Mon, 16 Sep 2019 15:45:00 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352413 - head/tests/sys/fs/fusefs Message-ID: <201909161545.x8GFj09T080385@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Mon Sep 16 15:44:59 2019 New Revision: 352413 URL: https://svnweb.freebsd.org/changeset/base/352413 Log: fusefs: fix some minor Coverity CIDs in the tests Where open(2) is expected to fail, the tests should assert or expect that its return value is -1. These tests all accepted too much but happened to pass anyway. Reported by: Coverity Coverity CID: 1404512, 1404378, 1404504, 1404483 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/fs/fusefs/create.cc head/tests/sys/fs/fusefs/default_permissions.cc head/tests/sys/fs/fusefs/opendir.cc Modified: head/tests/sys/fs/fusefs/create.cc ============================================================================== --- head/tests/sys/fs/fusefs/create.cc Mon Sep 16 15:21:37 2019 (r352412) +++ head/tests/sys/fs/fusefs/create.cc Mon Sep 16 15:44:59 2019 (r352413) @@ -204,7 +204,7 @@ TEST_F(Create, eexist) EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH) .WillOnce(Invoke(ReturnErrno(ENOENT))); expect_create(RELPATH, mode, ReturnErrno(EEXIST)); - EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode)); + EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, mode)); EXPECT_EQ(EEXIST, errno); } @@ -342,7 +342,7 @@ TEST_F(Create, eperm) .WillOnce(Invoke(ReturnErrno(ENOENT))); expect_create(RELPATH, mode, ReturnErrno(EPERM)); - EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode)); + EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, mode)); EXPECT_EQ(EPERM, errno); } Modified: head/tests/sys/fs/fusefs/default_permissions.cc ============================================================================== --- head/tests/sys/fs/fusefs/default_permissions.cc Mon Sep 16 15:21:37 2019 (r352412) +++ head/tests/sys/fs/fusefs/default_permissions.cc Mon Sep 16 15:44:59 2019 (r352413) @@ -749,7 +749,7 @@ TEST_F(Open, eacces) expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1); expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX); - EXPECT_NE(0, open(FULLPATH, O_RDWR)); + EXPECT_EQ(-1, open(FULLPATH, O_RDWR)); EXPECT_EQ(EACCES, errno); } Modified: head/tests/sys/fs/fusefs/opendir.cc ============================================================================== --- head/tests/sys/fs/fusefs/opendir.cc Mon Sep 16 15:21:37 2019 (r352412) +++ head/tests/sys/fs/fusefs/opendir.cc Mon Sep 16 15:44:59 2019 (r352413) @@ -103,7 +103,7 @@ TEST_F(Opendir, eperm) expect_lookup(RELPATH, ino); expect_opendir(ino, O_RDONLY, ReturnErrno(EPERM)); - EXPECT_NE(0, open(FULLPATH, O_DIRECTORY)); + EXPECT_EQ(-1, open(FULLPATH, O_DIRECTORY)); EXPECT_EQ(EPERM, errno); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909161545.x8GFj09T080385>