Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion base/cvd/cuttlefish/common/libs/fs/shared_fd_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <gtest/gtest.h>

namespace cuttlefish {
namespace {

char pipe_message[] = "Testing the pipe";

Expand All @@ -34,4 +35,5 @@ TEST(SendFD, Basic) {
EXPECT_EQ(0, strcmp(buf, pipe_message));
}

}
} // namespace
} // namespace cuttlefish
5 changes: 4 additions & 1 deletion base/cvd/cuttlefish/common/libs/utils/base64_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "cuttlefish/result/result_type.h"

namespace cuttlefish {
namespace {

TEST(Base64Test, EncodeMult3) {
ASSERT_THAT(EncodeBase64("foobar"), IsOkAndValue("Zm9vYmFy"));
Expand Down Expand Up @@ -70,4 +71,6 @@ TEST(Base64Test, EncodeThreeZeroes) {

ASSERT_THAT(DecodeBase64(*string_encoding), IsOkAndValue(in));
}
}

} // namespace
} // namespace cuttlefish
2 changes: 2 additions & 0 deletions base/cvd/cuttlefish/common/libs/utils/files_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "cuttlefish/result/result_matchers.h"

namespace cuttlefish {
namespace {

using testing::IsTrue;

Expand Down Expand Up @@ -227,4 +228,5 @@ TEST(FilesTest, SearchFileNotFoundReturnsError) {
EXPECT_FALSE(result.ok());
}

} // namespace
} // namespace cuttlefish
2 changes: 2 additions & 0 deletions base/cvd/cuttlefish/common/libs/utils/flag_parser_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "cuttlefish/result/result_matchers.h"

namespace cuttlefish {
namespace {

TEST(FlagParser, DuplicateAlias) {
FlagAlias alias = {FlagAliasMode::kFlagExact, "--flag"};
Expand Down Expand Up @@ -481,4 +482,5 @@ TEST_F(FlagConsumesArbitraryTest, TwoValuesOtherFlag) {
ASSERT_EQ(elems_, (std::vector<std::string>{"v1", "v2", ""}));
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "cuttlefish/common/libs/utils/proc_file_utils.h"

namespace cuttlefish {
namespace {

TEST(ProcFileUid, SelfUidTest) {
auto my_pid = getpid();
Expand All @@ -43,4 +44,5 @@ TEST(ProcFilePid, CurrentPidCollected) {
ASSERT_TRUE(Contains(*pids_result, this_pid));
}

} // namespace
} // namespace cuttlefish
2 changes: 2 additions & 0 deletions base/cvd/cuttlefish/common/libs/utils/unix_sockets_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "cuttlefish/common/libs/fs/shared_fd.h"

namespace cuttlefish {
namespace {

SharedFD CreateMemFDWithData(const std::string& data) {
auto memfd = SharedFD::MemfdCreate("");
Expand Down Expand Up @@ -197,4 +198,5 @@ TEST(UnixMessageSocket, AutoCredentials) {
ASSERT_EQ(getgid(), credentials_out->gid);
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "launch_cvd.pb.h"

namespace cuttlefish {
namespace {

TEST(DisplayConfigTest, ParseProto) {
std::string flag_value = "ChoKCgi4CBDYBBh4IDwKDAi4CBDYBBh4IDwqAA==";
Expand All @@ -42,4 +43,5 @@ TEST(DisplayConfigTest, ParseProto) {
ASSERT_TRUE(result);
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "cuttlefish/result/result_matchers.h"

namespace cuttlefish {
namespace {

TEST(FrontlineParserTest, SelectorArgs) {
cvd_common::Args input{"cvd", "--instance_name=1", "status"};
Expand All @@ -32,4 +33,5 @@ TEST(FrontlineParserTest, SelectorArgs) {
ASSERT_EQ(input, (std::vector<std::string>{"cvd", "status"}));
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "cuttlefish/host/commands/cvd/cli/parser/test_common.h"

namespace cuttlefish {
namespace {

TEST(FlagsInheritanceTest, MergeTwoIndependentJson) {
const char* dst_string = R""""(
Expand Down Expand Up @@ -140,4 +141,5 @@ TEST(FlagsInheritanceTest, MergeTwoOverlappedJson) {
EXPECT_EQ(dst_object["instances"][0]["vm"]["memory_mb"], 2048);
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "cuttlefish/host/commands/cvd/cli/parser/test_common.h"

namespace cuttlefish {
namespace {

TEST(FlagsParserTest, ParseInvalidJson) {
const char* test_string = R""""(
Expand Down Expand Up @@ -170,4 +171,5 @@ TEST(BootFlagsParserTest, ParseNetSimFlagEnabled) {
<< "netsim_uwb flag is missing or wrongly formatted";
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "cuttlefish/host/commands/cvd/cli/parser/test_common.h"

namespace cuttlefish {
namespace {

TEST(BootFlagsParserTest, ParseTwoInstancesBootAnimationFlagEmptyJson) {
const char* test_string = R""""(
Expand Down Expand Up @@ -352,4 +353,5 @@ TEST(BootFlagsParserTest, ParseTwoInstancesEnforceSecurityFlagFullJson) {
<< "guest_enforce_security flag is missing or wrongly formatted";
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "cuttlefish/host/commands/cvd/cli/parser/test_common.h"

namespace cuttlefish {
namespace {

TEST(BootFlagsParserTest, ParseTwoInstancesBlankDataImageEmptyJson) {
const char* test_string = R""""(
Expand Down Expand Up @@ -108,4 +109,5 @@ TEST(BootFlagsParserTest, ParseTwoInstancesBlankDataImageFullJson) {
<< "blank_data_image_mb flag is missing or wrongly formatted";
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
#include "cuttlefish/host/commands/cvd/cli/parser/test_common.h"
#include "cuttlefish/result/result_matchers.h"

namespace cuttlefish {
namespace {

using google::protobuf::Message;
using google::protobuf::util::MessageDifferencer;

namespace cuttlefish {

// TODO: schuffelen - make this into a matcher
static void AssertProtoEquals(const Message& expected, const Message& actual) {
MessageDifferencer diff;
Expand Down Expand Up @@ -241,4 +242,5 @@ TEST(BootFlagsParserTest, ParseTwoInstancesAutoTabletDisplaysFlag) {
AssertProtoEquals(expected, (*display).value());
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "cuttlefish/result/result_matchers.h"

namespace cuttlefish {
namespace {

TEST(VmFlagsParserTest, ParseTwoInstancesCpuFlagEmptyJson) {
const char* test_string = R""""(
Expand Down Expand Up @@ -994,4 +995,5 @@ TEST(VmFlagsParserTest, ParseTwoInstancesCustomActionsFlagPartialJson) {
EXPECT_THAT(ParseJson(custom_actions[0]), IsOkAndValue(expected_actions));
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "cuttlefish/result/result_matchers.h"

namespace cuttlefish {
namespace {

using ::testing::IsTrue;
using ::testing::Not;
Expand Down Expand Up @@ -125,4 +126,5 @@ TEST(MetricsFlagsParserTest, ParseTwoInstancesMetricsReportFlagEmptyJson) {
<< "report_anonymous_usage_stats flag is missing or wrongly formatted";
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ std::string AutoGeneratedHome(const std::string& subdir) {
return parent + "/" + std::to_string(getuid()) + "/" + subdir;
}

} // namespace

static auto home_test_inputs = testing::Values(
InputOutput{
.cmd_args = "cvd start --daemon",
Expand Down Expand Up @@ -284,5 +282,6 @@ TEST(AutoHomeTest, DefaultFollowedByNonDefaultTest) {
<< result_2nd_non_default.error().Trace();
}

} // namespace
} // namespace selector
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "cuttlefish/host/commands/cvd/unittests/selector/cvd_flags_helper.h"

namespace cuttlefish {
namespace {

TEST_F(CvdFlagCollectionTest, Init) {
auto output_result = flag_collection_.FilterFlags(input_);
Expand Down Expand Up @@ -70,4 +71,5 @@ TEST(CvdFlagTest, FlagProxyFilter) {
cvd_common::Args{"--bar --foo=name --enable_vnc"});
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "cuttlefish/result/result_matchers.h"

namespace cuttlefish {
namespace {

TEST(HostToolTarget, KnownFlags) {
std::string android_host_out = StringFromEnv("ANDROID_HOST_OUT", "");
Expand Down Expand Up @@ -60,4 +61,5 @@ TEST(HostToolManager, KnownBins) {
<< "stop_bin was " << *stop_bin;
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

namespace cuttlefish {
namespace selector {
namespace {

TEST_P(InstanceIdTest, InstanceIdCalculation) {
auto selector_options_res = ParseCommonSelectorArguments(selector_args_);
Expand Down Expand Up @@ -122,5 +123,6 @@ INSTANTIATE_TEST_SUITE_P(
.requested_num_instances = 3,
.expected_result = false}));

} // namespace
} // namespace selector
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace cuttlefish {
namespace selector {
namespace {

TEST_P(ValidNamesTest, ValidInputs) {
auto selector_options_res = ParseCommonSelectorArguments(selector_args_);
Expand Down Expand Up @@ -89,5 +90,6 @@ INSTANTIATE_TEST_SUITE_P(CvdParser, InvalidNamesTest,
"--group_name=3a", "--instance_name",
"--instance_name=*7a"));

} // namespace
} // namespace selector
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "cuttlefish/result/result_matchers.h"

namespace cuttlefish {
namespace {

std::string CreateTempFileWithText(const std::string& filepath,
const std::string& text) {
Expand Down Expand Up @@ -123,4 +124,5 @@ TEST_F(FetchCvdTests, CasDownloaderInvokedIfDownloaderPathSetInCasConfig) {
EXPECT_THAT(FileExists(cas_output_filepath_), IsTrue());
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "cuttlefish/result/result_matchers.h"

namespace cuttlefish {
namespace {

using testing::Eq;

Expand Down Expand Up @@ -60,4 +61,5 @@ TEST(FetchCvdParserTests, CreatesCasDownloaderFlags) {
Eq(10000000000));
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

namespace cuttlefish {
namespace selector {
namespace {

LocalInstanceGroup::Builder GroupParamWithInstances(
const std::string& name, const std::string& home_dir,
Expand Down Expand Up @@ -404,5 +405,6 @@ TEST_F(CvdInstanceDatabaseTest, UpdateInstances) {
EXPECT_EQ(find_res->Instances()[1].state(), cvd::INSTANCE_STATE_STARTING);
}

} // namespace
} // namespace selector
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

namespace cuttlefish {
namespace selector {
namespace {

static std::string GroupName() { return "yah_ong"; }

Expand Down Expand Up @@ -81,5 +82,6 @@ TEST_F(LocalInstanceGroupUnitTest, SearchById) {
}
}

} // namespace
} // namespace selector
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

namespace cuttlefish {
namespace selector {
namespace {

/**
* Note that invalid inputs must be tested at the InstanceDatabase level
Expand Down Expand Up @@ -47,5 +48,6 @@ TEST(LocalinstanceTest, Fields) {
EXPECT_EQ(parent_group.Proto().name(), "super");
}

} // namespace
} // namespace selector
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "cuttlefish/host/commands/cvd/unittests/server/utils.h"

namespace cuttlefish {
namespace {

TEST(CvdAutoGenId, CvdTwoFollowedByFive) {
cvd_common::Envs envs;
Expand Down Expand Up @@ -68,4 +69,5 @@ TEST(CvdAutoGenId, CvdTwoFollowedByFive) {
CmdRunner::Run("cvd reset -y", envs);
}

} // namespace
} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "cuttlefish/host/commands/cvd/unittests/server/cmd_runner.h"

namespace cuttlefish {
namespace {

TEST(CvdBasic, CvdDefaultStart) {
cvd_common::Envs envs;
Expand Down Expand Up @@ -49,4 +50,5 @@ TEST(CvdBasic, CvdDefaultStart) {
CmdRunner::Run("cvd reset -y", envs);
}

} // namespace
} // namespace cuttlefish
Loading