Skip to content

Instantly share code, notes, and snippets.

@tsauvajon
Forked from peterbourgon/parallel_tests.bash
Created January 12, 2020 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsauvajon/5992c1f178bee4f8bebc1f4b3b532c78 to your computer and use it in GitHub Desktop.
Save tsauvajon/5992c1f178bee4f8bebc1f4b3b532c78 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
function for_all_test_files { find $(go list -f '{{ .Dir }}' ./...) -name '*_test.go' ; }
function first_line_of_test { xargs -n1 awk '/^func Test/{getline; print FILENAME ":" NR-1 " " $0}' ; }
function not_parallel { grep -v 't.Parallel()' ; }
if for_all_test_files | first_line_of_test | not_parallel
then
echo FAIL: not all tests call t.Parallel
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment