Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Release information to each of the conformance tests. #70626

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 11 additions & 5 deletions test/conformance/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ type conformanceData struct {
TestName string
// Extracted from the "Description:" comment before the test
Description string
// Version when this test is added or modified ex: v1.12, v1.13
Release string
}

func (v *visitor) convertToConformanceData(at *ast.BasicLit) {
Expand All @@ -85,13 +87,16 @@ func (v *visitor) convertToConformanceData(at *ast.BasicLit) {
cd.Description = ""
for _, line := range lines {
line = strings.TrimSpace(line)
if strings.HasPrefix(line, "Testname:") {
line = strings.TrimSpace(line[9:])
cd.TestName = line
if sline := regexp.MustCompile("^Testname\\s*:\\s*").Split(line, -1); len(sline) == 2 {
cd.TestName = sline[1]
continue
}
if strings.HasPrefix(line, "Description:") {
line = strings.TrimSpace(line[12:])
if sline := regexp.MustCompile("^Release\\s*:\\s*").Split(line, -1); len(sline) == 2 {
cd.Release = sline[1]
continue
}
if sline := regexp.MustCompile("^Description\\s*:\\s*").Split(line, -1); len(sline) == 2 {
line = sline[1]
}
cd.Description += line + "\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we concerned that newer test files with older walk code will treat newer fields as descriptions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, we just add every other line in the comment block under the description after extracting the lines that has Testname and Version information.

}
Expand Down Expand Up @@ -341,6 +346,7 @@ func main() {
tests := scanfile(path, nil)
for _, cd := range tests {
fmt.Printf("## [%s](%s)\n\n", cd.TestName, cd.URL)
fmt.Printf("### Release %s\n", cd.Release)
fmt.Printf("%s\n\n", cd.Description)
if len(cd.Description) < 10 {
missingComments++
Expand Down