All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: xen-devel@lists.xenproject.org
Subject: Re: [OSSTEST PATCH 08/13] Reporting: Break out report_blessingscond
Date: Tue, 30 Jun 2015 10:11:19 +0100	[thread overview]
Message-ID: <1435655479.21469.36.camel@citrix.com> (raw)
In-Reply-To: <1435598089-21647-9-git-send-email-ian.jackson@eu.citrix.com>

On Mon, 2015-06-29 at 18:14 +0100, Ian Jackson wrote:
> The returned SQL is a self-contained expression, and does not require
> additional bind parameters.  To spot SQL quoting problems, we die if
> a blessing is not reasonable.
> 
> The use sites of the $blessingcond in sg-report-flight are adjusted to
> no longer pass @blessings to execute.
> 
> No overall functional change with reasonable blessings.
> 
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

BTW, I noticed that your valid blessing regex here includes "-", which
is not allowed elsewhere, which breaks "./standalone make-flight -f
$branch $branch" for our common branch names meaning the flight name
needs some munging. A minor inconvenience, but if this check were moved
to a centralised helper it could be easily fixed...

Or at least this was once the case, I can't see the problematic check
right now and haven't actually tried this for a while. Perhaps it got
fixed already and I didn't notice?

> ---
>  Osstest/Executive.pm |   13 +++++++++++++
>  sg-report-flight     |   10 +++-------
>  2 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
> index 9df4d91..ba668bc 100644
> --- a/Osstest/Executive.pm
> +++ b/Osstest/Executive.pm
> @@ -47,6 +47,7 @@ BEGIN {
>      @EXPORT      = qw(get_harness_rev grabrepolock_reexec
>                        findtask @all_lock_tables
>                        report_run_getinfo report_altcolour
> +                      report_blessingscond
>                        tcpconnect_queuedaemon plan_search
>                        alloc_resources alloc_resources_rollback_begin_work
>                        resource_check_allocated resource_shared_mark_ready
> @@ -246,6 +247,18 @@ sub report_altcolour ($) {
>      return "bgcolor=\"#".(qw(d0d0d0 ffffff))[$bool]."\"";
>  }
>  
> +sub report_blessingscond ($$) {
> +    my ($blessings, $maxflight) = @_;
> +    my $blessingscond= '('.join(' OR ', map {
> +	die if m/[^-_.0-9a-z]/;
> +	"blessing='$_'"
> +				} @$blessings).')';
> +    if (defined $maxflight) {
> +	$blessingscond= "( flight <= $maxflight AND $blessingscond )";
> +    }
> +    return $blessingscond;
> +}
> +
>  #---------- host (and other resource) allocation ----------
>  
>  our $taskid;
> diff --git a/sg-report-flight b/sg-report-flight
> index 117b609..c1661ec 100755
> --- a/sg-report-flight
> +++ b/sg-report-flight
> @@ -127,11 +127,7 @@ our $cw= 79;
>  our $tl= 20;
>  our $htmlleaf= "info.html";
>  
> -our $blessingscond= '('.join(' OR ', map { "blessing=?" } @blessings).')';
> -
> -if (defined $maxflight) {
> -    $blessingscond= "( flight <= $maxflight AND $blessingscond )";
> -}
> +our $blessingscond= report_blessingscond(\@blessings, $maxflight);
>  
>  sub displayflightnum ($) {
>      my ($flight) = @_;
> @@ -202,7 +198,7 @@ END
>        ORDER BY blessing ASC, flight DESC
>  END
>      $flightsq= db_prepare($flightsq);
> -    $flightsq->execute(@flightsq_params, @blessings);
> +    $flightsq->execute(@flightsq_params);
>  
>      my $buildflightsq= db_prepare(<<END);
>          SELECT val FROM runvars
> @@ -691,7 +687,7 @@ END
>              next;
>          }
>  
> -        $anypassq->execute($j->{job}, $s->{testid}, @blessings);
> +        $anypassq->execute($j->{job}, $s->{testid});
>          if (!$anypassq->fetchrow_hashref()) {
>              print MRO "never-passed $j->{job} $s->{testid} $st\n";
>              print DEBUG " never passed\n";

  reply	other threads:[~2015-06-30  9:11 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-29 17:14 [OSSTEST PATCH 00/13] Linux 4.1, and reporting improvements Ian Jackson
2015-06-29 17:14 ` [OSSTEST PATCH 01/13] ts-leak-check: Report leaked loop block devices Ian Jackson
2015-06-30  8:55   ` Ian Campbell
2015-06-29 17:14 ` [OSSTEST PATCH 02/13] Test Linux 4.1 Ian Jackson
2015-06-30  8:58   ` Ian Campbell
2015-06-29 17:14 ` [OSSTEST PATCH 03/13] Reporting: sg-report-flight: Fix undefined value in $worstrow[] Ian Jackson
2015-06-30  9:04   ` Ian Campbell
2015-06-30  9:39     ` Ian Jackson
2015-06-29 17:14 ` [OSSTEST PATCH 04/13] Reporting: In report_run_getinfo, abstract code for returning Ian Jackson
2015-06-30  9:05   ` Ian Campbell
2015-06-29 17:14 ` [OSSTEST PATCH 05/13] Reporting: report_run_getinfo produces ColourAttr Ian Jackson
2015-06-30  9:06   ` Ian Campbell
2015-06-30  9:25     ` Ian Jackson
2015-06-30  9:34       ` Ian Campbell
2015-06-29 17:14 ` [OSSTEST PATCH 06/13] Reporting: sg-report-job-history: Honour --limit Ian Jackson
2015-06-30  9:07   ` Ian Campbell
2015-06-29 17:14 ` [OSSTEST PATCH 07/13] Reporting: report_run_getinfo produces Content Ian Jackson
2015-06-30  9:07   ` Ian Campbell
2015-06-29 17:14 ` [OSSTEST PATCH 08/13] Reporting: Break out report_blessingscond Ian Jackson
2015-06-30  9:11   ` Ian Campbell [this message]
2015-06-30  9:31     ` Ian Jackson
2015-06-30  9:44       ` Ian Campbell
2015-06-30  9:54         ` Ian Jackson
2015-06-30 11:01           ` Ian Campbell
2015-06-29 17:14 ` [OSSTEST PATCH 09/13] Reporting sg-report-job-history: support --max-flight Ian Jackson
2015-06-30  9:12   ` Ian Campbell
2015-06-29 17:14 ` [OSSTEST PATCH 10/13] Reporting: sg-report-host-history: Support --max-flight Ian Jackson
2015-06-30  9:12   ` Ian Campbell
2015-06-29 17:14 ` [OSSTEST PATCH 11/13] Reporting: In history tables, show multiple failure steps Ian Jackson
2015-06-30  9:15   ` Ian Campbell
2015-06-29 17:14 ` [OSSTEST PATCH 12/13] Reporting: Provide report_find_push_age_info Ian Jackson
2015-06-30  9:39   ` Ian Campbell
2015-06-29 17:14 ` [OSSTEST PATCH 13/13] Reporting: sg-report-flight: Put overall pushgate stats in email Ian Jackson
2015-06-30  9:33   ` Ian Campbell
2015-06-30  9:50     ` Ian Jackson
2015-06-30  9:56       ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435655479.21469.36.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.