Skip to content

Commit

Permalink
Update CPU mapping values
Browse files Browse the repository at this point in the history
Specifically for Windows hosts, the target CPU string will report as
`x64`, not `x86_64`. Include the value in the mapping to get the
properly value.
  • Loading branch information
chrisroberts committed Oct 19, 2023
1 parent 728f7af commit 3367154
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/vagrant/util/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def architecture
end

@_host_architecture = case RbConfig::CONFIG["target_cpu"]
when "x86_64"
when "amd64", "x86_64", "x64"
"amd64"
when "i386"
"386"
when "386", "i386", "x86"
"i386"
when "arm64", "aarch64"
"arm64"
else
Expand Down
18 changes: 17 additions & 1 deletion test/unit/vagrant/util/platform_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,27 @@
end
end

context "when cpu is x64" do
let(:cpu_string) { "x64" }

it "should be mapped to amd64" do
expect(described_class.architecture).to eq("amd64")
end
end

context "when cpu is i386" do
let(:cpu_string) { "i386" }

it "should be mapped to i386" do
expect(described_class.architecture).to eq("i386")
end
end

context "when cpu is 386" do
let(:cpu_string) { "386" }

it "should be mapped to 386" do
expect(described_class.architecture).to eq("386")
expect(described_class.architecture).to eq("i386")
end
end

Expand Down

0 comments on commit 3367154

Please sign in to comment.