Author image Barrie Slaymaker

NAME

VCP::TestUtils - support routines for VCP testing

General utility functions

mk_tmp_dir

Creates one or more temporary directories, which will be removed upon exit in an END block

assert_eq
   assert_eq $test_name, $in, $out ;

dies with a useful diff in $@ is $in ne $out. Returns nothing.

Requires a diff that knows about the -d and -U options.

slurp
   $guts = slurp $filename ;
perl_cmd
   @perl = perl_cmd

Returns a list containing the Perl executable and some options to reproduce the current Perl options , like -I.

vcp_cmd
   @vcp = vcp_cmd

Returns a list containing the Perl executable and some options to reproduce the current Perl options , like -I.

vcp_cmd assumes it is called from within the main distro directory or one subdir under it, since it looks for "bin/vcp" and "../bin/vcp". This should be adequate for almost all uses.

vcp_cmd caches it's results to allow it to be run from other directories after the first time it's called. (this is not a significant performance improvement; running the vcp process takes several orders of magnitude longer than the quick checks vcp_cmd does).

get_vcp_output
   @vcp = get_vcp_output "foo:", "-bar" ;

Does a:

   run [ vcp_cmd, @_, "revml:", ... ], \undef, \$out
      or croak "`vcp blahdy blah` returned $?";

and returns $out. The "..." refers to whatever output options are needed to make the test output agree with bin/gentrevml's test files (t/test-*.revml).

XML "cleanup" functions

These are used to get rid of content or elements that are known to differ when comparing the revml fed in to a repository with the revml that comes out.

s_content
   s_content
      $elt_type1, $elt_type2, ..., \$string1, \$string2, ..., $new_content ;

Changes the contents of the elements, since some things, like suer id or mod_time can't be the same after going through a repository.

If $new_val is not supplied, a constant string is used.

rm_elts
   rm_elts $elt_type1, $elt_type2, ..., \$string1, \$string2
   rm_elts $elt_type1, $elt_type2, ..., qr/$content_re/, \$string1, \$string2

Removes the specified elements from the strings, including leading whitespace and trailing line separators. If the optional $content_re regular expression is provided, then only elements containing that pattern will be removed.

p4 repository mgmt functions

p4_borken

Returns true if the p4 is missing or too old (< 99.2).

launch_p4d
   launch_p4d "prefix_" ;

Creates an empty repository and launches a p4d for it. The p4d will be killed and it's repository deleted on exit. Returns the options needed to access the repository.

CVS mgmt functions

init_cvs
   my $cvs_options = init_cvs $prefix, $module_name ;

Creates a CVS repository containing an empty module. Also sets $ENV{LOGNAME} if it notices that we're running as root, so CVS won't give a "cannot commit files as 'root'" error. Tries "nobody", then "guest".

Returns the options needed to access the cvs repository.

COPYRIGHT

Copyright 2000, Perforce Software, Inc. All Rights Reserved.

This module and the VCP package are licensed according to the terms given in the file LICENSE accompanying this distribution, a copy of which is included in vcp.

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 186:

=cut found outside a pod block. Skipping to next block.

Around line 267:

You forgot a '=back' before '=head1'

Around line 481:

You forgot a '=back' before '=head1'