From 8e1ff66379e26ffea159e687d304fb693a2ce35f Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 26 Feb 2022 19:56:03 +0000 Subject: Fix remaining warnings --- Jamroot.jam | 5 +++ gentoobrowse-api/unittests/testMaintenance.cpp | 47 ++++++++++++++++++-------- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/Jamroot.jam b/Jamroot.jam index 3ddb43d..8a29f49 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -37,10 +37,15 @@ project tidy:ICE_MEMBER_IMPORT_EXPORT tidy:users.cpp tidy:user-models.cpp + tidy:slicer-user-models.cpp tidy:news-models.cpp + tidy:slicer-news-models.cpp tidy:extended-models.cpp + tidy:slicer-extended-models.cpp tidy:portage-models.cpp + tidy:slicer-portage-models.cpp tidy:portage.cpp + tidy:gb-base.cpp tidy:maintenance.h tidy:maintenance.cpp tidy:notifications.h diff --git a/gentoobrowse-api/unittests/testMaintenance.cpp b/gentoobrowse-api/unittests/testMaintenance.cpp index 0dc09c0..6b1621c 100644 --- a/gentoobrowse-api/unittests/testMaintenance.cpp +++ b/gentoobrowse-api/unittests/testMaintenance.cpp @@ -1,15 +1,37 @@ #define BOOST_TEST_MODULE TestMaintenance #include +#include "changeSet.h" +#include "maintenance.h" +#include "maintenance/abstractFileProcessor.h" #include "mockDefs.h" -#include +#include "portage-models.h" +#include "portage.h" +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include #include #include #include +#include +#include +#include #include #include #include +#include +#include +#include +// IWYU pragma: no_include +// IWYU pragma: no_include "resourcePool.impl.h" class MaintenanceClientCombined : public Maintenance, public TestClient { }; @@ -19,15 +41,18 @@ BOOST_FIXTURE_TEST_SUITE(maintenance, MaintenanceClientCombined) const std::filesystem::path treeDir(binDir / "tree"); const std::filesystem::path fixturesDir(rootDir / "fixtures"); +#if DUMPDB static void dumpDb(const DB::ConnectionPtr & db); +#endif void doRefreshPackageTree(const DB::ConnectionPtr & db, int64_t cats, int64_t devvcs, int64_t pkgs, int64_t ebs, int64_t ebus, int64_t ebas, int64_t pus, int64_t ug, int64_t ul, int64_t ugs, int64_t ugds, int64_t deps, int64_t rdeps, int64_t news, int64_t masks, int64_t ebuildMasks) { +#if DUMPDB dumpDb(db); - +#endif SQL_REQUIRE_EQUAL("SELECT COUNT(*) FROM gentoobrowse.categories", int64_t, cats); SQL_REQUIRE_EQUAL("SELECT COUNT(*) FROM gentoobrowse.categories WHERE name = 'dev-vcs'", int64_t, devvcs); SQL_REQUIRE_EQUAL("SELECT COUNT(*) FROM gentoobrowse.packages", int64_t, pkgs); @@ -46,10 +71,10 @@ doRefreshPackageTree(const DB::ConnectionPtr & db, int64_t cats, int64_t devvcs, SQL_REQUIRE_EQUAL("SELECT COUNT(*) FROM gentoobrowse.ebuild_masks", int64_t, ebuildMasks); } +#if DUMPDB void dumpDb(const DB::ConnectionPtr & db) { -#if DUMPDB db->execute("COPY gentoobrowse.categories TO '/tmp/categories.tsv'"); db->execute("COPY gentoobrowse.packages TO '/tmp/packages.tsv'"); db->execute("COPY gentoobrowse.ebuilds TO '/tmp/ebuilds.tsv'"); @@ -63,10 +88,8 @@ dumpDb(const DB::ConnectionPtr & db) db->execute("COPY gentoobrowse.masksets TO '/tmp/masksets.tsv'"); db->execute("COPY gentoobrowse.ebuild_masks TO '/tmp/ebuild_masks.tsv'"); db->execute("COPY gentoobrowse.news TO '/tmp/news.tsv'"); -#else - (void)db; -#endif } +#endif class M2 : public Gentoo::Service::Maintenance { public: @@ -275,15 +298,9 @@ BOOST_AUTO_TEST_CASE(testUpdateGitRepository) BOOST_REQUIRE(std::filesystem::is_regular_file(testRepo / "net-misc" / "gentoobrowse-api" / "Manifest")); } -struct localPortageRepoIsComplete { - boost::test_tools::assertion_result - operator()(boost::unit_test::test_unit_id) const - { - return !std::filesystem::exists("/usr/portage/.git/shallow"); - } -}; - -BOOST_AUTO_TEST_CASE(testRefreshGitRepository, *boost::unit_test::precondition(localPortageRepoIsComplete {})) +BOOST_AUTO_TEST_CASE(testRefreshGitRepository, *boost::unit_test::precondition([](auto) { + return !std::filesystem::exists("/usr/portage/.git/shallow"); +})) { auto db = DB::MockDatabase::openConnectionTo("GentooBrowseAPI"); auto insRepo = db->modify( -- cgit v1.2.3