summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-04-20 14:09:37 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2024-04-20 14:15:47 +0200
commit4e9a9dbf9bd52d38ab5818f3eb32c8189fd25671 (patch)
tree0656de05d8d9d783d8b0c77567f986cb46c9df5f
parent1350ca686ba2557dd8e2c17eab367bfbfe9b389a (diff)
build: test: Silence warnings in GTest code
GTest has a lot of broken things with signed vs unsigned, and double integer promotions, let's silence them.
-rw-r--r--test/libapt/acqprogress_test.cc2
-rw-r--r--test/libapt/authconf_test.cc2
-rw-r--r--test/libapt/cachefilter_test.cc2
-rw-r--r--test/libapt/cdrom_test.cc2
-rw-r--r--test/libapt/cdromfindpackages_test.cc2
-rw-r--r--test/libapt/commandline_test.cc2
-rw-r--r--test/libapt/common.h11
-rw-r--r--test/libapt/compareversion_test.cc2
-rw-r--r--test/libapt/configuration_test.cc2
-rw-r--r--test/libapt/extracttar_test.cc2
-rw-r--r--test/libapt/file-helpers.cc2
-rw-r--r--test/libapt/fileutl_test.cc2
-rw-r--r--test/libapt/getarchitectures_test.cc2
-rw-r--r--test/libapt/getlanguages_test.cc2
-rw-r--r--test/libapt/getlistoffilesindir_test.cc2
-rw-r--r--test/libapt/globalerror_test.cc2
-rw-r--r--test/libapt/gtest_runner.cc2
-rw-r--r--test/libapt/hashsums_test.cc2
-rw-r--r--test/libapt/indexcopytosourcelist_test.cc2
-rw-r--r--test/libapt/install_progress_test.cc2
-rw-r--r--test/libapt/json_test.cc2
-rw-r--r--test/libapt/openmaybeclearsignedfile_test.cc2
-rw-r--r--test/libapt/parsedepends_test.cc2
-rw-r--r--test/libapt/pattern_test.cc2
-rw-r--r--test/libapt/priority_test.cc2
-rw-r--r--test/libapt/sourcelist_test.cc2
-rw-r--r--test/libapt/srvrecs_test.cc2
-rw-r--r--test/libapt/stringview_test.cc2
-rw-r--r--test/libapt/strutil_test.cc2
-rw-r--r--test/libapt/tagfile_test.cc2
-rw-r--r--test/libapt/tagsection_test.cc2
-rw-r--r--test/libapt/teestream_test.cc2
-rw-r--r--test/libapt/uri_test.cc2
33 files changed, 43 insertions, 32 deletions
diff --git a/test/libapt/acqprogress_test.cc b/test/libapt/acqprogress_test.cc
index d4596c85d..17a04161e 100644
--- a/test/libapt/acqprogress_test.cc
+++ b/test/libapt/acqprogress_test.cc
@@ -4,7 +4,7 @@
#include <apt-pkg/configuration.h>
#include <apt-pkg/hashes.h>
#include <apt-private/acqprogress.h>
-#include <gtest/gtest.h>
+#include "common.h"
#include <sstream>
#include <string>
diff --git a/test/libapt/authconf_test.cc b/test/libapt/authconf_test.cc
index 3a7b149a9..b301b8bfb 100644
--- a/test/libapt/authconf_test.cc
+++ b/test/libapt/authconf_test.cc
@@ -7,7 +7,7 @@
#include <string>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/cachefilter_test.cc b/test/libapt/cachefilter_test.cc
index 08812e0dc..3e24010c0 100644
--- a/test/libapt/cachefilter_test.cc
+++ b/test/libapt/cachefilter_test.cc
@@ -5,7 +5,7 @@
#include <string>
-#include <gtest/gtest.h>
+#include "common.h"
TEST(CacheFilterTest, ArchitectureSpecification)
{
diff --git a/test/libapt/cdrom_test.cc b/test/libapt/cdrom_test.cc
index 364971e2a..4c43f196c 100644
--- a/test/libapt/cdrom_test.cc
+++ b/test/libapt/cdrom_test.cc
@@ -9,7 +9,7 @@
#include <string>
#include <vector>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/cdromfindpackages_test.cc b/test/libapt/cdromfindpackages_test.cc
index 9e13c1d8b..6d6586784 100644
--- a/test/libapt/cdromfindpackages_test.cc
+++ b/test/libapt/cdromfindpackages_test.cc
@@ -10,7 +10,7 @@
#include <string>
#include <vector>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc
index cde80b457..035d69844 100644
--- a/test/libapt/commandline_test.cc
+++ b/test/libapt/commandline_test.cc
@@ -4,7 +4,7 @@
#include <apt-pkg/configuration.h>
#include <apt-private/private-cmndline.h>
-#include <gtest/gtest.h>
+#include "common.h"
class CLT: public CommandLine {
public:
diff --git a/test/libapt/common.h b/test/libapt/common.h
new file mode 100644
index 000000000..d69711d50
--- /dev/null
+++ b/test/libapt/common.h
@@ -0,0 +1,11 @@
+/*
+ * GTest is a horribly broken library needing lots of diagnostic overrides,
+ * do them here.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdouble-promotion"
+#pragma GCC diagnostic ignored "-Wsign-promo"
+#pragma GCC diagnostic ignored "-Wsign-compare"
+#include <gtest/gtest.h>
+#pragma GCC diagnostic pop
+
diff --git a/test/libapt/compareversion_test.cc b/test/libapt/compareversion_test.cc
index 0fe32cf98..c8b9e4179 100644
--- a/test/libapt/compareversion_test.cc
+++ b/test/libapt/compareversion_test.cc
@@ -28,7 +28,7 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <gtest/gtest.h>
+#include "common.h"
using namespace std;
diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc
index 0e8a1f191..37bc5ff5d 100644
--- a/test/libapt/configuration_test.cc
+++ b/test/libapt/configuration_test.cc
@@ -6,7 +6,7 @@
#include <string>
#include <vector>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/extracttar_test.cc b/test/libapt/extracttar_test.cc
index 246aea737..b01846c10 100644
--- a/test/libapt/extracttar_test.cc
+++ b/test/libapt/extracttar_test.cc
@@ -7,7 +7,7 @@
#include <iostream>
#include "assert.h"
-#include <gtest/gtest.h>
+#include "common.h"
class Stream : public pkgDirStream
{
diff --git a/test/libapt/file-helpers.cc b/test/libapt/file-helpers.cc
index bb7052b2a..541dea1ac 100644
--- a/test/libapt/file-helpers.cc
+++ b/test/libapt/file-helpers.cc
@@ -9,7 +9,7 @@
#include <sys/types.h>
#include <unistd.h>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc
index da772df3b..b35a2d45e 100644
--- a/test/libapt/fileutl_test.cc
+++ b/test/libapt/fileutl_test.cc
@@ -12,7 +12,7 @@
#include <string>
#include <vector>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/getarchitectures_test.cc b/test/libapt/getarchitectures_test.cc
index 4f767226f..a4ccf673d 100644
--- a/test/libapt/getarchitectures_test.cc
+++ b/test/libapt/getarchitectures_test.cc
@@ -6,7 +6,7 @@
#include <string>
#include <vector>
-#include <gtest/gtest.h>
+#include "common.h"
TEST(ArchitecturesTest,SimpleLists)
{
diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc
index 7146c5af2..941a1529c 100644
--- a/test/libapt/getlanguages_test.cc
+++ b/test/libapt/getlanguages_test.cc
@@ -14,7 +14,7 @@
#include <sys/stat.h>
#include <sys/types.h>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/getlistoffilesindir_test.cc b/test/libapt/getlistoffilesindir_test.cc
index f00235504..d48f36638 100644
--- a/test/libapt/getlistoffilesindir_test.cc
+++ b/test/libapt/getlistoffilesindir_test.cc
@@ -7,7 +7,7 @@
#include <string>
#include <vector>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/globalerror_test.cc b/test/libapt/globalerror_test.cc
index 42e8355b3..d6ef07421 100644
--- a/test/libapt/globalerror_test.cc
+++ b/test/libapt/globalerror_test.cc
@@ -7,7 +7,7 @@
#include <cstring>
#include <string>
-#include <gtest/gtest.h>
+#include "common.h"
TEST(GlobalErrorTest,BasicDiscard)
{
diff --git a/test/libapt/gtest_runner.cc b/test/libapt/gtest_runner.cc
index 09fc55d92..d0f81e263 100644
--- a/test/libapt/gtest_runner.cc
+++ b/test/libapt/gtest_runner.cc
@@ -5,7 +5,7 @@
#include <apt-pkg/init.h>
#include <apt-pkg/pkgsystem.h>
-#include <gtest/gtest.h>
+#include "common.h"
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc
index 901150e02..48d52acf0 100644
--- a/test/libapt/hashsums_test.cc
+++ b/test/libapt/hashsums_test.cc
@@ -9,7 +9,7 @@
#include <iostream>
#include <string>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/indexcopytosourcelist_test.cc b/test/libapt/indexcopytosourcelist_test.cc
index 7dbe97329..a1fed06fa 100644
--- a/test/libapt/indexcopytosourcelist_test.cc
+++ b/test/libapt/indexcopytosourcelist_test.cc
@@ -7,7 +7,7 @@
#include <cstdio>
#include <string>
-#include <gtest/gtest.h>
+#include "common.h"
class NoCopy : private IndexCopy {
public:
diff --git a/test/libapt/install_progress_test.cc b/test/libapt/install_progress_test.cc
index 7015c619c..43c461e29 100644
--- a/test/libapt/install_progress_test.cc
+++ b/test/libapt/install_progress_test.cc
@@ -5,7 +5,7 @@
#include <locale>
#include <string>
-#include <gtest/gtest.h>
+#include "common.h"
TEST(InstallProgressTest, FancyGetTextProgressStr)
{
diff --git a/test/libapt/json_test.cc b/test/libapt/json_test.cc
index ee8f3cebe..6ab13a3d9 100644
--- a/test/libapt/json_test.cc
+++ b/test/libapt/json_test.cc
@@ -1,7 +1,7 @@
#include <config.h>
#include "../../apt-private/private-cachefile.cc"
#include "../../apt-private/private-json-hooks.cc"
-#include <gtest/gtest.h>
+#include "common.h"
#include <string>
TEST(JsonTest, JsonString)
diff --git a/test/libapt/openmaybeclearsignedfile_test.cc b/test/libapt/openmaybeclearsignedfile_test.cc
index 4db89679a..3979d8560 100644
--- a/test/libapt/openmaybeclearsignedfile_test.cc
+++ b/test/libapt/openmaybeclearsignedfile_test.cc
@@ -6,7 +6,7 @@
#include <string>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/parsedepends_test.cc b/test/libapt/parsedepends_test.cc
index 454908ef7..9771c5d24 100644
--- a/test/libapt/parsedepends_test.cc
+++ b/test/libapt/parsedepends_test.cc
@@ -7,7 +7,7 @@
#include <cstring>
#include <string>
-#include <gtest/gtest.h>
+#include "common.h"
static void parseDependency(bool const StripMultiArch, bool const ParseArchFlags, bool const ParseRestrictionsList, std::string Arch)
{
diff --git a/test/libapt/pattern_test.cc b/test/libapt/pattern_test.cc
index 55bc4bdcf..75afead5f 100644
--- a/test/libapt/pattern_test.cc
+++ b/test/libapt/pattern_test.cc
@@ -10,7 +10,7 @@
#include <apt-pkg/cachefilter-patterns.h>
#include <apt-pkg/cachefilter.h>
-#include <gtest/gtest.h>
+#include "common.h"
using namespace APT::Internal;
diff --git a/test/libapt/priority_test.cc b/test/libapt/priority_test.cc
index af7932ae8..55703404c 100644
--- a/test/libapt/priority_test.cc
+++ b/test/libapt/priority_test.cc
@@ -1,6 +1,6 @@
#include <config.h>
#include <apt-pkg/pkgcache.h>
-#include <gtest/gtest.h>
+#include "common.h"
#include <string>
using std::string;
diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc
index f6a1a91ae..9046b9127 100644
--- a/test/libapt/sourcelist_test.cc
+++ b/test/libapt/sourcelist_test.cc
@@ -8,7 +8,7 @@
#include <string>
#include <unistd.h>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/srvrecs_test.cc b/test/libapt/srvrecs_test.cc
index f04257970..c20f945c2 100644
--- a/test/libapt/srvrecs_test.cc
+++ b/test/libapt/srvrecs_test.cc
@@ -7,7 +7,7 @@
#include <iostream>
#include <string>
-#include <gtest/gtest.h>
+#include "common.h"
TEST(SrvRecTest, PopFromSrvRecs)
{
diff --git a/test/libapt/stringview_test.cc b/test/libapt/stringview_test.cc
index 9cfaa3b48..5abb7a8e1 100644
--- a/test/libapt/stringview_test.cc
+++ b/test/libapt/stringview_test.cc
@@ -5,7 +5,7 @@
#include <type_traits>
-#include <gtest/gtest.h>
+#include "common.h"
TEST(StringViewTest,EmptyString)
{
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc
index 469de4403..d7e57365f 100644
--- a/test/libapt/strutil_test.cc
+++ b/test/libapt/strutil_test.cc
@@ -6,7 +6,7 @@
#include <string>
#include <vector>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc
index 51a574fb2..1dad5fe6c 100644
--- a/test/libapt/tagfile_test.cc
+++ b/test/libapt/tagfile_test.cc
@@ -9,7 +9,7 @@
#include <string>
#include <unistd.h>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/tagsection_test.cc b/test/libapt/tagsection_test.cc
index 80cecca5b..28156f78a 100644
--- a/test/libapt/tagsection_test.cc
+++ b/test/libapt/tagsection_test.cc
@@ -6,7 +6,7 @@
#include <sstream>
#include <string>
-#include <gtest/gtest.h>
+#include "common.h"
#include "file-helpers.h"
diff --git a/test/libapt/teestream_test.cc b/test/libapt/teestream_test.cc
index a897e08ec..da85b70a1 100644
--- a/test/libapt/teestream_test.cc
+++ b/test/libapt/teestream_test.cc
@@ -5,7 +5,7 @@
#include <sstream>
#include <string>
-#include <gtest/gtest.h>
+#include "common.h"
TEST(TeeStreamTest,TwoStringSinks)
{
diff --git a/test/libapt/uri_test.cc b/test/libapt/uri_test.cc
index 519de49ba..dfdff1b04 100644
--- a/test/libapt/uri_test.cc
+++ b/test/libapt/uri_test.cc
@@ -2,7 +2,7 @@
#include <apt-pkg/configuration.h>
#include <apt-pkg/proxy.h>
#include <apt-pkg/strutl.h>
-#include <gtest/gtest.h>
+#include "common.h"
#include <string>
TEST(URITest, BasicHTTP)