[svn:parrot] r49552 - in branches/tt1824_ipv6_configure: . config/auto config/auto/ipv6 t/steps/auto
jkeenan at svn.parrot.org
jkeenan at svn.parrot.org
Fri Oct 15 17:42:53 UTC 2010
Author: jkeenan
Date: Fri Oct 15 17:42:52 2010
New Revision: 49552
URL: https://trac.parrot.org/parrot/changeset/49552
Log:
Implement kurahaupo++'s patch as configuration step auto::ipv6. Add test file. Update MANIFEST.
Modified:
branches/tt1824_ipv6_configure/MANIFEST
branches/tt1824_ipv6_configure/config/auto/ipv6.pm
branches/tt1824_ipv6_configure/config/auto/ipv6/test.in
branches/tt1824_ipv6_configure/t/steps/auto/ipv6-01.t
Modified: branches/tt1824_ipv6_configure/MANIFEST
==============================================================================
--- branches/tt1824_ipv6_configure/MANIFEST Fri Oct 15 16:52:36 2010 (r49551)
+++ branches/tt1824_ipv6_configure/MANIFEST Fri Oct 15 17:42:52 2010 (r49552)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Mon Oct 4 20:12:34 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Fri Oct 15 17:29:14 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 []
@@ -1988,6 +1990,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]
Modified: branches/tt1824_ipv6_configure/config/auto/ipv6.pm
==============================================================================
--- branches/tt1824_ipv6_configure/config/auto/ipv6.pm Fri Oct 15 16:52:36 2010 (r49551)
+++ branches/tt1824_ipv6_configure/config/auto/ipv6.pm Fri Oct 15 17:42:52 2010 (r49552)
@@ -33,14 +33,30 @@
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->set_result();
- $conf->data->set( ipv6 => undef );
+ $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:
Modified: branches/tt1824_ipv6_configure/config/auto/ipv6/test.in
==============================================================================
--- branches/tt1824_ipv6_configure/config/auto/ipv6/test.in Fri Oct 15 16:52:36 2010 (r49551)
+++ branches/tt1824_ipv6_configure/config/auto/ipv6/test.in Fri Oct 15 17:42:52 2010 (r49552)
@@ -7,13 +7,13 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
-#include <errno.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 2;
+ return EXIT_FAILURE;
}
/*
@@ -26,7 +26,7 @@
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.
@@ -43,14 +43,14 @@
re-use timeout period.
*/
int reuse_address = 1;
- if ( setsockopt(x, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) < 0 ) {
+ if ( setsockopt(x, SOL_SOCKET, SO_REUSEADDR, &reuse_address, sizeof(reuse_address)) < 0 ) {
perror("Not OK - setsockopt failed");
- return 1;
+ return EXIT_FAILURE;
}
if ( bind( x, (void*) &S, sizeof(S) ) < 0 && errno != EADDRINUSE ) {
perror("Not OK - bind failed");
- return 1;
+ return EXIT_FAILURE;
}
/*
@@ -60,7 +60,7 @@
*/
puts("OK");
close(x);
- return 0;
+ return EXIT_SUCCESS;
}
/*
Modified: branches/tt1824_ipv6_configure/t/steps/auto/ipv6-01.t
==============================================================================
--- branches/tt1824_ipv6_configure/t/steps/auto/ipv6-01.t Fri Oct 15 16:52:36 2010 (r49551)
+++ branches/tt1824_ipv6_configure/t/steps/auto/ipv6-01.t Fri Oct 15 17:42:52 2010 (r49552)
@@ -29,6 +29,32 @@
$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");
More information about the parrot-commits
mailing list