52
52
53
53
require "#{ TRUFFLERUBY_DIR } /lib/truffle/truffle/openssl-prefix.rb"
54
54
55
+ # A list of MRI C API tests we can run. Files that do not load at all are in failing.exclude.
56
+ MRI_TEST_CAPI_TESTS = File . readlines ( "#{ TRUFFLERUBY_DIR } /test/mri/capi_tests.list" ) . map { |line |
57
+ "#{ TRUFFLERUBY_DIR } /test/mri/tests/#{ line . chomp } "
58
+ }
59
+
55
60
MRI_TEST_MODULES = {
56
- '--no-sulong' => {
57
- help : 'exclude all tests requiring Sulong' ,
58
- exclude : "#{ TRUFFLERUBY_DIR } /test/mri/sulong.exclude"
59
- } ,
60
61
'--openssl' => {
61
62
help : 'include only openssl tests' ,
62
- include : openssl = [ "#{ TRUFFLERUBY_DIR } /test/mri/tests/openssl/test_*.rb" ] ,
63
+ include : openssl = Dir [ "#{ TRUFFLERUBY_DIR } /test/mri/tests/openssl/test_*.rb" ] . sort ,
63
64
} ,
64
65
'--syslog' => {
65
66
help : 'include only syslog tests' ,
68
69
"#{ TRUFFLERUBY_DIR } /test/mri/tests/syslog/test_syslog_logger.rb"
69
70
]
70
71
} ,
71
- '--cext' => {
72
- help : 'include only tests requiring Sulong' ,
73
- include : openssl + syslog + [
74
- "#{ TRUFFLERUBY_DIR } /test/mri/tests/cext-ruby/**/test_*.rb" ,
72
+ '--cexts' => {
73
+ help : 'run all MRI tests testing C extensions' ,
74
+ include : cexts = openssl + syslog + [
75
75
"#{ TRUFFLERUBY_DIR } /test/mri/tests/etc/test_etc.rb" ,
76
+ "#{ TRUFFLERUBY_DIR } /test/mri/tests/nkf/test_kconv.rb" ,
77
+ "#{ TRUFFLERUBY_DIR } /test/mri/tests/nkf/test_nkf.rb" ,
76
78
"#{ TRUFFLERUBY_DIR } /test/mri/tests/zlib/test_zlib.rb" ,
77
79
]
78
- }
80
+ } ,
81
+ '--capi' => {
82
+ help : 'run all C-API MRI tests' ,
83
+ include : MRI_TEST_CAPI_TESTS ,
84
+ } ,
85
+ '--all-sulong' => {
86
+ help : 'run all tests requiring Sulong (C exts and C API)' ,
87
+ include : all_sulong = cexts + MRI_TEST_CAPI_TESTS
88
+ } ,
89
+ '--no-sulong' => {
90
+ help : 'exclude all tests requiring Sulong' ,
91
+ exclude : all_sulong
92
+ } ,
79
93
}
80
94
81
95
SUBPROCESSES = [ ]
@@ -972,14 +986,15 @@ def test_mri(*args)
972
986
973
987
mri_args = [ ]
974
988
prefix = "#{ TRUFFLERUBY_DIR } /test/mri/tests/"
975
- exclusions = [ "#{ TRUFFLERUBY_DIR } /test/mri/failing.exclude" ]
989
+ excluded_files = File . readlines ( "#{ TRUFFLERUBY_DIR } /test/mri/failing.exclude" ) .
990
+ map { |line | line . gsub ( /#.*/ , '' ) . strip } . reject ( &:empty? )
976
991
patterns = [ ]
977
992
978
993
args . each do |arg |
979
994
test_module = MRI_TEST_MODULES [ arg ]
980
995
if test_module
981
996
patterns . push ( *test_module [ :include ] )
982
- exclusions . push ( *test_module [ :exclude ] )
997
+ excluded_files . push ( *test_module [ :exclude ] )
983
998
elsif arg . start_with? ( '-' )
984
999
mri_args . push arg
985
1000
else
@@ -989,11 +1004,6 @@ def test_mri(*args)
989
1004
990
1005
patterns . push "#{ TRUFFLERUBY_DIR } /test/mri/tests/**/test_*.rb" if patterns . empty?
991
1006
992
- excluded_files = exclusions .
993
- flat_map { |f | File . readlines ( f ) } .
994
- map { |l | l . gsub ( /#.*/ , '' ) . strip } .
995
- reject ( &:empty? )
996
-
997
1007
files_to_run = patterns . flat_map do |pattern |
998
1008
Dir . glob ( pattern ) . map do |path |
999
1009
expanded_path = File . expand_path path
0 commit comments