From 1d77c915005f7630949e2ce706055ee3235009b6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 4 May 2018 18:24:57 +0200 Subject: Prevent GTest from flooding us with compiler warnings GTest has a bunch of undefined macros which causes the compiler to spit out warnings for each one on each test file. There isn't much we can do, so we just disable the warning for the testcases. Other warnings like sign-promo and sign-compare we can avoid by being more explicit about our expected integer constants being unsigned. As we are just changing testcases, there is no user visible change which would deserve to be noted in the changelog. Gbp-Dch: Ignore Reported-By: gcc-8 --- test/libapt/compareversion_test.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'test/libapt/compareversion_test.cc') diff --git a/test/libapt/compareversion_test.cc b/test/libapt/compareversion_test.cc index 1782c61cc..ee469f785 100644 --- a/test/libapt/compareversion_test.cc +++ b/test/libapt/compareversion_test.cc @@ -32,17 +32,18 @@ using namespace std; -static bool callDPKG(const char *val, const char *ref, const char &op) { +static bool callDPKG(const char * const val, const char * const ref, char const * const op) { pid_t Process = ExecFork(); if (Process == 0) { - const char * args[6]; - args[0] = "/usr/bin/dpkg"; - args[1] = "--compare-versions"; - args[2] = val; - args[3] = (op == 1) ? ">>" : ( (op == 0) ? "=" : "<<"); - args[4] = ref; - args[5] = 0; + const char * args[] = { + BIN_DIR "/dpkg", + "--compare-versions", + val, + op, + ref, + nullptr + }; execv(args[0], (char**) args); exit(1); } @@ -57,7 +58,7 @@ static bool callDPKG(const char *val, const char *ref, const char &op) { int Res = debVS.CmpVersion(A, B); \ Res = (Res < 0) ? -1 : ( (Res > 0) ? 1 : Res); \ EXPECT_EQ(compare, Res) << "APT: A: »" << A << "« B: »" << B << "«"; \ - EXPECT_PRED3(callDPKG, A, B, compare); \ + EXPECT_PRED3(callDPKG, A, B, ((compare == 1) ? ">>" : ( (compare == 0) ? "=" : "<<"))); \ } #define EXPECT_VERSION(A, compare, B) \ EXPECT_VERSION_PART(A, compare, B); \ -- cgit v1.2.3-70-g09d2