Open MPI logo

MTT Devel Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all MTT Devel mailing list

Subject: Re: [MTT devel] use of &perl()
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2009-07-06 10:56:24


Ah, ok. Yes, that is cleaner -- so &perl() is of somewhat limited
value.

I already have a Cisco.pm file, so adding a new funclet is no biggie.
Thanks for the idea.

On Jul 6, 2009, at 10:54 AM, Ethan Mallove wrote:

> On Mon, Jul/06/2009 10:25:51AM, Jeff Squyres wrote:
> > I was just trying to use &perl() in an ini file and ran across an
> annoying
> > restriction: I had to make the whole thing be one long line:
> >
> > max_test_num = <<EOF
> > &perl('open(IN, "./mpi_test_suite -l|") || die("cant open"); while
> (<IN>) {
> > if (m/Num Tests : (\d+)/) { close(IN); return $1; } } close(IN);
> return
> > "0"; ')
> > EOF
> >
> > Without that, the MTT parser would complain that it couldn't find
> the
> > closing ' quote (i.e., "&perl(' ... ')"). I tracked it down and
> it's
> > because if I did this:
> >
> > max_test_num = <<EOF
> > &perl('
> > open(IN, "./mpi_test_suite -l|") || die("cant open");
> > while (<IN>) {
> > if (m/Num Tests : (\d+)/) { close(IN); return $1; }
> > }
> > close(IN);
> > return "0";
> > ')
> > EOF
> >
> > then the parser stops looking for the closing quote on the
> "&perl('" line
> > -- it doesn't go beyond the \n. Yuck.
>
> Ewww. I think the parser should be able to handle those newlines.
>
> >
> > Any suggestions?
>
> When I need a multi-line &perl(), I throw the perl code into a sub in
> my funclet file. E.g., do this in a Cisco.pm file:
>
> sub max_test_num {
> open(IN, "./mpi_test_suite -l|") || die("cant open");
> while (<IN>) {
> if (m/Num Tests : (\d+)/) {
> close(IN);
> return $1;
> }
> }
> close(IN);
> return "0";
> }
>
> Put your funclet file next to your INI file, since your INI file will
> now require your funclet file:
>
> foo/bar.ini
> funclets/Cisco.pm
>
> And then have this in your INI file:
>
> [MTT]
> ...
> funclet_files = &dirname("@INI_NAME@")/../funclets/Cisco.pm
> ...
> max_test_num = &Cisco::max_test_num()
>
> -Ethan
>
>
> >
> > --
> > Jeff Squyres
> > Cisco Systems
> >
> > _______________________________________________
> > mtt-devel mailing list
> > mtt-devel_at_[hidden]
> > http://www.open-mpi.org/mailman/listinfo.cgi/mtt-devel
> _______________________________________________
> mtt-devel mailing list
> mtt-devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/mtt-devel
>

-- 
Jeff Squyres
Cisco Systems