cts: write test URL in url() instead of description

test name: from "... + section name" -> "section name + ..."

bug: tint:1203
Change-Id: Ic71f2cd3ef3e45d335f382dde93cc8694d998204
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65980
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Sarah 2021-10-06 22:00:58 +00:00 committed by Tint LUCI CQ
parent a9f8c7db81
commit 7ff308fd18
1 changed files with 12 additions and 9 deletions
tools/src/cmd/get-test-plan

View File

@ -707,7 +707,7 @@ var (
// testName creates a test name given a rule id (ie. section name), description and section // testName creates a test name given a rule id (ie. section name), description and section
// returns for a builtin rule: // returns for a builtin rule:
// testName: ${builtin name} + "_" + ${section name} // testName:${section name} + "," + ${builtin name}
// builtinName: ${builtin name} // builtinName: ${builtin name}
// err: nil // err: nil
// returns for a other rules: // returns for a other rules:
@ -741,9 +741,12 @@ func testName(id string, desc string, section string) (testName, builtinName str
builtinName = reUnderScore.ReplaceAllString(builtinName, "_") builtinName = reUnderScore.ReplaceAllString(builtinName, "_")
match, _ := regexp.MatchString(name, builtinName) match, _ := regexp.MatchString(name, builtinName)
if match { if match {
testName = builtinName + "," + id testName = id + "," + builtinName
for i := 1; testNamesSet[testName]; i++ { // in case there is more than one builtin functions
testName = builtinName + "_" + id + "_" + strconv.Itoa(i) // with the same name in one section:
// "id,builtin", "id,builtin2", "id,builtin3", ...
for i := 2; testNamesSet[testName]; i++ {
testName = id + "," + builtinName + strconv.Itoa(i)
} }
testNamesSet[testName] = true testNamesSet[testName] = true
return testName, builtinName, nil return testName, builtinName, nil
@ -757,7 +760,7 @@ func testName(id string, desc string, section string) (testName, builtinName str
globalRuleCounter = 0 globalRuleCounter = 0
globalPrevSectionX = sectionX[0] globalPrevSectionX = sectionX[0]
} }
testName = "section" + strconv.Itoa(sectionX[0]) + "_rule" + strconv.Itoa(globalRuleCounter) testName = id + ",rule" + strconv.Itoa(globalRuleCounter)
if testNamesSet[testName] { if testNamesSet[testName] {
testName = "error-unable-to-generate-unique-file-name" testName = "error-unable-to-generate-unique-file-name"
return testName, "", fmt.Errorf("unable to generate unique test name\n" + desc) return testName, "", fmt.Errorf("unable to generate unique test name\n" + desc)
@ -962,8 +965,8 @@ func isBuiltinFunctionRule(r rule) bool {
func testPlan(r rule) string { func testPlan(r rule) string {
sb := strings.Builder{} sb := strings.Builder{}
sb.WriteString(fmt.Sprintf(unImplementedTestTemplate, r.TestName, sb.WriteString(fmt.Sprintf(unImplementedTestTemplate, r.TestName, r.Sha, r.URL,
r.Sha, "`\n"+r.URL+"\n"+r.Description+"\n"+howToContribute+"`")) "`\n"+r.Description+"\n"+howToContribute+"\n`"))
return sb.String() return sb.String()
} }
@ -986,6 +989,7 @@ export const g = makeTestGroup(GPUTest);
` `
unImplementedTestTemplate = `g.test('%v') unImplementedTestTemplate = `g.test('%v')
.uniqueId('%v') .uniqueId('%v')
.specURL('%v')
.desc( .desc(
%v %v
) )
@ -994,6 +998,5 @@ export const g = makeTestGroup(GPUTest);
` `
howToContribute = ` howToContribute = `
Please read the following guidelines before contributing: Please read the following guidelines before contributing:
https://github.com/gpuweb/cts/blob/main/docs/plan_autogen.md https://github.com/gpuweb/cts/blob/main/docs/plan_autogen.md`
`
) )