You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tools/flakeguard/Makefile
+14-5Lines changed: 14 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -12,16 +12,25 @@ test:
12
12
example:
13
13
rm -rf example_results
14
14
mkdir -p example_results
15
-
- go run . run --project-path=./runner --test-packages=./example_test_package --run-count=5 --skip-tests=Panic --max-pass-ratio=1 --race=false --output-json=example_results/example_run_1.json
16
-
- go run . run --project-path=./runner --test-packages=./example_test_package --run-count=5 --skip-tests=Panic --max-pass-ratio=1 --race=false --output-json=example_results/example_run_2.json
17
-
- go run . run --project-path=./runner --test-packages=./example_test_package --run-count=5 --skip-tests=Panic --max-pass-ratio=1 --race=false --output-json=example_results/example_run_3.json
15
+
- go run . run --project-path=./runner --test-packages=./example_test_package --run-count=5 --skip-tests=Panic,Timeout --max-pass-ratio=1 --race=false --output-json=example_results/example_run_1.json
16
+
- go run . run --project-path=./runner --test-packages=./example_test_package --run-count=5 --skip-tests=Panic,Timeout --max-pass-ratio=1 --race=false --output-json=example_results/example_run_2.json
17
+
- go run . run --project-path=./runner --test-packages=./example_test_package --run-count=5 --skip-tests=Panic,Timeout --max-pass-ratio=1 --race=false --output-json=example_results/example_run_3.json
18
18
go run . aggregate-results --results-path ./example_results --output-results ./example_results/all_tests_example.json
19
19
20
-
.PHONY: example_panic
21
-
example_panic:
20
+
.PHONY: example_flaky_panic
21
+
example_flaky_panic:
22
22
rm -rf example_results
23
23
mkdir -p example_results
24
24
- go run . run --project-path=./runner --test-packages=./example_test_package --run-count=5 --skip-tests=TestPanic --max-pass-ratio=1 --race=false --output-json=example_results/example_run_1.json
25
25
- go run . run --project-path=./runner --test-packages=./example_test_package --run-count=5 --skip-tests=TestPanic --max-pass-ratio=1 --race=false --output-json=example_results/example_run_2.json
26
26
- go run . run --project-path=./runner --test-packages=./example_test_package --run-count=5 --skip-tests=TestPanic --max-pass-ratio=1 --race=false --output-json=example_results/example_run_3.json
27
+
go run . aggregate-results --results-path ./example_results --output-results ./example_results/all_tests_example.json
28
+
29
+
.PHONY: example_timeout
30
+
example_timeout:
31
+
rm -rf example_results
32
+
mkdir -p example_results
33
+
- go run . run --project-path=./runner --test-packages=./example_test_package --run-count=5 --select-tests=TestTimeout --timeout=1s --max-pass-ratio=1 --race=false --output-json=example_results/example_run_1.json
34
+
- go run . run --project-path=./runner --test-packages=./example_test_package --run-count=5 --select-tests=TestTimeout --timeout=1s --max-pass-ratio=1 --race=false --output-json=example_results/example_run_2.json
35
+
- go run . run --project-path=./runner --test-packages=./example_test_package --run-count=5 --select-tests=TestTimeout --timeout=1s --max-pass-ratio=1 --race=false --output-json=example_results/example_run_3.json
27
36
go run . aggregate-results --results-path ./example_results --output-results ./example_results/all_tests_example.json
@@ -50,6 +52,8 @@ var RunTestsCmd = &cobra.Command{
50
52
ProjectPath: projectPath,
51
53
Verbose: true,
52
54
RunCount: runCount,
55
+
Timeout: timeout,
56
+
Tags: tags,
53
57
UseRace: useRace,
54
58
SkipTests: skipTests,
55
59
SelectTests: selectTests,
@@ -98,6 +102,8 @@ func init() {
98
102
RunTestsCmd.Flags().StringSlice("test-packages", nil, "Comma-separated list of test packages to run")
99
103
RunTestsCmd.Flags().Bool("run-all-packages", false, "Run all test packages in the project. This flag overrides --test-packages and --test-packages-json")
100
104
RunTestsCmd.Flags().IntP("run-count", "c", 1, "Number of times to run the tests")
105
+
RunTestsCmd.Flags().Duration("timeout", 0, "Passed on to the 'go test' command as the -timeout flag")
106
+
RunTestsCmd.Flags().StringArray("tags", nil, "Passed on to the 'go test' command as the -tags flag")
101
107
RunTestsCmd.Flags().Bool("race", false, "Enable the race detector")
102
108
RunTestsCmd.Flags().Bool("shuffle", false, "Enable test shuffling")
103
109
RunTestsCmd.Flags().String("shuffle-seed", "", "Set seed for test shuffling. Must be used with --shuffle")
return"", fmt.Errorf("failed to attribute panic to test, using regex %s on these strings:\n%s", panicAttributionRe.String(), strings.Join(entriesOutputs, "\n"))
441
+
return"", false, fmt.Errorf("failed to attribute panic to test, using regex %s on these strings:\n%s", panicAttributionRe.String(), strings.Join(entriesOutputs, ""))
427
442
}
428
443
429
444
// properly attributes races to the test that caused them
return"", fmt.Errorf("failed to attribute race to test, using regex: %s on these strings:\n%s", raceAttributionRe.String(), strings.Join(entriesOutputs, "\n"))
456
+
return"", fmt.Errorf("failed to attribute race to test, using regex: %s on these strings:\n%s", raceAttributionRe.String(), strings.Join(entriesOutputs, ""))
442
457
}
443
458
444
459
// parseSubTest checks if a test name is a subtest and returns the parent and sub names
0 commit comments