[perl #38052] [PATCH] Patch to sanitize tests under t/pmc

2005-12-28 Thread via RT
# New Ticket Created by  Alberto Simoes 
# Please include the string:  [perl #38052]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/rt3/Ticket/Display.html?id=38052 >


uses warning, strict, lib and so on, so you can use prove on all those 
tests.

Cheers
Alberto
-- 
Alberto Simões - Departamento de Informática - Universidade do Minho
  Campus de Gualtar - 4710-057 Braga - Portugal
Index: t/pmc/perlint.t
===
--- t/pmc/perlint.t (revision 10703)
+++ t/pmc/perlint.t (working copy)
@@ -2,13 +2,20 @@
 # Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
+use strict;
+use warnings;
+use lib qw( . lib ../lib ../../lib );
+use Test::More;
+use Parrot::Test tests => 70;
+use Parrot::PMC '%pmc_types';
+
 =head1 NAME
 
 t/pmc/perlint.t - Perl Integers
 
 =head1 SYNOPSIS
 
-% perl -Ilib t/pmc/perlint.t
+% prove t/pmc/perlint.t
 
 =head1 DESCRIPTION
 
@@ -16,9 +23,6 @@
 
 =cut
 
-use Parrot::Test tests => 70;
-use Parrot::PMC '%pmc_types';
-
 my $perlint = $pmc_types{'PerlInt'};
 my $ok = '"ok 1\n"';
 my $fp_equality_macro = <<'ENDOFMACRO';
Index: t/pmc/mmd.t
===
--- t/pmc/mmd.t (revision 10703)
+++ t/pmc/mmd.t (working copy)
@@ -1,14 +1,20 @@
 #! perl -w
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
+use strict;
+use warnings;
+use lib qw( . lib ../lib ../../lib );
+use Test::More;
+use Parrot::Test tests => 30;
+
 =head1 NAME
 
 t/pmc/mmd.t - Multi-Method Dispatch
 
 =head1 SYNOPSIS
 
-   % perl -Ilib t/pmc/mmd.t
+   % prove t/pmc/mmd.t
 
 =head1 DESCRIPTION
 
@@ -16,8 +22,6 @@
 
 =cut
 
-use Parrot::Test tests => 30;
-
 pir_output_is(<<'CODE', <<'OUTPUT', "PASM divide");
 
 .sub _main
Index: t/pmc/signal.t
===
--- t/pmc/signal.t  (revision 10703)
+++ t/pmc/signal.t  (working copy)
@@ -1,14 +1,20 @@
 #! perl -w
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
+use strict;
+use warnings;
+use lib qw( . lib ../lib ../../lib );
+use Test::More;
+use Parrot::Test;
+
 =head1 NAME
 
 t/pmc/signal.t - Signal Handling
 
 =head1 SYNOPSIS
 
-   % perl -Ilib t/pmc/signal.t
+   % prove t/pmc/signal.t
 
 =head1 DESCRIPTION
 
@@ -16,10 +22,6 @@
 
 =cut
 
-use Parrot::Test;
-use Test::More;
-use strict;
-
 # actually more platforms should work - all POSIX compliant ones - but
 # signals are currently not enabled for all in src/events.c
 # a second problem is to get the test doing the right thing: mainly figuring
Index: t/pmc/boolean.t
===
--- t/pmc/boolean.t (revision 10703)
+++ t/pmc/boolean.t (working copy)
@@ -1,14 +1,20 @@
 #! perl -w
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
+use strict;
+use warnings;
+use lib qw( . lib ../lib ../../lib );
+use Test::More;
+use Parrot::Test tests => 9;
+
 =head1 NAME
 
 t/pmc/boolean.t - Boolean Ops
 
 =head1 SYNOPSIS
 
-   % perl -Ilib t/pmc/boolean.t
+   % prove t/pmc/boolean.t
 
 =head1 DESCRIPTION
 
@@ -17,8 +23,6 @@
 
 =cut
 
-use Parrot::Test tests => 9;
-use Test::More;
 
 output_is(<<'CODE', <<'OUTPUT', "Initialization, and integer tests");
new P0,.Boolean
Index: t/pmc/pmc.t
===
--- t/pmc/pmc.t (revision 10703)
+++ t/pmc/pmc.t (working copy)
@@ -1,15 +1,21 @@
 #! perl -w
-
 # Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
+use strict;
+use warnings;
+use lib qw( . lib ../lib ../../lib );
+use Test::More;
+use Parrot::Test tests => 24;
+use Parrot::PMC qw(%pmc_types);
+
 =head1 NAME
 
 t/pmc/pmc.t - Perl PMCs
 
 =head1 SYNOPSIS
 
-   % perl -Ilib t/pmc/pmc.t
+   % prove t/pmc/pmc.t
 
 =head1 DESCRIPTION
 
@@ -17,9 +23,6 @@
 
 =cut
 
-use Parrot::Test tests => 24;
-use Test::More;
-use Parrot::PMC qw(%pmc_types);
 my $max_pmc = scalar(keys(%pmc_types)) + 1;
 
 my $fp_equality_macro = <<'ENDOFMACRO';
Index: t/pmc/prop.t
===
--- t/pmc/prop.t(revision 10703)
+++ t/pmc/prop.t(working copy)
@@ -1,15 +1,20 @@
 #! perl -w
-
-# Copyright: 2001-2004 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
+use strict;
+use warnings;
+use lib qw( . lib ../lib ../../lib );
+use Test::More;
+use Parrot::Test tests => 7;
+
 =head1 NAME
 
 t/pmc/prop.t - Properties
 
 =head1 SYNOPSIS
 
-   % perl -Ilib t/pmc/prop.t
+   % prove t/pmc/prop.t
 
 =head1 DESCRIPTION
 
@@ 

Configuration error in parrot-0.4.0

2005-12-28 Thread Sastry
Hi
I tried building parrot on  Linux 2.4.20 and I get the following error
during gmake process. I have  the default perl-5.8.6 built on my
system. Can anybody suggest me what this error is and how to overcome
this?

regards
Ravi Sastry

./parrot -o runtime/parrot/library/Stream/ParrotIO.pbc
runtime/parrot/library/Stream/ParrotIO.imc
./parrot -o runtime/parrot/library/Stream/Replay.pbc
runtime/parrot/library/Stream/Replay.imc
./parrot -o runtime/parrot/library/Stream/Sub.pbc
runtime/parrot/library/Stream/Sub.imc
./parrot -o runtime/parrot/library/Stream/Writer.pbc
runtime/parrot/library/Stream/Writer.imc
./parrot -o runtime/parrot/library/YAML/Parser/Syck.pbc
runtime/parrot/library/YAML/Parser/Syck.imc
/usr/local/bin/perl -e 'chdir shift @ARGV; system q{gmake}, @ARGV;
exit $? >> 8;' dynclasses
gmake[1]: Entering directory `/home/sastry/parrot-0.4.0/dynclasses'
/usr/local/bin/perl /home/sastry/parrot-0.4.0/build_tools/pmc2c.pl
--dump gdbmhash.pmc
Can't write 'classes/default.dump': No such file or directory at
/home/sastry/parrot-0.4.0/build_tools/pmc2c.pl line 687.
pmc2c dump failed (512)
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/home/sastry/parrot-0.4.0/dynclasses'
gmake: *** [dynclasses.dummy] Error 2
[EMAIL PROTECTED] parrot-0.4.0]$

--


Re: External Parrot as opposed to embedded

2005-12-28 Thread Peter Schwenn
And then ... ?  Does Pugs see and invoke that Parrot available in PATH 
without some explicit command or parameter when running PUGS?


Gaal Yahas wrote:

On Fri, Dec 23, 2005 at 11:24:54PM -0500, Peter Schwenn wrote:

How does Pugs use Parrot "external" as opposed to "embedded"?


Have the parrot executable in your path. Don't have "parrot" in the
PUGS_EMBED environment variable.


Re: Journal moved.

2005-12-28 Thread Piers Cawley
"Audrey Tang (autrijus)" <[EMAIL PROTECTED]> writes:

[...]

> I am not sure how much (if any) of this should be cross-posted to P6C...
> Would the list subscribers be interested in getting them in email form,
> in addition to the current blog format?

It'd certainly make it easier for this summary writer if they appeared
in the same inbox as the rest of p6c. 

-- 
Piers Cawley <[EMAIL PROTECTED]>
http://www.bofh.org.uk/


Re: Configuration error in parrot-0.4.0

2005-12-28 Thread jerry gay
On 12/28/05, Sastry <[EMAIL PROTECTED]> wrote:
> Hi
> I tried building parrot on  Linux 2.4.20 and I get the following error
> during gmake process. I have  the default perl-5.8.6 built on my
> system. Can anybody suggest me what this error is and how to overcome
> this?
>
[snip extra build error info]

> /usr/local/bin/perl -e 'chdir shift @ARGV; system q{gmake}, @ARGV;
> exit $? >> 8;' dynclasses
> gmake[1]: Entering directory `/home/sastry/parrot-0.4.0/dynclasses'
> /usr/local/bin/perl /home/sastry/parrot-0.4.0/build_tools/pmc2c.pl
> --dump gdbmhash.pmc
> Can't write 'classes/default.dump': No such file or directory at
> /home/sastry/parrot-0.4.0/build_tools/pmc2c.pl line 687.
> pmc2c dump failed (512)
> gmake[1]: *** [all] Error 2
> gmake[1]: Leaving directory `/home/sastry/parrot-0.4.0/dynclasses'
> gmake: *** [dynclasses.dummy] Error 2
> [EMAIL PROTECTED] parrot-0.4.0]$
>
i assume you have the 0.4.0 release tarball. i don't know why it's not
working with that configuration, sorry--perhaps there's somebody with
linux and gmake that can chime in. in the meantime, perhaps an updated
tarball, or a fresh checkout from svn will prove successful. see
http://www.parrotcode.org/source.html for instructions on downloading
either.

hope that helps.
~jerry


[perl #38057] [PATCH] fixes a little typo from chromatic some time ago

2005-12-28 Thread via RT
# New Ticket Created by  Alberto Simoes 
# Please include the string:  [perl #38057]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/rt3/Ticket/Display.html?id=38057 >



-- 
Alberto Simões - Departamento de Informática - Universidade do Minho
  Campus de Gualtar - 4710-057 Braga - Portugal
Index: t/harness
===
--- t/harness   (revision 10724)
+++ t/harness   (working copy)
@@ -184,8 +184,8 @@
 printf STDERR "%s OK from %s tests (%.2f%% ok)\n\n",
 $stats{ok},
 $stats{tests},
-$stats{ok} / $stats{tests} * 100,
-$self->{meat}{end_time} = time;
+$stats{ok} / $stats{tests} * 100;
+   $self->{meat}{end_time} = time;
   };
 
   my $start = time();


How to mangle system time for testing

2005-12-28 Thread Javier Amor Garcia
Hello,
  i am testing a  module for a web application and i need to test the
expiration of sessions. The problem is that i can not modify the
expiration time and i not want to make sleep the test for the full
length of expiration time (a hour). 
So, the natural solution appears to be mangling the system's time.
I had do it with system calls but i am searching a more cleaner way. I
tried the Time::Warp module but i had not found a way to modify the time
function inside the module to be tested as opposed to the test script
itself.

Can anyone give me pointers or advice about how to perform this type of
tests?

Cheers,
  Javier



Re: How to mangle system time for testing

2005-12-28 Thread Adrian Howard


On 28 Dec 2005, at 16:36, Javier Amor Garcia wrote:


Hello,
  i am testing a  module for a web application and i need to test the
expiration of sessions. The problem is that i can not modify the
expiration time and i not want to make sleep the test for the full
length of expiration time (a hour).

[snip]
Can anyone give me pointers or advice about how to perform this  
type of

tests?


What I would do would be to isolate all the bits of code that poke at  
real time functions. For example I could imagine the only place where  
I actually call time being:


sub is_expired {
my $self = shift;
return ( $self->time_created + $self->session_length ) <= time;
}

then I can test everything except is_expired() by simple symbol table  
munging:


{
local *MySessionClass::is_expired = sub { return 1 };
... test stuff that assumes session expired ...
}

{
local *MySessionClass::is_expired = sub { return };
... test stuff that assumes session valid ...
}

and I can test is_expired() by overwriting time explicitly - with the  
rather useful Test::MockTime.


use Test::More tests => 4;
use Test::MockTime;

BEGIN { use_ok 'MySessionClass' };

my $s = MySessionClass->new( session_length => 10, time_created =>  
1234 );


Test::MockTime::set_fixed_time( 1234 );
ok( ! $s->is_expired, 'not expired at creation time' );

Test::MockTime::set_fixed_time( 1243 );
ok( ! $s->is_expired, 'not expired on session_length seconds' );

Test::MockTime::set_fixed_time( 1244 );
ok( $s->is_expired, 'is expired after session_length seconds' );

Hope this helps.

Adrian


s/\.imc/\.pir/g (was: parrot directory reorganization)

2005-12-28 Thread jerry gay
On 11/28/05, Chip Salzenberg <[EMAIL PROTECTED]> wrote:
> Oh, one other thing for the renaming game:
>
> IMC vs. PIR
> Two names enter
> One name leaves
>
> /me giggles

this is now referenced in DEPRECATED (thanks to will,) and the
remaining .imc files in the parrot tree are quickly being converted to
.pir files. this should be done by the time parrot is released (this
weekend?)

note that this includes runtime libraries like Data/Dumper.imc,
JSON.imc, etc. you may need to modify your code to point to the
renamed libraries.

for those with a large base of .imc files, don't dispair. parrot will
continue to recognize the .imc extension for the time being. as a
courtesy to existing users who need to convert existing files to the
new extension, the .imc file extension will continue to be supported 
in the coming release. but soon enough, if there are no objections,
it'll be ripped out, so be prepared.

two simple rules to use the proper file extension:
~ writing PIR? name your file foo.pir, or convert an existing one from foo.imc
~ writing PASM? name your file foo.pasm

~jerry


[perl #38060] [BUG] atan2() broken on Solaris with gcc

2005-12-28 Thread via RT
# New Ticket Created by  Joshua Hoblitt 
# Please include the string:  [perl #38060]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/rt3/Ticket/Display.html?id=38060 >


A quick demonstration of the issue:

--
#include 
#include 

int main ()
{
printf("%f\n", atan2(0.0, 0.0));
printf("%f\n", atan2(-0.0, -0.0));
}
--

--
$ gcc foo.c -lm
$ ./a.out
0.00
0.00
--

This is also documented in config/init/hints/solaris.pm:


# Parrot usually aims for IEEE-754 compliance.
# For Solaris 8/Sun Workshop Pro 4, both
#atan2( 0.0, -0.0) and atan2(-0.0, -0.0)
# return 0, when they should return +PI and -PI respectively.
# For Sun's compilers, fix this with the -xlibmieee flag.
# I don't know of an equivalent flag for gcc.
# (Alternatively, and more generally, perhahs we should run an
# ieee-conformance test and then call back into a hints-file trigger
# to set platform-specific flags.
#   A. Dougherty  7 March 2005
# We don't know which compiler we're using till after the gccversion
# test.


The question is, can we get atan2() to 'behave' with gcc or do we need
to provide our own implementation?

-J

--


pgpgBxGh0ZiTj.pgp
Description: PGP signature


[perl #38061] [TODO] Fix failing benchmark scripts

2005-12-28 Thread via RT
# New Ticket Created by  Bernhard Schmalhofer 
# Please include the string:  [perl #38061]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/rt3/Ticket/Display.html?id=38061 >


'make benchmark_tests' test whether the benchmark programs are
working. Currrently 7 out of 37 benchmarks are failing. See 
t/benchmark/benchmarks.t for a list.

The failing programs should be fixed.


[perl #38058] [PATCH] make last work on tcl

2005-12-28 Thread via RT
# New Ticket Created by  Alberto Simoes 
# Please include the string:  [perl #38058]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/rt3/Ticket/Display.html?id=38058 >


Please validate the tests, as the meaning of the 'last' third argument 
wasn't the correct in the test cases.

 From tcl,
Search string2 for a sequence of characters that exactly match the 
characters in string1. If found, return the index of the first character 
in the last such match within string2. If there is no match, then return 
-1. If lastIndex is specified (in any of the forms accepted by the index 
method), then only the characters in string2 at or before the specified 
lastIndex will be considered by the search.


Which means that if lastindex > length(string2), then length(string2) is 
considered and no error is raised.

Cheers
Alberto
-- 
Alberto Simões - Departamento de Informática - Universidade do Minho
  Campus de Gualtar - 4710-057 Braga - Portugal
Index: languages/tcl/t/cmd_string.t
===
--- languages/tcl/t/cmd_string.t(revision 10725)
+++ languages/tcl/t/cmd_string.t(working copy)
@@ -72,9 +72,6 @@
 wrong # args: should be "string first subString string ?startIndex?"
 OUT
 
-TODO: {
-  local $TODO = "implement string last";
-
 language_output_is("tcl",< 3 goto bad_args
+  if argc < 2 goto bad_args
+  $S1 = argv[0]
+  $S2 = argv[1]
+  
+  $I0 = length $S2
+  if argc == 2 goto last_do
+  
+  $S3 = argv[2]
+  .local pmc string_index
+  string_index = find_global "_Tcl", "__string_index"
+  $I1 = string_index($S3,$S2)
+
+  if $I1 > $I0 goto last_do
+  $I0 = $I1
+
+last_do:
+  .local int index_1
+  index_1 = index $S2, $S1, 0
+  if index_1 > $I0 goto not_found
+  if index_1 < 0   goto not_found
+
+iterate:   
+  $I1 = index_1
+  $I2 = $I1 + 1
+  index_1 = index $S2, $S1, $I2
+  if index_1 < 0   goto return
+  if index_1 > $I0 goto return
+  goto iterate
+
+return:
+  .return($I1)
+
+not_found:
+  .return(-1)
+  
+bad_args:
+  .throw ("wrong # args: should be \"string last subString string 
?lastIndex?\"")
+
+.end
+
 .sub "index"
   .param pmc argv
 


relationship between slurpy parameters and named args?

2005-12-28 Thread Austin Frank

Hello all!

In reading S06 from the svn repository I had some questions about the 
use of prefix:<*> in different contexts.  When used in an argument list, 
it forces pairs to be interpreted as named args.  When used in a 
parameter list, it causes slurpiness.


It seems to me like these are related contexts-- arguments to a sub are 
supposed to fulfill its parameter list.  This makes the overloading of 
prefix:<*> confusing to me.


I'm pretty sure we don't need slurpiness in argument lists, and I don't 
know if the prefix:<*> notation for named arguments would be useful in 
parameter lists.  But just because I can reason that, for example, 
prefix:<*> in an argument list can't mean slurpiness, that doesn't make 
it clear to me what prefix:<*> _does_ mean in that context.


I think I understand that prefix:<*> is available outside of parameter 
lists because that's the only place we need it to mean slurpiness.  This 
particular overloading, however, seems like one that I'm likely to 
forget or mess up because I don't see the connection between the two 
different meanings.


So, is there a conceptual connection between imposing named argument 
interpretation on pairs in an arg list and slurping up the end of a 
parameter list?  Are there other meanings of prefix:<*> that relate to 
one or the other of these two meanings?


Any explanations are appreciated!

Thanks,
/au


Re: Cygwin versun plain XP (for working with Pugs+Parrot together)

2005-12-28 Thread Joshua Hoblitt
Greg,

Can you send the post the output of `prove -v t/op/trans.t`?  I suspect
that atan2() may be misbehaving on cygwin in the same way that it does
on Solaris.

-J

--
On Wed, Dec 28, 2005 at 05:25:29PM -0600, Greg Bacon wrote:
> In message <[EMAIL PROTECTED]>,
> Joshua Hoblitt writes:
> 
> : It looks like it was just a missing curly brace.  Fix commited as
> : r10699.  Thanks for reporting.
> 
> Thanks.
> 
> In my defense, yes, I did try the obvious fix. Looking at the diff,
> I must've added the curly after C<1;>.  The quiet from my wife and
> kids visiting my mother-in-law must be too distracting! :-)
> 
> After svn up and Nick's nullification of the dynclasses Makefile, I
> see
> 
> Failed TestStat Wstat Total Fail  Failed  List of Failed
> ---
> t/dynclass/dynlexpad.t6  1536 66 100.00%  1-6
> t/dynclass/foo.t  8  2048 98  88.89%  1-5 7-9
> t/dynclass/gdbmhash.t13  332813   13 100.00%  1-13
> t/op/trans.t  1   256191   5.26%  13
> 7 tests and 702 subtests skipped.
> Failed 4/189 test scripts, 97.88% okay. 28/4581 subtests failed, 99.39% okay.
> make: *** [test] Error 14
> 
> Greg


pgpSZRTVNkVu2.pgp
Description: PGP signature


Re: relationship between slurpy parameters and named args?

2005-12-28 Thread Stuart Cook
On 29/12/05, Austin Frank <[EMAIL PROTECTED]> wrote:
> So, is there a conceptual connection between imposing named argument
> interpretation on pairs in an arg list and slurping up the end of a
> parameter list?  Are there other meanings of prefix:<*> that relate to
> one or the other of these two meanings?

The missing link is that prefix:<*> in an argument list also causes
things like arrays to be treated as a sequence of separate parameters,
rather than as a single array parameter.  See "Flattening argument
lists" in S06.

(This was the original meaning of prefix:<*> in arglists; the
named-pair behaviour was added later, when pair values ceased to have
named behaviour automatically.)


Stuart


[perl #38063] [TODO] Tcl: Correctly convert to a number or string in [expr]

2005-12-28 Thread via RT
# New Ticket Created by  Matt Diephouse 
# Please include the string:  [perl #38063]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/rt3/Ticket/Display.html?id=38063 >


In [expr], partcl tries to convert both operands of every binary 
operator to numbers. This works for most ops, but some ops need to work 
with both strings and numbers

 == is one such op. The following displays the behavior:

mdiep~$ tclsh
% set a foo
foo
% set b foo
foo
% expr {$a == $b}
1
mdiep~$ partcl
% set a foo
foo
% set b foo
foo
% expr {$a == $b}
Not a number!

--
matt diephouse
http://matt.diephouse.com


[perl #38064] [TODO] Tcl: Unsetting variables breaks aliasing

2005-12-28 Thread via RT
# New Ticket Created by  Matt Diephouse 
# Please include the string:  [perl #38064]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/rt3/Ticket/Display.html?id=38064 >


When partcl unsets a variable, it breaks aliasing. Setting that variable 
should set the original variable as well. You can see this when using 
[global]:

mdiep~$ cat test.tcl
proc changeA {} {
  global a
  unset a # remove this and partcl outputs baz correctly
  set a baz
}
set a foo
changeA
puts $a
mdiep~$ tclsh test.tcl
baz
mdiep~$ partcl test.tcl
foo
mdiep~$

Partcl currently nulls registers when unsetting variables, which has no 
effect on the actual PMC. For a discussion of this issue, see the 
"Variables, Aliasing, and Undefined-ness" thread on p6i.

--
matt diephouse
http://matt.diephouse.com