1use Module::Build; 2my $mb = Module::Build->current(); 3exit(0) unless $mb->feature('config_support'); 4 5use Cwd; 6my ($testconfig, $maintest, $subtest) = (shift, shift, shift); 7my $PWD = getcwd; 8 9# setup the configuration file 10open my $FILE, '>', $testconfig; 11print {$FILE} <<"EOF"; 12#!/usr/bin/perl -MSVN::Notify::Config=\$0 13--- #YAML:1.0 14'': 15 PATH: "/usr/local/bin:/usr/bin" 16'/project1/branches/branch1': 17 handler: Mirror 18 to: "$PWD/t/wc-branch/" 19EOF 20 21if ( $mb->feature('ssh_support') and $mb->notes('sshtests') ) { 22 print {$FILE} <<"EOF"; 23'/project1/trunk': 24 handler: Mirror::SSH 25 to: "$PWD/t/wc-trunk/" 26 minimal: 1 27 ssh-host: localhost 28'/project1/tags': 29 handler: Mirror::SSH 30 to: "$PWD/t/wc-tag/" 31 tag-regex: 'TRUNK' 32 ssh-host: localhost 33EOF 34} 35else { 36 print {$FILE} <<"EOF"; 37'/project1/trunk': 38 handler: Mirror 39 minimal: 1 40 to: "$PWD/t/wc-trunk/" 41'/project1/tags': 42 handler: Mirror 43 to: "$PWD/t/wc-tag/" 44 tag-regex: 'TRUNK' 45EOF 46} 47close $FILE; 48 49open my $FILE, '>', $subtest; 50print {$FILE} <<"EOF"; 51#!/usr/bin/perl -w 52# We have to go through this roundabout method because 53# SVN::Notify::Config->import() won't run with -I on the 54# command line and because it calls exit at the end 55BEGIN { 56 unshift \@INC, "blib/lib", "blib/arch"; 57} 58 59my (\$repos_path, \$rev) = (shift, shift); 60 61require SVN::Notify::Config; 62push \@ARGV, \$repos_path, \$rev; 63SVN::Notify::Config->import( 64 "$testconfig" 65); 66EOF 67 68close $FILE; 69 70open my $FILE, '>', $maintest; 71print {$FILE} <<"EOF"; 72require "t/coretests.pm"; 73 74reset_all_tests(); 75run_tests("perl $subtest"); 76EOF 77 78close $FILE; 79