Permalink
Browse files

Merge fileconf branch into trunk per

http://rt.perl.org/rt3/Ticket/Display.html?id=60134.  Adds xconf/ directory to
hold files used in configuration in different circumstances.  Adds
xconf/samples/ directory to holds samples thereof.  Adds
t/configure/008-file_based_configuration.t to test
Parrot::Configure::Options::Conf::File.  Adds associated dummy files for
testing.


git-svn-id: https://svn.parrot.org/parrot/trunk@32182 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent d8554c1 commit e478ac726603968f1c75ba71d75d48b5fa43eaf7 @jkeenan jkeenan committed Oct 26, 2008
View
@@ -647,7 +647,7 @@ =head2 Example
=head1 SEE ALSO
-F<config/init/data.pl>, F<lib/Parrot/Configure.pm>,
+F<lib/Parrot/Configure.pm>,
F<lib/Parrot/Configure/Step.pm>, F<docs/configuration.pod>
=cut
View
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Sun Oct 26 03:30:46 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sun Oct 26 17:17:07 2008 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
@@ -3234,6 +3234,7 @@ t/configure/004-configure.t []
t/configure/005-run_one_step.t []
t/configure/006-bad_step.t []
t/configure/007-verbose_two.t []
+t/configure/008-file_based_configuration.t []
t/configure/011-no_description.t []
t/configure/012-verbose.t []
t/configure/013-die.t []
@@ -3276,6 +3277,10 @@ t/configure/059-silent.t []
t/configure/061-revision_from_cache.t []
t/configure/testlib/Make_VERSION_File.pm []
t/configure/testlib/Tie/Filehandle/Preempt/Stdin.pm []
+t/configure/testlib/adefectivefoobar []
+t/configure/testlib/bdefectivefoobar []
+t/configure/testlib/cdefectivefoobar []
+t/configure/testlib/ddefectivefoobar []
t/configure/testlib/init/alpha.pm []
t/configure/testlib/init/beta.pm []
t/configure/testlib/init/delta.pm []
@@ -3288,6 +3293,7 @@ t/configure/testlib/init/lambda.pm []
t/configure/testlib/init/mu.pm []
t/configure/testlib/init/zeta.pm []
t/configure/testlib/inter/theta.pm []
+t/configure/testlib/verbosefoobar []
t/distro/file_metadata.t []
t/distro/manifest.t []
t/distro/meta_yml.t []
@@ -3740,6 +3746,8 @@ tools/util/smokeserv-client.pl []
tools/util/smokeserv-server.pl []
tools/util/templates.json []
tools/util/update_copyright.pl []
+xconf/samples/testfoobar []
+xconf/samples/yourfoobar []
# Local variables:
# mode: text
# buffer-read-only: t
@@ -12,7 +12,7 @@ BEGIN {
our $topdir = realpath($Bin) . "/../..";
unshift @INC, qq{$topdir/lib};
}
-use Test::More qw(no_plan); # tests => 34;
+use Test::More tests => 51;
use Carp;
use Parrot::Configure::Options qw| process_options |;
use Parrot::Configure::Options::Conf::CLI ();
@@ -293,7 +293,7 @@ The files in this directory test functionality used by F<Configure.pl>.
The tests in this file test subroutines exported by
Parrot::Configure::Options as it is used in F<Configure.pl>, I<i.e.>, with
-C<mode => configure>..
+C<mode =E<gt> q{configure}>.
=head1 AUTHOR
@@ -0,0 +1,196 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 008-file_based_configuration.t
+
+use strict;
+use warnings;
+
+BEGIN {
+ use FindBin qw($Bin);
+ use Cwd qw(cwd realpath);
+ our $topdir = realpath($Bin) . "/../..";
+ unshift @INC, qq{$topdir/lib};
+}
+use Test::More qw(no_plan); # tests => 29;
+use Carp;
+use Parrot::Configure::Options qw| process_options |;
+
+{
+ my $configfile = q{xconf/samples/testfoobar};
+ my ($args, $steps_list_ref) = _test_good_config_file($configfile);
+
+ ok(! defined $args->{maintainer},
+ "Configuring from testfoobar: 'maintainer' not defined, as expected");
+ is($args->{'verbose-step'}, 'init::hints',
+ "Configuring from testfoobar: 'init::hints' is verbose step");
+ is($args->{'fatal-step'}, 'init::hints',
+ "Configuring from testfoobar: 'init::hints' is fatal step");
+ ok($args->{nomanicheck},
+ "Configuring from testfoobar: will omit check of MANIFEST");
+ is($args->{file}, $configfile,
+ "Configuring from testfoobar: config file correctly stored");
+ ok($args->{debugging},
+ "Configuring from testfoobar: debugging turned on");
+ my %steps_seen = map {$_ => 1} @{ $steps_list_ref };
+ ok(exists $steps_seen{'init::manifest'},
+ "Configuring from testfoobar: init::manifest is in list even though it will be skipped");
+ ok(! exists $steps_seen{'auto::perldoc'},
+ "Configuring from testfoobar: auto::perldoc not in list");
+}
+
+{
+ my $configfile = q{xconf/samples/yourfoobar};
+ my ($args, $steps_list_ref) = _test_good_config_file($configfile);
+
+ my $c_compiler = '/usr/bin/gcc';
+ my $cplusplus_compiler = '/usr/bin/g++';
+ ok(! defined $args->{maintainer},
+ "Configuring from yourfoobar: 'maintainer' not defined as expected");
+ is($args->{'verbose-step'}, 'init::hints',
+ "Configuring from yourfoobar: 'init::hints' is verbose step");
+ ok($args->{nomanicheck},
+ "Configuring from yourfoobar: will omit check of MANIFEST");
+ is($args->{file}, $configfile,
+ "Configuring from yourfoobar: config file correctly stored");
+ ok($args->{debugging},
+ "Configuring from yourfoobar: debugging turned on");
+ is($args->{cc}, $c_compiler,
+ "Configuring from yourfoobar: C compiler is $c_compiler");
+ is($args->{cxx}, $cplusplus_compiler,
+ "Configuring from yourfoobar: C++ compiler is $cplusplus_compiler");
+ is($args->{link}, $cplusplus_compiler,
+ "Configuring from yourfoobar: linker is $cplusplus_compiler");
+ is($args->{ld}, $cplusplus_compiler,
+ "Configuring from yourfoobar: shared library loader is $cplusplus_compiler");
+
+ my %steps_seen = map {$_ => 1} @{ $steps_list_ref };
+
+ ok(exists $steps_seen{'init::manifest'},
+ "Configuring from yourfoobar: init::manifest is in list even though it will be skipped");
+ ok(! exists $steps_seen{'auto::perldoc'},
+ "Configuring from yourfoobar: auto::perldoc not in list");
+}
+
+{
+ my $configfile = q{t/configure/testlib/verbosefoobar};
+ my ($args, $steps_list_ref) = _test_good_config_file($configfile);
+
+ ok(! defined $args->{maintainer},
+ "Configuring from verbosefoobar: 'maintainer' not defined as expected");
+ ok($args->{nomanicheck},
+ "Configuring from verbosefoobar: will omit check of MANIFEST");
+ is($args->{file}, $configfile,
+ "Configuring from verbosefoobar: config file correctly stored");
+ ok($args->{debugging},
+ "Configuring from verbosefoobar: debugging turned on");
+ is($args->{verbose}, 1,
+ "Configuring from verbosefoobar: verbose output is on");
+
+ my %steps_seen = map {$_ => 1} @{ $steps_list_ref };
+
+ ok(exists $steps_seen{'init::manifest'},
+ "Configuring from verbosefoobar: init::manifest is in list even though it will be skipped");
+ ok(! exists $steps_seen{'auto::perldoc'},
+ "Configuring from verbosefoobar: auto::perldoc not in list");
+}
+
+{
+ my $configfile = q{t/configure/testlib/adefectivefoobar};
+ my $error = _test_defective_config_file($configfile);
+ like($error, qr/Configuration file $configfile did not parse correctly/,
+ "Got expected failure message after using defective configuration file");
+}
+
+{
+ my $configfile = q{t/configure/testlib/bdefectivefoobar};
+ my $error = _test_defective_config_file($configfile);
+ like($error, qr/Bad variable substitution in $configfile/,
+ "Got expected failure message after using defective configuration file");
+}
+
+{
+ my $configfile = q{t/configure/testlib/cdefectivefoobar};
+ my $error = _test_defective_config_file($configfile);
+ like($error, qr/Invalid general option foobar in $configfile/,
+ "Got expected failure message after using defective configuration file");
+}
+
+{
+ my $configfile = q{t/configure/testlib/ddefectivefoobar};
+ my $error = _test_defective_config_file($configfile);
+ like($error, qr/Invalid option "foobar"/,
+ "Got expected failure message after using defective configuration file");
+}
+
+pass("Completed all tests in $0");
+
+################### SUBROUTINES ###################
+
+sub _test_good_config_file {
+ my $configfile = shift;
+ local @ARGV = ( qq{--file=$configfile} );
+ my ($args, $steps_list_ref) = process_options(
+ {
+ mode => (defined $ARGV[0] and $ARGV[0] =~ /^--file=/)
+ ? 'file'
+ : 'configure',
+ argv => [@ARGV],
+ }
+ );
+ return ($args, $steps_list_ref);
+}
+
+sub _test_defective_config_file {
+ my $configfile = shift;
+ local @ARGV = ( qq{--file=$configfile} );
+ eval {
+ my ($args, $steps_list_ref) = process_options(
+ {
+ mode => (defined $ARGV[0] and $ARGV[0] =~ /^--file=/)
+ ? 'file'
+ : 'configure',
+ argv => [@ARGV],
+ }
+ );
+ };
+ my $error = $@;
+ $@ = undef;
+ return $error;
+}
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+008-file_based_configuration.t - test components of Parrot's file-based interface to configuration
+
+=head1 SYNOPSIS
+
+ % prove t/configure/008-file_based_configuration.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test subroutines exported by
+Parrot::Configure::Options as it is used with
+C<mode =E<gt> q{file}>.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Configure::Options, Parrot::Configure::Options::Conf,
+Parrot::Configure::Options::Conf::CLI, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
@@ -0,0 +1,76 @@
+# $Id$
+
+=general
+
+=steps
+
+init::manifest nomanicheck
+init::defaults
+init::install
+init::miniparrot
+init::hints verbose-step
+init::headers
+inter::progs
+inter::make
+inter::lex
+inter::yacc
+auto::gcc
+auto::glibc
+auto::backtrace
+auto::fink
+auto::macports
+auto::msvc
+auto::attributes
+auto::warnings
+init::optimize
+inter::shlibs
+inter::libparrot
+inter::charset
+inter::encoding
+inter::types
+auto::ops
+auto::pmc
+auto::alignptrs
+auto::headers
+auto::sizes
+auto::byteorder
+auto::va_ptr
+auto::format
+auto::isreg
+auto::arch
+auto::jit
+auto::cpu
+auto::funcptr
+auto::cgoto
+auto::inline
+auto::gc
+auto::memalign
+auto::signal
+auto::socklen_t
+auto::env
+auto::aio
+auto::gmp
+auto::readline
+auto::gdbm
+auto::pcre
+auto::opengl
+auto::crypto
+auto::gettext
+auto::snprintf
+# auto::perldoc
+auto::ctags
+auto::revision
+auto::icu
+gen::config_h
+gen::core_pmcs
+gen::crypto
+gen::parrot_include
+gen::opengl
+gen::call_list
+gen::languages
+gen::makefiles
+gen::platform
+gen::config_pm
+
+=cut
+
Oops, something went wrong.

0 comments on commit e478ac7

Please sign in to comment.