[svn:parrot] r39092 - in branches/test_install: . t/tools/install t/tools/install/testlib

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Sat May 23 14:52:45 UTC 2009


Author: jkeenan
Date: Sat May 23 14:52:44 2009
New Revision: 39092
URL: https://trac.parrot.org/parrot/changeset/39092

Log:
First pass at developing a test program which will simulate overall action of tools/dev/install_files.pl.

Added:
   branches/test_install/t/tools/install/overall.t   (contents, props changed)
   branches/test_install/t/tools/install/testlib/CREDITS   (contents, props changed)
   branches/test_install/t/tools/install/testlib/generated_pseudo   (contents, props changed)
   branches/test_install/t/tools/install/testlib/manifest_pseudo   (contents, props changed)
   branches/test_install/t/tools/install/testlib/vtable.dump   (contents, props changed)
Modified:
   branches/test_install/MANIFEST

Modified: branches/test_install/MANIFEST
==============================================================================
--- branches/test_install/MANIFEST	Sat May 23 14:49:20 2009	(r39091)
+++ branches/test_install/MANIFEST	Sat May 23 14:52:44 2009	(r39092)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Thu May 21 03:56:48 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat May 23 14:47:21 2009 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -1254,6 +1254,9 @@
 src/exec_start.c                                            []
 src/exit.c                                                  []
 src/extend.c                                                []
+src/gc/alloc_memory.c                                       []
+src/gc/alloc_register.c                                     []
+src/gc/alloc_resources.c                                    []
 src/gc/api.c                                                []
 src/gc/gc_malloc.c                                          []
 src/gc/gc_ms.c                                              []
@@ -1263,10 +1266,7 @@
 src/gc/malloc.c                                             []
 src/gc/malloc_trace.c                                       []
 src/gc/mark_sweep.c                                         []
-src/gc/alloc_memory.c                                       []
-src/gc/alloc_register.c                                     []
 src/gc/res_lea.c                                            []
-src/gc/alloc_resources.c                                    []
 src/gc/system.c                                             []
 src/global.c                                                []
 src/global_setup.c                                          []
@@ -2002,6 +2002,11 @@
 t/tools/dev/searchops.t                                     [test]
 t/tools/dev/searchops/samples.pm                            [test]
 t/tools/dump_pbc.t                                          [test]
+t/tools/install/overall.t                                   [test]
+t/tools/install/testlib/CREDITS                             [test]
+t/tools/install/testlib/generated_pseudo                    [test]
+t/tools/install/testlib/manifest_pseudo                     [test]
+t/tools/install/testlib/vtable.dump                         [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]

Added: branches/test_install/t/tools/install/overall.t
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/test_install/t/tools/install/overall.t	Sat May 23 14:52:44 2009	(r39092)
@@ -0,0 +1,112 @@
+#! perl
+# Copyright (C) 2007-2008, Parrot Foundation.
+# $Id$
+# overall.t
+
+use strict;
+use warnings;
+use Test::More qw(no_plan); # tests =>  4;
+use Carp;
+use Cwd;
+use File::Copy;
+use File::Path qw( mkpath );
+use File::Spec ();
+use File::Temp qw( tempdir );
+use lib qw( lib );
+use IO::CaptureOutput qw( capture );
+
+my $cwd = cwd();
+my $installer = File::Spec->catfile( 'tools', 'dev', 'install_files.pl' );
+my $full_installer = File::Spec->catfile( $cwd, $installer );
+ok(-f $full_installer, "Able to locate $installer");
+
+my $testlibdir = File::Spec->catdir( qw| t tools install testlib | );
+my $man_pseudo = File::Spec->catfile( $testlibdir, q|manifest_pseudo| );
+my $full_man_pseudo = File::Spec->catfile( $cwd, $man_pseudo );
+my $gen_pseudo = File::Spec->catfile( $testlibdir, q|generated_pseudo| );
+my $full_gen_pseudo = File::Spec->catfile( $cwd, $gen_pseudo );
+
+my %testfiles = (
+    'CREDITS'                 => File::Spec->catdir( qw| . | ),
+    'vtable.dump'             => File::Spec->catdir( qw| . src | ),
+#    'docs/gettingstarted.pod'      => File::Spec->catdir( qw| . docs | ),
+);
+
+{
+    my $builddir    = tempdir( CLEANUP => 1 );
+    my $prefixdir   = tempdir( CLEANUP => 1 );
+
+    chdir $builddir or croak "Unable to change to tempdir for testing: $!";
+    my $man_quasi = File::Spec->catfile( $builddir, 'MANIFEST' );
+    my $gen_quasi = File::Spec->catfile( $builddir, 'MANIFEST.generated' );
+    copy $full_man_pseudo => $man_quasi
+        or croak "Unable to copy $man_pseudo for testing:  $!";
+    copy $full_gen_pseudo => $gen_quasi
+        or croak "Unable to copy $gen_pseudo for testing: $!";
+
+    my @dirs_needed = qw(
+        src
+    );
+#        docs
+    my @created = mkpath( @dirs_needed );
+    foreach my $f ( keys %testfiles ) {
+        my $src = File::Spec->catfile( $cwd, $testlibdir, $f );
+        my $des = File::Spec->catfile( $builddir, $testfiles{$f}, $f );
+        copy $src, $des or croak "Unable to copy $f for testing: $!";
+    }
+    my $cmd = qq{$^X $full_installer --prefix=$prefixdir};
+    $cmd .= qq{ MANIFEST MANIFEST.generated };
+    my ($stdout, $stderr);
+    capture(
+        sub {
+            system( $cmd ) and croak "Unable to execute $installer: $!";
+        },
+        \$stdout,
+        \$stderr,
+    );
+    like( $stdout, qr/^Installing/, "Got expected standard output" );
+    my $seen = 0;
+    foreach my $f ( keys %testfiles ) {
+        my $des = File::Spec->catfile( $builddir, $testfiles{$f}, $f );
+        $seen++ if -f $des;
+    }
+    is( $seen, scalar keys %testfiles,
+        "Got all $seen expected files in installation" );
+
+    chdir $cwd
+        or croak "Unable to return to top-level directory after testing: $!";
+}
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+overall.t - test tools/dev/install_files.pl
+
+=head1 SYNOPSIS
+
+    % prove t/tools/install/overall.t
+
+=head1 DESCRIPTION
+
+This file simulates the operation of F<tools/dev/install_files.pl> and
+sanity-checks the results.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+F<tools/dev/install_files.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: branches/test_install/t/tools/install/testlib/CREDITS
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/test_install/t/tools/install/testlib/CREDITS	Sat May 23 14:52:44 2009	(r39092)
@@ -0,0 +1,2 @@
+# $Id$
+

Added: branches/test_install/t/tools/install/testlib/generated_pseudo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/test_install/t/tools/install/testlib/generated_pseudo	Sat May 23 14:52:44 2009	(r39092)
@@ -0,0 +1,8 @@
+# $Id$
+# See tools/dev/install_files.pl for documentation on the
+# format of this file.
+# Please re-sort this file after *EVERY* modification
+vtable.dump                                       [devel]src
+# Local variables:
+#   mode: text
+# End:

Added: branches/test_install/t/tools/install/testlib/manifest_pseudo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/test_install/t/tools/install/testlib/manifest_pseudo	Sat May 23 14:52:44 2009	(r39092)
@@ -0,0 +1,13 @@
+# $Id$
+#
+# generated by tools/dev/mk_manifest_and_skip.pl Thu May 21 03:56:48 2009 UT
+#
+# See tools/dev/install_files.pl for documentation on the
+# format of this file.
+# See docs/submissions.pod on how to recreate this file after SVN
+# has been told about new or deleted files.
+CREDITS                                                     []
+#docs/gettingstarted.pod                                     [main]doc
+# Local variables:
+#   mode: text
+# End:

Added: branches/test_install/t/tools/install/testlib/vtable.dump
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/test_install/t/tools/install/testlib/vtable.dump	Sat May 23 14:52:44 2009	(r39092)
@@ -0,0 +1,2 @@
+# $Id$
+


More information about the parrot-commits mailing list