Skip to content
Merged
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
1 change: 1 addition & 0 deletions base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ cf_cc_library(
srcs = ["bootconfig_args.cpp"],
hdrs = ["bootconfig_args.h"],
deps = [
"//cuttlefish/common/libs/utils:contains",
"//cuttlefish/common/libs/utils:json",
"//cuttlefish/host/libs/config:config_constants",
"//cuttlefish/host/libs/config:cuttlefish_config",
Expand Down
40 changes: 40 additions & 0 deletions base/cvd/cuttlefish/host/commands/assemble_cvd/bootconfig_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "absl/log/log.h"
#include "absl/strings/numbers.h"

#include "cuttlefish/common/libs/utils/contains.h"
#include "cuttlefish/common/libs/utils/json.h"
#include "cuttlefish/host/libs/config/config_constants.h"
#include "cuttlefish/host/libs/config/cuttlefish_config.h"
Expand All @@ -40,6 +41,23 @@ using vm_manager::QemuManager;

namespace {

static constexpr std::string_view kLegacyBoardBootconfigKeysShared[] = {
"androidboot.hardware",
"androidboot.vendor.apex.com.google.emulated.camera.provider.hal",
"kernel.vmw_vsock_virtio_transport_common.virtio_transport_max_vsock_pkt_buf_size",
};

static constexpr std::string_view kLegacyBoardBootconfigKeysAuto[] = {
"androidboot.cuttlefish_service_bluetooth_checker",
"androidboot.hibernation_resume_device",
};

static constexpr std::string_view kLegacyBoardBootconfigKeysMinidroid[] = {
"androidboot.adb.enabled",
"androidboot.init_rc",
"androidboot.microdroid.debuggable",
};

template <typename T>
void AppendMapWithReplacement(T* destination, const T& source) {
for (const auto& [k, v] : source) {
Expand Down Expand Up @@ -72,10 +90,32 @@ Result<std::unordered_map<std::string, std::string>> ConsoleBootconfig(

} // namespace

// Bootconfing args should be added to the launcher and no longer via the build system variable
// `BOARD_BOOTCONFIG`. Allow legacy keys for backward compatibility.
Result<void> ValidateBoardBootconfigKeys(
const cuttlefish::DeviceType type,
const std::map<std::string, std::string, std::less<void>> args) {
std::vector<std::string> allowed_args(std::begin(kLegacyBoardBootconfigKeysShared), std::end(kLegacyBoardBootconfigKeysShared));
if (type == cuttlefish::DeviceType::Auto) {
allowed_args.insert(allowed_args.end(), std::begin(kLegacyBoardBootconfigKeysAuto), std::end(kLegacyBoardBootconfigKeysAuto));
} else if (type == cuttlefish::DeviceType::Minidroid) {
allowed_args.insert(allowed_args.end(), std::begin(kLegacyBoardBootconfigKeysMinidroid), std::end(kLegacyBoardBootconfigKeysMinidroid));
}

for(auto iter = args.begin(); iter != args.end(); iter++) {
CF_EXPECTF(Contains(allowed_args, iter->first),
"Error: detected new `BOARD_BOOTCONFIG` key: \"{}\"!!! Please add new bootconfig args to the `cvd` launcher.", iter->first);
}

return {};
}

Result<std::unordered_map<std::string, std::string>> BootconfigArgsFromConfig(
const CuttlefishConfig& config,
const CuttlefishConfig::InstanceSpecific& instance,
const std::map<std::string, std::string, std::less<void>> builtin_bootconfig_args) {
CF_EXPECT(ValidateBoardBootconfigKeys(instance.device_type(), builtin_bootconfig_args));

std::unordered_map<std::string, std::string> bootconfig_args;

AppendMapWithReplacement(&bootconfig_args,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ go_test(
],
deps = [
"//cvd/common",
"//cvd/cvd_powerwash_tests/common",
],
)

Expand All @@ -45,6 +44,5 @@ go_test(
],
deps = [
"//cvd/common",
"//cvd/cvd_powerwash_tests/common",
],
)
25 changes: 0 additions & 25 deletions e2etests/cvd/cvd_powerwash_tests/common/BUILD.bazel

This file was deleted.

49 changes: 0 additions & 49 deletions e2etests/cvd/cvd_powerwash_tests/common/common.go

This file was deleted.

69 changes: 0 additions & 69 deletions e2etests/cvd/cvd_powerwash_tests/default/main_test.go

This file was deleted.

52 changes: 0 additions & 52 deletions e2etests/cvd/cvd_powerwash_tests/gpu/BUILD.bazel

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,21 @@ import (
"testing"

"github.com/google/android-cuttlefish/e2etests/cvd/common"
"github.com/google/android-cuttlefish/e2etests/cvd/cvd_powerwash_tests/common"
)

func TestCvdPowerwash(t *testing.T) {
testcases := []struct {
shortName string
branch string
target string
createArgs []string
}{
{
shortName: "AospGfxstream",
branch: "aosp-android-latest-release",
target: "aosp_cf_x86_64_only_phone-userdebug",
createArgs: []string{
"--gpu_mode=gfxstream",
},
},
{
shortName: "AospGfxstreamAngle",
branch: "aosp-android-latest-release",
target: "aosp_cf_x86_64_only_phone-userdebug",
createArgs: []string{
"--gpu_mode=gfxstream_guest_angle",
},
},
}
c := e2etests.TestContext{}
for _, tc := range testcases {
t.Run(fmt.Sprintf("BUILD=%s", tc.shortName), func(t *testing.T) {
t.Run(fmt.Sprintf("BUILD=%s/%s", tc.branch, tc.target), func(t *testing.T) {
c.SetUp(t)
defer c.TearDown()

Expand All @@ -59,13 +44,30 @@ func TestCvdPowerwash(t *testing.T) {
t.Fatal(err)
}

if err := c.CVDCreate(e2etests.CreateArgs{Args: tc.createArgs}); err != nil {
if err := c.CVDCreate(e2etests.CreateArgs{}); err != nil {
t.Fatal(err)
}

if err := powerwash_common.VerifyPowerwash(&c); err != nil {
if err := c.RunAdbWaitForDevice(); err != nil {
t.Fatalf("failed to wait for Cuttlefish device to connect to adb: %w", err)
}

const tmpFile = "/data/local/tmp/foo"
if _, err := c.RunCmd("adb", "shell", "touch", tmpFile); err != nil {
t.Fatalf("failed to create %s: %w", tmpFile, err)
}

if _, err := c.RunCmd("adb", "shell", "stat", tmpFile); err != nil {
t.Fatal("failed to verify %s created: %w", err)
}

if err := c.CVDPowerwash(); err != nil {
t.Fatal(err)
}

if _, err := c.RunCmd("adb", "shell", "stat", tmpFile); err == nil {
t.Fatal("failed to powerwash, %s still exists")
}
})
}
}
}
Loading