[svn:parrot] r49631 - in trunk: . compilers/data_json compilers/imcc compilers/pct compilers/pge compilers/tge config/auto config/auto/ipv6 config/auto/sizes config/auto/zlib docs/book/draft docs/book/pct docs/dev docs/pdds examples/embed examples/languages/abc examples/languages/squaak examples/pge examples/tools ext/nqp-rx include/parrot lib/Parrot lib/Parrot/Configure/Step ports/cygwin ports/debian runtime/parrot/languages runtime/parrot/library runtime/parrot/library/Math src/call src/gc src/interp src/runcore t/codingstd t/compilers/tge t/examples t/oo t/pmc t/src t/steps/auto t/steps/init/hints tools/build tools/dev tools/release

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Fri Oct 22 01:23:46 UTC 2010


Author: jkeenan
Date: Fri Oct 22 01:23:46 2010
New Revision: 49631
URL: https://trac.parrot.org/parrot/changeset/49631

Log:
Merge tt1824_ipv6_configure branch into trunk.  Add configure step auto::ipv6, associated probe and test.

Added:
   trunk/config/auto/ipv6/
      - copied from r49629, branches/tt1824_ipv6_configure/config/auto/ipv6/
   trunk/config/auto/ipv6.pm   (props changed)
      - copied unchanged from r49629, branches/tt1824_ipv6_configure/config/auto/ipv6.pm
   trunk/t/steps/auto/ipv6-01.t   (props changed)
      - copied unchanged from r49629, branches/tt1824_ipv6_configure/t/steps/auto/ipv6-01.t
Replaced:
   trunk/config/auto/ipv6/test.in   (props changed)
      - copied unchanged from r49629, branches/tt1824_ipv6_configure/config/auto/ipv6/test.in
Modified:
   trunk/   (props changed)
   trunk/MANIFEST
   trunk/compilers/data_json/Rules.mak   (props changed)
   trunk/compilers/imcc/Rules.in   (props changed)
   trunk/compilers/pct/Rules.mak   (props changed)
   trunk/compilers/pge/Rules.mak   (props changed)
   trunk/compilers/tge/Rules.mak   (props changed)
   trunk/config/auto/sizes/intval_maxmin_c.in   (props changed)
   trunk/config/auto/zlib/   (props changed)
   trunk/docs/book/draft/README   (props changed)
   trunk/docs/book/draft/appa_glossary.pod   (props changed)
   trunk/docs/book/draft/appb_patch_submission.pod   (props changed)
   trunk/docs/book/draft/appc_command_line_options.pod   (props changed)
   trunk/docs/book/draft/appd_build_options.pod   (props changed)
   trunk/docs/book/draft/appe_source_code.pod   (props changed)
   trunk/docs/book/draft/ch01_introduction.pod   (props changed)
   trunk/docs/book/draft/ch02_getting_started.pod   (props changed)
   trunk/docs/book/draft/ch07_dynpmcs.pod   (props changed)
   trunk/docs/book/draft/ch08_dynops.pod   (props changed)
   trunk/docs/book/draft/ch10_opcode_reference.pod   (props changed)
   trunk/docs/book/draft/ch11_directive_reference.pod   (props changed)
   trunk/docs/book/draft/ch12_operator_reference.pod   (props changed)
   trunk/docs/book/draft/chXX_hlls.pod   (props changed)
   trunk/docs/book/draft/chXX_library.pod   (props changed)
   trunk/docs/book/draft/chXX_testing_and_debugging.pod   (props changed)
   trunk/docs/book/pct/ch01_introduction.pod   (props changed)
   trunk/docs/book/pct/ch02_getting_started.pod   (props changed)
   trunk/docs/book/pct/ch03_compiler_tools.pod   (props changed)
   trunk/docs/book/pct/ch04_pge.pod   (props changed)
   trunk/docs/book/pct/ch05_nqp.pod   (props changed)
   trunk/docs/dev/c_functions.pod   (props changed)
   trunk/docs/pdds/pdd30_install.pod   (props changed)
   trunk/examples/embed/cotorra.c   (props changed)
   trunk/examples/languages/abc/   (props changed)
   trunk/examples/languages/squaak/   (props changed)
   trunk/examples/pge/demo.pir   (props changed)
   trunk/examples/tools/pgegrep   (props changed)
   trunk/ext/nqp-rx/Rules.mak   (props changed)
   trunk/include/parrot/call.h   (props changed)
   trunk/include/parrot/gc_api.h   (props changed)
   trunk/include/parrot/runcore_api.h   (props changed)
   trunk/include/parrot/runcore_profiling.h   (props changed)
   trunk/include/parrot/runcore_trace.h   (props changed)
   trunk/lib/Parrot/Configure/Step/List.pm
   trunk/lib/Parrot/Configure/Step/Test.pm   (props changed)
   trunk/lib/Parrot/H2inc.pm   (props changed)
   trunk/ports/cygwin/parrot-1.0.0-1.cygport   (props changed)
   trunk/ports/debian/libparrot-dev.install.in   (props changed)
   trunk/ports/debian/libparrot.install.in   (props changed)
   trunk/ports/debian/parrot-doc.install.in   (props changed)
   trunk/ports/debian/parrot.install.in   (props changed)
   trunk/runtime/parrot/languages/   (props changed)
   trunk/runtime/parrot/library/Math/Rand.pir   (props changed)
   trunk/runtime/parrot/library/Rules.mak   (props changed)
   trunk/src/call/ops.c   (props changed)
   trunk/src/call/pcc.c   (props changed)
   trunk/src/gc/alloc_memory.c   (props changed)
   trunk/src/gc/alloc_resources.c   (props changed)
   trunk/src/gc/api.c   (props changed)
   trunk/src/gc/malloc.c   (props changed)
   trunk/src/gc/malloc_trace.c   (props changed)
   trunk/src/gc/mark_sweep.c   (props changed)
   trunk/src/gc/string_gc.c   (props changed)
   trunk/src/gc/system.c   (props changed)
   trunk/src/interp/inter_cb.c   (props changed)
   trunk/src/interp/inter_create.c   (props changed)
   trunk/src/interp/inter_misc.c   (props changed)
   trunk/src/runcore/cores.c   (props changed)
   trunk/src/runcore/main.c   (props changed)
   trunk/src/runcore/profiling.c   (props changed)
   trunk/src/runcore/trace.c   (props changed)
   trunk/t/codingstd/pmc_docs.t   (props changed)
   trunk/t/compilers/tge/NoneGrammar.tg   (props changed)
   trunk/t/examples/pgegrep.t   (props changed)
   trunk/t/oo/objects.t   (props changed)
   trunk/t/oo/root_new.t   (props changed)
   trunk/t/pmc/namespace-old.t   (props changed)
   trunk/t/src/embed.t   (props changed)
   trunk/t/steps/init/hints/linux-01.t   (props changed)
   trunk/tools/build/README   (props changed)
   trunk/tools/build/h2inc.pl   (props changed)
   trunk/tools/dev/README   (props changed)
   trunk/tools/dev/addopstags.pl   (props changed)
   trunk/tools/dev/dump_pbc.pl   (props changed)
   trunk/tools/dev/fetch_languages.pl   (props changed)
   trunk/tools/dev/headerizer.pl   (props changed)
   trunk/tools/dev/mk_gitignore.pl   (props changed)
   trunk/tools/dev/ncidef2pasm.pl   (props changed)
   trunk/tools/dev/parrot-config.pir   (props changed)
   trunk/tools/dev/perlcritic-cage.conf   (props changed)
   trunk/tools/dev/perlcritic.conf   (props changed)
   trunk/tools/dev/perltidy.conf   (props changed)
   trunk/tools/dev/update_copyright.pl   (props changed)
   trunk/tools/release/crow.pir   (props changed)
   trunk/tools/release/gen_release_info.pl   (props changed)
   trunk/tools/release/inc_ver.pir   (props changed)
   trunk/tools/release/release.json   (props changed)
   trunk/tools/release/templates.json   (props changed)

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Fri Oct 22 01:18:16 2010	(r49630)
+++ trunk/MANIFEST	Fri Oct 22 01:23:46 2010	(r49631)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Thu Oct 21 03:36:17 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Fri Oct 22 01:18:08 2010 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -211,6 +211,8 @@
 config/auto/inline.pm                                       []
 config/auto/inline/test1_c.in                               []
 config/auto/inline/test2_c.in                               []
+config/auto/ipv6.pm                                         []
+config/auto/ipv6/test.in                                    []
 config/auto/isreg.pm                                        []
 config/auto/isreg/test_c.in                                 []
 config/auto/jit.pm                                          []
@@ -1993,6 +1995,7 @@
 t/steps/auto/headers-01.t                                   [test]
 t/steps/auto/icu-01.t                                       [test]
 t/steps/auto/inline-01.t                                    [test]
+t/steps/auto/ipv6-01.t                                      [test]
 t/steps/auto/isreg-01.t                                     [test]
 t/steps/auto/jit-01.t                                       [test]
 t/steps/auto/llvm-01.t                                      [test]

Copied: trunk/config/auto/ipv6.pm (from r49629, branches/tt1824_ipv6_configure/config/auto/ipv6.pm)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/config/auto/ipv6.pm	Fri Oct 22 01:23:46 2010	(r49631, copy of r49629, branches/tt1824_ipv6_configure/config/auto/ipv6.pm)
@@ -0,0 +1,67 @@
+# Copyright (C) 2001-2007, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+config/auto/ipv6.pm - determine ipv6 capabilities of local machine
+
+=head1 DESCRIPTION
+
+This configuration step probes the local machine to determine if it capable of
+running an ipv6 stack.
+
+=cut
+
+package auto::ipv6;
+
+use strict;
+use warnings;
+
+use base qw(Parrot::Configure::Step);
+
+use Parrot::Configure::Utils ':auto';
+
+
+sub _init {
+    my $self = shift;
+    my %data;
+    $data{description} = q{Determine IPV6 capabilities};
+    $data{result}      = q{};
+    return \%data;
+}
+
+sub runstep {
+    my ( $self, $conf ) = @_;
+
+    my $ipv6_status = 0;
+
+    $conf->cc_gen('config/auto/ipv6/test.in');
+    eval { $conf->cc_build(); };
+    if (!$@) {
+        my $output = eval { $conf->cc_run() };
+        if (!$@ && $output =~ /OK/) {
+            $ipv6_status = 1;
+        }
+    }
+    $conf->cc_clean();
+    $self->_handle_ipv6_status($conf, $ipv6_status);
+
+    return 1;
+}
+
+sub _handle_ipv6_status {
+    my ($self, $conf, $ipv6_status) = @_;
+    $conf->data->set( HAS_IPV6 => $ipv6_status );
+    $ipv6_status
+        ? $self->set_result('yes')
+        : $self->set_result('no');
+}
+
+1;
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Copied: trunk/config/auto/ipv6/test.in (from r49629, branches/tt1824_ipv6_configure/config/auto/ipv6/test.in)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/config/auto/ipv6/test.in	Fri Oct 22 01:23:46 2010	(r49631, copy of r49629, branches/tt1824_ipv6_configure/config/auto/ipv6/test.in)
@@ -0,0 +1,71 @@
+/*
+Copyright (C) 2005-2009, Parrot Foundation.
+$Id$
+
+*/
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int c,char**v) {
+    int x = socket( PF_INET6, SOCK_DGRAM, 0 );
+    if ( x < 0 ) {
+        perror("Not OK - socket failed");
+        return EXIT_FAILURE;
+    }
+
+    /*
+    By now we have (a) PF_INET6 defined, and (b) in-principle kernel
+    support for v6; however we don't yet know if we have any v6
+    interfaces.
+    */
+
+    struct in6_addr A = IN6ADDR_LOOPBACK_INIT;  /* IN6ADDR_ANY_INIT; */
+    struct sockaddr_in6 S = { AF_INET6 };  /* family is always first field in sockaddr_* */
+    S.sin6_addr = A;
+    S.sin6_port = 32760;  /* a pseudorandom 15-bit number */
+
+    /*
+    By now we have struct in6_addr, struct sockaddr_in6 and AF_INET6 and
+    IN6ADDR_LOOPBACK_INIT. But we still don't know about interfaces.
+    */
+
+    #ifdef linux  /* might not be supported elsewhere */
+    S.sin6_flowinfo = 0;
+    S.sin6_scope_id = 0;
+    #endif
+
+    /*
+    Set the SO_REUSEADDR option so as not to interfere with anyone else
+    using the port, including running this test again within the
+    re-use timeout period.
+    */
+    int reuse_address = 1;
+    if ( setsockopt(x, SOL_SOCKET, SO_REUSEADDR, &reuse_address, sizeof(reuse_address)) < 0 ) {
+        perror("Not OK - setsockopt failed");
+        return EXIT_FAILURE;
+    }
+
+    if ( bind( x, (void*) &S, sizeof(S) ) < 0 && errno != EADDRINUSE ) {
+        perror("Not OK - bind failed");
+        return EXIT_FAILURE;
+    }
+
+    /*
+    By now we know we can bind to "::1", which means we truly do have
+    IPv6 support. Of course, we might not have any useful routes off
+    this host, but that wasn't the question.
+    */
+    puts("OK");
+    close(x);
+    return EXIT_SUCCESS;
+}
+
+/*
+ * Local variables:
+ *   c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */

Modified: trunk/lib/Parrot/Configure/Step/List.pm
==============================================================================
--- trunk/lib/Parrot/Configure/Step/List.pm	Fri Oct 22 01:18:16 2010	(r49630)
+++ trunk/lib/Parrot/Configure/Step/List.pm	Fri Oct 22 01:23:46 2010	(r49631)
@@ -62,6 +62,7 @@
     auto::ctags
     auto::revision
     auto::icu
+    auto::ipv6
     gen::config_h
     gen::core_pmcs
     gen::opengl

Copied: trunk/t/steps/auto/ipv6-01.t (from r49629, branches/tt1824_ipv6_configure/t/steps/auto/ipv6-01.t)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/t/steps/auto/ipv6-01.t	Fri Oct 22 01:23:46 2010	(r49631, copy of r49629, branches/tt1824_ipv6_configure/t/steps/auto/ipv6-01.t)
@@ -0,0 +1,92 @@
+#! perl
+# Copyright (C) 2007, Parrot Foundation.
+# $Id$
+# auto/ipv6-01.t
+
+use strict;
+use warnings;
+use Test::More qw(no_plan); # tests =>  5;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::auto::ipv6');
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Step::Test;
+use Parrot::Configure::Test qw(
+    test_step_constructor_and_description
+);
+
+my ($args, $step_list_ref) = process_options(
+    {
+        argv => [ ],
+        mode => q{configure},
+    }
+);
+
+my $conf = Parrot::Configure::Step::Test->new;
+$conf->include_config_results( $args );
+
+my $pkg = q{auto::ipv6};
+$conf->add_steps($pkg);
+$conf->options->set( %{$args} );
+my $step = test_step_constructor_and_description($conf);
+my $ret = $step->runstep($conf);
+ok( $ret, "runstep() returned true value" );
+
+##### _handle_ipv6_status  #####
+
+my ($ipv6_status, $exp);
+
+$conf->data->set( HAS_IPV6 => undef );
+$ipv6_status = 1;
+$exp = 'yes';
+$step->_handle_ipv6_status($conf, $ipv6_status);
+ok( defined $conf->data->get( 'HAS_IPV6' ),
+    "HAS_IPV6 is defined" );
+ok( $conf->data->get( 'HAS_IPV6' ),
+    "HAS_IPV6 is true value" );
+is( $step->result(), $exp, "Got expected result '$exp'" );
+
+$conf->data->set( HAS_IPV6 => undef );
+$ipv6_status = 0;
+$exp = 'no';
+$step->_handle_ipv6_status($conf, $ipv6_status);
+ok( defined $conf->data->get( 'HAS_IPV6' ),
+    "HAS_IPV6 is defined" );
+ok( ! $conf->data->get( 'HAS_IPV6' ),
+    "HAS_IPV6 is false value" );
+is( $step->result(), $exp, "Got expected result '$exp'" );
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+auto/ipv6-01.t - test auto::ipv6
+
+=head1 SYNOPSIS
+
+    % prove t/steps/auto/ipv6-01.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test auto::ipv6.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::ipv6, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:


More information about the parrot-commits mailing list