This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new 17dc71436 [tests] check for gflags::SetCommandLineOption() result
17dc71436 is described below
commit 17dc7143605acf547a2964c1463bd0149060008f
Author: Alexey Serbin <[email protected]>
AuthorDate: Tue May 14 11:20:55 2024 -0700
[tests] check for gflags::SetCommandLineOption() result
With LTO and other link-time optimization, linker might remove symbols
it didn't find in use. [1] shows a particular example of this.
This patch adds verification for the value returned by
gflags::SetCommandLineOption() to spot such cases earlier if they
happen due to future library restructuring and unexpected regressions.
It makes sense to catch such issues before other related assertions
are triggered in a test.
[1] https://gerrit.cloudera.org/#/c/21399/
Change-Id: I225142d580fac2c911e81d95aa0e89ef037922b0
Reviewed-on: http://gerrit.cloudera.org:8080/21630
Reviewed-by: Abhishek Chennaka <[email protected]>
Tested-by: Alexey Serbin <[email protected]>
---
src/kudu/client/client-test.cc | 2 +-
src/kudu/util/flag_tags-test.cc | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc
index d3372920a..c50988716 100644
--- a/src/kudu/client/client-test.cc
+++ b/src/kudu/client/client-test.cc
@@ -1775,7 +1775,7 @@ TEST_F(ClientTest, TestScanCloseProxy) {
// Check that the client scanner does not redact rows.
TEST_F(ClientTest, TestRowPtrNoRedaction) {
- google::SetCommandLineOption("redact", "log");
+ ASSERT_NE("", google::SetCommandLineOption("redact", "log"));
NO_FATALS(InsertTestRows(client_table_.get(), FLAGS_test_scan_num_rows));
KuduScanner scanner(client_table_.get());
diff --git a/src/kudu/util/flag_tags-test.cc b/src/kudu/util/flag_tags-test.cc
index a6d2da655..cb33405c1 100644
--- a/src/kudu/util/flag_tags-test.cc
+++ b/src/kudu/util/flag_tags-test.cc
@@ -82,7 +82,7 @@ TEST_F(FlagTagsTest, TestUnlockFlags) {
// Setting an unsafe flag without unlocking should crash.
{
gflags::FlagSaver s;
- gflags::SetCommandLineOption("test_unsafe_flag", "true");
+ ASSERT_NE("", gflags::SetCommandLineOption("test_unsafe_flag", "true"));
ASSERT_DEATH({ ValidateFlags(); },
"Flag --test_unsafe_flag is unsafe and unsupported.*"
"Use --unlock_unsafe_flags to proceed");
@@ -93,8 +93,8 @@ TEST_F(FlagTagsTest, TestUnlockFlags) {
StringVectorSink sink;
ScopedRegisterSink reg(&sink);
gflags::FlagSaver s;
- gflags::SetCommandLineOption("test_unsafe_flag", "true");
- gflags::SetCommandLineOption("unlock_unsafe_flags", "true");
+ ASSERT_NE("", gflags::SetCommandLineOption("test_unsafe_flag", "true"));
+ ASSERT_NE("", gflags::SetCommandLineOption("unlock_unsafe_flags", "true"));
ValidateFlags();
ASSERT_EQ(1, sink.logged_msgs().size());
ASSERT_STR_CONTAINS(sink.logged_msgs()[0], "Enabled unsafe flag:
--test_unsafe_flag");
@@ -103,7 +103,7 @@ TEST_F(FlagTagsTest, TestUnlockFlags) {
// Setting an experimental flag without unlocking should crash.
{
gflags::FlagSaver s;
- gflags::SetCommandLineOption("test_experimental_flag", "true");
+ ASSERT_NE("", gflags::SetCommandLineOption("test_experimental_flag",
"true"));
ASSERT_DEATH({ ValidateFlags(); },
"Flag --test_experimental_flag is experimental and
unsupported.*"
"Use --unlock_experimental_flags to proceed");
@@ -114,8 +114,8 @@ TEST_F(FlagTagsTest, TestUnlockFlags) {
StringVectorSink sink;
ScopedRegisterSink reg(&sink);
gflags::FlagSaver s;
- gflags::SetCommandLineOption("test_experimental_flag", "true");
- gflags::SetCommandLineOption("unlock_experimental_flags", "true");
+ ASSERT_NE("", gflags::SetCommandLineOption("test_experimental_flag",
"true"));
+ ASSERT_NE("", gflags::SetCommandLineOption("unlock_experimental_flags",
"true"));
ValidateFlags();
ASSERT_EQ(1, sink.logged_msgs().size());
ASSERT_STR_CONTAINS(sink.logged_msgs()[0],