#!/usr/local/bin/perl -w =head1 NAME vcp.t - testing of vcp command =cut use strict ; use Carp ; use Test ; use VCP::TestUtils qw( vcp_cmd ); use constant is_win32 => $^O =~ /Win32/; my @vcp = vcp_cmd ; my $options = <<'END_TRANSFER'; Options: --help END_TRANSFER # Note the spaces instead of tabs and the spaces after the null: my $null_transfer = <<'END_TRANSFER'; Source: null: Destination: null: END_TRANSFER my $null_source = <<'END_TRANSFER'; Source: null: END_TRANSFER my $null_destination = <<'END_TRANSFER'; Destination: null: END_TRANSFER # Note the spaces instead of tabs and the spaces after the null: my $identity_transfer = <<'END_TRANSFER'; Source: null: Destination: null: Identity: END_TRANSFER sub _ok { my ( $cli_params, $stdin, $exp_return_codes, $expected ) = @_; my ( $out, $err ) = ( "", "" ); my $ok = eval { VCP::TestUtils::run [ @vcp, @$cli_params ], \$stdin, \$out, \$err, { ok_result_codes => $exp_return_codes }; 1; }; warn "$err" if $err && ! $ok; @_ = ( $ok ? defined $expected ? "$out$err" : $ok : $@, defined $expected ? $expected : 1, join " ", "vcp", @$cli_params, $stdin ? qq{\\"$stdin"} : () ); goto &ok; } my @tests = ( #perldoc now complains when run as root, causing this test to fail sub { return skip "perldoc may not be run as root", 1 unless $< || is_win32; _ok [ "help" ], undef, [0], qr/help topics/i; }, sub { return skip "perldoc may not be run as root", 1 unless $< || is_win32; _ok [ "--help" ], undef, [0], qr/help topics/i }, sub { _ok [ "vcp:-" ], $options, [0], qr/help topics/i }, sub { _ok [ "scan", "vcp:-" ], $null_transfer, [0]; }, sub { _ok [ "scan", "vcp:-" ], $null_source, [0]; }, sub { _ok [ "filter", "vcp:-" ], $null_transfer, [0]; }, sub { _ok [ "filter", "vcp:-" ], "", [0]; }, sub { _ok [ "filter", "vcp:-" ], $null_source, [0]; }, sub { _ok [ "filter", "vcp:-" ], $null_destination, [0]; }, sub { _ok [ "transfer", "vcp:-" ], $null_transfer, [0]; }, sub { _ok [ qw( null: null: ) ] }, sub { _ok [ qw( null: identity: null: ) ] }, sub { _ok [ qw( null: identity: identity: null: ) ] }, sub { _ok [ "vcp:-" ], $null_transfer }, sub { _ok [ "vcp:-" ], $identity_transfer }, sub { _ok [ 'foo:' ], undef, [ 2 ], qr/unknown source scheme/s }, sub { _ok [ 'revml:', 'foo:' ], undef, [ 2 ], qr/unknown dest\w* scheme/s }, sub { _ok [ '--foo' ], undef, [ 1 ], qr/foo.*Usage/s }, sub { local $ENV{VCPDEBUG} = "1"; _ok [ "help" ], undef, undef, qr/debugging/i; }, sub { _ok [ "--output-config-file=-", "vcp:-" ], $null_transfer, [0], qr/Source:.*null:.*Dest:.*null:/s; }, sub { _ok [ "--output-config-file=-", "vcp:-" ], $identity_transfer, [0], qr/Source:.*null:.*Dest:.*null:.*Identity:/s; }, sub { _ok [ "--output-config-file=-", qw( null: identity: identity: null: ) ], undef, [0], qr/Source:.*null:.*Dest:.*null:.*Identity:.*Identity:/s; }, ) ; plan tests => scalar( @tests ) ; $_->() 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. |