diff options
author | David Kalnischkies <david@kalnischkies.de> | 2018-05-04 18:24:57 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2018-05-04 18:42:37 +0200 |
commit | 1d77c915005f7630949e2ce706055ee3235009b6 (patch) | |
tree | d10b246f29198a4085e2923a53e4d8bafff73bcc /test/libapt/compareversion_test.cc | |
parent | 39d9e217a22901892647499ee695ba472a111d25 (diff) |
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
Diffstat (limited to 'test/libapt/compareversion_test.cc')
-rw-r--r-- | test/libapt/compareversion_test.cc | 19 |
1 files changed, 10 insertions, 9 deletions
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); \ |