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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ runs:
apt-get install -y lsb-release
apt-get install -y pciutils
apt-get install -y apt-show-versions
apt-get install -y linux-image-arm64 linux-headers-arm64
- name: Setup base and non-free repository
shell: bash
run: |
Expand Down
36 changes: 21 additions & 15 deletions .github/workflows/gigabyte-ampere-cuttlefish-installer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
nvidia_gpu: ["true", "false"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Check preseed after install script
uses: ./.github/actions/gigabyte-ampere-cuttlefish-installer-check-preseed-after-install-script
with:
Expand All @@ -72,11 +72,11 @@ jobs:
image: debian@sha256:13f29b6806e531c3ff3b565bb6eed73f2132506c8c9d41bb996065ca20fb27f2 # debian:trixie-20260223 (amd64)
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Build iso installer
uses: ./.github/actions/build-gigabyte-ampere-cuttlefish-installer
- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: gigabyte-ampere-cuttlefish-installer-artifacts
path: gigabyte-ampere-cuttlefish-installer/preseed-mini.iso.xz
Expand All @@ -93,9 +93,9 @@ jobs:
TEST_DISK_SIZE: "10G"
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: gigabyte-ampere-cuttlefish-installer-artifacts
- name: Prepare test environment
Expand Down Expand Up @@ -137,9 +137,9 @@ jobs:
working-directory: ./gigabyte-ampere-cuttlefish-installer
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: gigabyte-ampere-cuttlefish-installer-artifacts
- name: Prepare test environment
Expand Down Expand Up @@ -185,9 +185,9 @@ jobs:
working-directory: ./gigabyte-ampere-cuttlefish-installer
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: gigabyte-ampere-cuttlefish-installer-artifacts
- name: Prepare test environment
Expand Down Expand Up @@ -233,9 +233,9 @@ jobs:
working-directory: ./gigabyte-ampere-cuttlefish-installer
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: gigabyte-ampere-cuttlefish-installer-artifacts
- name: Prepare test environment
Expand Down Expand Up @@ -281,9 +281,9 @@ jobs:
working-directory: ./gigabyte-ampere-cuttlefish-installer
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: gigabyte-ampere-cuttlefish-installer-artifacts
- name: Prepare test environment
Expand All @@ -301,6 +301,9 @@ jobs:
run: |
screen -d -m -L -Logfile console_001.log ./installer-iso-run-qemu.sh
while ! egrep "[^[:space:]]+[[:space:]]login:" console_001.log; do sleep 30; done
# The login prompt appears before the system is usable, so wait for the
# boot to complete. "degraded" means booted with some unit failed.
until sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -o "ConnectTimeout 60" -p 33322 vsoc-01@localhost 'systemctl is-system-running | grep -qE "running|degraded"'; do sleep 30; done
cp -f console_001.log console_001_p1.log
CONSOLELINES=$(cat console_001_p1.log | wc -l)
cat console_001_p1.log
Expand Down Expand Up @@ -361,9 +364,9 @@ jobs:
working-directory: ./gigabyte-ampere-cuttlefish-installer
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: gigabyte-ampere-cuttlefish-installer-artifacts
- name: Prepare test environment
Expand All @@ -381,6 +384,9 @@ jobs:
run: |
screen -d -m -L -Logfile console_001.log ./installer-iso-run-qemu.sh
while ! egrep "[^[:space:]]+[[:space:]]login:" console_001.log; do sleep 30; done
# The login prompt appears before the system is usable, so wait for the
# boot to complete. "degraded" means booted with some unit failed.
until sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -o "ConnectTimeout 60" -p 33322 vsoc-01@localhost 'systemctl is-system-running | grep -qE "running|degraded"'; do sleep 30; done
cp -f console_001.log console_001_p1.log
CONSOLELINES=$(cat console_001_p1.log | wc -l)
cat console_001_p1.log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ inline constexpr char kFlagEnableSandbox[] = "enable_sandbox";
inline constexpr char kFlagCrosvmSimpleMediaDevice[] =
"crosvm_simple_media_device";
inline constexpr char kFlagCrosvmV4l2Proxy[] = "crosvm_v4l2_proxy";
inline constexpr char kFlagVhostUserVsock[] = "vhost_user_vsock";

std::set<std::string> GatherFlagNamesUsedInInstanceConfig(const Instance& ins) {
std::set<std::string> names;
Expand Down Expand Up @@ -82,6 +83,10 @@ std::set<std::string> GatherFlagNamesUsedInInstanceConfig(const Instance& ins) {
ins.vm().crosvm().has_v4l2_proxy()) {
names.insert(kFlagCrosvmV4l2Proxy);
}
if (ins.vm().vmm_case() == Vm::VmmCase::kCrosvm &&
ins.vm().crosvm().has_vhost_user_vsock()) {
names.insert(kFlagVhostUserVsock);
}
return names;
}

Expand Down Expand Up @@ -175,6 +180,13 @@ static std::string V4l2Proxy(const Instance& instance) {
return crosvm.has_v4l2_proxy() ? crosvm.v4l2_proxy() : default_val;
}

static std::string VhostUserVsock(const Instance& instance) {
const auto& crosvm = instance.vm().crosvm();
const auto& default_val = CF_DEFAULTS_VHOST_USER_VSOCK;
return crosvm.has_vhost_user_vsock() ? crosvm.vhost_user_vsock()
: default_val;
}

static std::vector<std::string> UserPageSize(
const EnvironmentSpecification& cfg) {
std::vector<std::string> ret;
Expand Down Expand Up @@ -260,6 +272,10 @@ Result<std::vector<std::string>> GenerateVmFlags(
flags.emplace_back(
GenerateInstanceFlag(kFlagCrosvmV4l2Proxy, cfg, V4l2Proxy));
}
if (used_names.contains(kFlagVhostUserVsock)) {
flags.emplace_back(
GenerateInstanceFlag(kFlagVhostUserVsock, cfg, VhostUserVsock));
}

flags = MergeResults(std::move(flags), CF_EXPECT(CustomConfigsFlags(cfg)));
flags = MergeResults(std::move(flags), UserPageSize(cfg));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,4 +743,71 @@ TEST(VmFlagsParserTest, ParseTwoInstancesCustomActionsFlagPartialJson) {
EXPECT_THAT(ParseJson(custom_actions[0]), IsOkAndValue(expected_actions));
}

TEST(VmFlagsParserTest, ParseTwoInstancesVhostUserVsockFlagPartialJson) {
const char* test_string = R""""(
{
"instances" :
[
{
"vm": {
"crosvm":{
}
}
},
{
"vm": {
"crosvm":{
"vhost_user_vsock": "true"
}
}
}
]
}
)"""";

Json::Value json_configs;
std::string json_text(test_string);

EXPECT_TRUE(ParseJsonString(json_text, json_configs))
<< "Invalid Json string";
auto serialized_data = LaunchCvdParserTester(json_configs);
EXPECT_TRUE(serialized_data.ok()) << serialized_data.error().Trace();
EXPECT_TRUE(FindConfig(*serialized_data, R"(--vhost_user_vsock=auto,true)"))
<< "vhost_user_vsock flag is missing or wrongly formatted";
}

TEST(VmFlagsParserTest, ParseTwoInstancesVhostUserVsockFlagFullJson) {
const char* test_string = R""""(
{
"instances" :
[
{
"vm": {
"crosvm":{
"vhost_user_vsock": "true"
}
}
},
{
"vm": {
"crosvm":{
"vhost_user_vsock": "false"
}
}
}
]
}
)"""";

Json::Value json_configs;
std::string json_text(test_string);

EXPECT_TRUE(ParseJsonString(json_text, json_configs))
<< "Invalid Json string";
auto serialized_data = LaunchCvdParserTester(json_configs);
EXPECT_TRUE(serialized_data.ok()) << serialized_data.error().Trace();
EXPECT_TRUE(FindConfig(*serialized_data, R"(--vhost_user_vsock=true,false)"))
<< "vhost_user_vsock flag is missing or wrongly formatted";
}

} // namespace cuttlefish
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ message Crosvm {
optional bool enable_sandbox = 1;
optional bool simple_media_device = 2;
optional string v4l2_proxy = 3;
optional string vhost_user_vsock = 4;
}

message Gem5 {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,9 @@
<DISPLAYTEXT id="3" cmd="21" menuId="03" text="D05E8103012181820281028D5308004F00540041529F80FD53EF5229752877ED4FE1606F901A9053FF0C5E2E52A95BA262375B9E73B0005500530049004D536151854E1A52A183DC5355768452A860014E0B8F7D3001522096644E0E66F465B0"></DISPLAYTEXT>
</SELECTITEM>
</SETUPMENU>

<!-- Grouped Card Metadata -->
<CardProfile>
<ATR>3F979580BFFE8210428031A073BE211797</ATR>
<EID>89049032000001000000000254806852</EID>
</CardProfile>
</IccProfile>
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,9 @@
<DISPLAYTEXT id="3" cmd="21" menuId="03" text="D05E8103012181820281028D5308004F00540041529F80FD53EF5229752877ED4FE1606F901A9053FF0C5E2E52A95BA262375B9E73B0005500530049004D536151854E1A52A183DC5355768452A860014E0B8F7D3001522096644E0E66F465B0"></DISPLAYTEXT>
</SELECTITEM>
</SETUPMENU>

<!-- Grouped Card Metadata -->
<CardProfile>
<ATR>3F979580BFFE8210428031A073BE211797</ATR>
<EID>89049032000001000000000254806852</EID>
</CardProfile>
</IccProfile>
Loading
Loading