Open MPI logo

MTT Devel Mailing List Archives

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

Subject: Re: [MTT devel] [MTT svn] svn:mtt-svn r1306
From: Ethan Mallove (ethan.mallove_at_[hidden])
Date: 2009-08-11 10:33:24


On Tue, Aug/11/2009 02:53:50PM, Mike Dubman wrote:
> Hey Jeff,
>
> This code acts as a pre-processor during loading of ini file into mtt.
> It replaces builtin vars %VAR% with their values, for example:
>
> ...
> [Test run: trivial]
> my_sect_name=%INI_SECTION_NAME%
> ...
>
> %INI_SECTION_NAME% get replaced with real value. (trivial)
>
> it is useful in the following situation:
>
> ...
> [test run: trivial]
> #param=&test_run_name()
> param=%INI_SECTION_NAME%
> ...
>
> when "param" was accessed from Reporter context, test_run_name() will
> return undef, but real value if %INI_SECTION_NAME% is used!

Doesn't &current_simple_section() do the same thing as
%INI_SECTION_NAME%? There are a couple predefined INI vars already,
but they use @VAR@ syntax:

  @INI_NAME@
  @PROGRAM_NAME@

The predefined vars are for strings that can't be known via the
Config::IniFiles module (e.g., the full path to the INI file and
client/mtt).

Could you add INI_SECTION_NAME to InsertINIPredefines, and use the
@VAR@ syntax?

-Ethan

>
> regards
>
> Mike
>
> On Tue, Aug 11, 2009 at 2:03 PM, Jeff Squyres <jsquyres_at_[hidden]> wrote:
>
> Mike --
>
> Can you explain what this does?
>
> On Aug 11, 2009, at 4:28 AM, <miked_at_[hidden]> wrote:
>
> Author: miked
> Date: 2009-08-11 04:28:03 EDT (Tue, 11 Aug 2009)
> New Revision: 1306
> URL: https://svn.open-mpi.org/trac/mtt/changeset/1306
>
> Log:
> added poor-man-inifile-preprocessor
> Text files modified:
> * trunk/client/mtt * * | * * 3 +++
> * trunk/lib/MTT/INI.pm | * *24 ++++++++++++++++++++++++
> * 2 files changed, 27 insertions(+), 0 deletions(-)
>
> Modified: trunk/client/mtt
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- trunk/client/mtt * *(original)
> +++ trunk/client/mtt * *2009-08-11 04:28:03 EDT (Tue, 11 Aug 2009)
> @@ -652,6 +652,9 @@
> * * * * # Expand all the "include_section" parameters
> * * * * $unfiltered = MTT::INI::ExpandIncludeSections($unfiltered);
>
> + * * * *# Expand all the "%PREDEFINED_VARS%" parameters
> + * * * *$unfiltered = MTT::INI::ExpandPredefinedVars($unfiltered);
> +
> * * * * # Keep an unfiltered version of the ini file for error
> checking
> * * * * my $filtered = dclone($unfiltered);
>
> Modified: trunk/lib/MTT/INI.pm
> ==============================================================================
> --- trunk/lib/MTT/INI.pm * * * *(original)
> +++ trunk/lib/MTT/INI.pm * * * *2009-08-11 04:28:03 EDT (Tue, 11 Aug
> 2009)
> @@ -275,6 +275,30 @@
> * * return $ini;
> *}
>
> +sub ExpandPredefinedVars {
> + * *my($ini) = @_;
> +
> + * *foreach my $section ($ini->Sections) {
> + * * * * * * * foreach my $parameter ($ini->Parameters($section)) {
> + * * * * * * * * * * * my $val = $ini->val($section, $parameter);
> + * * * * * * * * * * * if ( $val =~ /%INI_SECTION_NAME%/i ) {
> + * * * * * * * * * * * * * * * my $sect = $section;
> + * * * * * * * * * * * * * * * $sect =~ s/test run://gi;
> + * * * * * * * * * * * * * * * $sect =~ s/test build://gi;
> + * * * * * * * * * * * * * * * $sect =~ s/test get://gi;
> + * * * * * * * * * * * * * * * $sect =~ s/mpi get://gi;
> + * * * * * * * * * * * * * * * $sect =~ s/mpi install://gi;
> + * * * * * * * * * * * * * * * $sect =~ s/mpi details://gi;
> + * * * * * * * * * * * * * * * $sect =~ s/reporter://gi;
> + * * * * * * * * * * * * * * * $val =~ s/%INI_SECTION_NAME%/$sect/g;
> + * * * * * * * * * * * * * * * $ini->delval($section, $parameter);
> + * * * * * * * * * * * * * * * $ini->newval($section, $parameter,
> $val);
> + * * * * * * * * * * * }
> + * * * * * * * }
> + * *}
> + * *return $ini;
> +}
> +
> *# Worker subroutine for recursive ExpandIncludeSections
> *sub _expand_include_sections {
> * * my($ini, $section) = @_;
> _______________________________________________
> mtt-svn mailing list
> mtt-svn_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/mtt-svn
>
> --
> Jeff Squyres
> jsquyres_at_[hidden]
>
> _______________________________________________
> mtt-devel mailing list
> mtt-devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/mtt-devel
>
> References
>
> Visible links
> . mailto:jsquyres_at_[hidden]
> . mailto:miked_at_[hidden]
> . https://svn.open-mpi.org/trac/mtt/changeset/1306
> . mailto:mtt-svn_at_[hidden]
> . http://www.open-mpi.org/mailman/listinfo.cgi/mtt-svn
> . mailto:jsquyres_at_[hidden]
> . mailto: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