diff --git a/run-clang-tidy.sh b/run-clang-tidy.sh index e111c5a6..a050c6f5 100755 --- a/run-clang-tidy.sh +++ b/run-clang-tidy.sh @@ -11,7 +11,10 @@ set -e NUMCORES=`nproc` # Run cmake in current working directory, but on source that is in the same directory as this script file -cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "${0%/*}" +cmake -DBUILD_TESTING=on -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "${0%/*}" + +# Build scrypt first. Our Makefiles call ino theirs, and this is needed to generate some header files. Clang-tidy will otherwise complain they're missing. +make -j${NUMCORES} scrypt run-clang-tidy.py -j${NUMCORES} -quiet -header-filter "$(realpath ${0%/*})/(src|test)/.*" $@ diff --git a/src/blockstore/implementations/integrity/ClientIdAndBlockId.h b/src/blockstore/implementations/integrity/ClientIdAndBlockId.h index 12759444..e0eac19b 100644 --- a/src/blockstore/implementations/integrity/ClientIdAndBlockId.h +++ b/src/blockstore/implementations/integrity/ClientIdAndBlockId.h @@ -9,6 +9,8 @@ namespace blockstore { namespace integrity { struct ClientIdAndBlockId final { + ClientIdAndBlockId(uint32_t clientId_, BlockId blockId_): clientId(clientId_), blockId(blockId_) {} + uint32_t clientId; BlockId blockId; }; diff --git a/src/cpp-utils/CMakeLists.txt b/src/cpp-utils/CMakeLists.txt index 0425774a..62239b3b 100644 --- a/src/cpp-utils/CMakeLists.txt +++ b/src/cpp-utils/CMakeLists.txt @@ -2,6 +2,7 @@ project (cpp-utils) set(SOURCES crypto/symmetric/ciphers.cpp + crypto/symmetric/testutils/FakeAuthenticatedCipher.cpp crypto/kdf/Scrypt.cpp crypto/kdf/SCryptParameters.cpp crypto/kdf/PasswordBasedKDF.cpp diff --git a/test/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.cpp b/src/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.cpp similarity index 65% rename from test/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.cpp rename to src/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.cpp index e2a6232a..76172eea 100644 --- a/test/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.cpp +++ b/src/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.cpp @@ -2,4 +2,6 @@ namespace cpputils { constexpr unsigned int FakeKey::BINARY_LENGTH; + + std::random_device FakeAuthenticatedCipher::random_; } diff --git a/test/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h b/src/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h similarity index 96% rename from test/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h rename to src/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h index f8c2a41b..6599bac4 100644 --- a/test/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h +++ b/src/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h @@ -7,6 +7,7 @@ #include "cpp-utils/data/FixedSizeData.h" #include "cpp-utils/data/Data.h" #include "cpp-utils/random/RandomGenerator.h" +#include namespace cpputils { @@ -52,7 +53,7 @@ namespace cpputils { Data result(ciphertextSize(plaintextSize)); //Add a random IV - uint8_t iv = rand(); + uint8_t iv = std::uniform_int_distribution()(random_); std::memcpy(result.data(), &iv, 1); //Use caesar chiffre on plaintext @@ -108,6 +109,8 @@ namespace cpputils { dst[i] = src[i] + key; } } + + static std::random_device random_; }; } diff --git a/src/fspp/fstest/FsppDeviceTest_Timestamps.h b/src/fspp/fstest/FsppDeviceTest_Timestamps.h index 244e3c15..d3d38367 100644 --- a/src/fspp/fstest/FsppDeviceTest_Timestamps.h +++ b/src/fspp/fstest/FsppDeviceTest_Timestamps.h @@ -16,7 +16,7 @@ public: } void Test_Load_While_Not_Loaded() { - struct stat oldStat; + struct stat oldStat{}; { auto node = this->CreateNode("/mynode"); oldStat = this->stat(*node); diff --git a/src/fspp/fstest/FsppDirTest.h b/src/fspp/fstest/FsppDirTest.h index 43fc3dde..e3a7ca07 100644 --- a/src/fspp/fstest/FsppDirTest.h +++ b/src/fspp/fstest/FsppDirTest.h @@ -48,11 +48,11 @@ public: }; TYPED_TEST_CASE_P(FsppDirTest); -fspp::Dir::Entry DirEntry(const std::string &name) { +inline fspp::Dir::Entry DirEntry(const std::string &name) { return fspp::Dir::Entry(fspp::Dir::EntryType::DIR, name); } -fspp::Dir::Entry FileEntry(const std::string &name) { +inline fspp::Dir::Entry FileEntry(const std::string &name) { return fspp::Dir::Entry(fspp::Dir::EntryType::FILE, name); } diff --git a/src/fspp/fstest/FsppFileTest.h b/src/fspp/fstest/FsppFileTest.h index c6fb4be7..10b0daa8 100644 --- a/src/fspp/fstest/FsppFileTest.h +++ b/src/fspp/fstest/FsppFileTest.h @@ -79,8 +79,8 @@ public: } void Test_Utimens(fspp::File *file, fspp::Node *node) { - struct timespec ATIME; ATIME.tv_sec = 1458086400; ATIME.tv_nsec = 34525; - struct timespec MTIME; MTIME.tv_sec = 1458086300; MTIME.tv_nsec = 48293; + struct timespec ATIME{}; ATIME.tv_sec = 1458086400; ATIME.tv_nsec = 34525; + struct timespec MTIME{}; MTIME.tv_sec = 1458086300; MTIME.tv_nsec = 48293; node->utimens(ATIME, MTIME); this->IN_STAT(file, node, [this, ATIME, MTIME] (struct stat st) { this->EXPECT_ATIME_EQ(ATIME, st); diff --git a/src/fspp/fstest/FsppNodeTest_Timestamps.h b/src/fspp/fstest/FsppNodeTest_Timestamps.h index 00855f38..c1cdd8b2 100644 --- a/src/fspp/fstest/FsppNodeTest_Timestamps.h +++ b/src/fspp/fstest/FsppNodeTest_Timestamps.h @@ -26,7 +26,7 @@ public: void Test_Stat() { auto node = this->CreateNode("/mynode"); auto operation = [&node] () { - struct stat st; + struct stat st{}; node->stat(&st); }; this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS("/mynode", operation, { diff --git a/src/fspp/fstest/FsppOpenFileTest.h b/src/fspp/fstest/FsppOpenFileTest.h index d8dbdbf3..3e113677 100644 --- a/src/fspp/fstest/FsppOpenFileTest.h +++ b/src/fspp/fstest/FsppOpenFileTest.h @@ -8,7 +8,7 @@ template class FsppOpenFileTest: public FileSystemTest { public: void IN_STAT(fspp::OpenFile *openFile, std::function callback) { - struct stat st; + struct stat st{}; openFile->stat(&st); callback(st); } diff --git a/src/fspp/fstest/FsppOpenFileTest_Timestamps.h b/src/fspp/fstest/FsppOpenFileTest_Timestamps.h index 5b87731f..a5df28ec 100644 --- a/src/fspp/fstest/FsppOpenFileTest_Timestamps.h +++ b/src/fspp/fstest/FsppOpenFileTest_Timestamps.h @@ -24,7 +24,7 @@ TYPED_TEST_CASE_P(FsppOpenFileTest_Timestamps); TYPED_TEST_P(FsppOpenFileTest_Timestamps, stat) { auto openFile = this->CreateAndOpenFile("/mynode"); auto operation = [&openFile] () { - struct ::stat st; + struct ::stat st{}; openFile->stat(&st); }; this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS(*openFile, operation, {this->ExpectDoesntUpdateAnyTimestamps}); diff --git a/src/fspp/fstest/testutils/FileSystemTest.h b/src/fspp/fstest/testutils/FileSystemTest.h index 6018d982..6ec640c8 100644 --- a/src/fspp/fstest/testutils/FileSystemTest.h +++ b/src/fspp/fstest/testutils/FileSystemTest.h @@ -90,7 +90,7 @@ public: void setModificationTimestampLaterThanAccessTimestamp(const boost::filesystem::path& path) { auto node = device->Load(path).value(); - struct stat st; + struct stat st{}; node->stat(&st); st.st_mtim.tv_nsec = st.st_mtim.tv_nsec + 1; node->utimens( diff --git a/src/fspp/fstest/testutils/FileTest.h b/src/fspp/fstest/testutils/FileTest.h index f3a7ed6f..773e53cb 100644 --- a/src/fspp/fstest/testutils/FileTest.h +++ b/src/fspp/fstest/testutils/FileTest.h @@ -29,7 +29,7 @@ public: //TODO IN_STAT still needed after moving it to FsppNodeTest? void IN_STAT(fspp::File *file, fspp::Node *node, std::function callback) { - struct stat st1, st2; + struct stat st1{}, st2{}; node->stat(&st1); callback(st1); file->open(O_RDONLY)->stat(&st2); diff --git a/src/fspp/fstest/testutils/FsppNodeTest.h b/src/fspp/fstest/testutils/FsppNodeTest.h index e9fa23c8..d656c66a 100644 --- a/src/fspp/fstest/testutils/FsppNodeTest.h +++ b/src/fspp/fstest/testutils/FsppNodeTest.h @@ -10,7 +10,7 @@ class FsppNodeTestHelper { public: void IN_STAT(fspp::Node *file, std::function callback) { - struct stat st; + struct stat st{}; file->stat(&st); callback(st); } diff --git a/src/fspp/fstest/testutils/TimestampTestUtils.h b/src/fspp/fstest/testutils/TimestampTestUtils.h index 43ed14f6..362f4a86 100644 --- a/src/fspp/fstest/testutils/TimestampTestUtils.h +++ b/src/fspp/fstest/testutils/TimestampTestUtils.h @@ -70,13 +70,13 @@ public: } static struct stat stat(const fspp::Node &node) { - struct stat st; + struct stat st{}; node.stat(&st); return st; } static struct stat stat(const fspp::OpenFile &openFile) { - struct stat st; + struct stat st{}; openFile.stat(&st); return st; } diff --git a/test/blobstore/implementations/onblocks/BlobStoreTest.cpp b/test/blobstore/implementations/onblocks/BlobStoreTest.cpp index dc84f698..e7c87a8a 100644 --- a/test/blobstore/implementations/onblocks/BlobStoreTest.cpp +++ b/test/blobstore/implementations/onblocks/BlobStoreTest.cpp @@ -2,8 +2,6 @@ #include using blockstore::BlockId; -using cpputils::unique_ref; -using blobstore::Blob; using boost::none; TEST_F(BlobStoreTest, LoadNonexistingKeyOnEmptyBlobstore) { diff --git a/test/blobstore/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp b/test/blobstore/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp index 9b101907..cff5b9c9 100644 --- a/test/blobstore/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp +++ b/test/blobstore/implementations/onblocks/datanodestore/DataLeafNodeTest.cpp @@ -13,7 +13,6 @@ using ::testing::Test; using ::testing::WithParamInterface; using ::testing::Values; -using ::testing::Combine; using cpputils::unique_ref; using cpputils::make_unique_ref; using std::string; diff --git a/test/blobstore/implementations/onblocks/datatreestore/DataTreeStoreTest.cpp b/test/blobstore/implementations/onblocks/datatreestore/DataTreeStoreTest.cpp index f01fba87..eb279a31 100644 --- a/test/blobstore/implementations/onblocks/datatreestore/DataTreeStoreTest.cpp +++ b/test/blobstore/implementations/onblocks/datatreestore/DataTreeStoreTest.cpp @@ -5,9 +5,7 @@ #include #include -using blockstore::testfake::FakeBlockStore; using blockstore::BlockId; -using blobstore::onblocks::datanodestore::DataNodeStore; using boost::none; using namespace blobstore::onblocks::datatreestore; diff --git a/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_NumStoredBytes.cpp b/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_NumStoredBytes.cpp index 5b8a6b87..85f54be6 100644 --- a/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_NumStoredBytes.cpp +++ b/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_NumStoredBytes.cpp @@ -1,15 +1,10 @@ #include "testutils/DataTreeTest.h" #include -using ::testing::_; using ::testing::WithParamInterface; using ::testing::Values; -using blobstore::onblocks::datanodestore::DataLeafNode; -using blobstore::onblocks::datanodestore::DataInnerNode; -using blobstore::onblocks::datanodestore::DataNode; using blobstore::onblocks::datanodestore::DataNodeLayout; -using blobstore::onblocks::datatreestore::DataTree; using blockstore::BlockId; class DataTreeTest_NumStoredBytes: public DataTreeTest { diff --git a/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_Performance.cpp b/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_Performance.cpp index b229f13b..bb0f98ef 100644 --- a/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_Performance.cpp +++ b/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_Performance.cpp @@ -2,16 +2,10 @@ #include -using blobstore::onblocks::datanodestore::DataNodeStore; -using blobstore::onblocks::datanodestore::DataLeafNode; -using blobstore::onblocks::datanodestore::DataInnerNode; -using blobstore::onblocks::datanodestore::DataNode; using blobstore::onblocks::datatreestore::DataTree; using blobstore::onblocks::datatreestore::LeafHandle; using blockstore::BlockId; -using blockstore::testfake::FakeBlockStore; using cpputils::Data; -using cpputils::make_unique_ref; class DataTreeTest_Performance: public DataTreeTest { public: diff --git a/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_TraverseLeaves.cpp b/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_TraverseLeaves.cpp index 8425a5e3..217b926a 100644 --- a/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_TraverseLeaves.cpp +++ b/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_TraverseLeaves.cpp @@ -8,7 +8,6 @@ using ::testing::Eq; using blobstore::onblocks::datanodestore::DataLeafNode; using blobstore::onblocks::datanodestore::DataInnerNode; using blobstore::onblocks::datanodestore::DataNode; -using blobstore::onblocks::datatreestore::DataTree; using blobstore::onblocks::datatreestore::LeafHandle; using blockstore::BlockId; diff --git a/test/blobstore/implementations/onblocks/datatreestore/impl/GetLowestInnerRightBorderNodeWithLessThanKChildrenOrNullTest.cpp b/test/blobstore/implementations/onblocks/datatreestore/impl/GetLowestInnerRightBorderNodeWithLessThanKChildrenOrNullTest.cpp index 8be22415..69a9ecd9 100644 --- a/test/blobstore/implementations/onblocks/datatreestore/impl/GetLowestInnerRightBorderNodeWithLessThanKChildrenOrNullTest.cpp +++ b/test/blobstore/implementations/onblocks/datatreestore/impl/GetLowestInnerRightBorderNodeWithLessThanKChildrenOrNullTest.cpp @@ -7,14 +7,7 @@ #include #include "blobstore/implementations/onblocks/datatreestore/impl/algorithms.h" -using ::testing::Test; -using std::pair; -using std::make_pair; -using blobstore::onblocks::datanodestore::DataNodeStore; -using blobstore::onblocks::datanodestore::DataNode; -using blobstore::onblocks::datanodestore::DataInnerNode; -using blockstore::testfake::FakeBlockStore; using blockstore::BlockId; using cpputils::Data; using namespace blobstore::onblocks::datatreestore::algorithms; diff --git a/test/blobstore/implementations/onblocks/datatreestore/impl/GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest.cpp b/test/blobstore/implementations/onblocks/datatreestore/impl/GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest.cpp index a4b931df..e3000cac 100644 --- a/test/blobstore/implementations/onblocks/datatreestore/impl/GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest.cpp +++ b/test/blobstore/implementations/onblocks/datatreestore/impl/GetLowestRightBorderNodeWithMoreThanOneChildOrNullTest.cpp @@ -7,14 +7,7 @@ #include #include "blobstore/implementations/onblocks/datatreestore/impl/algorithms.h" -using ::testing::Test; -using std::pair; -using std::make_pair; -using blobstore::onblocks::datanodestore::DataNodeStore; -using blobstore::onblocks::datanodestore::DataNode; -using blobstore::onblocks::datanodestore::DataInnerNode; -using blockstore::testfake::FakeBlockStore; using blockstore::BlockId; using namespace blobstore::onblocks::datatreestore::algorithms; diff --git a/test/blockstore/implementations/caching/CachingBlockStore2Test_Generic.cpp b/test/blockstore/implementations/caching/CachingBlockStore2Test_Generic.cpp index bef85f82..1d4ec708 100644 --- a/test/blockstore/implementations/caching/CachingBlockStore2Test_Generic.cpp +++ b/test/blockstore/implementations/caching/CachingBlockStore2Test_Generic.cpp @@ -5,7 +5,6 @@ #include "../../testutils/BlockStore2Test.h" #include -using ::testing::Test; using blockstore::BlockStore; using blockstore::BlockStore2; @@ -13,8 +12,6 @@ using blockstore::caching::CachingBlockStore2; using blockstore::lowtohighlevel::LowToHighLevelBlockStore; using blockstore::inmemory::InMemoryBlockStore2; -using cpputils::Data; -using cpputils::DataFixture; using cpputils::make_unique_ref; using cpputils::unique_ref; diff --git a/test/blockstore/implementations/caching/CachingBlockStore2Test_Specific.cpp b/test/blockstore/implementations/caching/CachingBlockStore2Test_Specific.cpp index ab10c17e..17de609f 100644 --- a/test/blockstore/implementations/caching/CachingBlockStore2Test_Specific.cpp +++ b/test/blockstore/implementations/caching/CachingBlockStore2Test_Specific.cpp @@ -5,8 +5,6 @@ using ::testing::Test; using cpputils::Data; -using cpputils::unique_ref; -using cpputils::make_unique_ref; using blockstore::inmemory::InMemoryBlockStore2; diff --git a/test/blockstore/implementations/caching/cache/CacheTest_PushAndPop.cpp b/test/blockstore/implementations/caching/cache/CacheTest_PushAndPop.cpp index 88f6462e..9337cf7a 100644 --- a/test/blockstore/implementations/caching/cache/CacheTest_PushAndPop.cpp +++ b/test/blockstore/implementations/caching/cache/CacheTest_PushAndPop.cpp @@ -5,7 +5,6 @@ #include "testutils/MinimalValueType.h" #include -using ::testing::Test; using namespace blockstore::caching; diff --git a/test/blockstore/implementations/caching/cache/testutils/CopyableMovableValueType.h b/test/blockstore/implementations/caching/cache/testutils/CopyableMovableValueType.h index e69c1de6..1e241278 100644 --- a/test/blockstore/implementations/caching/cache/testutils/CopyableMovableValueType.h +++ b/test/blockstore/implementations/caching/cache/testutils/CopyableMovableValueType.h @@ -14,10 +14,10 @@ public: ++numCopyConstructorCalled; return *this; } - CopyableMovableValueType(CopyableMovableValueType &&rhs): CopyableMovableValueType(rhs._value) { + CopyableMovableValueType(CopyableMovableValueType &&rhs) noexcept: CopyableMovableValueType(rhs._value) { //Don't increase numCopyConstructorCalled } - CopyableMovableValueType &operator=(CopyableMovableValueType &&rhs) { + CopyableMovableValueType &operator=(CopyableMovableValueType &&rhs) noexcept { //Don't increase numCopyConstructorCalled _value = rhs._value; return *this; diff --git a/test/blockstore/implementations/caching/cache/testutils/MinimalValueType.h b/test/blockstore/implementations/caching/cache/testutils/MinimalValueType.h index 72d4aef2..1228630f 100644 --- a/test/blockstore/implementations/caching/cache/testutils/MinimalValueType.h +++ b/test/blockstore/implementations/caching/cache/testutils/MinimalValueType.h @@ -15,11 +15,11 @@ public: return MinimalValueType(value); } - MinimalValueType(MinimalValueType &&rhs): MinimalValueType(rhs.value()) { + MinimalValueType(MinimalValueType &&rhs) noexcept: MinimalValueType(rhs.value()) { rhs._isMoved = true; } - MinimalValueType &operator=(MinimalValueType &&rhs) { + MinimalValueType &operator=(MinimalValueType &&rhs) noexcept { _value = rhs.value(); _isMoved = false; rhs._isMoved = true; diff --git a/test/blockstore/implementations/compressing/CompressingBlockStoreTest.cpp b/test/blockstore/implementations/compressing/CompressingBlockStoreTest.cpp index 15dfd538..05e4f34a 100644 --- a/test/blockstore/implementations/compressing/CompressingBlockStoreTest.cpp +++ b/test/blockstore/implementations/compressing/CompressingBlockStoreTest.cpp @@ -5,7 +5,6 @@ #include "../../testutils/BlockStoreTest.h" #include -using ::testing::Test; using blockstore::BlockStore; using blockstore::compressing::CompressingBlockStore; diff --git a/test/blockstore/implementations/encrypted/EncryptedBlockStoreTest_Generic.cpp b/test/blockstore/implementations/encrypted/EncryptedBlockStoreTest_Generic.cpp index 4ff29efc..a97688f7 100644 --- a/test/blockstore/implementations/encrypted/EncryptedBlockStoreTest_Generic.cpp +++ b/test/blockstore/implementations/encrypted/EncryptedBlockStoreTest_Generic.cpp @@ -7,10 +7,9 @@ #include "../../testutils/BlockStoreTest.h" #include "../../testutils/BlockStore2Test.h" //TODO Move FakeAuthenticatedCipher out of test folder to normal folder. Dependencies should not point into tests of other modules. -#include "../../../cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h" +#include "cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h" #include -using ::testing::Test; using blockstore::BlockStore; using blockstore::BlockStore2; diff --git a/test/blockstore/implementations/encrypted/EncryptedBlockStoreTest_Specific.cpp b/test/blockstore/implementations/encrypted/EncryptedBlockStoreTest_Specific.cpp index 6bddf695..5c410328 100644 --- a/test/blockstore/implementations/encrypted/EncryptedBlockStoreTest_Specific.cpp +++ b/test/blockstore/implementations/encrypted/EncryptedBlockStoreTest_Specific.cpp @@ -1,6 +1,6 @@ #include "cpp-utils/crypto/cryptopp_byte.h" #include -#include "../../../cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h" +#include "cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h" #include "blockstore/implementations/encrypted/EncryptedBlockStore2.h" #include "blockstore/implementations/inmemory/InMemoryBlockStore2.h" #include "blockstore/utils/BlockStoreUtils.h" @@ -54,7 +54,7 @@ public: blockstore::BlockId CopyBaseBlock(const blockstore::BlockId &blockId) { auto source = baseBlockStore->load(blockId).value(); - return baseBlockStore->create(std::move(source)); + return baseBlockStore->create(source); } private: diff --git a/test/blockstore/implementations/integrity/IntegrityBlockStoreTest_Generic.cpp b/test/blockstore/implementations/integrity/IntegrityBlockStoreTest_Generic.cpp index e5be4e33..5c8ccf91 100644 --- a/test/blockstore/implementations/integrity/IntegrityBlockStoreTest_Generic.cpp +++ b/test/blockstore/implementations/integrity/IntegrityBlockStoreTest_Generic.cpp @@ -6,17 +6,13 @@ #include #include -using ::testing::Test; using blockstore::BlockStore; using blockstore::BlockStore2; using blockstore::integrity::IntegrityBlockStore2; -using blockstore::integrity::KnownBlockVersions; using blockstore::lowtohighlevel::LowToHighLevelBlockStore; using blockstore::inmemory::InMemoryBlockStore2; -using cpputils::Data; -using cpputils::DataFixture; using cpputils::make_unique_ref; using cpputils::unique_ref; using cpputils::TempFile; diff --git a/test/blockstore/implementations/integrity/IntegrityBlockStoreTest_Specific.cpp b/test/blockstore/implementations/integrity/IntegrityBlockStoreTest_Specific.cpp index 2fa919fe..b7af3e4a 100644 --- a/test/blockstore/implementations/integrity/IntegrityBlockStoreTest_Specific.cpp +++ b/test/blockstore/implementations/integrity/IntegrityBlockStoreTest_Specific.cpp @@ -102,7 +102,7 @@ public: } void insertBaseBlock(const blockstore::BlockId &blockId, Data data) { - EXPECT_TRUE(baseBlockStore->tryCreate(blockId, std::move(data))); + EXPECT_TRUE(baseBlockStore->tryCreate(blockId, data)); } private: diff --git a/test/blockstore/implementations/low2highlevel/LowToHighLevelBlockStoreTest.cpp b/test/blockstore/implementations/low2highlevel/LowToHighLevelBlockStoreTest.cpp index aad0c08a..82670059 100644 --- a/test/blockstore/implementations/low2highlevel/LowToHighLevelBlockStoreTest.cpp +++ b/test/blockstore/implementations/low2highlevel/LowToHighLevelBlockStoreTest.cpp @@ -5,19 +5,13 @@ #include #include -using ::testing::Test; using blockstore::BlockStore; -using blockstore::BlockStore2; using blockstore::lowtohighlevel::LowToHighLevelBlockStore; -using blockstore::testfake::FakeBlockStore; using blockstore::inmemory::InMemoryBlockStore2; -using cpputils::Data; -using cpputils::DataFixture; using cpputils::make_unique_ref; using cpputils::unique_ref; -using cpputils::TempFile; class LowToHighLevelBlockStoreTestFixture: public BlockStoreTestFixture { public: diff --git a/test/blockstore/implementations/parallelaccess/ParallelAccessBlockStoreTest_Specific.cpp b/test/blockstore/implementations/parallelaccess/ParallelAccessBlockStoreTest_Specific.cpp index 59670fb6..b59f7370 100644 --- a/test/blockstore/implementations/parallelaccess/ParallelAccessBlockStoreTest_Specific.cpp +++ b/test/blockstore/implementations/parallelaccess/ParallelAccessBlockStoreTest_Specific.cpp @@ -5,8 +5,6 @@ using ::testing::Test; using cpputils::Data; -using cpputils::unique_ref; -using cpputils::make_unique_ref; using blockstore::testfake::FakeBlockStore; diff --git a/test/blockstore/interface/BlockStore2Test.cpp b/test/blockstore/interface/BlockStore2Test.cpp index 4dc36eb1..e194c693 100644 --- a/test/blockstore/interface/BlockStore2Test.cpp +++ b/test/blockstore/interface/BlockStore2Test.cpp @@ -13,7 +13,6 @@ using ::testing::ByRef; using std::string; using cpputils::Data; using cpputils::DataFixture; -using cpputils::unique_ref; using boost::optional; namespace boost { diff --git a/test/blockstore/utils/BlockStoreUtilsTest.cpp b/test/blockstore/utils/BlockStoreUtilsTest.cpp index dc90a07a..0ec31972 100644 --- a/test/blockstore/utils/BlockStoreUtilsTest.cpp +++ b/test/blockstore/utils/BlockStoreUtilsTest.cpp @@ -6,8 +6,6 @@ #include using ::testing::Test; -using ::testing::WithParamInterface; -using ::testing::Values; using cpputils::Data; using cpputils::DataFixture; diff --git a/test/cpp-utils/CMakeLists.txt b/test/cpp-utils/CMakeLists.txt index 3c9d0f11..0acc127a 100644 --- a/test/cpp-utils/CMakeLists.txt +++ b/test/cpp-utils/CMakeLists.txt @@ -1,9 +1,7 @@ project (cpp-utils-test) set(SOURCES - EitherIncludeTest.cpp crypto/symmetric/CipherTest.cpp - crypto/symmetric/testutils/FakeAuthenticatedCipher.cpp crypto/kdf/SCryptTest.cpp crypto/kdf/SCryptParametersTest.cpp crypto/hash/HashTest.cpp @@ -42,7 +40,6 @@ set(SOURCES logging/LoggingTest.cpp logging/LoggerIncludeTest.cpp logging/LoggingIncludeTest.cpp - EitherTest.cpp assert/assert_release_test.cpp assert/backtrace_include_test.cpp assert/assert_include_test.cpp diff --git a/test/cpp-utils/assert/assert_debug_test.cpp b/test/cpp-utils/assert/assert_debug_test.cpp index 7da2627e..7e6d4be1 100644 --- a/test/cpp-utils/assert/assert_debug_test.cpp +++ b/test/cpp-utils/assert/assert_debug_test.cpp @@ -5,7 +5,6 @@ #undef NDEBUG #include "cpp-utils/assert/assert.h" -using testing::MatchesRegex; TEST(AssertTest_DebugBuild, DoesntDieIfTrue) { ASSERT(true, "bla"); diff --git a/test/cpp-utils/crypto/symmetric/CipherTest.cpp b/test/cpp-utils/crypto/symmetric/CipherTest.cpp index bfe54383..dc606916 100644 --- a/test/cpp-utils/crypto/symmetric/CipherTest.cpp +++ b/test/cpp-utils/crypto/symmetric/CipherTest.cpp @@ -2,7 +2,7 @@ #include #include "cpp-utils/crypto/symmetric/Cipher.h" #include "cpp-utils/crypto/symmetric/ciphers.h" -#include "testutils/FakeAuthenticatedCipher.h" +#include "cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h" #include "cpp-utils/data/DataFixture.h" #include "cpp-utils/data/Data.h" diff --git a/test/cpp-utils/data/DataFixtureTest.cpp b/test/cpp-utils/data/DataFixtureTest.cpp index 5029a3ff..0fa60cdc 100644 --- a/test/cpp-utils/data/DataFixtureTest.cpp +++ b/test/cpp-utils/data/DataFixtureTest.cpp @@ -4,10 +4,7 @@ #include "cpp-utils/data/DataFixture.h" using ::testing::Test; -using ::testing::WithParamInterface; -using ::testing::Values; -namespace bf = boost::filesystem; using namespace cpputils; diff --git a/test/cpp-utils/io/ConsoleTest_Ask.cpp b/test/cpp-utils/io/ConsoleTest_Ask.cpp index 400680ad..ea8911fd 100644 --- a/test/cpp-utils/io/ConsoleTest_Ask.cpp +++ b/test/cpp-utils/io/ConsoleTest_Ask.cpp @@ -2,11 +2,8 @@ using std::stringstream; using std::string; -using std::vector; using std::istream; using std::ostream; -using std::future; -using std::initializer_list; class ConsoleTest_Ask: public ConsoleTest {}; diff --git a/test/cpp-utils/logging/LoggerTest.cpp b/test/cpp-utils/logging/LoggerTest.cpp index a909ee49..120f5331 100644 --- a/test/cpp-utils/logging/LoggerTest.cpp +++ b/test/cpp-utils/logging/LoggerTest.cpp @@ -6,7 +6,6 @@ using namespace cpputils::logging; using std::string; -using testing::MatchesRegex; class LoggerTest: public LoggingTest {}; diff --git a/test/cpp-utils/network/CurlHttpClientTest.cpp b/test/cpp-utils/network/CurlHttpClientTest.cpp index d23fb219..c3c9252f 100644 --- a/test/cpp-utils/network/CurlHttpClientTest.cpp +++ b/test/cpp-utils/network/CurlHttpClientTest.cpp @@ -4,8 +4,6 @@ #include "cpp-utils/pointer/unique_ref_boost_optional_gtest_workaround.h" using std::string; -using boost::none; -using testing::MatchesRegex; using namespace cpputils; diff --git a/test/cpp-utils/pointer/unique_ref_test.cpp b/test/cpp-utils/pointer/unique_ref_test.cpp index 955212b5..f8d8e941 100644 --- a/test/cpp-utils/pointer/unique_ref_test.cpp +++ b/test/cpp-utils/pointer/unique_ref_test.cpp @@ -590,7 +590,7 @@ namespace { class OnlyMoveable { public: OnlyMoveable(int value_): value(value_) {} - OnlyMoveable(OnlyMoveable &&source): value(source.value) {source.value = -1;} + OnlyMoveable(OnlyMoveable &&source) noexcept: value(source.value) {source.value = -1;} bool operator==(const OnlyMoveable &rhs) const { return value == rhs.value; } diff --git a/test/cryfs-cli/CallAfterTimeoutTest.cpp b/test/cryfs-cli/CallAfterTimeoutTest.cpp index 3f28456d..41518ffc 100644 --- a/test/cryfs-cli/CallAfterTimeoutTest.cpp +++ b/test/cryfs-cli/CallAfterTimeoutTest.cpp @@ -6,7 +6,6 @@ using cpputils::unique_ref; using cpputils::make_unique_ref; using boost::chrono::milliseconds; using boost::chrono::minutes; -using boost::chrono::duration_cast; using boost::this_thread::sleep_for; using namespace cryfs; diff --git a/test/cryfs-cli/VersionCheckerTest.cpp b/test/cryfs-cli/VersionCheckerTest.cpp index 8f2bdea6..9008510d 100644 --- a/test/cryfs-cli/VersionCheckerTest.cpp +++ b/test/cryfs-cli/VersionCheckerTest.cpp @@ -3,8 +3,6 @@ #include #include -using std::shared_ptr; -using std::make_shared; using std::string; using cpputils::FakeHttpClient; using cpputils::unique_ref; diff --git a/test/cryfs-cli/program_options/ProgramOptionsTest.cpp b/test/cryfs-cli/program_options/ProgramOptionsTest.cpp index abe148dd..73e843bc 100644 --- a/test/cryfs-cli/program_options/ProgramOptionsTest.cpp +++ b/test/cryfs-cli/program_options/ProgramOptionsTest.cpp @@ -3,7 +3,6 @@ #include using namespace cryfs::program_options; -using std::vector; using boost::none; using boost::optional; using std::ostream; diff --git a/test/cryfs/config/CompatibilityTest.cpp b/test/cryfs/config/CompatibilityTest.cpp index b36fe9a5..eb24b3f6 100644 --- a/test/cryfs/config/CompatibilityTest.cpp +++ b/test/cryfs/config/CompatibilityTest.cpp @@ -8,12 +8,10 @@ #include #include -using std::vector; using cpputils::Data; using cpputils::AES256_GCM; using cpputils::Serpent128_CFB; using cpputils::TempFile; -namespace bf = boost::filesystem; using namespace cryfs; // Test that config files created with (old) versions of cryfs are still loadable. diff --git a/test/cryfs/config/CryCipherTest.cpp b/test/cryfs/config/CryCipherTest.cpp index d336f793..b88aae5e 100644 --- a/test/cryfs/config/CryCipherTest.cpp +++ b/test/cryfs/config/CryCipherTest.cpp @@ -53,7 +53,7 @@ public: unique_ref _baseStore = make_unique_ref(); InMemoryBlockStore2 *baseStore = _baseStore.get(); unique_ref encryptedStore = cipher.createEncryptedBlockstore(std::move(_baseStore), encKey); - bool created = encryptedStore->tryCreate(blockId, std::move(data)); + bool created = encryptedStore->tryCreate(blockId, data); EXPECT_TRUE(created); return _loadBlock(baseStore, blockId); } @@ -61,7 +61,7 @@ public: template Data _decryptUsingEncryptedBlockStoreWithCipher(const std::string &encKey, const blockstore::BlockId &blockId, Data data) { unique_ref baseStore = make_unique_ref(); - bool created = baseStore->tryCreate(blockId, std::move(data)); + bool created = baseStore->tryCreate(blockId, data); EXPECT_TRUE(created); EncryptedBlockStore2 encryptedStore(std::move(baseStore), Cipher::EncryptionKey::FromString(encKey)); return _loadBlock(&encryptedStore, blockId); diff --git a/test/cryfs/config/CryConfigConsoleTest.cpp b/test/cryfs/config/CryConfigConsoleTest.cpp index f76806aa..83062314 100644 --- a/test/cryfs/config/CryConfigConsoleTest.cpp +++ b/test/cryfs/config/CryConfigConsoleTest.cpp @@ -10,17 +10,12 @@ using namespace cryfs; using boost::optional; using boost::none; -using cpputils::Console; using cpputils::NoninteractiveConsole; -using cpputils::unique_ref; -using cpputils::make_unique_ref; using std::string; -using std::vector; using std::shared_ptr; using std::make_shared; using ::testing::_; using ::testing::Return; -using ::testing::Invoke; using ::testing::ValuesIn; using ::testing::HasSubstr; using ::testing::UnorderedElementsAreArray; diff --git a/test/cryfs/config/CryConfigCreatorTest.cpp b/test/cryfs/config/CryConfigCreatorTest.cpp index 53d28cb6..8298903a 100644 --- a/test/cryfs/config/CryConfigCreatorTest.cpp +++ b/test/cryfs/config/CryConfigCreatorTest.cpp @@ -10,23 +10,15 @@ using namespace cryfs; -using boost::optional; using boost::none; -using cpputils::Console; using cpputils::NoninteractiveConsole; -using cpputils::unique_ref; -using cpputils::make_unique_ref; using std::string; -using std::vector; using std::shared_ptr; using std::make_shared; using ::testing::_; using ::testing::Return; -using ::testing::Invoke; -using ::testing::ValuesIn; using ::testing::HasSubstr; using ::testing::UnorderedElementsAreArray; -using ::testing::WithParamInterface; #define EXPECT_ASK_TO_USE_DEFAULT_SETTINGS() \ EXPECT_CALL(*console, askYesNo("Use default settings?", true)).Times(1) diff --git a/test/cryfs/config/CryConfigLoaderTest.cpp b/test/cryfs/config/CryConfigLoaderTest.cpp index 401688d6..06c70b6c 100644 --- a/test/cryfs/config/CryConfigLoaderTest.cpp +++ b/test/cryfs/config/CryConfigLoaderTest.cpp @@ -10,8 +10,6 @@ #include #include -using cpputils::unique_ref; -using cpputils::make_unique_ref; using cpputils::TempFile; using cpputils::SCrypt; using cpputils::DataFixture; @@ -23,7 +21,6 @@ using std::string; using std::ostream; using std::make_shared; using ::testing::Return; -using ::testing::_; using ::testing::HasSubstr; using namespace cryfs; diff --git a/test/cryfs/config/crypto/outer/OuterConfigTest.cpp b/test/cryfs/config/crypto/outer/OuterConfigTest.cpp index ce96f3ed..f7f7fb0a 100644 --- a/test/cryfs/config/crypto/outer/OuterConfigTest.cpp +++ b/test/cryfs/config/crypto/outer/OuterConfigTest.cpp @@ -4,8 +4,6 @@ using cpputils::Data; using cpputils::DataFixture; -using cpputils::Deserializer; -using cpputils::Serializer; using boost::none; using std::ostream; using namespace cryfs; diff --git a/test/cryfs/filesystem/CryFsTest.cpp b/test/cryfs/filesystem/CryFsTest.cpp index 29dec8cb..3b445625 100644 --- a/test/cryfs/filesystem/CryFsTest.cpp +++ b/test/cryfs/filesystem/CryFsTest.cpp @@ -16,19 +16,14 @@ //TODO (whole project) Make constructors explicit when implicit construction not needed using ::testing::Test; -using ::testing::Return; -using ::testing::_; using std::make_shared; using cpputils::TempDir; using cpputils::TempFile; -using cpputils::dynamic_pointer_move; using cpputils::make_unique_ref; using cpputils::unique_ref; -using cpputils::Console; using cpputils::Random; using cpputils::SCrypt; using cpputils::Data; -using cpputils::system::FakeHomeDirectoryRAII; using cpputils::NoninteractiveConsole; using blockstore::ondisk::OnDiskBlockStore2; using boost::none; diff --git a/test/cryfs/filesystem/FileSystemTest.cpp b/test/cryfs/filesystem/FileSystemTest.cpp index dfd4f1fb..14867320 100644 --- a/test/cryfs/filesystem/FileSystemTest.cpp +++ b/test/cryfs/filesystem/FileSystemTest.cpp @@ -13,8 +13,6 @@ using cpputils::Random; using cpputils::SCrypt; using cpputils::NoninteractiveConsole; using fspp::Device; -using ::testing::Return; -using ::testing::_; using boost::none; using std::make_shared; using blockstore::inmemory::InMemoryBlockStore2; diff --git a/test/fspp/fuse/BasicFuseTest.cpp b/test/fspp/fuse/BasicFuseTest.cpp index 042b28f0..07d3c446 100644 --- a/test/fspp/fuse/BasicFuseTest.cpp +++ b/test/fspp/fuse/BasicFuseTest.cpp @@ -3,8 +3,6 @@ using namespace fspp::fuse; using namespace fspp::fuse; -using ::testing::_; -using ::testing::StrEq; typedef FuseTest BasicFuseTest; diff --git a/test/fspp/fuse/access/FuseAccessModeTest.cpp b/test/fspp/fuse/access/FuseAccessModeTest.cpp index b29031db..316f6659 100644 --- a/test/fspp/fuse/access/FuseAccessModeTest.cpp +++ b/test/fspp/fuse/access/FuseAccessModeTest.cpp @@ -1,6 +1,5 @@ #include "testutils/FuseAccessTest.h" -using ::testing::_; using ::testing::StrEq; using ::testing::Return; using ::testing::WithParamInterface; diff --git a/test/fspp/fuse/closeFile/FuseCloseTest.cpp b/test/fspp/fuse/closeFile/FuseCloseTest.cpp index fe66a1e4..2c698809 100644 --- a/test/fspp/fuse/closeFile/FuseCloseTest.cpp +++ b/test/fspp/fuse/closeFile/FuseCloseTest.cpp @@ -2,15 +2,8 @@ #include "../../testutils/OpenFileHandle.h" #include -using ::testing::_; -using ::testing::StrEq; -using ::testing::Eq; using ::testing::WithParamInterface; using ::testing::Values; -using ::testing::Return; -using ::testing::Invoke; -using ::testing::InSequence; -using ::testing::AtLeast; using std::string; using std::mutex; diff --git a/test/fspp/fuse/createAndOpenFile/FuseCreateAndOpenFlagsTest.cpp b/test/fspp/fuse/createAndOpenFile/FuseCreateAndOpenFlagsTest.cpp index 400f2f4e..b8ff7b6c 100644 --- a/test/fspp/fuse/createAndOpenFile/FuseCreateAndOpenFlagsTest.cpp +++ b/test/fspp/fuse/createAndOpenFile/FuseCreateAndOpenFlagsTest.cpp @@ -1,10 +1,7 @@ #include "testutils/FuseCreateAndOpenTest.h" -using ::testing::_; -using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; -using ::testing::Return; class FuseCreateAndOpenFlagsTest: public FuseCreateAndOpenTest, public WithParamInterface { }; diff --git a/test/fspp/fuse/createAndOpenFile/testutils/FuseCreateAndOpenTest.cpp b/test/fspp/fuse/createAndOpenFile/testutils/FuseCreateAndOpenTest.cpp index 692ae173..797b42df 100644 --- a/test/fspp/fuse/createAndOpenFile/testutils/FuseCreateAndOpenTest.cpp +++ b/test/fspp/fuse/createAndOpenFile/testutils/FuseCreateAndOpenTest.cpp @@ -1,6 +1,5 @@ #include "FuseCreateAndOpenTest.h" -using ::testing::_; using cpputils::unique_ref; using cpputils::make_unique_ref; diff --git a/test/fspp/fuse/fdatasync/FuseFdatasyncErrorTest.cpp b/test/fspp/fuse/fdatasync/FuseFdatasyncErrorTest.cpp index 4136345b..57cfa7fc 100644 --- a/test/fspp/fuse/fdatasync/FuseFdatasyncErrorTest.cpp +++ b/test/fspp/fuse/fdatasync/FuseFdatasyncErrorTest.cpp @@ -2,8 +2,6 @@ #include "fspp/fuse/FuseErrnoException.h" -using ::testing::_; -using ::testing::StrEq; using ::testing::Throw; using ::testing::WithParamInterface; using ::testing::Values; diff --git a/test/fspp/fuse/fdatasync/FuseFdatasyncFileDescriptorTest.cpp b/test/fspp/fuse/fdatasync/FuseFdatasyncFileDescriptorTest.cpp index fb5c99c8..e0e88c52 100644 --- a/test/fspp/fuse/fdatasync/FuseFdatasyncFileDescriptorTest.cpp +++ b/test/fspp/fuse/fdatasync/FuseFdatasyncFileDescriptorTest.cpp @@ -2,8 +2,6 @@ #include "fspp/fuse/FuseErrnoException.h" -using ::testing::_; -using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; using ::testing::Eq; diff --git a/test/fspp/fuse/flush/FuseFlushErrorTest.cpp b/test/fspp/fuse/flush/FuseFlushErrorTest.cpp index 504064d2..052ce121 100644 --- a/test/fspp/fuse/flush/FuseFlushErrorTest.cpp +++ b/test/fspp/fuse/flush/FuseFlushErrorTest.cpp @@ -7,7 +7,6 @@ using ::testing::StrEq; using ::testing::Eq; using ::testing::Return; using ::testing::Throw; -using ::testing::AtLeast; using ::testing::Values; using ::testing::_; diff --git a/test/fspp/fuse/flush/FuseFlushFileDescriptorTest.cpp b/test/fspp/fuse/flush/FuseFlushFileDescriptorTest.cpp index 11e14bcb..5c34dc28 100644 --- a/test/fspp/fuse/flush/FuseFlushFileDescriptorTest.cpp +++ b/test/fspp/fuse/flush/FuseFlushFileDescriptorTest.cpp @@ -6,7 +6,6 @@ using ::testing::Eq; using ::testing::WithParamInterface; using ::testing::Values; using ::testing::Return; -using ::testing::AtLeast; using std::string; diff --git a/test/fspp/fuse/fstat/FuseFstatErrorTest.cpp b/test/fspp/fuse/fstat/FuseFstatErrorTest.cpp index cf655d95..53851629 100644 --- a/test/fspp/fuse/fstat/FuseFstatErrorTest.cpp +++ b/test/fspp/fuse/fstat/FuseFstatErrorTest.cpp @@ -3,15 +3,11 @@ #include "fspp/fuse/FuseErrnoException.h" using ::testing::_; -using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; using ::testing::Eq; -using ::testing::Return; using ::testing::Throw; -using cpputils::unique_ref; -using cpputils::make_unique_ref; using namespace fspp::fuse; diff --git a/test/fspp/fuse/fstat/FuseFstatParameterTest.cpp b/test/fspp/fuse/fstat/FuseFstatParameterTest.cpp index e0fd043f..f9fe1d24 100644 --- a/test/fspp/fuse/fstat/FuseFstatParameterTest.cpp +++ b/test/fspp/fuse/fstat/FuseFstatParameterTest.cpp @@ -3,12 +3,9 @@ #include "fspp/fuse/FuseErrnoException.h" using ::testing::_; -using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; using ::testing::Eq; -using ::testing::Return; -using ::testing::Throw; using namespace fspp::fuse; diff --git a/test/fspp/fuse/fsync/FuseFsyncErrorTest.cpp b/test/fspp/fuse/fsync/FuseFsyncErrorTest.cpp index 81a7dbec..9165d98f 100644 --- a/test/fspp/fuse/fsync/FuseFsyncErrorTest.cpp +++ b/test/fspp/fuse/fsync/FuseFsyncErrorTest.cpp @@ -2,8 +2,6 @@ #include "fspp/fuse/FuseErrnoException.h" -using ::testing::_; -using ::testing::StrEq; using ::testing::Throw; using ::testing::WithParamInterface; using ::testing::Values; diff --git a/test/fspp/fuse/fsync/FuseFsyncFileDescriptorTest.cpp b/test/fspp/fuse/fsync/FuseFsyncFileDescriptorTest.cpp index d6413305..32c9f897 100644 --- a/test/fspp/fuse/fsync/FuseFsyncFileDescriptorTest.cpp +++ b/test/fspp/fuse/fsync/FuseFsyncFileDescriptorTest.cpp @@ -2,8 +2,6 @@ #include "fspp/fuse/FuseErrnoException.h" -using ::testing::_; -using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; using ::testing::Eq; diff --git a/test/fspp/fuse/ftruncate/FuseFTruncateErrorTest.cpp b/test/fspp/fuse/ftruncate/FuseFTruncateErrorTest.cpp index 4aeca3e8..5db23b28 100644 --- a/test/fspp/fuse/ftruncate/FuseFTruncateErrorTest.cpp +++ b/test/fspp/fuse/ftruncate/FuseFTruncateErrorTest.cpp @@ -3,7 +3,6 @@ #include "fspp/fuse/FuseErrnoException.h" using ::testing::_; -using ::testing::StrEq; using ::testing::Throw; using ::testing::WithParamInterface; using ::testing::Values; diff --git a/test/fspp/fuse/ftruncate/FuseFTruncateFileDescriptorTest.cpp b/test/fspp/fuse/ftruncate/FuseFTruncateFileDescriptorTest.cpp index 2374bc81..5be1c896 100644 --- a/test/fspp/fuse/ftruncate/FuseFTruncateFileDescriptorTest.cpp +++ b/test/fspp/fuse/ftruncate/FuseFTruncateFileDescriptorTest.cpp @@ -3,12 +3,10 @@ #include "fspp/fuse/FuseErrnoException.h" using ::testing::_; -using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; using ::testing::Eq; using ::testing::Return; -using ::testing::Throw; using namespace fspp::fuse; diff --git a/test/fspp/fuse/ftruncate/FuseFTruncateSizeTest.cpp b/test/fspp/fuse/ftruncate/FuseFTruncateSizeTest.cpp index 82dc5561..28ff937e 100644 --- a/test/fspp/fuse/ftruncate/FuseFTruncateSizeTest.cpp +++ b/test/fspp/fuse/ftruncate/FuseFTruncateSizeTest.cpp @@ -1,7 +1,5 @@ #include "testutils/FuseFTruncateTest.h" -using ::testing::_; -using ::testing::StrEq; using ::testing::Eq; using ::testing::Return; using ::testing::WithParamInterface; diff --git a/test/fspp/fuse/lstat/testutils/FuseLstatTest.cpp b/test/fspp/fuse/lstat/testutils/FuseLstatTest.cpp index ebfda067..8d797c6a 100644 --- a/test/fspp/fuse/lstat/testutils/FuseLstatTest.cpp +++ b/test/fspp/fuse/lstat/testutils/FuseLstatTest.cpp @@ -6,12 +6,12 @@ using ::testing::_; using ::testing::Invoke; void FuseLstatTest::LstatPath(const std::string &path) { - struct stat dummy; + struct stat dummy{}; LstatPath(path, &dummy); } int FuseLstatTest::LstatPathReturnError(const std::string &path) { - struct stat dummy; + struct stat dummy{}; return LstatPathReturnError(path, &dummy); } @@ -45,7 +45,7 @@ struct stat FuseLstatTest::CallLstatWithImpl(function implem implementation(stat); })); - struct stat result; + struct stat result{}; LstatPath(FILENAME, &result); return result; diff --git a/test/fspp/fuse/mkdir/FuseMkdirDirnameTest.cpp b/test/fspp/fuse/mkdir/FuseMkdirDirnameTest.cpp index 8dd3887b..77f18b6f 100644 --- a/test/fspp/fuse/mkdir/FuseMkdirDirnameTest.cpp +++ b/test/fspp/fuse/mkdir/FuseMkdirDirnameTest.cpp @@ -2,9 +2,6 @@ using ::testing::_; using ::testing::StrEq; -using ::testing::Return; -using ::testing::Invoke; -using ::testing::Action; class FuseMkdirDirnameTest: public FuseMkdirTest { }; diff --git a/test/fspp/fuse/mkdir/FuseMkdirModeTest.cpp b/test/fspp/fuse/mkdir/FuseMkdirModeTest.cpp index ec4fa36f..c593147a 100644 --- a/test/fspp/fuse/mkdir/FuseMkdirModeTest.cpp +++ b/test/fspp/fuse/mkdir/FuseMkdirModeTest.cpp @@ -2,7 +2,6 @@ using ::testing::_; using ::testing::StrEq; -using ::testing::Return; using ::testing::WithParamInterface; using ::testing::Values; diff --git a/test/fspp/fuse/openFile/FuseOpenFlagsTest.cpp b/test/fspp/fuse/openFile/FuseOpenFlagsTest.cpp index 2009cccd..644f6e0f 100644 --- a/test/fspp/fuse/openFile/FuseOpenFlagsTest.cpp +++ b/test/fspp/fuse/openFile/FuseOpenFlagsTest.cpp @@ -1,6 +1,5 @@ #include "testutils/FuseOpenTest.h" -using ::testing::_; using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; diff --git a/test/fspp/fuse/read/FuseReadErrorTest.cpp b/test/fspp/fuse/read/FuseReadErrorTest.cpp index ab50fb76..bd7074c5 100644 --- a/test/fspp/fuse/read/FuseReadErrorTest.cpp +++ b/test/fspp/fuse/read/FuseReadErrorTest.cpp @@ -3,12 +3,10 @@ #include "fspp/fuse/FuseErrnoException.h" using ::testing::_; -using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; using ::testing::Eq; using ::testing::Ne; -using ::testing::Return; using ::testing::Invoke; using ::testing::Throw; diff --git a/test/fspp/fuse/read/FuseReadFileDescriptorTest.cpp b/test/fspp/fuse/read/FuseReadFileDescriptorTest.cpp index 3170af4c..7cb284b1 100644 --- a/test/fspp/fuse/read/FuseReadFileDescriptorTest.cpp +++ b/test/fspp/fuse/read/FuseReadFileDescriptorTest.cpp @@ -3,13 +3,9 @@ #include "fspp/fuse/FuseErrnoException.h" using ::testing::_; -using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; using ::testing::Eq; -using ::testing::Return; -using ::testing::Invoke; -using ::testing::Throw; using namespace fspp::fuse; diff --git a/test/fspp/fuse/read/FuseReadOverflowTest.cpp b/test/fspp/fuse/read/FuseReadOverflowTest.cpp index 78175d65..5a35aeab 100644 --- a/test/fspp/fuse/read/FuseReadOverflowTest.cpp +++ b/test/fspp/fuse/read/FuseReadOverflowTest.cpp @@ -3,13 +3,7 @@ #include "fspp/fuse/FuseErrnoException.h" using ::testing::_; -using ::testing::StrEq; -using ::testing::Eq; -using ::testing::Return; -using ::testing::Invoke; -using ::testing::Action; -using std::min; using namespace fspp::fuse; diff --git a/test/fspp/fuse/read/FuseReadReturnedDataTest.cpp b/test/fspp/fuse/read/FuseReadReturnedDataTest.cpp index 0c0e503b..31ac6c75 100644 --- a/test/fspp/fuse/read/FuseReadReturnedDataTest.cpp +++ b/test/fspp/fuse/read/FuseReadReturnedDataTest.cpp @@ -10,18 +10,14 @@ #include using ::testing::_; -using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; using ::testing::Combine; -using ::testing::Eq; -using ::testing::Return; using ::testing::Invoke; using ::testing::Action; using std::tuple; using std::get; -using std::min; using cpputils::Data; using cpputils::DataFixture; diff --git a/test/fspp/fuse/read/testutils/FuseReadTest.cpp b/test/fspp/fuse/read/testutils/FuseReadTest.cpp index dee3b68a..50655d01 100644 --- a/test/fspp/fuse/read/testutils/FuseReadTest.cpp +++ b/test/fspp/fuse/read/testutils/FuseReadTest.cpp @@ -14,7 +14,7 @@ FuseReadTest::ReadError FuseReadTest::ReadFileReturnError(const char *filename, auto fd = OpenFile(fs.get(), filename); - ReadError result; + ReadError result{}; errno = 0; result.read_bytes = ::pread(fd->fd(), buf, count, offset); result.error = errno; diff --git a/test/fspp/fuse/readDir/FuseReadDirDirnameTest.cpp b/test/fspp/fuse/readDir/FuseReadDirDirnameTest.cpp index c0556c7d..58c094ab 100644 --- a/test/fspp/fuse/readDir/FuseReadDirDirnameTest.cpp +++ b/test/fspp/fuse/readDir/FuseReadDirDirnameTest.cpp @@ -1,10 +1,7 @@ #include "testutils/FuseReadDirTest.h" -using ::testing::_; using ::testing::StrEq; -using ::testing::Return; -using std::vector; using std::string; class FuseReadDirDirnameTest: public FuseReadDirTest { diff --git a/test/fspp/fuse/readDir/FuseReadDirErrorTest.cpp b/test/fspp/fuse/readDir/FuseReadDirErrorTest.cpp index 6fe313c4..07df5801 100644 --- a/test/fspp/fuse/readDir/FuseReadDirErrorTest.cpp +++ b/test/fspp/fuse/readDir/FuseReadDirErrorTest.cpp @@ -2,13 +2,11 @@ #include "fspp/fuse/FuseErrnoException.h" -using ::testing::_; using ::testing::StrEq; using ::testing::Throw; using ::testing::WithParamInterface; using ::testing::Values; -using std::vector; using std::string; using namespace fspp::fuse; diff --git a/test/fspp/fuse/readDir/FuseReadDirReturnTest.cpp b/test/fspp/fuse/readDir/FuseReadDirReturnTest.cpp index 3723ba36..0eb58956 100644 --- a/test/fspp/fuse/readDir/FuseReadDirReturnTest.cpp +++ b/test/fspp/fuse/readDir/FuseReadDirReturnTest.cpp @@ -2,9 +2,7 @@ #include #include "fspp/fuse/FuseErrnoException.h" -using ::testing::_; using ::testing::StrEq; -using ::testing::Throw; using ::testing::WithParamInterface; using ::testing::Values; @@ -14,7 +12,6 @@ using std::vector; using std::string; using namespace fspp::fuse; -using fspp::Dir; unique_ref> LARGE_DIR(int num_entries) { auto result = make_unique_ref>(); diff --git a/test/fspp/fuse/readDir/testutils/FuseReadDirTest.cpp b/test/fspp/fuse/readDir/testutils/FuseReadDirTest.cpp index 0fe0723a..9e92a999 100644 --- a/test/fspp/fuse/readDir/testutils/FuseReadDirTest.cpp +++ b/test/fspp/fuse/readDir/testutils/FuseReadDirTest.cpp @@ -4,7 +4,6 @@ using cpputils::unique_ref; using cpputils::make_unique_ref; using std::vector; using std::string; -using std::initializer_list; using ::testing::Action; using ::testing::Return; diff --git a/test/fspp/fuse/rename/FuseRenameErrorTest.cpp b/test/fspp/fuse/rename/FuseRenameErrorTest.cpp index 15079d53..5b404bd5 100644 --- a/test/fspp/fuse/rename/FuseRenameErrorTest.cpp +++ b/test/fspp/fuse/rename/FuseRenameErrorTest.cpp @@ -1,7 +1,6 @@ #include "testutils/FuseRenameTest.h" #include "fspp/fuse/FuseErrnoException.h" -using ::testing::_; using ::testing::StrEq; using ::testing::Throw; using ::testing::WithParamInterface; diff --git a/test/fspp/fuse/rename/FuseRenameFilenameTest.cpp b/test/fspp/fuse/rename/FuseRenameFilenameTest.cpp index c1cc05d6..beb4a5a6 100644 --- a/test/fspp/fuse/rename/FuseRenameFilenameTest.cpp +++ b/test/fspp/fuse/rename/FuseRenameFilenameTest.cpp @@ -1,10 +1,7 @@ #include "testutils/FuseRenameTest.h" -using ::testing::_; using ::testing::StrEq; using ::testing::Return; -using ::testing::Invoke; -using ::testing::Action; class FuseRenameFilenameTest: public FuseRenameTest { }; diff --git a/test/fspp/fuse/rename/testutils/FuseRenameTest.cpp b/test/fspp/fuse/rename/testutils/FuseRenameTest.cpp index b0e1732c..9d3f4f07 100644 --- a/test/fspp/fuse/rename/testutils/FuseRenameTest.cpp +++ b/test/fspp/fuse/rename/testutils/FuseRenameTest.cpp @@ -1,7 +1,5 @@ #include "FuseRenameTest.h" -using ::testing::Action; -using ::testing::Invoke; void FuseRenameTest::Rename(const char *from, const char *to) { int error = RenameReturnError(from, to); diff --git a/test/fspp/fuse/rmdir/FuseRmdirDirnameTest.cpp b/test/fspp/fuse/rmdir/FuseRmdirDirnameTest.cpp index 5dcc5d0b..69615044 100644 --- a/test/fspp/fuse/rmdir/FuseRmdirDirnameTest.cpp +++ b/test/fspp/fuse/rmdir/FuseRmdirDirnameTest.cpp @@ -1,10 +1,6 @@ #include "testutils/FuseRmdirTest.h" -using ::testing::_; using ::testing::StrEq; -using ::testing::Return; -using ::testing::Invoke; -using ::testing::Action; class FuseRmdirDirnameTest: public FuseRmdirTest { }; diff --git a/test/fspp/fuse/rmdir/FuseRmdirErrorTest.cpp b/test/fspp/fuse/rmdir/FuseRmdirErrorTest.cpp index 37d281c1..d8b3f890 100644 --- a/test/fspp/fuse/rmdir/FuseRmdirErrorTest.cpp +++ b/test/fspp/fuse/rmdir/FuseRmdirErrorTest.cpp @@ -1,7 +1,6 @@ #include "testutils/FuseRmdirTest.h" #include "fspp/fuse/FuseErrnoException.h" -using ::testing::_; using ::testing::StrEq; using ::testing::Throw; using ::testing::WithParamInterface; diff --git a/test/fspp/fuse/statfs/testutils/FuseStatfsTest.cpp b/test/fspp/fuse/statfs/testutils/FuseStatfsTest.cpp index 7d0e09bd..d2e1f806 100644 --- a/test/fspp/fuse/statfs/testutils/FuseStatfsTest.cpp +++ b/test/fspp/fuse/statfs/testutils/FuseStatfsTest.cpp @@ -6,12 +6,12 @@ using ::testing::_; using ::testing::Invoke; void FuseStatfsTest::Statfs(const std::string &path) { - struct ::statvfs dummy; + struct ::statvfs dummy{}; Statfs(path, &dummy); } int FuseStatfsTest::StatfsReturnError(const std::string &path) { - struct ::statvfs dummy; + struct ::statvfs dummy{}; return StatfsReturnError(path, &dummy); } @@ -38,7 +38,7 @@ struct ::statvfs FuseStatfsTest::CallStatfsWithImpl(function using ::testing::_; -using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; using ::testing::Combine; -using ::testing::Eq; -using ::testing::Return; using ::testing::Invoke; using ::testing::Action; using std::tuple; using std::get; -using std::min; using cpputils::Data; using cpputils::DataFixture; diff --git a/test/fspp/fuse/write/FuseWriteErrorTest.cpp b/test/fspp/fuse/write/FuseWriteErrorTest.cpp index a3031aa9..548d25bc 100644 --- a/test/fspp/fuse/write/FuseWriteErrorTest.cpp +++ b/test/fspp/fuse/write/FuseWriteErrorTest.cpp @@ -3,12 +3,10 @@ #include "fspp/fuse/FuseErrnoException.h" using ::testing::_; -using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; using ::testing::Eq; using ::testing::Ne; -using ::testing::Return; using ::testing::Invoke; using ::testing::Throw; diff --git a/test/fspp/fuse/write/FuseWriteFileDescriptorTest.cpp b/test/fspp/fuse/write/FuseWriteFileDescriptorTest.cpp index 6a18087a..7b88deae 100644 --- a/test/fspp/fuse/write/FuseWriteFileDescriptorTest.cpp +++ b/test/fspp/fuse/write/FuseWriteFileDescriptorTest.cpp @@ -3,13 +3,10 @@ #include "fspp/fuse/FuseErrnoException.h" using ::testing::_; -using ::testing::StrEq; using ::testing::WithParamInterface; using ::testing::Values; using ::testing::Eq; using ::testing::Return; -using ::testing::Invoke; -using ::testing::Throw; using namespace fspp::fuse; diff --git a/test/fspp/fuse/write/FuseWriteOverflowTest.cpp b/test/fspp/fuse/write/FuseWriteOverflowTest.cpp index 5c4ed422..17dec34a 100644 --- a/test/fspp/fuse/write/FuseWriteOverflowTest.cpp +++ b/test/fspp/fuse/write/FuseWriteOverflowTest.cpp @@ -5,13 +5,9 @@ #include "fspp/fuse/FuseErrnoException.h" using ::testing::_; -using ::testing::StrEq; -using ::testing::Eq; -using ::testing::Return; using ::testing::Invoke; using ::testing::Action; -using std::min; using cpputils::DataFixture; using cpputils::Data; diff --git a/test/fspp/fuse/write/testutils/FuseWriteTest.cpp b/test/fspp/fuse/write/testutils/FuseWriteTest.cpp index af96de03..fb0e29b2 100644 --- a/test/fspp/fuse/write/testutils/FuseWriteTest.cpp +++ b/test/fspp/fuse/write/testutils/FuseWriteTest.cpp @@ -14,7 +14,7 @@ FuseWriteTest::WriteError FuseWriteTest::WriteFileReturnError(const char *filena auto fd = OpenFile(fs.get(), filename); - WriteError result; + WriteError result{}; errno = 0; result.written_bytes = ::pwrite(fd->fd(), buf, count, offset); result.error = errno;