| 1 |
#!/usr/bin/env perl |
| 2 |
|
| 3 |
use strict; |
| 4 |
|
| 5 |
use Cwd qw(abs_path); |
| 6 |
use File::Spec; |
| 7 |
use Getopt::Long; |
| 8 |
use Test::Harness qw(&runtests $verbose); |
| 9 |
|
| 10 |
my $opts = {}; |
| 11 |
GetOptions($opts, 'h|help', 'C|class=s@', 'K|keep-tmpfiles', 'F|file-pattern=s', |
| 12 |
'V|verbose'); |
| 13 |
|
| 14 |
if ($opts->{h}) { |
| 15 |
usage(); |
| 16 |
} |
| 17 |
|
| 18 |
if ($opts->{K}) { |
| 19 |
$ENV{KEEP_TMPFILES} = 1; |
| 20 |
} |
| 21 |
|
| 22 |
if ($opts->{V}) { |
| 23 |
$ENV{TEST_VERBOSE} = 1; |
| 24 |
$verbose = 1; |
| 25 |
} |
| 26 |
|
| 27 |
# We use this, rather than use(), since use() is equivalent to a BEGIN |
| 28 |
# block, and we want the module to be loaded at run-time. |
| 29 |
|
| 30 |
my $test_dir = (File::Spec->splitpath(abs_path(__FILE__)))[1]; |
| 31 |
push(@INC, "$test_dir/t/lib"); |
| 32 |
|
| 33 |
require ProFTPD::TestSuite::Utils; |
| 34 |
import ProFTPD::TestSuite::Utils qw(:testsuite); |
| 35 |
|
| 36 |
# This is to handle the case where this tests.pl script might be |
| 37 |
# being used to run test files other than those that ship with proftpd, |
| 38 |
# e.g. to run the tests that come with third-party modules. |
| 39 |
unless (defined($ENV{PROFTPD_TEST_BIN})) { |
| 40 |
$ENV{PROFTPD_TEST_BIN} = File::Spec->catfile($test_dir, '..', 'proftpd'); |
| 41 |
} |
| 42 |
|
| 43 |
# Set this environment variable, for other test cases which may want to |
| 44 |
# know the directory, and not necessarily just the location of the uninstalled |
| 45 |
# `proftpd' binary. This is useful, for example, for using the utilities. |
| 46 |
$ENV{PROFTPD_TEST_PATH} = $test_dir; |
| 47 |
|
| 48 |
$| = 1; |
| 49 |
|
| 50 |
my $test_files; |
| 51 |
|
| 52 |
if (scalar(@ARGV) > 0) { |
| 53 |
$test_files = [@ARGV]; |
| 54 |
|
| 55 |
} else { |
| 56 |
$test_files = [qw( |
| 57 |
t/http.t |
| 58 |
t/smtp.t |
| 59 |
t/ssh2.t |
| 60 |
t/logins.t |
| 61 |
t/commands.t |
| 62 |
t/commands/user.t |
| 63 |
t/commands/pass.t |
| 64 |
t/commands/pwd.t |
| 65 |
t/commands/cwd.t |
| 66 |
t/commands/cdup.t |
| 67 |
t/commands/syst.t |
| 68 |
t/commands/type.t |
| 69 |
t/commands/mkd.t |
| 70 |
t/commands/rmd.t |
| 71 |
t/commands/dele.t |
| 72 |
t/commands/mdtm.t |
| 73 |
t/commands/size.t |
| 74 |
t/commands/mode.t |
| 75 |
t/commands/stru.t |
| 76 |
t/commands/allo.t |
| 77 |
t/commands/noop.t |
| 78 |
t/commands/feat.t |
| 79 |
t/commands/help.t |
| 80 |
t/commands/quit.t |
| 81 |
t/commands/rang.t |
| 82 |
t/commands/rnfr.t |
| 83 |
t/commands/rnto.t |
| 84 |
t/commands/rest.t |
| 85 |
t/commands/pasv.t |
| 86 |
t/commands/epsv.t |
| 87 |
t/commands/port.t |
| 88 |
t/commands/eprt.t |
| 89 |
t/commands/nlst.t |
| 90 |
t/commands/list.t |
| 91 |
t/commands/retr.t |
| 92 |
t/commands/stor.t |
| 93 |
t/commands/stou.t |
| 94 |
t/commands/appe.t |
| 95 |
t/commands/stat.t |
| 96 |
t/commands/abor.t |
| 97 |
t/commands/mlsd.t |
| 98 |
t/commands/mlst.t |
| 99 |
t/commands/mff.t |
| 100 |
t/commands/mfmt.t |
| 101 |
t/commands/opts.t |
| 102 |
t/commands/host.t |
| 103 |
t/commands/clnt.t |
| 104 |
t/commands/csid.t |
| 105 |
t/commands/site/chgrp.t |
| 106 |
t/commands/site/chmod.t |
| 107 |
t/config/accessdenymsg.t |
| 108 |
t/config/accessgrantmsg.t |
| 109 |
t/config/allowfilter.t |
| 110 |
t/config/allowforeignaddress.t |
| 111 |
t/config/allowoverwrite.t |
| 112 |
t/config/allowstorerestart.t |
| 113 |
t/config/anonrejectpasswords.t |
| 114 |
t/config/anonrequirepassword.t |
| 115 |
t/config/authaliasonly.t |
| 116 |
t/config/authgroupfile.t |
| 117 |
t/config/authorder.t |
| 118 |
t/config/authuserfile.t |
| 119 |
t/config/authusingalias.t |
| 120 |
t/config/classes.t |
| 121 |
t/config/commandbuffersize.t |
| 122 |
t/config/createhome.t |
| 123 |
t/config/defaultchdir.t |
| 124 |
t/config/defaultroot.t |
| 125 |
t/config/deferwelcome.t |
| 126 |
t/config/deleteabortedstores.t |
| 127 |
t/config/denyfilter.t |
| 128 |
t/config/dirfakegroup.t |
| 129 |
t/config/dirfakemode.t |
| 130 |
t/config/dirfakeuser.t |
| 131 |
t/config/displaychdir.t |
| 132 |
t/config/displayconnect.t |
| 133 |
t/config/displayfiletransfer.t |
| 134 |
t/config/displaylogin.t |
| 135 |
t/config/displayquit.t |
| 136 |
t/config/envvars.t |
| 137 |
t/config/factsoptions.t |
| 138 |
t/config/groupowner.t |
| 139 |
t/config/hiddenstores.t |
| 140 |
t/config/hidefiles.t |
| 141 |
t/config/hidegroup.t |
| 142 |
t/config/hidenoaccess.t |
| 143 |
t/config/hideuser.t |
| 144 |
t/config/ifdefine.t |
| 145 |
t/config/ifmodule.t |
| 146 |
t/config/include.t |
| 147 |
t/config/listoptions.t |
| 148 |
t/config/logoptions.t |
| 149 |
t/config/masqueradeaddress.t |
| 150 |
t/config/maxclients.t |
| 151 |
t/config/maxclientsperclass.t |
| 152 |
t/config/maxclientsperhost.t |
| 153 |
t/config/maxclientsperuser.t |
| 154 |
t/config/maxcommandrate.t |
| 155 |
t/config/maxconnectionsperhost.t |
| 156 |
t/config/maxinstances.t |
| 157 |
t/config/maxloginattempts.t |
| 158 |
t/config/maxpasswordsize.t |
| 159 |
t/config/maxretrievefilesize.t |
| 160 |
t/config/maxstorefilesize.t |
| 161 |
t/config/maxtransfersperhost.t |
| 162 |
t/config/maxtransfersperuser.t |
| 163 |
t/config/order.t |
| 164 |
t/config/passiveports.t |
| 165 |
t/config/pathallowfilter.t |
| 166 |
t/config/pathdenyfilter.t |
| 167 |
t/config/pidfile.t |
| 168 |
t/config/port.t |
| 169 |
t/config/protocols.t |
| 170 |
t/config/regexoptions.t |
| 171 |
t/config/requirevalidshell.t |
| 172 |
t/config/rewritehome.t |
| 173 |
t/config/rlimitchroot.t |
| 174 |
t/config/rlimitcpu.t |
| 175 |
t/config/rlimitmemory.t |
| 176 |
t/config/rlimitopenfiles.t |
| 177 |
t/config/rootrevoke.t |
| 178 |
t/config/serveradmin.t |
| 179 |
t/config/serveralias.t |
| 180 |
t/config/serverident.t |
| 181 |
t/config/setenv.t |
| 182 |
t/config/showsymlinks.t |
| 183 |
t/config/socketoptions.t |
| 184 |
t/config/storeuniqueprefix.t |
| 185 |
t/config/sysloglevel.t |
| 186 |
t/config/timeoutidle.t |
| 187 |
t/config/timeoutlogin.t |
| 188 |
t/config/timeoutnotransfer.t |
| 189 |
t/config/timeoutsession.t |
| 190 |
t/config/timeoutstalled.t |
| 191 |
t/config/trace.t |
| 192 |
t/config/traceoptions.t |
| 193 |
t/config/transferrate.t |
| 194 |
t/config/umask.t |
| 195 |
t/config/useftpusers.t |
| 196 |
t/config/useglobbing.t |
| 197 |
t/config/useralias.t |
| 198 |
t/config/userdirroot.t |
| 199 |
t/config/userowner.t |
| 200 |
t/config/userpassword.t |
| 201 |
t/config/usesendfile.t |
| 202 |
t/config/virtualhost.t |
| 203 |
t/config/directory/limits.t |
| 204 |
t/config/directory/umask.t |
| 205 |
t/config/ftpaccess/dele.t |
| 206 |
t/config/ftpaccess/empty.t |
| 207 |
t/config/ftpaccess/merging.t |
| 208 |
t/config/ftpaccess/retr.t |
| 209 |
t/config/limit/anonymous.t |
| 210 |
t/config/limit/login.t |
| 211 |
t/config/limit/mfmt.t |
| 212 |
t/config/limit/opts.t |
| 213 |
t/config/limit/rmd.t |
| 214 |
t/config/limit/xmkd.t |
| 215 |
t/config/limit/filters.t |
| 216 |
t/config/limit/subdirs.t |
| 217 |
t/logging/extendedlog.t |
| 218 |
t/logging/serverlog.t |
| 219 |
t/logging/systemlog.t |
| 220 |
t/logging/transferlog.t |
| 221 |
t/signals/term.t |
| 222 |
t/signals/hup.t |
| 223 |
t/signals/segv.t |
| 224 |
t/signals/abrt.t |
| 225 |
t/telnet.t |
| 226 |
t/utils/ftpcount.t |
| 227 |
t/utils/ftpwho.t |
| 228 |
)]; |
| 229 |
|
| 230 |
# Now interrogate the build to see which module/feature-specific test files |
| 231 |
# should be added to the list. |
| 232 |
my $order = 0; |
| 233 |
|
| 234 |
my $FEATURE_TESTS = { |
| 235 |
't/modules/mod_auth_file.t' => { |
| 236 |
order => ++$order, |
| 237 |
test_class => [qw(mod_auth_file)], |
| 238 |
}, |
| 239 |
|
| 240 |
't/modules/mod_auth_otp.t' => { |
| 241 |
order => ++$order, |
| 242 |
test_class => [qw(mod_auth_otp mod_sql mod_sql_sqlite)], |
| 243 |
}, |
| 244 |
|
| 245 |
't/modules/mod_auth_otp/sftp.t' => { |
| 246 |
order => ++$order, |
| 247 |
test_class => [qw(mod_auth_otp mod_sftp mod_sql mod_sql_sqlite)], |
| 248 |
}, |
| 249 |
|
| 250 |
't/modules/mod_ban.t' => { |
| 251 |
order => ++$order, |
| 252 |
test_class => [qw(mod_ban)], |
| 253 |
}, |
| 254 |
|
| 255 |
't/modules/mod_ban/memcache.t' => { |
| 256 |
order => ++$order, |
| 257 |
test_class => [qw(mod_ban mod_memcache)], |
| 258 |
}, |
| 259 |
|
| 260 |
't/modules/mod_cap.t' => { |
| 261 |
order => ++$order, |
| 262 |
test_class => [qw(mod_cap)], |
| 263 |
}, |
| 264 |
|
| 265 |
't/modules/mod_copy.t' => { |
| 266 |
order => ++$order, |
| 267 |
test_class => [qw(mod_copy)], |
| 268 |
}, |
| 269 |
|
| 270 |
't/modules/mod_ctrls.t' => { |
| 271 |
order => ++$order, |
| 272 |
test_class => [qw(mod_ctrls)], |
| 273 |
}, |
| 274 |
|
| 275 |
't/modules/mod_deflate.t' => { |
| 276 |
order => ++$order, |
| 277 |
test_class => [qw(mod_deflate)], |
| 278 |
}, |
| 279 |
|
| 280 |
't/modules/mod_delay.t' => { |
| 281 |
order => ++$order, |
| 282 |
test_class => [qw(mod_delay)], |
| 283 |
}, |
| 284 |
|
| 285 |
't/modules/mod_digest.t' => { |
| 286 |
order => ++$order, |
| 287 |
test_class => [qw(mod_digest)], |
| 288 |
}, |
| 289 |
|
| 290 |
't/modules/mod_dynmasq.t' => { |
| 291 |
order => ++$order, |
| 292 |
test_class => [qw(mod_dynmasq)], |
| 293 |
}, |
| 294 |
|
| 295 |
't/modules/mod_exec.t' => { |
| 296 |
order => ++$order, |
| 297 |
test_class => [qw(mod_exec)], |
| 298 |
}, |
| 299 |
|
| 300 |
't/modules/mod_facl.t' => { |
| 301 |
order => ++$order, |
| 302 |
test_class => [qw(mod_facl)], |
| 303 |
}, |
| 304 |
|
| 305 |
't/modules/mod_facts.t' => { |
| 306 |
order => ++$order, |
| 307 |
test_class => [qw(mod_facts)], |
| 308 |
}, |
| 309 |
|
| 310 |
't/modules/mod_geoip.t' => { |
| 311 |
order => ++$order, |
| 312 |
test_class => [qw(mod_geoip)], |
| 313 |
}, |
| 314 |
|
| 315 |
't/modules/mod_geoip/sql.t' => { |
| 316 |
order => ++$order, |
| 317 |
test_class => [qw(mod_geoip mod_sql mod_sql_sqlite)], |
| 318 |
}, |
| 319 |
|
| 320 |
't/modules/mod_ifversion.t' => { |
| 321 |
order => ++$order, |
| 322 |
test_class => [qw(mod_ifversion)], |
| 323 |
}, |
| 324 |
|
| 325 |
't/modules/mod_lang.t' => { |
| 326 |
order => ++$order, |
| 327 |
test_class => [qw(mod_lang)], |
| 328 |
}, |
| 329 |
|
| 330 |
't/modules/mod_log_forensic.t' => { |
| 331 |
order => ++$order, |
| 332 |
test_class => [qw(mod_log_forensic)], |
| 333 |
}, |
| 334 |
|
| 335 |
't/modules/mod_quotatab_file.t' => { |
| 336 |
order => ++$order, |
| 337 |
test_class => [qw(mod_quotatab mod_quotatab_file)], |
| 338 |
}, |
| 339 |
|
| 340 |
't/modules/mod_quotatab_sql.t' => { |
| 341 |
order => ++$order, |
| 342 |
test_class => [qw(mod_quotatab mod_quotatab_sql mod_sql_sqlite)], |
| 343 |
}, |
| 344 |
|
| 345 |
't/modules/mod_quotatab/copy.t' => { |
| 346 |
order => ++$order, |
| 347 |
test_class => [qw(mod_copy mod_quotatab mod_quotatab_sql mod_sql_sqlite)], |
| 348 |
}, |
| 349 |
|
| 350 |
't/modules/mod_quotatab/site_misc.t' => { |
| 351 |
order => ++$order, |
| 352 |
test_class => [qw( |
| 353 |
mod_copy |
| 354 |
mod_quotatab |
| 355 |
mod_quotatab_sql |
| 356 |
mod_sql_sqlite |
| 357 |
mod_site_misc |
| 358 |
)], |
| 359 |
}, |
| 360 |
|
| 361 |
't/modules/mod_ratio.t' => { |
| 362 |
order => ++$order, |
| 363 |
test_class => [qw(mod_ratio)], |
| 364 |
}, |
| 365 |
|
| 366 |
't/modules/mod_readme.t' => { |
| 367 |
order => ++$order, |
| 368 |
test_class => [qw(mod_readme)], |
| 369 |
}, |
| 370 |
|
| 371 |
't/modules/mod_redis.t' => { |
| 372 |
order => ++$order, |
| 373 |
test_class => [qw(mod_redis)], |
| 374 |
}, |
| 375 |
|
| 376 |
't/modules/mod_rewrite.t' => { |
| 377 |
order => ++$order, |
| 378 |
test_class => [qw(mod_rewrite)], |
| 379 |
}, |
| 380 |
|
| 381 |
't/modules/mod_rlimit.t' => { |
| 382 |
order => ++$order, |
| 383 |
test_class => [qw(mod_rlimit)], |
| 384 |
}, |
| 385 |
|
| 386 |
't/modules/mod_sftp.t' => { |
| 387 |
order => ++$order, |
| 388 |
test_class => [qw(mod_sftp)], |
| 389 |
}, |
| 390 |
|
| 391 |
't/modules/mod_sftp/ban.t' => { |
| 392 |
order => ++$order, |
| 393 |
test_class => [qw(mod_ban mod_sftp)], |
| 394 |
}, |
| 395 |
|
| 396 |
't/modules/mod_sftp/exec.t' => { |
| 397 |
order => ++$order, |
| 398 |
test_class => [qw(mod_exec mod_sftp)], |
| 399 |
}, |
| 400 |
|
| 401 |
't/modules/mod_sftp/fips.t' => { |
| 402 |
order => ++$order, |
| 403 |
test_class => [qw(feat_openssl_fips mod_sftp)], |
| 404 |
}, |
| 405 |
|
| 406 |
't/modules/mod_sftp/rewrite.t' => { |
| 407 |
order => ++$order, |
| 408 |
test_class => [qw(mod_rewrite mod_sftp)], |
| 409 |
}, |
| 410 |
|
| 411 |
't/modules/mod_sftp/sql.t' => { |
| 412 |
order => ++$order, |
| 413 |
test_class => [qw(mod_sftp mod_sql_sqlite)], |
| 414 |
}, |
| 415 |
|
| 416 |
't/modules/mod_sftp/wrap2.t' => { |
| 417 |
order => ++$order, |
| 418 |
test_class => [qw(mod_sftp mod_wrap2)], |
| 419 |
}, |
| 420 |
|
| 421 |
't/modules/mod_sftp_pam.t' => { |
| 422 |
order => ++$order, |
| 423 |
test_class => [qw(mod_sftp mod_sftp_pam)], |
| 424 |
}, |
| 425 |
|
| 426 |
't/modules/mod_sftp_sql.t' => { |
| 427 |
order => ++$order, |
| 428 |
test_class => [qw(mod_sftp mod_sftp_sql mod_sql_sqlite)], |
| 429 |
}, |
| 430 |
|
| 431 |
't/modules/mod_shaper.t' => { |
| 432 |
order => ++$order, |
| 433 |
test_class => [qw(mod_shaper)], |
| 434 |
}, |
| 435 |
|
| 436 |
't/modules/mod_site.t' => { |
| 437 |
order => ++$order, |
| 438 |
test_class => [qw(mod_site)], |
| 439 |
}, |
| 440 |
|
| 441 |
't/modules/mod_site_misc.t' => { |
| 442 |
order => ++$order, |
| 443 |
test_class => [qw(mod_site_misc)], |
| 444 |
}, |
| 445 |
|
| 446 |
't/modules/mod_snmp.t' => { |
| 447 |
order => ++$order, |
| 448 |
test_class => [qw(mod_snmp)], |
| 449 |
}, |
| 450 |
|
| 451 |
't/modules/mod_sql.t' => { |
| 452 |
order => ++$order, |
| 453 |
test_class => [qw(mod_sql)], |
| 454 |
}, |
| 455 |
|
| 456 |
't/modules/mod_sql_passwd.t' => { |
| 457 |
order => ++$order, |
| 458 |
test_class => [qw(mod_sql_passwd mod_sql_sqlite)], |
| 459 |
}, |
| 460 |
|
| 461 |
't/modules/mod_sql_passwd/fips.t' => { |
| 462 |
order => ++$order, |
| 463 |
test_class => [qw(feat_openssl_fips mod_sql_passwd mod_sql_sqlite mod_sftp)], |
| 464 |
}, |
| 465 |
|
| 466 |
't/modules/mod_sql_odbc.t' => { |
| 467 |
order => ++$order, |
| 468 |
test_class => [qw(mod_sql_odbc)], |
| 469 |
}, |
| 470 |
|
| 471 |
't/modules/mod_sql_sqlite.t' => { |
| 472 |
order => ++$order, |
| 473 |
test_class => [qw(mod_sql_sqlite)], |
| 474 |
}, |
| 475 |
|
| 476 |
't/modules/mod_statcache.t' => { |
| 477 |
order => ++$order, |
| 478 |
test_class => [qw(mod_statcache)], |
| 479 |
}, |
| 480 |
|
| 481 |
't/modules/mod_statcache/sftp.t' => { |
| 482 |
order => ++$order, |
| 483 |
test_class => [qw(mod_sftp mod_statcache)], |
| 484 |
}, |
| 485 |
|
| 486 |
't/modules/mod_tls.t' => { |
| 487 |
order => ++$order, |
| 488 |
test_class => [qw(mod_tls)], |
| 489 |
}, |
| 490 |
|
| 491 |
't/modules/mod_tls/sni.t' => { |
| 492 |
order => ++$order, |
| 493 |
test_class => [qw(mod_tls)], |
| 494 |
}, |
| 495 |
|
| 496 |
't/modules/mod_tls_fscache.t' => { |
| 497 |
order => ++$order, |
| 498 |
test_class => [qw(mod_tls_fscache)], |
| 499 |
}, |
| 500 |
|
| 501 |
't/modules/mod_tls_memcache.t' => { |
| 502 |
order => ++$order, |
| 503 |
test_class => [qw(mod_memcache mod_tls_memcache)], |
| 504 |
}, |
| 505 |
|
| 506 |
't/modules/mod_tls_redis.t' => { |
| 507 |
order => ++$order, |
| 508 |
test_class => [qw(mod_redis mod_tls_redis)], |
| 509 |
}, |
| 510 |
|
| 511 |
't/modules/mod_tls_shmcache.t' => { |
| 512 |
order => ++$order, |
| 513 |
test_class => [qw(mod_tls_shmcache)], |
| 514 |
}, |
| 515 |
|
| 516 |
't/modules/mod_unique_id.t' => { |
| 517 |
order => ++$order, |
| 518 |
test_class => [qw(mod_unique_id)], |
| 519 |
}, |
| 520 |
|
| 521 |
't/modules/mod_wrap.t' => { |
| 522 |
order => ++$order, |
| 523 |
test_class => [qw(mod_wrap)], |
| 524 |
}, |
| 525 |
|
| 526 |
't/modules/mod_wrap2_file.t' => { |
| 527 |
order => ++$order, |
| 528 |
test_class => [qw(mod_wrap2_file)], |
| 529 |
}, |
| 530 |
|
| 531 |
't/modules/mod_wrap2_redis.t' => { |
| 532 |
order => ++$order, |
| 533 |
test_class => [qw(mod_redis mod_wrap2_redis)], |
| 534 |
}, |
| 535 |
|
| 536 |
't/modules/mod_wrap2_sql.t' => { |
| 537 |
order => ++$order, |
| 538 |
test_class => [qw(mod_sql_sqlite mod_wrap2_sql)], |
| 539 |
}, |
| 540 |
}; |
| 541 |
|
| 542 |
my @feature_tests = testsuite_get_runnable_tests($FEATURE_TESTS); |
| 543 |
my $feature_ntests = scalar(@feature_tests); |
| 544 |
if ($feature_ntests > 1 || |
| 545 |
($feature_ntests == 1 && $feature_tests[0] ne 'testsuite_empty_test')) { |
| 546 |
push(@$test_files, @feature_tests); |
| 547 |
} |
| 548 |
} |
| 549 |
|
| 550 |
$ENV{PROFTPD_TEST} = 1; |
| 551 |
|
| 552 |
if (defined($opts->{C})) { |
| 553 |
$ENV{PROFTPD_TEST_ENABLE_CLASS} = join(':', @{ $opts->{C} }); |
| 554 |
|
| 555 |
} else { |
| 556 |
# Disable all 'inprogress' and 'slow' tests by default |
| 557 |
$ENV{PROFTPD_TEST_DISABLE_CLASS} = 'inprogress:slow'; |
| 558 |
} |
| 559 |
|
| 560 |
if (defined($opts->{F})) { |
| 561 |
# Using the provided string as a regex, and run only the tests whose |
| 562 |
# files match the pattern |
| 563 |
|
| 564 |
my $file_pattern = $opts->{F}; |
| 565 |
|
| 566 |
my $filtered_files = []; |
| 567 |
foreach my $test_file (@$test_files) { |
| 568 |
if ($test_file =~ /$file_pattern/) { |
| 569 |
push(@$filtered_files, $test_file); |
| 570 |
} |
| 571 |
} |
| 572 |
|
| 573 |
$test_files = $filtered_files; |
| 574 |
} |
| 575 |
|
| 576 |
runtests(@$test_files) if scalar(@$test_files) > 0; |
| 577 |
|
| 578 |
exit 0; |
| 579 |
|
| 580 |
sub usage { |
| 581 |
print STDOUT <<EOH; |
| 582 |
|
| 583 |
$0: [--help] [--class=\$name] [--verbose] |
| 584 |
|
| 585 |
Examples: |
| 586 |
|
| 587 |
perl $0 |
| 588 |
perl $0 --class foo |
| 589 |
perl $0 --class bar --class baz |
| 590 |
|
| 591 |
EOH |
| 592 |
exit 0; |
| 593 |
} |