Skip to content

Commit d98c802

Browse files
Cleanup sytest.list, add ignore list (#276)
* sytest list cleanup * add more ignored tests * add one more ignored entry
1 parent 2ea38f3 commit d98c802

File tree

3 files changed

+734
-647
lines changed

3 files changed

+734
-647
lines changed

cmd/sytest-coverage/main.go

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,9 @@ var (
2828
// in all files in ./tests - if there's a match it marks that test as converted.
2929
func main() {
3030
verbose := len(os.Args) == 2 && os.Args[1] == "-v"
31-
body, err := ioutil.ReadFile("./sytest.list")
32-
if err != nil {
33-
panic(err)
34-
}
35-
testLines := strings.Split(string(body), "\n")
36-
filenameToTestName := make(map[string][]string)
37-
testNameToFilename := make(map[string]string)
38-
for _, line := range testLines {
39-
name, filename := extract(line)
40-
if name == "" || filename == "" {
41-
continue
42-
}
43-
name = "sytest: " + strings.TrimSpace(name)
44-
filenameToTestName[filename] = append(filenameToTestName[filename], name)
45-
testNameToFilename[name] = strings.TrimSpace(filename)
46-
}
31+
32+
filenameToTestName, testNameToFilename := getList()
33+
4734
total := len(testNameToFilename)
4835

4936
convertedTests := make(map[string]bool)
@@ -100,6 +87,60 @@ func main() {
10087
fmt.Printf("\nTOTAL: %d/%d tests converted\n", numComplementTests, total)
10188
}
10289

90+
// filenameToTestName and testNameToFilename
91+
// will filter ignored tests
92+
func getList() (map[string][]string, map[string]string) {
93+
var ignoredTests = make(map[string]bool)
94+
var ignoredPaths []string
95+
ignoredBody, err := ioutil.ReadFile("./sytest.ignored.list")
96+
if err != nil {
97+
// ignore error, set body to nothing
98+
ignoredBody = []byte{}
99+
}
100+
ignoredLines := strings.Split(string(ignoredBody), "\n")
101+
for _, ignoredLine := range ignoredLines {
102+
ignoredLine = strings.TrimSpace(ignoredLine)
103+
104+
if len(ignoredLine) == 0 || ignoredLine[0] == '#' {
105+
continue
106+
}
107+
108+
if ignoredLine[0] == '!' {
109+
ignoredPaths = append(ignoredPaths, ignoredLine[1:])
110+
}
111+
112+
ignoredTests[ignoredLine] = true
113+
}
114+
115+
body, err := ioutil.ReadFile("./sytest.list")
116+
if err != nil {
117+
panic(err)
118+
}
119+
testLines := strings.Split(string(body), "\n")
120+
filenameToTestName := make(map[string][]string)
121+
testNameToFilename := make(map[string]string)
122+
lines:
123+
for _, line := range testLines {
124+
name, filename := extract(line)
125+
if name == "" || filename == "" {
126+
continue
127+
}
128+
if _, ok := ignoredTests[name]; ok {
129+
continue
130+
}
131+
for _, path := range ignoredPaths {
132+
if strings.Contains(filename, path) {
133+
continue lines
134+
}
135+
}
136+
name = "sytest: " + strings.TrimSpace(name)
137+
filenameToTestName[filename] = append(filenameToTestName[filename], name)
138+
testNameToFilename[name] = strings.TrimSpace(filename)
139+
}
140+
141+
return filenameToTestName, testNameToFilename
142+
}
143+
103144
func sorted(in map[string][]string) []string {
104145
out := make([]string, len(in))
105146
i := 0
@@ -115,7 +156,7 @@ func sorted(in map[string][]string) []string {
115156
// ./tests/31sync/16room-summary.pl:test "Room summary counts change when membership changes",
116157
func extract(line string) (string, string) {
117158
line = strings.TrimSpace(line)
118-
if len(line) == 0 {
159+
if len(line) == 0 || line[0] == '#' {
119160
return "", ""
120161
}
121162
nameGroups := testNameRegexp.FindStringSubmatch(line)

sytest.ignored.list

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# These list all of the sytests that're ignored, line-by-line
2+
# Complete with comments as to why particular tests were ignored
3+
4+
# Dummy test in 00prepare.pl
5+
foo
6+
7+
# Tests synapse admin API
8+
Can quarantine media in rooms
9+
10+
# Tests deprecated endpoints
11+
Tags appear in the v1 /initialSync
12+
Tags appear in the v1 /events stream
13+
Tags appear in the v1 room initial sync
14+
Account data appears in v1 /events stream
15+
Latest account data comes down in /initialSync
16+
Latest account data comes down in room initialSync
17+
Room account data appears in v1 /events stream
18+
GET /events with negative 'limit'
19+
GET /events with non-numeric 'limit'
20+
GET /events with non-numeric 'timeout'
21+
GET /initialSync with non-numeric 'limit'
22+
GET /events initially
23+
GET /initialSync initially
24+
GET /rooms/:room_id/initialSync fetches initial sync state
25+
All room members see all room members' presence in global initialSync
26+
New room members see existing users' presence in room initialSync
27+
New room members see existing members' presence in room initialSync
28+
New room members see first user's profile information in global initialSync
29+
New room members see first user's profile information in per-room initialSync
30+
A departed room is still included in /initialSync (SPEC-216)
31+
Can get rooms/{roomId}/initialSync for a departed room (SPEC-216)
32+
initialSync sees my presence status
33+
Global initialSyncGlobal initialSync with limit=0 gives no messages
34+
Room initialSync
35+
Room initialSync with limit=0 gives no messages
36+
Read receipts are visible to /initialSync
37+
Newly created users see their own presence in /initialSync (SYT-34)
38+
Push rules come down in an initial /sync
39+
Guest user calling /events doesn't tightloop
40+
Guest user cannot call /events globally
41+
!53groups

0 commit comments

Comments
 (0)