[Bps-public-commit] r14306 - in Pushmi/trunk: lib/Pushmi
clkao at bestpractical.com
clkao at bestpractical.com
Fri Jul 18 21:45:27 EDT 2008
Author: clkao
Date: Fri Jul 18 21:45:26 2008
New Revision: 14306
Modified:
Pushmi/trunk/lib/Pushmi/Test.pm
Pushmi/trunk/t/basic.t
Pushmi/trunk/t/concurrency.t
Pushmi/trunk/t/verify.t
Log:
refactor basic test builder.
Modified: Pushmi/trunk/lib/Pushmi/Test.pm
==============================================================================
--- Pushmi/trunk/lib/Pushmi/Test.pm (original)
+++ Pushmi/trunk/lib/Pushmi/Test.pm Fri Jul 18 21:45:26 2008
@@ -4,7 +4,7 @@
use Pushmi::Config;
use base 'Exporter';
-our @EXPORT = qw(get_dav_server run_pushmi is_svn_output start_memcached check_apache svn_error_txn_outofdate svn_error_commit_hook);
+our @EXPORT = qw(get_dav_server run_pushmi is_svn_output start_memcached check_apache svn_error_txn_outofdate svn_error_commit_hook build_basic_test_ok);
use FindBin;
BEGIN {
@@ -17,6 +17,7 @@
use SVK::Util qw(can_run abs_path);
use IPC::Run3 'run3';
use Test::More;
+use SVK::Test;
my $apache_port = 5008;
@@ -177,6 +178,38 @@
return ("svn: Commit blocked by pre-commit hook (exit code $exit_code) with output:", @_);
}
+sub build_basic_test_ok {
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+ my ($xd, $svk) = SVK::Test::build_test('test');
+ my ($srepospath, $spath, $srepos) = $xd->find_repos ('/test/', 1);
+
+ $svk->mkdir('-m', 'init', '/test/A');
+
+ my ($copath, $corpath) = get_copath('basic-svn');
+ my ($scopath, $scorpath) = get_copath('basic-svk');
+
+ my $uri = uri($srepospath.($spath eq '/' ? '' : $spath));
+
+ my ($repospath, $path, $repos) = $xd->find_repos ('//', 1);
+ ok( Pushmi::Mirror->new(path => $repospath)->install_hook );
+
+ start_memcached();
+ my $muri = uri($repospath.($path eq '/' ? '' : $path));
+
+ $svk->mirror('//', $uri);
+
+ is_output($svk, 'sync', ['//'],
+ ["Syncing $uri",
+ 'Retrieving log information from 1 to 1',
+ 'Committed revision 1 from revision 1.']);
+
+ # XXX: this is so lame
+ return ($svk,
+ $uri, $srepos, $spath, $scopath, $scorpath,
+ $muri, $repos, $path, $copath, $corpath);
+}
+
+
END {
for (@CLEANUP) {
$_->();
Modified: Pushmi/trunk/t/basic.t
==============================================================================
--- Pushmi/trunk/t/basic.t (original)
+++ Pushmi/trunk/t/basic.t Fri Jul 18 21:45:26 2008
@@ -8,31 +8,9 @@
plan tests => 28;
-my ($xd, $svk) = build_test('test');
-
-our $output;
-
-my ($srepospath, $spath, $srepos) = $xd->find_repos ('/test/', 1);
-
-$svk->mkdir('-m', 'init', '/test/A');
-
-my ($copath, $corpath) = get_copath('basic-svn');
-my ($scopath, $scorpath) = get_copath('basic-svk');
-
-my $uri = uri($srepospath.($spath eq '/' ? '' : $spath));
-
-my ($repospath, $path, $repos) = $xd->find_repos ('//', 1);
-ok( Pushmi::Mirror->new(path => $repospath)->install_hook );
-
-start_memcached();
-my $muri = uri($repospath.($path eq '/' ? '' : $path));
-
-$svk->mirror('//', $uri);
-
-is_output($svk, 'sync', ['//'],
- ["Syncing $uri",
- 'Retrieving log information from 1 to 1',
- 'Committed revision 1 from revision 1.']);
+my ($svk,
+ $uri, $srepos, undef, undef, $scorpath,
+ $muri, $repos, undef, $copath, undef ) = build_basic_test_ok();
is_output($svk, 'sync', ['//'],
["Syncing $uri"]);
Modified: Pushmi/trunk/t/concurrency.t
==============================================================================
--- Pushmi/trunk/t/concurrency.t (original)
+++ Pushmi/trunk/t/concurrency.t Fri Jul 18 21:45:26 2008
@@ -8,31 +8,9 @@
plan tests => 10;
-my ($xd, $svk) = build_test('test');
-
-our $output;
-
-my ($srepospath, $spath, $srepos) = $xd->find_repos ('/test/', 1);
-start_memcached();
-
-$svk->mkdir('-m', 'init', '/test/A');
-
-my ($copath, $corpath) = get_copath('basic-svn');
-my ($scopath, $scorpath) = get_copath('basic-svk');
-
-my $uri = uri($srepospath.($spath eq '/' ? '' : $spath));
-
-my ($repospath, $path, $repos) = $xd->find_repos ('//', 1);
-ok( Pushmi::Mirror->new(path => $repospath)->install_hook );
-
-my $muri = uri($repospath.($path eq '/' ? '' : $path));
-
-$svk->mirror('//', $uri);
-
-is_output($svk, 'sync', ['//'],
- ["Syncing $uri",
- 'Retrieving log information from 1 to 1',
- 'Committed revision 1 from revision 1.']);
+my ($svk,
+ $uri, $srepos, undef, undef, $scorpath,
+ $muri, $repos, undef, $copath, undef ) = build_basic_test_ok();
is_svn_output(['co', $muri, $copath],
['A t/checkout/basic-svn/A',
Modified: Pushmi/trunk/t/verify.t
==============================================================================
--- Pushmi/trunk/t/verify.t (original)
+++ Pushmi/trunk/t/verify.t Fri Jul 18 21:45:26 2008
@@ -38,33 +38,9 @@
plan tests => 8;
-my ($xd, $svk) = build_test('test');
-
-our $output;
-
-my ($srepospath, $spath, $srepos) = $xd->find_repos ('/test/', 1);
-
-$svk->mkdir('-m', 'init', '/test/A');
-
-my ($copath, $corpath) = get_copath('basic-svn');
-my ($scopath, $scorpath) = get_copath('basic-svk');
-
-my $uri = uri($srepospath.($spath eq '/' ? '' : $spath));
-
-my ($repospath, $path, $repos) = $xd->find_repos ('//', 1);
-my $depot = $xd->find_depot('');
-$depot->repos->fs->change_rev_prop(0, 'pushmi:auto-verify', '*');
-ok( Pushmi::Mirror->new( path => $repospath)->install_hook );
-
-start_memcached();
-my $muri = uri($repospath.($path eq '/' ? '' : $path));
-
-$svk->mirror('//', $uri);
-
-is_output($svk, 'sync', ['//'],
- ["Syncing $uri",
- 'Retrieving log information from 1 to 1',
- 'Committed revision 1 from revision 1.']);
+my ($svk,
+ $uri, $srepos, undef, undef, $scorpath,
+ $muri, $repos, undef, $copath, undef ) = build_basic_test_ok();
is_output($svk, 'sync', ['//'],
["Syncing $uri"]);
@@ -89,6 +65,8 @@
'Retrieving log information from 3 to 3',
'Committed revision 3 from revision 3.']);
+my $depot = $svk->{xd}->find_depot('');
+$depot->repos->fs->change_rev_prop(0, 'pushmi:auto-verify', '*');
$depot->repos->fs->change_rev_prop(0, 'pushmi:inconsistent', '2');
More information about the Bps-public-commit
mailing list