#!/usr/local/bin/perl -w =head1 NAME revml.t - testing of vcp revml in and out =cut use strict ; use Carp ; use File::Spec ; use Test ; use VCP::TestUtils ; use constant is_win32 => $^O =~ /Win32/; my @vcp = vcp_cmd ; my @sort = qw( sort: -- ); my $t = -d 't' ? 't/' : '' ; my $in_revml = $t . "test-revml-in-0-no-big-files.revml" ; my $compressed_revml = "/tmp/50revml_$$.revml.gz"; my @tests = ( ## ## Empty imports, used here just to see if commad line parsing is ok and ## that a really simple file can make it through the XML parser ok. ## sub { run [ @vcp, "revml:-", "revml:" ], \"<revml/>" ; ok $?, 0, "`vcp revml:- revml:` return value" ; }, sub { run [ @vcp, "-", "-" ], \"<revml/>" ; ok $?, 0, "`vcp revml:- revml:` return value" ; }, sub { run [ @vcp, "-", ], \"<revml/>" ; ok $?, 0, "`vcp revml:- revml:` return value" ; }, # create gzipped revml sub { return skip 1, "gzip not normally found on Win32" if is_win32; run [ @vcp, "revml:$in_revml", "revml:$compressed_revml", "--compress" ]; ok $?, 0, "vcp return value" ; }, # check that gzipped revml exists sub { return skip 1, "gzip not normally found on Win32" if is_win32; ok -z $compressed_revml, '', "gzipped file $compressed_revml created"; }, # uncompress the gzipped revml sub { return skip 1, "gzip not normally found on Win32" if is_win32; my $out; run [ @vcp, "revml:$compressed_revml", "--uncompress", @sort, "revml:-", ], \undef, \$out; unlink $compressed_revml or warn "failed to unlink $compressed_revml"; my $expected = slurp $in_revml; ok_or_diff $out, $expected; }, # two ok's in next test sub {}, # create non-indented revml sub { my $out; run [ @vcp, "revml:$in_revml", "revml:-", "--no-indent" ], \undef, \$out; # there should be no leading whitespace on any line ok $out !~ /^\s/m ; # re-indent the result, to check against original my $re_indented_out; run [ @vcp, "revml:-", @sort, "revml:-" ], \$out, # now the input \$re_indented_out; my $expected = slurp $in_revml; ok_or_diff $re_indented_out, $expected; }, ( map { my $source_spec = $_; sub { my $out ; my $infile = $t . "test-revml-in-0.revml" ; $source_spec =~ s/INFILE/$infile/; run [ @vcp, $source_spec, @sort, "-" ], \undef, \$out; my $in = slurp( $infile ) ; ok_or_diff $out, $in, $source_spec; }; } qw( INFILE revml:INFILE revml:INFILE: revml:INFILE:/... ) ), ( map { my $type = $_ ; ## ## Idempotency tests ## ## These depend on the "test-foo-in.revml" files built in the makefile. ## See MakeMaker.PL for how those are generated. ## sub { my $out ; my $infile = $t . "test-$type-in-0.revml" ; ## $in and $out allow us to avoide execing diff most of the time. run [ @vcp, "$infile", @sort, "-" ], \undef, \$out; my $in = slurp( $infile ); ok_or_diff $out, $in, $type; }, } qw( revml cvs p4 ) ) ) ; plan tests => scalar( @tests ) ; $_->() for @tests ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 6118 | Dimitry Andric | Integ from //public/revml to //guest/dimitry_andric/revml/main. | ||
//guest/perforce_software/revml/t/50revml.t | |||||
#23 | 3698 | Barrie Slaymaker | - Passes all VSS, cvs, and revml tests | ||
#22 | 3437 | Barrie Slaymaker | Remove debugging from test suite. | ||
#21 | 3427 | Barrie Slaymaker |
- test suite cleanup - Win32 fix for test suite |
||
#20 | 3261 | John Fetkovich | test suite fixes | ||
#19 | 3115 | Barrie Slaymaker |
Move sorting function to the new VCP::Filter::sort; it's for testing and reporting only and the code was bloating VCP::Dest and limiting VCP::Rev and VCP::Dest optimizations. Breaks test suite in minor way. |
||
#18 | 3008 | John Fetkovich |
make state database files go under vcp_state in the program start directory (start_dir) instead of start_dir itself. Also escape periods (.) from the database directory as well as the characters already escaped. |
||
#17 | 2768 | John Fetkovich |
Allow revml to be output in non-indented form with --no-indent option on dest::revml |
||
#16 | 2764 | John Fetkovich |
add --compress switch to dest::revml add --uncompress switch to source::revml use gzip to compress/uncompress revml files |
||
#15 | 2640 | Barrie Slaymaker | VCP::Source::revml now supports revision name wildcard matching. | ||
#14 | 2369 | John Fetkovich | @vcp now built via VCP::TestUtils vcp_cmd | ||
#13 | 2319 | Barrie Slaymaker | make t/test-*.revml be consistent with cvs2p4 and p42cvs scenarios | ||
#12 | 2275 | Barrie Slaymaker | clean up a warning | ||
#11 | 2059 | Barrie Slaymaker | Support for branching in p4->p4 added | ||
#10 | 2051 | Barrie Slaymaker | Enable p4_branch_spec to be carried through revml->revml. | ||
#9 | 2049 | Barrie Slaymaker | Get branching working in Dest::p4, clean up some tests. | ||
#8 | 2013 | Barrie Slaymaker | Reenable vcp as a unixy command line filter processing revml | ||
#7 | 1358 | Barrie Slaymaker | Win32 changes | ||
#6 | 1055 | Barrie Slaymaker |
add sorting, revamp test suite, misc cleanup. Dest/revml is not portable off my system yet (need to release ...::Diff) |
||
#5 | 825 | Barrie Slaymaker |
test, handle case where no revs are transferred and VCP::Dest::*::handle_footer() blew up. |
||
#4 | 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. |
||
#3 | 478 | Barrie Slaymaker |
0.05 Mon Dec 18 07:27:53 EST 2000 - Use `p4 labels //...@label` command as per Rober Cowham's suggestion, with the '-s' flag recommended by Christopher Siewald and Amaury.FORGEOTDARC@atsm.fr. Though it's actually something like vcp: running /usr/bin/p4 -u safari -c safari -p localhost:5666 -s files //.../NtLkly //...@compiler_a3 //.../NtLkly //...@compiler_may3 and so //on //for 50 parameters to get the speed up. I use the //.../NtLkly "file" as //a separator between the lists of files in various //revisions. Hope nobody has any files named that :-). What I should do is choose a random label that doesn't occur in the labels list, I guess. - VCP::Source::revml and VCP::Dest::revml are now binary, control code, and "hibit ASCII" (I know, that's an oxymoron) clean. The <comment>, <delta>, and <content> elements now escape anything other than tab, line feed, space, or printable chars (32 <= c <= ASCII 126) using a tag like '<char code="0x09">'. The test suite tests all this. Filenames should also be escaped this way, but I didn't get to that. - The decision whether to do deltas or encode the content in base64 is now based on how many characters would need to be escaped. - We now depend on the users' diff program to have a "-a" option to force it to diff even if the files look binary to it. I need to use Diff.pm and adapt it for use on binary data. - VCP::Dest::cvs now makes sure that no two consecutive revisions of the same file have the same mod_time. VCP::Source::p4 got so fast at pulling revisions from the repositories the test suite sets up that CVS was not noticing that files had changed. - VCP::Plugin now allows you to set a list of acceptable result codes, since we now use p4 in ways that make it return non-zero result codes. - VCP::Revs now croaks if you try to add two entries of the same VCP::Rev (ie matching filename and rev_id). - The <type> tag is now limited to "text" or "binary", and is meant to pass that level of info between foreign repositories. - The <p4_info> on each file now carries the one line p4 description of the file so that p4->p4 transferes can pick out the more detailed info. VCP::Source::p4, VCP::Dest::p4 do this. - VCP::{Source,Dest}::{p4,cvs} now set binaryness on added files properly, I think. For p4->p4, the native p4 type is preserved. For CVS sources, seeing the keyword substitution flag 'o' or 'b' implies binaryness, for p4, seeing a filetype like qr/u?x?binary/ or qr/x?tempobj/ or "resource" implies binaryness (to non-p4 destinations). NOTE: Seeing a 'o' or 'b' in a CVS source only ends up setting the 'b' option on the destination. That should be ok for most uses, but we can make it smarter for cvs->cvs transfers if need be. |
||
#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. |