MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / qemuRepairPackageRoot

Function qemuRepairPackageRoot

Tests/Tools/ToolsTest.cpp:123–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121 String script = StringEncoding::Utf8;
122 auto builder = StringBuilder::create(script);
123 SC_TRY(builder.append("#!/bin/sh\n"));
124 SC_TRY(builder.append("echo \"{} version 10.0.0\"\n", name));
125 builder.finalize();
126 SC_TRY(fs.writeString(path, script.view()));
127 return fs.chmod(path, 0755u);
128}
129#endif
130
131static Result qemuRepairPackageRoot(StringView packagesRoot, String& packageRoot)
132{
133 StringView leaf;
134 switch (HostPlatform)
135 {
136 case Platform::Apple:
137 switch (HostInstructionSet)
138 {
139 case InstructionSet::ARM64: leaf = "macos_arm64"; break;
140 case InstructionSet::Intel64: leaf = "macos_intel64"; break;
141 case InstructionSet::Intel32: return Result::Error("Unsupported QEMU test host");
142 }
143 break;
144 case Platform::Linux:
145 switch (HostInstructionSet)
146 {
147 case InstructionSet::ARM64: leaf = "linux_arm64"; break;
148 case InstructionSet::Intel64: leaf = "linux_intel64"; break;
149 case InstructionSet::Intel32: return Result::Error("Unsupported QEMU test host");
150 }
151 break;
152 case Platform::Windows:
153 switch (HostInstructionSet)
154 {
155 case InstructionSet::ARM64: leaf = "windows_arm64"; break;
156 case InstructionSet::Intel64: leaf = "windows_intel64"; break;
157 case InstructionSet::Intel32: return Result::Error("Unsupported QEMU test host");
158 }
159 break;

Callers 1

SupportToolsTestMethod · 0.85

Calls 3

ErrorEnum · 0.50
formatFunction · 0.50
ResultClass · 0.50

Tested by

no test coverage detected