| 1 | import { resolve } from "node:path"; |
| 2 | import { fileURLToPath } from "node:url"; |
| 3 | import { runGoTest } from "./go-test-groups.mjs"; |
| 4 | |
| 5 | export const windowsPRContractGroups = [ |
| 6 | { |
| 7 | package: "./internal/tool/builtin", |
| 8 | tests: [ |
| 9 | "TestBashPowerShellExecuteDetailedContract", |
| 10 | "TestBashPowerShell51PreflightRejectsAndAndDetailed", |
| 11 | "TestBashPowerShellOutputIsUTF8", |
| 12 | "TestBashPowerShellSurfacesNonZeroExit", |
| 13 | "TestBashPowerShellRejectsChaining", |
| 14 | "TestBashSharesSessionTempAcrossCalls", |
| 15 | "TestWorkspacePassesBashTimeout", |
| 16 | "TestBashSchemaUnchangedWithSessionTemp", |
| 17 | "TestBashUnsupportedOSSandboxUsesToolLayerPermissionBoundary", |
| 18 | ], |
| 19 | }, |
| 20 | { package: "./internal/sandbox", tests: ["TestOSSandboxSupportedPerPlatform"] }, |
| 21 | { |
| 22 | package: "./internal/acp", |
| 23 | tests: ["TestE2EApprovalRoundTrip", "TestE2ECancelMidTurn"], |
| 24 | }, |
| 25 | { |
| 26 | package: "./internal/bot", |
| 27 | tests: [ |
| 28 | "TestBotGatewayStopWaitsForDispatchHandler", |
| 29 | "TestBotGatewayStopWaitsForTurn", |
| 30 | "TestBotGatewayStopBeforeTurnCancelPublication", |
| 31 | ], |
| 32 | }, |
| 33 | ]; |
| 34 | |
| 35 | export function windowsPRContractArgs(group, { fullBuiltin = false } = {}) { |
| 36 | if (fullBuiltin && group.package === "./internal/tool/builtin") { |
| 37 | return ["test", "-timeout=5m", group.package]; |
| 38 | } |
| 39 | return ["test", "-timeout=3m", "-run", `^(?:${group.tests.join("|")})$`, group.package]; |
| 40 | } |
| 41 | |
| 42 | function main() { |
| 43 | for (const group of windowsPRContractGroups) { |
| 44 | const args = windowsPRContractArgs(group, { fullBuiltin: process.env.WINDOWS_BUILTIN_FULL === "true" }); |
| 45 | const status = runGoTest(`Windows PR contract ${group.package}`, [group.package], args); |
| 46 | if (status !== 0) return status; |
| 47 | } |
| 48 | return 0; |
| 49 | } |
| 50 | |
| 51 | if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { |
| 52 | process.exitCode = main(); |
| 53 | } |
| 54 |