1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/tool/lib
nagachika 1d29740c1b merge revision(s) 5086c25f6015558877f85c3f1c014780b08fd3ce,3ff0a0b40c2e1fbdad2286f1dafe837f822d0e0d: [Backport #16936]
Properly exclude test cases.

	Lets consider the following scenario:

	~~~
	irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):001:0> p suite
	OpenSSL::TestEC
	=> OpenSSL::TestEC

	irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):002:0> p all_test_methods
	["test_ECPrivateKey", "test_ECPrivateKey_encrypted", "test_PUBKEY", "test_check_key", "test_derive_key", "test_dh_compute_key", "test_dsa_sign_asn1_FIPS186_3", "test_ec_group", "test_ec_key", "test_ec_point", "test_ec_point_add", "test_ec_point_mul", "test_generate", "test_marshal", "test_sign_verify", "test_sign_verify_raw"]
	=>
	["test_ECPrivateKey",
	 "test_ECPrivateKey_encrypted",
	 "test_PUBKEY",
	 "test_check_key",
	 "test_derive_key",
	 "test_dh_compute_key",
	 "test_dsa_sign_asn1_FIPS186_3",
	 "test_ec_group",
	 "test_ec_key",
	 "test_ec_point",
	 "test_ec_point_add",
	 "test_ec_point_mul",
	 "test_generate",
	 "test_marshal",
	 "test_sign_verify",
	 "test_sign_verify_raw"]

	irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):003:0> p filter
	/\A(?=.*)(?!.*(?-mix:(?-mix:memory_leak)|(?-mix:OpenSSL::TestEC.test_check_key)))/
	=> /\A(?=.*)(?!.*(?-mix:(?-mix:memory_leak)|(?-mix:OpenSSL::TestEC.test_check_key)))/

	irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):004:0> method = "test_check_key"
	=> "test_check_key"
	~~~

	The intention here is to exclude the `test_check_key` test case.
	Unfortunately this does not work as expected, because the negative filter
	is never checked:

	~~~
	irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):005:0> filter === method
	=> true

	irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):006:0> filter === "#{suite}##{method}"
	=> false

	irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):007:0> filter === method || filter === "#{suite}##{method}"
	=> true
	~~~

	Therefore always filter against the fully qualified method name
	`#{suite}##{method}`, which should provide the expected result.

	However, if plain string filter is used, keep checking also only the
	method name.

	This resolves [Bug #16936].
	---
	 tool/lib/test/unit.rb | 12 +++++++++---
	 1 file changed, 9 insertions(+), 3 deletions(-)

	Filter method names only if filtering method name only

	If sole `filter` option doesn't seem including test case name,
	match with method name only.
	And if the filter is a Regexp or String, it never matches method
	name symbols.
	---
	 tool/lib/test/unit.rb | 15 ++++++---------
	 1 file changed, 6 insertions(+), 9 deletions(-)
2021-12-24 14:41:08 +09:00
..
-test-
minitest Workaround for make test-tool 2021-07-07 10:03:15 +09:00
test merge revision(s) 5086c25f6015558877f85c3f1c014780b08fd3ce,3ff0a0b40c2e1fbdad2286f1dafe837f822d0e0d: [Backport #16936] 2021-12-24 14:41:08 +09:00
webrick Removed needless gemspec of webrick 2020-12-11 14:16:42 +09:00
colorize.rb Add default color for each instance 2020-08-11 18:35:07 +09:00
envutil.rb [ruby/date] Fix envutil for old Ruby 2020-12-23 18:19:26 +09:00
find_executable.rb
gc_compact_checker.rb call GC.compact after each test. 2019-12-12 03:32:12 +09:00
iseq_loader_checker.rb Enable checkers on parallel test. 2019-10-02 16:23:00 +09:00
jisx0208.rb
leakchecker.rb Check warning flags only if available to run with old versions 2020-07-15 23:33:24 +09:00
memory_status.rb
profile_test_all.rb
tracepointchecker.rb Fixed misspellings 2019-12-20 09:32:42 +09:00
vcs.rb merge revision(s) b8386f7f7f: 2021-08-04 12:40:12 +09:00
vpath.rb
webrick.rb Move webrick library into internal test toolchain 2020-12-10 18:06:25 +09:00
zombie_hunter.rb