[svn:parrot] r37912 - in branches/install_tools: . t/tools/install t/tools/install/testlib
jkeenan at svn.parrot.org
jkeenan at svn.parrot.org
Sun Apr 5 00:44:06 UTC 2009
Author: jkeenan
Date: Sun Apr 5 00:44:03 2009
New Revision: 37912
URL: https://trac.parrot.org/parrot/changeset/37912
Log:
Add tests to mock the Cygwin-specific cases in Parrot::Install::install_files().
Added:
branches/install_tools/t/tools/install/testlib/README
- copied unchanged from r37894, branches/install_tools/README
branches/install_tools/t/tools/install/testlib/phony
branches/install_tools/t/tools/install/testlib/phony.exe
Modified:
branches/install_tools/MANIFEST
branches/install_tools/t/tools/install/02-install_files.t
Modified: branches/install_tools/MANIFEST
==============================================================================
--- branches/install_tools/MANIFEST Sat Apr 4 23:36:43 2009 (r37911)
+++ branches/install_tools/MANIFEST Sun Apr 5 00:44:03 2009 (r37912)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Sat Apr 4 23:35:45 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Apr 4 23:54:53 2009 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
@@ -2501,6 +2501,9 @@
t/tools/install/testlib/MANIFEST [test]
t/tools/install/testlib/MANIFEST.1defective [test]
t/tools/install/testlib/MANIFEST.generated [test]
+t/tools/install/testlib/README []doc
+t/tools/install/testlib/phony [test]
+t/tools/install/testlib/phony.exe [test]
t/tools/ops2cutils/01-new.t [test]
t/tools/ops2cutils/02-usage.t [test]
t/tools/ops2cutils/03-print_c_header_file.t [test]
Modified: branches/install_tools/t/tools/install/02-install_files.t
==============================================================================
--- branches/install_tools/t/tools/install/02-install_files.t Sat Apr 4 23:36:43 2009 (r37911)
+++ branches/install_tools/t/tools/install/02-install_files.t Sun Apr 5 00:44:03 2009 (r37912)
@@ -6,8 +6,10 @@
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More qw(no_plan); # tests => 11;
use Carp;
+use Cwd;
+use File::Copy;
use File::Path qw( mkpath );
use File::Temp qw( tempdir );
use lib qw( lib );
@@ -17,15 +19,17 @@
);
use IO::CaptureOutput qw( capture );
+my $cwd = cwd();
+my $testsourcedir = qq{$cwd/t/tools/install/testlib};
+
{
my $tdir = tempdir( CLEANUP => 1 );
$tdir .= '/';
my @dirs = qw(foo/bar foo/bar/baz);
create_directories($tdir, { map { $_ => 1 } @dirs });
- my($fullname);
- my @files = ( ['README', "$dirs[0]/README"] );
+ my @files = ( [ "$testsourcedir/README", "$dirs[0]/README"] );
{
my ( $stdout, $stderr, $rv );
@@ -40,10 +44,10 @@
foreach my $el (@files) {
$files_created++ if -f "$tdir$el->[1]";
}
- is( $files_created, 0, 'dry-run, so no files created' );
+ is( $files_created, 0, 'Dry run, so no files created' );
like( $stdout, qr/Installing.*README.*README/s,
- 'got expected installation message' );
+ 'Got expected installation message' );
}
{
@@ -59,11 +63,93 @@
foreach my $el (@files) {
$files_created++ if -f "$tdir$el->[1]";
}
- is( $files_created, 1, 'production, so 1 file created' );
+ is( $files_created, 1, 'Production, so 1 file created' );
like( $stdout, qr/Installing.*README/s,
- 'got expected installation message' );
+ 'Got expected installation message' );
+ }
+}
+
+{
+ local $^O = 'cygwin';
+ my $tdir = tempdir( CLEANUP => 1 );
+ chdir $tdir or die "Unable to change to testing directory: $!";
+ $tdir .= '/';
+
+ my @dirs = qw(foo/bar foo/bar/baz);
+ create_directories($tdir, { map { $_ => 1 } @dirs });
+
+ my @testingfiles = qw( README phony );
+ foreach my $f ( @testingfiles ) {
+ copy "$testsourcedir/$f", "$tdir/$f"
+ or die "Unable to copy $f prior to testing: $!";
+ }
+ my @files = (
+ [ "$tdir/README", "$dirs[0]/README" ],
+ [ "$tdir/phony", "$dirs[0]/phony" ],
+ );
+
+ {
+ my ( $stdout, $stderr, $rv );
+ capture(
+ sub { $rv = install_files($tdir, 0, @files); },
+ \$stdout,
+ \$stderr,
+ );
+ ok( $rv, 'install_files() completed successfully in mock-Cygwin case' );
+
+ my $files_created = 0;
+ foreach my $el (@files) {
+ $files_created++ if -f "$tdir$el->[1]";
+ }
+ is( $files_created, 2, 'Production, so 2 files created' );
+
+ like( $stdout, qr/Installing.*README.*phony/s,
+ 'Got expected installation message' );
+ }
+ chdir $cwd or die "Unable to change back to starting directory: $!";
+}
+
+{
+ local $^O = 'cygwin';
+ my $tdir = tempdir( CLEANUP => 1 );
+ chdir $tdir or die "Unable to change to testing directory: $!";
+ $tdir .= '/';
+
+ my @dirs = qw(foo/bar foo/bar/baz);
+ create_directories($tdir, { map { $_ => 1 } @dirs });
+
+ my @testingfiles = qw( README phony phony.exe );
+ foreach my $f ( @testingfiles ) {
+ copy "$testsourcedir/$f", "$tdir/$f"
+ or die "Unable to copy $f prior to testing: $!";
+ }
+ my @files = (
+ [ "$tdir/README", "$dirs[0]/README" ],
+ [ "$tdir/phony", "$dirs[0]/phony" ],
+ [ "$tdir/phony.exe", "$dirs[0]/phony.exe" ],
+ );
+
+ {
+ my ( $stdout, $stderr, $rv );
+ capture(
+ sub { $rv = install_files($tdir, 0, @files); },
+ \$stdout,
+ \$stderr,
+ );
+ ok( $rv, 'install_files() completed successfully in mock-Cygwin case' );
+
+ my $files_created = 0;
+ foreach my $el (@files) {
+ $files_created++ if -f "$tdir$el->[1]";
+ }
+ is( $files_created, 2,
+ 'Production, so 2 files created; 1 file passed over' );
+
+ like( $stdout, qr/Installing.*README.*phony/s,
+ 'Got expected installation message' );
}
+ chdir $cwd or die "Unable to change back to starting directory: $!";
}
{
@@ -72,7 +158,6 @@
my @dirs = qw(foo/bar foo/bar/baz);
create_directories($tdir, { map { $_ => 1 } @dirs });
- my($fullname);
# Case where element in @files is not an array ref
my @files = ( q{} );
@@ -87,7 +172,7 @@
ok( $rv, 'install_files() handled invalid argument as expected' );
like( $stdout, qr/Installing \.\.\./,
- 'got expected installation message' );
+ 'Got expected installation message' );
}
}
@@ -97,7 +182,6 @@
my @dirs = qw(foo/bar foo/bar/baz);
create_directories($tdir, { map { $_ => 1 } @dirs });
- my($fullname);
# Case where element in @files does not hold existent file
my $nonexistent = q{ajdpfadksjfjvjkvds} . $$;
@@ -113,7 +197,7 @@
ok( $rv, 'install_files() handled non-existent file as expected' );
like( $stdout, qr/Installing \.\.\./,
- 'got expected installation message' );
+ 'Got expected installation message' );
}
}
Copied: branches/install_tools/t/tools/install/testlib/README (from r37894, branches/install_tools/README)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/install_tools/t/tools/install/testlib/README Sun Apr 5 00:44:03 2009 (r37912, copy of r37894, branches/install_tools/README)
@@ -0,0 +1,155 @@
+This is Parrot, version 0.9.1
+------------------------------
+
+Parrot is Copyright (C) 2001-2009, Parrot Foundation.
+
+$Id$
+
+LICENSE INFORMATION
+-------------------
+
+This code is distributed under the terms of the Artistic License 2.0.
+For more details, see the full text of the license in the file LICENSE.
+
+PREREQUISITES
+-------------
+
+You need a C compiler, a linker, and a make program of course. If you will be
+linking with the ICU library you have to download and install it before
+configuring Parrot.
+
+Get it from http://www-306.ibm.com/software/globalization/icu/downloads.jsp
+
+You also need Perl 5.8.4 or newer, Storable 2.12 or newer, and Bundle::Parrot
+to run various configure and build scripts.
+
+For most of the platforms that we are supporting initially, Parrot should build
+out of the box. PLATFORM lists our target platforms.
+
+The current configure system is primitive, as it's only a temporary solution.
+It will be happy with most any answers you decide to feed it. Garbage In,
+Garbage Out.
+
+INSTRUCTIONS
+------------
+
+For now, unpack your Parrot tarball, (if you're reading this, you've
+probably already done that) and type
+
+ perl Configure.pl
+
+to run the Configure script. The Configure.pl script extracts
+configuration from the running perl5 program. Unfortunately, the perl5
+configuration is not set up to compile and link c++ programs, so you
+may need to explicitly tell Configure.pl which compiler and linker to
+use. For example, to compile C files with 'cc', C++ files with
+'CC', and link everything together with 'CC', you would type
+
+ perl Configure.pl --cc=cc --cxx=CC --link=CC --ld=CC
+
+See "perl Configure.pl --help" for more options and docs/configuration.pod
+for more details.
+
+For systems like HPUX that don't have inet_pton please run
+
+ perl Configure.pl --define=inet_aton
+
+Running Configure.pl will generate a config.h header, a Parrot::Config
+module, platform files and many Makefiles.
+
+The file "myconfig" has an overview of configure settings.
+
+Next, run make. (Configure.pl will tell you which version of make it
+recommends for your system.)
+
+Now, the interpreter should build. If you are building the ICU library
+(this is the default on most systems), you need to use GNU make instead
+(or something compatible with it).
+
+NOTE: If you have trouble linking parrot, this *may* be due to a pre-existing
+parrot version installed via 'make install'. Until this issue is resolved,
+you may have to delete the installed version of parrot before building a new
+one. Our apologies.
+
+You can test parrot by running "make test". You can run the tests in parallel
+with "make TEST_JOBS=3 test".
+
+You can run the full test suite with
+
+ make fulltest
+
+Note: PLATFORMS contains notes about whether test failures are expected
+on your system.
+
+On some systems you can install parrot:
+
+ make install
+
+This installs a bunch of files in /usr/local. The parrot executable is in
+/usr/local/bin. Please note that this feature is currently experimental.
+(It's so experimental that you have to read the directions it gives you.)
+
+If you want to install Parrot into a non-standard location use:
+
+ perl Configure.pl --prefix=/Users/foo/parrot-0.7.0
+ make install
+
+But please note that dynamic libs will not be found for non-standard
+locations unless you set LD_LIBRARY_PATH or similar.
+
+Look at docs/parrot.pod and docs/intro.pod for where to go from here. If you
+have any problems, see the section "How To Submit A Bug Report" in
+docs/submissions.pod. These documents are in POD format. You can view these
+files with the command:
+
+ perldoc -F docs/intro.pod
+
+NOTES
+-----
+
+On some older computers with little RAM, the computed-goto dispatch core
+(ops/core_ops_cg.c) may take a while to compile or may fail to compile at all.
+You can pass a flag to Configure.pl (--cgoto=0) to disable the computed-goto
+core, at a slight cost in runtime speed.
+
+CHANGES
+-------
+
+For documentation on the user-visible changes between this version and
+previous versions, please see NEWS.
+
+MAILING LISTS
+-------------
+
+The mailing list for parrot is parrot-dev at lists.parrot.org. Subscribe by
+filling out the form at http://lists.parrot.org/mailman/listinfo/parrot-dev
+It is archived at http://lists.parrot.org/pipermail/parrot-dev/
+
+The old development list is archived at
+http://www.nntp.perl.org/group/perl.perl6.internals
+and available via NNTP at nntp://nntp.perl.org/perl.perl6.internals
+
+You can also read the (old) list via Google Groups at
+http://groups-beta.google.com/group/perl.perl6.internals
+
+FEEDBACK, PATCHES, etc.
+-----------------------
+
+See F<docs/submissions.pod> for more information on reporting bugs and
+submitting patches.
+
+WEB SITES
+---------
+
+The following web sites have all the information you need about Parrot:
+ http://www.parrot.org/
+ http://trac.parrot.org/
+ http://www.parrotblog.org/
+
+And Perl6:
+ http://rakudo.org/
+ http://dev.perl.org/perl6/
+ http://pugscode.org/
+
+Have fun,
+ The Parrot Team.
Added: branches/install_tools/t/tools/install/testlib/phony
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/install_tools/t/tools/install/testlib/phony Sun Apr 5 00:44:03 2009 (r37912)
@@ -0,0 +1 @@
+File used in testing of Parrot::Install.
Added: branches/install_tools/t/tools/install/testlib/phony.exe
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/install_tools/t/tools/install/testlib/phony.exe Sun Apr 5 00:44:03 2009 (r37912)
@@ -0,0 +1 @@
+File used in testing of Parrot::Install; not a real executable.
More information about the parrot-commits
mailing list