Open MPI logo

MTT Devel Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: Re: [MTT devel] use of &perl()
From: Ethan Mallove (ethan.mallove_at_[hidden])
Date: 2009-07-06 10:54:27


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