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

Function writePackageReceiptFixture

Tests/Tools/ToolsTest.cpp:69–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static Result writePackageReceiptFixture(StringView packageRoot, StringView packageName,
70 Span<const Tools::PackageReceiptExport> exports)
71{
72 FileSystem fs;
73 SC_TRY(fs.init("."));
74 if (fs.existsAndIsDirectory(packageRoot))
75 {
76 SC_TRY(fs.removeDirectoriesRecursive(packageRoot));
77 }
78 SC_TRY(fs.makeDirectoryRecursive(packageRoot));
79
80 for (const Tools::PackageReceiptExport& packageExport : exports)
81 {
82 if (packageExport.relativePath == "."_a8)
83 {
84 continue;
85 }
86
87 String exportedPath = StringEncoding::Utf8;
88 SC_TRY(Path::join(exportedPath, {packageRoot, packageExport.relativePath}));
89 SC_TRY(fs.makeDirectoryRecursive(Path::dirname(exportedPath.view(), Path::AsNative)));
90 SC_TRY(fs.writeString(exportedPath.view(), "fake"));
91 }
92
93 Tools::Package package;
94 package.installDirectoryLink = packageRoot;
95
96 Tools::PackageReceiptInfo info;
97 info.packageName = packageName;
98 info.packageVersion = "1";
99 info.recipeVersion = "1";
100 info.hostPlatform = "test";
101 info.packageVariant = "host";
102 info.source = "test";
103 info.sourceHash = "";
104 info.validation = "passed";
105 const StringView phases[] = {"writeReceipt"};
106 info.phases = phases;
107 return Tools::writePackageReceipt(package, info, exports);
108}
109
110#if !SC_PLATFORM_WINDOWS
111static Result writeFakeQEMURunner(FileSystem& fs, StringView path, StringView name)

Callers 1

SupportToolsTestMethod · 0.85

Calls 8

dirnameFunction · 0.85
existsAndIsDirectoryMethod · 0.80
joinFunction · 0.50
initMethod · 0.45
viewMethod · 0.45
writeStringMethod · 0.45

Tested by

no test coverage detected