#!/usr/local/bin/perl -w =head1 NAME vcp.t - testing of vcp command =cut use strict ; use Carp ; use Test ; use IPC::Run ; use VCP::TestUtils (); my %seen ; my @perl = ( $^X, map { my $s = $_ ; $s = File::Spec->rel2abs( $_ ) ; "-I$s" ; } grep ! $seen{$_}++, @INC ) ; ## We always run vcp by doing a @perl, vcp, to make sure that vcp runs under ## the same version of perl that we are running under. my $vcp = 'vcp' ; $vcp = "bin/$vcp" if -e "bin/$vcp" ; $vcp = "../bin/$vcp" if -e "../bin/$vcp" ; $vcp = File::Spec->rel2abs( $vcp ) ; my @vcp = ( @perl, $vcp ) ; # Note the spaces instead of tabs and the spaces after the null: my $transfer = <<'END_TRANSFER'; Source: null: Destination: null: Map: ...#branch //foo/branch/... # cvs -> p4 //...#branch //foo/branch/... # same thing //blah/blargh/...#branch //plink/plonk //blah/boink/...#branch //plink/boo //...#branch - # cvs -> bitbucket //foo/branch/... //foo/branch/...#branch_id # p4 -> cvs //foo/branch/... - # p4 -> bitbucket # hmmm END_TRANSFER sub vcp { my $exp_results = shift ; my $out ; my $err ; my $pid = IPC::Run::run [ @vcp, @_ ], \undef, \$out, \$err ; confess "$vcp ", join( ' ', @_ ), " returned $?\n$out$err" if defined $exp_results && ! grep $? == $_ << 8, @$exp_results ; return $err . $out ; } my @tests = ( #perldoc now complains when run as root, causing this test to fail #sub { ok vcp( [ 0 ], 'help' ), qr/OPTIONS/s }, sub { my $ok = eval { VCP::TestUtils::run [ @vcp, "null:", "null:" ]; 1; }; ok $ok || $@, 1, "vcp:-"; }, sub { my $ok = eval { VCP::TestUtils::run [ @vcp, "vcp:-" ], "<", \$transfer; 1; }; ok $ok || $@, 1, "vcp:-"; }, sub { ok vcp( [ 2 ], 'foo:' ), qr/unknown source scheme/s }, sub { ok vcp( [ 2 ], 'revml:', 'foo:' ), qr/unknown dest\w* scheme/s }, sub { ok vcp( [ 1 ], '--foo' ), qr/foo.*Usage/s }, ) ; plan tests => scalar( @tests ) ; unless ( -e $vcp ) { print STDERR "# '$vcp' not found\n" ; skip( 1, '' ) for @tests ; exit ; } $_->() for @tests ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#22 | 4143 | Barrie Slaymaker | - Further adaptation to vcp.exe packaging format | ||
#21 | 3800 | Barrie Slaymaker | - <branches> removed from all code | ||
#20 | 3779 | Barrie Slaymaker |
- bin/vcp has nascent support for 3 stage transfers: - scan the source - filter the metadata (modify or prune) - transfer the filtered results - PRELIMINARY |
||
#19 | 3466 | Barrie Slaymaker |
- --output-config-file now usable with vcp:- specification - --output-config-file now tested - VCP::{Source,Dest}::null now sets a repo_scheme so they may be emitted to config files. - Dest: is now emitted right after Source: when there are filters to dump. |
||
#18 | 3426 | Barrie Slaymaker | - Test suite cleanup | ||
#17 | 3155 | Barrie Slaymaker |
Convert to logging using VCP::Logger to reduce stdout/err spew. Simplify & speed up debugging quite a bit. Provide more verbose information in logs. Print to STDERR progress reports to keep users from wondering what's going on. Breaks test; halfway through upgrading run3() to an inline function for speed and for VCP specific features. |
||
#16 | 2926 | John Fetkovich |
remove --state-location switch add --db-dir and --repo-id switches build state location from concatenation of those two. |
||
#15 | 2754 | John Fetkovich | Convert to use IPC::Run3::run3 rather than IPC::Run::run | ||
#14 | 2747 | John Fetkovich | removed unnecessary IPC::Run and IPC::Run3 "use"s | ||
#13 | 2708 | Barrie Slaymaker | Add support for Options: in .vcp files, improve testing of CLI | ||
#12 | 2688 | Barrie Slaymaker |
Add back $ENV{VCPDEBUG} and augment with turning on debugging for IPC::Run3. |
||
#11 | 2358 | John Fetkovich | simplified and factored tests and used VCP::TestUtils::vcp_cmd. | ||
#10 | 2302 | Barrie Slaymaker | test, debug filter chain CLI parsing | ||
#9 | 2301 | Barrie Slaymaker | A chain of plugins instead of source & dest | ||
#8 | 2293 | Barrie Slaymaker | Update CHANGES, TODO, improve .vcp files, add --init-cvs | ||
#7 | 2282 | Barrie Slaymaker | Add in support for *.vcp files | ||
#6 | 2012 | Barrie Slaymaker | code cleanup tweaks | ||
#5 | 1815 | Barrie Slaymaker |
Adapt to changes in parameter parsing. I think. |
||
#4 | 1358 | Barrie Slaymaker | Win32 changes | ||
#3 | 608 | Barrie Slaymaker |
Lots of changes to get vcp to install better, now up to 0.066. Many thanks to Matthew Attaway for testing & suggestions. |
||
#2 | 468 | Barrie Slaymaker |
- VCP::Dest::p4 now does change number aggregation based on the comment field changing or whenever a new revision of a file with unsubmitted changes shows up on the input stream. Since revisions of files are normally sorted in time order, this should work in a number of cases. I'm sure we'll need to generalize it, perhaps with a time thresholding function. - t/90cvs.t now tests cvs->p4 replication. - VCP::Dest::p4 now doesn't try to `p4 submit` when no changes are pending. - VCP::Rev now prevents the same label from being applied twice to a revision. This was occuring because the "r_1"-style label that gets added to a target revision by VCP::Dest::p4 could duplicate a label "r_1" that happened to already be on a revision. - Added t/00rev.t, the beginnings of a test suite for VCP::Rev. - Tweaked bin/gentrevml to comment revisions with their change number instead of using a unique comment for every revision for non-p4 t/test-*-in-0.revml files. This was necessary to test cvs->p4 functionality. |
||
#1 | 467 | Barrie Slaymaker | Version 0.01, initial checkin in perforce public depot. |