KBEC-00257 - Preventing an inconsistent Property value while using postp

Summary

While using postp, reading values from the Property cache sometimes returns its value inconsistently when using different forms of path, such as the full path of Property versus the short path.

Solution

This is related to the fact that referencing the postp property caches (%::gProperties) inconsistently.

If the short path is used to set the property name definition in postp, then use the short path in postpEndHook() to get the Property value.

Examples

The following code defined in postp.pl:
my @newMatchers = (
{id => "MY_ERRS",
pattern => q{command not found|[Ee]rror: (d+)},
action => q{incValue("errors");},
},
{
id => "SKIP",
pattern => q{[BBL|BFW] tests skipped: (d+)},
action => q{setProperty ("test_skipped", $1);postpEndHook();diagnostic("", "test_skipped", -1)},
},
);

push @::gMatchers, @newMatchers;

sub postpEndHook(){
my $customProperty;
$customProperty .= "\nSkipped: " . $::gProperties{"/myJobStep/tests_skipped"};
setProperty ("postSummary", $customProperty);
}
Should change to:
my @newMatchers = (
{id => "MY_ERRS",
pattern => q{command not found|[Ee]rror: (d+)},
action => q{incValue("errors");},
},
{
id => "SKIP",
pattern => q{[BBL|BFW] tests skipped: (d+)},
action => q{setProperty ("test_skipped", $1);postpEndHook();diagnostic("", "test_skipped", -1)},
},
);

push @::gMatchers, @newMatchers;

sub postpEndHook(){
my $customProperty;
$customProperty .= "\nSkipped: " . $::gProperties{"tests_skipped"};
setProperty ("postSummary", $customProperty);}

to reflect the value properly.

Applies to

  • Product versions: All
  • OS versions: All
Have more questions? Submit a request

Comments

Powered by Zendesk