[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [OSSTEST PATCH 59/82] runvar access: Provide runvar_glob
From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> We will need this because when runvar access is restricted, accessing via %r directly won't work. We want to see what patterns the code is interested in (so that interest in a nonexistent runvar is properly tracked). Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- Osstest/TestSupport.pm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index b1eca0a9..6403e52b 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -53,7 +53,7 @@ BEGIN { store_runvar get_runvar get_runvar_maybe get_runvar_default need_runvars unique_incrementing_runvar next_unique_name - stashfilecontents runvar_is_synth + stashfilecontents runvar_is_synth runvar_glob target_cmd_root_status target_cmd_output_root_status target_cmd_root target_cmd target_cmd_build @@ -3187,6 +3187,20 @@ sub runvar_access_check ($$) { Carp::cluck $m; } +sub runvar_glob { + my $monitor = tied %r; + my $realr = $monitor || \%r; + my @out; + foreach my $pat (@_) { + if ($monitor) { runvar_access_check($pat, 'scan') } + foreach my $key (sort keys %$realr) { + next unless fnmatch $pat, $key; + push @out, $key; + } + } + @out; +} + package RunvarMonitor; use Carp; use Osstest; -- 2.20.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |