mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 17:59:08 +00:00
fix(release-exposure): match backslash-relative Go flag paths
GO_FLAG_PATH accepted dot-relative roots only with a forward slash, so `-I..\sdk\include` and `-I.\sdk` produced no path and go.build_paths came back not_observed. Accept either separator after the dots. The CLI acceptance test now expects unknown for electron.run_as_node on a directory with no native images, matching the service.
This commit is contained in:
3 files changed
+22
-3
No files matched your search
@@ -1019,7 +1019,7 @@ describe("ReleaseExposureService cleanup", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("ReleaseExposureService Go UNC paths", () => {
|
||||
describe("ReleaseExposureService Go Windows paths", () => {
|
||||
it("reports UNC roots retained in Go flags", async () => {
|
||||
const module = (value: string) => ({
|
||||
path: "github.com/acme/app",
|
||||
@@ -1045,6 +1045,25 @@ describe("ReleaseExposureService Go UNC paths", () => {
|
||||
await goStatus(module(String.raw`-DNAME=\\ -DHOST=\\buildhost`)),
|
||||
).toBe("not_observed");
|
||||
});
|
||||
|
||||
it.each([
|
||||
[String.raw`-I..\sdk\include`, String.raw`..\sdk\include`],
|
||||
[String.raw`-O2 -I.\sdk`, String.raw`.\sdk`],
|
||||
[String.raw`"-isystem ..\my sdk\include"`, String.raw`..\my sdk\include`],
|
||||
])("reports the backslash-relative path in %s", async (value, path) => {
|
||||
const report = await goReport({
|
||||
path: "github.com/acme/app",
|
||||
main: null,
|
||||
dependencies: [],
|
||||
settings: [{ key: "CGO_CFLAGS", value }],
|
||||
unparsed_lines: [],
|
||||
unparsed_line_bytes_base64: [],
|
||||
complete: true,
|
||||
});
|
||||
const check = report.checks.find((item) => item.id === "go.build_paths");
|
||||
expect(check?.status).toBe("exposed");
|
||||
expect(check?.observation.samples).toEqual([path]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("ReleaseExposureService Go paths", () => {
|
||||
|
||||
@@ -740,7 +740,7 @@ const GO_FLAG_SETTING =
|
||||
const GO_FLAG_FIELD = /(?:[^\s"']|"[^"]*"|'[^']*')+/gu;
|
||||
/** A path after a flag prefix, whitespace, `=`, or `,`, as in `-isystem/opt/x`. */
|
||||
const GO_FLAG_PATH =
|
||||
/(?:^|[\s=,])(?:-(?:idirafter|imacros|include|iprefix|iquote|isysroot|isystem|[BFILT]))?((?:\.{1,2}\/|\/|[A-Za-z]:[\\/]|\\{2}[^\\\s=,]+\\)[^=,]+)/gu;
|
||||
/(?:^|[\s=,])(?:-(?:idirafter|imacros|include|iprefix|iquote|isysroot|isystem|[BFILT]))?((?:\.{1,2}[\\/]|\/|[A-Za-z]:[\\/]|\\{2}[^\\\s=,]+\\)[^=,]+)/gu;
|
||||
|
||||
/** Paths in one flag value, with a quoted path kept whole up to the next flag. */
|
||||
const goFlagPaths = (value: string): string[] =>
|
||||
|
||||
@@ -44,7 +44,7 @@ cliTest(
|
||||
expect(
|
||||
report.checks.find((check) => check.id === "electron.run_as_node")
|
||||
?.status,
|
||||
).toBe("not_applicable");
|
||||
).toBe("unknown");
|
||||
expect(
|
||||
report.checks.find((check) => check.id === "native.pdb_path")?.status,
|
||||
).toBe("not_applicable");
|
||||
|
||||
Reference in new issue
Block a user