From: Kamalesh Babulal Date: Sat, 30 Sep 2023 09:09:17 +0000 (+0530) Subject: gunit/017: fix build warnings X-Git-Tag: v3.2.0~184 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5533343534c2350ba497d815ea52e6293a979ebb;p=thirdparty%2Flibcgroup.git gunit/017: fix build warnings 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::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 Signed-off-by: Tom Hromatka --- diff --git a/tests/gunit/017-API_fuzz_test.cpp b/tests/gunit/017-API_fuzz_test.cpp index 969cfdb6..49a80ba5 100644 --- a/tests/gunit/017-API_fuzz_test.cpp +++ b/tests/gunit/017-API_fuzz_test.cpp @@ -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); }