]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
gunit/017: fix build warnings
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Sat, 30 Sep 2023 09:09:17 +0000 (14:39 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 25 Oct 2023 20:20:14 +0000 (14:20 -0600)
Fix unused variable and sign comparison warnings across the test case:

017-API_fuzz_test.cpp: In member function ‘virtual void APIArgsTest_API_cgroup_add_controller_Test::TestBody()’:
017-API_fuzz_test.cpp:190:6: warning: unused variable ‘ret’ [-Wunused-variable]
  int ret;
      ^~~
In file included from 017-API_fuzz_test.cpp:11:
../../googletest/googletest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int]’:
../../googletest/googletest/include/gtest/gtest.h:1421:23:   required from ‘static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int; bool lhs_is_null_literal = false]’
017-API_fuzz_test.cpp:480:2:   required from here
../../googletest/googletest/include/gtest/gtest.h:1392:11: warning: comparison of integer expressions of different signedness: ‘const long unsigned int’ and ‘const int’ [-Wsign-compare]
   if (lhs == rhs) {
       ~~~~^~~~~~

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
tests/gunit/017-API_fuzz_test.cpp

index 969cfdb63248b8a1d2a2fcfa9e1fe92ffef8fbaf..49a80ba5a34c692989ac15869ec07cd75e7172ca 100644 (file)
@@ -187,7 +187,6 @@ TEST_F(APIArgsTest, API_cgroup_add_controller)
        const char * const new_cg_ctrl = NULL;
        struct cgroup_controller *cgc = NULL;
        struct cgroup *cgroup = NULL;
-       int ret;
 
        // case 1
        // cgrp = NULL, name = NULL
@@ -477,7 +476,7 @@ TEST_F(APIArgsTest, API_cgroup_set_value_uint64)
        // check if the value was set right
        ret = cgroup_get_value_uint64(cgc, name, &value);
        ASSERT_EQ(ret, 0);
-       ASSERT_EQ(value, 1024);
+       ASSERT_EQ((int)value, 1024);
 
        free(name);
 }