rkt/rkt

build: Allow to blacklist some functional tests

Open

#1,553 创建于 2015年10月7日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)Go (8,871 star) (865 fork)batch import
area/developer toolingarea/testinghelp wantedpriority/Pmaybe

描述

Currently we have a GO_TEST_FUNC_ARGS variable which is passed directly to go test. With that we can do something like make check GO_TEST_FUNC_ARGS='-run "TestAuth.*"' to run only TestAuth{Sanity,Basic,Oauth,Override,Ignore} tests.

But it is a hassle to run all tests but TestFetch for example. An idea would be to maybe deprecate the GO_TEST_FUNC_ARGS in favor of GO_TEST_RUN_REGEXP and GO_TEST_DONT_RUN_REGEXP.

To run only TestAuth tests the invocation would be make check GO_TEST_RUN_REGEXP='TestAuth.*'.

To run all the tests but TestFetch: make check GO_TEST_DONT_RUN_REGEXP='TestFetch'.

To run all the auth test but override: make check GO_TEST_RUN_REGEXP='TestAuth.*' GO_TEST_DONT_RUN_REGEXP='TestAuthOverride' (or '.*Override').

Some other (probably bit crazy) notes:

  • I couldn't find any builtin command to list all the tests that would be executed, so a hacky way to get the list would be:
    • git grep -P 'func Test\w+\(\w+\s+\*testing\.T\)' tests | grep -o '\bTest[[:alnum:]]\+' | sort -u
  • run grep '$(GO_TEST_RUN_REGEXP)' on that list to get a whitelist
  • run `grep -v '$(GO_TEST_DONT_RUN_REGEXP)' on that whitelist to get a final list of tests to run
  • prepare the final list to something like (test1)|(test2)|...|(testN)
  • We could then run `go test -run '$(prepared_final_list)' github.com/coreos/rkt/tests

贡献者指南

build: Allow to blacklist some functional tests · rkt/rkt#1553 | Good First Issue