in torchci/lib/bot/verifyDisableTestIssueBot.ts [75:138]
export function formValidationComment(
testName: string,
platforms: [Set<string>, Set<string>]
): string {
const platformsToSkip = Array.from(platforms[0]).sort((a, b) =>
a.localeCompare(b)
);
const platformMsg =
platformsToSkip.length === 0
? "none parsed, defaulting to ALL platforms"
: platformsToSkip.join(", ");
const invalidPlatforms = Array.from(platforms[1]).sort((a, b) =>
a.localeCompare(b)
);
let body =
"<body>Hello there! From the DISABLED prefix in this issue title, ";
body += "it looks like you are attempting to disable a test in PyTorch CI. ";
body += "The information I have parsed is below:\n\n";
body += `* Test name: \`${testName}\`\n`;
body += `* Platforms for which to skip the test: ${platformMsg}\n\n`;
if (invalidPlatforms.length > 0) {
body +=
"<b>WARNING!</b> In the parsing process, I received these invalid inputs as platforms for ";
body += `which the test will be disabled: ${invalidPlatforms.join(
", "
)}. These could `;
body +=
"be typos or platforms we do not yet support test disabling. Please ";
body +=
"verify the platform list above and modify your issue body if needed.\n\n";
}
if (!testNameIsExpected(testName)) {
body +=
"<b>ERROR!</b> As you can see above, I could not properly parse the test ";
body +=
"information and determine which test to disable. Please modify the ";
body +=
"title to be of the format: DISABLED test_case_name (test.ClassName), ";
body += "for example, `test_cuda_assert_async (__main__.TestCuda)`.\n\n";
} else {
body += `Within ~15 minutes, \`${testName}\` will be disabled in PyTorch CI for `;
body +=
platformsToSkip.length === 0
? "all platforms"
: `these platforms: ${platformsToSkip.join(", ")}`;
body +=
". Please verify that your test name looks correct, e.g., `test_cuda_assert_async (__main__.TestCuda)`.\n\n";
}
body +=
"To modify the platforms list, please include a line in the issue body, like below. The default ";
body +=
"action will disable the test for all platforms if no platforms list is specified. \n";
body +=
"```\nPlatforms: case-insensitive, list, of, platforms\n```\nWe currently support the following platforms: ";
body += `${Array.from(supportedPlatforms)
.sort((a, b) => a.localeCompare(b))
.join(", ")}.</body>`;
return validationCommentStart + body + validationCommentEnd;
}