]> xenbits.xensource.com Git - osstest.git/log
osstest.git
4 years agosg-report-host-history: Drop a redundznt AND clause
Ian Jackson [Fri, 24 Jul 2020 16:17:24 +0000 (17:17 +0100)]
sg-report-host-history: Drop a redundznt AND clause

This condition is the same as $flightcond.  (This has no effect on the
db performance since the query planner figures it out, but it is
confusing.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Rerganisation: Change loops
Ian Jackson [Fri, 24 Jul 2020 15:52:10 +0000 (16:52 +0100)]
sg-report-host-history: Rerganisation: Change loops

Move the per-host code all into the same per-host loop.  One effect is
to transpose the db_retry and host loops for mainquery.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Rerganisation: Read old logs later
Ian Jackson [Fri, 24 Jul 2020 15:51:28 +0000 (16:51 +0100)]
sg-report-host-history: Rerganisation: Read old logs later

Perhaps at one point something read from these logs influenced the db
query for thye flights range, but that is no longer the case and it
doesn't seem likely to need to come back.

We want to move the per-host stuff together.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Rerganisation: Make mainquery per-host
Ian Jackson [Fri, 24 Jul 2020 15:50:07 +0000 (16:50 +0100)]
sg-report-host-history: Rerganisation: Make mainquery per-host

This moves the loop over hosts into the main program.  We are working
our way to a new code structure.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Do the main query per host
Ian Jackson [Fri, 24 Jul 2020 15:11:49 +0000 (16:11 +0100)]
sg-report-host-history: Do the main query per host

In f6001d628c3b3fd42b10cd15351981a04bc02572 we combined these
queries into one:
  sg-report-host-history: Aggregate runvars query for all hosts

Now that we have an index, there is a faster way for the db to do this
query: via that index.  But it doesn't like to do that if be aggregate
the queries.  Experimentally, doing this query separately once per
host is significantly faster.

Also, later, it will allow us to parallelise this work.

So, we undo that.  (Not by reverting, though.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: Use proper \ escaping for underscores in LIKE

4 years agosg-report-host-history: Add a debug print after sorting jobs
Ian Jackson [Fri, 24 Jul 2020 15:45:23 +0000 (16:45 +0100)]
sg-report-host-history: Add a debug print after sorting jobs

This helps rule this sort out as a source of slowness.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoExecutive: Export opendb_tests
Ian Jackson [Fri, 24 Jul 2020 16:05:58 +0000 (17:05 +0100)]
Executive: Export opendb_tests

sg-report-host-history is going to want this in a moment

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Drop per-job debug etc.
Ian Jackson [Fri, 24 Jul 2020 13:11:46 +0000 (14:11 +0100)]
sg-report-host-history: Drop per-job debug etc.

This printing has a significant effect on the performance of this
program, at least after we optimise various other things.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Find flight limit by flight start date
Ian Jackson [Fri, 24 Jul 2020 13:05:27 +0000 (14:05 +0100)]
sg-report-host-history: Find flight limit by flight start date

By default we look for anything in (roughly) the last year.

This query is in fact quite fast because the flights table is small.

There is still the per-host limit of $limit (2000) recent runs.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoExecutive: Drop redundant AND clause
Ian Jackson [Wed, 22 Jul 2020 14:08:33 +0000 (15:08 +0100)]
Executive: Drop redundant AND clause

In "Executive: Use index for report__find_test" we changed an EXISTS
subquery into a JOIN.

Now, the condition r.flight=f.flight is redundant because this is the
join column (from USING).

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: George Dunlap <George.Dunlap@citrix.com>
4 years agoduration_estimator: Move duration query loop into database
Ian Jackson [Tue, 21 Jul 2020 14:36:11 +0000 (15:36 +0100)]
duration_estimator: Move duration query loop into database

Stuff the two queries together: we use the firsty query as a WITH
clause.  This is significantly faster, perhaps because the query
optimiser does a better job but probably just because it saves on
round trips.

No functional change.

Perf: subjectively this seemed to help when the cache was cold.  Now I
have a warm cache and it doesn't seem to make much difference.

Perf: runtime of my test case now ~5-7s.

Example queries before (from the debugging output):

 Query A part I:

            SELECT f.flight AS flight,
                   j.job AS job,
                   f.started AS started,
                   j.status AS status
                     FROM flights f
                     JOIN jobs j USING (flight)
                     JOIN runvars r
                             ON  f.flight=r.flight
                            AND  r.name=?
                    WHERE  j.job=r.job
                      AND  f.blessing=?
                      AND  f.branch=?
                      AND  j.job=?
                      AND  r.val=?
                      AND  (j.status='pass' OR j.status='fail'
                           OR j.status='truncated'!)
                      AND  f.started IS NOT NULL
                      AND  f.started >= ?
                 ORDER BY f.started DESC

 With bind variables:
     "test-amd64-i386-xl-pvshim"
     "guest-start"

 Query B part I:

            SELECT f.flight AS flight,
                   s.job AS job,
                   NULL as started,
                   NULL as status,
                   max(s.finished) AS max_finished
                      FROM steps s JOIN flights f
                        ON s.flight=f.flight
                     WHERE s.job=? AND f.blessing=? AND f.branch=?
                       AND s.finished IS NOT NULL
                       AND f.started IS NOT NULL
                       AND f.started >= ?
                     GROUP BY f.flight, s.job
                     ORDER BY max_finished DESC

 With bind variables:
    "test-armhf-armhf-libvirt"
    'real'
    "xen-unstable"
    1594144469

 Query common part II:

        WITH tsteps AS
        (
            SELECT *
              FROM steps
             WHERE flight=? AND job=?
        )
        , tsteps2 AS
        (
            SELECT *
              FROM tsteps
             WHERE finished <=
                     (SELECT finished
                        FROM tsteps
                       WHERE tsteps.testid = ?)
        )
        SELECT (
            SELECT max(finished)-min(started)
              FROM tsteps2
          ) - (
            SELECT sum(finished-started)
              FROM tsteps2
             WHERE step = 'ts-hosts-allocate'
          )
                AS duration

 With bind variables from previous query, eg:
     152045
     "test-armhf-armhf-libvirt"
     "guest-start.2"

After:

 Query A (combined):

            WITH f AS (
            SELECT f.flight AS flight,
                   j.job AS job,
                   f.started AS started,
                   j.status AS status
                     FROM flights f
                     JOIN jobs j USING (flight)
                     JOIN runvars r
                             ON  f.flight=r.flight
                            AND  r.name=?
                    WHERE  j.job=r.job
                      AND  f.blessing=?
                      AND  f.branch=?
                      AND  j.job=?
                      AND  r.val=?
                      AND  (j.status='pass' OR j.status='fail'
                           OR j.status='truncated'!)
                      AND  f.started IS NOT NULL
                      AND  f.started >= ?
                 ORDER BY f.started DESC

            )
            SELECT flight, job, started, status,
            (
        WITH tsteps AS
        (
            SELECT *
              FROM steps
             WHERE flight=f.flight AND job=f.job
        )
        , tsteps2 AS
        (
            SELECT *
              FROM tsteps
             WHERE finished <=
                     (SELECT finished
                        FROM tsteps
                       WHERE tsteps.testid = ?)
        )
        SELECT (
            SELECT max(finished)-min(started)
              FROM tsteps2
          ) - (
            SELECT sum(finished-started)
              FROM tsteps2
             WHERE step = 'ts-hosts-allocate'
          )
                AS duration

            ) FROM f

 Query B (combined):

            WITH f AS (
            SELECT f.flight AS flight,
                   s.job AS job,
                   NULL as started,
                   NULL as status,
                   max(s.finished) AS max_finished
                      FROM steps s JOIN flights f
                        ON s.flight=f.flight
                     WHERE s.job=? AND f.blessing=? AND f.branch=?
                       AND s.finished IS NOT NULL
                       AND f.started IS NOT NULL
                       AND f.started >= ?
                     GROUP BY f.flight, s.job
                     ORDER BY max_finished DESC

            )
            SELECT flight, job, started, status,
            (
        WITH tsteps AS
        (
            SELECT *
              FROM steps
             WHERE flight=f.flight AND job=f.job
        )
        , tsteps2 AS
        (
            SELECT *
              FROM tsteps
             WHERE finished <=
                     (SELECT finished
                        FROM tsteps
                       WHERE tsteps.testid = ?)
        )
        SELECT (
            SELECT max(finished)-min(started)
              FROM tsteps2
          ) - (
            SELECT sum(finished-started)
              FROM tsteps2
             WHERE step = 'ts-hosts-allocate'
          )
                AS duration

            ) FROM f

Diff for query A:

@@ -1,3 +1,4 @@
+            WITH f AS (
             SELECT f.flight AS flight,
                    j.job AS job,
                    f.started AS started,
@@ -18,11 +19,14 @@
                       AND  f.started >= ?
                  ORDER BY f.started DESC

+            )
+            SELECT flight, job, started, status,
+            (
        WITH tsteps AS
         (
             SELECT *
               FROM steps
-             WHERE flight=? AND job=?
+             WHERE flight=f.flight AND job=f.job
         )
         , tsteps2 AS
         (
@@ -42,3 +46,5 @@
              WHERE step = 'ts-hosts-allocate'
           )
                 AS duration
+
+            ) FROM f

Diff for query B:

@@ -1,3 +1,4 @@
+            WITH f AS (
             SELECT f.flight AS flight,
                    s.job AS job,
                    NULL as started,
@@ -12,11 +13,14 @@
                      GROUP BY f.flight, s.job
                      ORDER BY max_finished DESC

+            )
+            SELECT flight, job, started, status,
+            (
         WITH tsteps AS
         (
             SELECT *
               FROM steps
-             WHERE flight=? AND job=?
+             WHERE flight=f.flight AND job=f.job
         )
         , tsteps2 AS
         (
@@ -36,3 +40,5 @@
              WHERE step = 'ts-hosts-allocate'
           )
                 AS duration
+
+            ) FROM f

Reviewed-by: George Dunlap <George.Dunlap@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v4: Drop max_finished from new SELECT clause.
    This column is present in the query A just for the ORDER BY.
    It is not used by the perl code which actually processe
    these rows.  Which is just as well because the query B doesn't
    have this column, so with max_finished that query is broken.

4 years agoduration_estimator: Move $uptincl_testid to separate @x_params
Ian Jackson [Tue, 21 Jul 2020 14:34:00 +0000 (15:34 +0100)]
duration_estimator: Move $uptincl_testid to separate @x_params

This is going to be useful soon.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoduration_estimator: Return job column in first query
Ian Jackson [Tue, 21 Jul 2020 14:32:33 +0000 (15:32 +0100)]
duration_estimator: Return job column in first query

Right now this is pointless since the Perl code doesn't need it.  But
this row is going to be part of a WITH clause soon.

No functional change.

Diffs to two example queries (from the Perl DBI trace):

            SELECT f.flight AS flight,
+                   j.job AS job,
                   f.started AS started,
                    j.status AS status
                     FROM flights f
                     JOIN jobs j USING (flight)
                     JOIN runvars r
                             ON  f.flight=r.flight
                            AND  r.name=?
                    WHERE  j.job=r.job
                      AND  f.blessing=?
                      AND  f.branch=?
                      AND  j.job=?
                      AND  r.val=?
                      AND  (j.status='pass' OR j.status='fail'
                           OR j.status='truncated'!)
                      AND  f.started IS NOT NULL
                       AND  f.started >= ?
                  ORDER BY f.started DESC

            SELECT f.flight AS flight,
+                   s.job AS job,
                    NULL as started,
                    NULL as status,
                    max(s.finished) AS max_finished
                      FROM steps s JOIN flights f
                        ON s.flight=f.flight
                     WHERE s.job=? AND f.blessing=? AND f.branch=?
                        AND s.finished IS NOT NULL
                        AND f.started IS NOT NULL
                        AND f.started >= ?
-                     GROUP BY f.flight
+                     GROUP BY f.flight, s.job
                      ORDER BY max_finished DESC

CC: George Dunlap <George.Dunlap@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoduration_estimator: Explicitly provide null in general host q
Ian Jackson [Tue, 21 Jul 2020 14:22:28 +0000 (15:22 +0100)]
duration_estimator: Explicitly provide null in general host q

Our spec. says we return nulls for started and status if we don't find
a job matching the host spec.

The way this works right now is that we look up the nonexistent
entries in $refs->[0].  This is not really brilliant and is going to
be troublesome as we continue to refactor.

Provide these values explicitly.  No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoduration_estimator: Introduce some _qtxt variables
Ian Jackson [Tue, 21 Jul 2020 14:21:50 +0000 (15:21 +0100)]
duration_estimator: Introduce some _qtxt variables

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoduration_estimator: Ignore truncated jobs unless we know the step
Ian Jackson [Tue, 21 Jul 2020 14:18:38 +0000 (15:18 +0100)]
duration_estimator: Ignore truncated jobs unless we know the step

If we are looking for a particular step then we will ignore jobs
without that step, so any job which was truncated before it will be
ignored.

Otherwise we are looking for the whole job duration and a truncated
job is not a good representative.

This is a bugfix (to duration estimation), not a performance
improvement like the preceding and subsequent changes.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoExecutive: Use index for report__find_test
Ian Jackson [Mon, 20 Jul 2020 16:36:54 +0000 (17:36 +0100)]
Executive: Use index for report__find_test

After we refactor this query then we can enable the index use.
(Both of these things together in this commit because I haven't perf
tested the version with just the refactoring.)

(We have provided an index that can answer this question really
quickly if a version is specified.  But the query planner couldn't see
that because it works without seeing the bind variables, so doesn't
know that the value of name is going to be suitable for this index.)

* Convert the two EXISTS subqueries into JOIN/AND with a DISTINCT
  clause naming the fields on flights, so as to replicate the previous
  result rows.  Then do $selection field last.  The subquery is a
  convenient way to let this do the previous thing for all the values
  of $selection (including, notably, *).

* Add the additional AND clause for r.name, which has no logical
  effect given the actual values of name, enabling the query planner
  to use this index.

Perf: In my test case the sg-report-flight runtime is now ~8s.  I am
reasonably confident that this will not make other use cases of this
code worse.

Perf: runtime of my test case now ~11s

Example query before (from the Perl DBI trace):

        SELECT *
         FROM flights f
        WHERE
                EXISTS (
                   SELECT 1
                    FROM runvars r
                   WHERE name=?
                     AND val=?
                     AND r.flight=f.flight
                     AND (      (CASE
       WHEN (r.job) LIKE 'build-%-prev' THEN 'xprev'
       WHEN ((r.job) LIKE 'build-%-freebsd'
             AND 'x' = 'freebsdbuildjob') THEN 'DISCARD'
       ELSE                                      ''
       END)
 = '')
                 )
          AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
          AND (branch=?)
        ORDER BY flight DESC
        LIMIT 1

After:

        SELECT *
          FROM ( SELECT DISTINCT
                      flight, started, blessing, branch, intended
                 FROM flights f
                    JOIN runvars r USING (flight)
                   WHERE name=?
                     AND name LIKE 'revision\_%'
                     AND val=?
                     AND r.flight=f.flight
                     AND (      (CASE
       WHEN (r.job) LIKE 'build-%-prev' THEN 'xprev'
       WHEN ((r.job) LIKE 'build-%-freebsd'
             AND 'x' = 'freebsdbuildjob') THEN 'DISCARD'
       ELSE                                      ''
       END)
 = '')
          AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
          AND (branch=?)
) AS sub WHERE TRUE
        ORDER BY flight DESC
        LIMIT 1

In both cases with bind vars:

   'revision_xen'
   '165f3afbfc3db70fcfdccad07085cde0a03c858b'
   "xen-unstable"

Diff to the example query:

@@ -1,10 +1,10 @@
         SELECT *
+          FROM ( SELECT DISTINCT
+                      flight, started, blessing, branch, intended
          FROM flights f
-        WHERE
-                EXISTS (
-                   SELECT 1
-                    FROM runvars r
+                    JOIN runvars r USING (flight)
                    WHERE name=?
+                     AND name LIKE 'revision\_%'
                      AND val=?
                      AND r.flight=f.flight
                      AND (      (CASE
@@ -14,8 +14,8 @@
        ELSE                                      ''
        END)
  = '')
-                 )
           AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
           AND (branch=?)
+) AS sub WHERE TRUE
         ORDER BY flight DESC
         LIMIT 1

Reviewed-by: George Dunlap <George.Dunlap@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: Use proper \ escaping for underscores in LIKE

4 years agosg-report-flight: Use the job row from the intitial query
Ian Jackson [Tue, 21 Jul 2020 11:59:03 +0000 (12:59 +0100)]
sg-report-flight: Use the job row from the intitial query

$jcheckq is redundant: we looked this up right at the start.

This is not expected to speed things up very much, but it makes things
somewhat cleaner and clearer.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v4: Fix reference to $tjstatus

4 years agosg-report-flight: Use WITH clause to use index for $anypassq
Ian Jackson [Mon, 20 Jul 2020 15:58:16 +0000 (16:58 +0100)]
sg-report-flight: Use WITH clause to use index for $anypassq

Perf: runtime of my test case now ~11s

Example query before (from the Perl DBI trace):

        SELECT * FROM flights JOIN steps USING (flight)
            WHERE (branch='xen-unstable')
              AND job=? and testid=? and status='pass'
              AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
            LIMIT 1

After:

        WITH s AS
        (
        SELECT * FROM steps
         WHERE job=? and testid=? and status='pass'
        )
        SELECT * FROM flights JOIN s USING (flight)
            WHERE (branch='xen-unstable')
              AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
            LIMIT 1

In both cases with bind vars:

   "test-amd64-i386-xl-pvshim"
   "guest-start"

Diff to the query:

-        SELECT * FROM flights JOIN steps USING (flight)
+        WITH s AS
+        (
+        SELECT * FROM steps
+         WHERE job=? and testid=? and status='pass'
+        )
+        SELECT * FROM flights JOIN s USING (flight)
             WHERE (branch='xen-unstable')
-              AND job=? and testid=? and status='pass'
               AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
             LIMIT 1

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
4 years agosg-report-flight: Use WITH to use best index use for $flightsq
Ian Jackson [Tue, 21 Jul 2020 11:56:42 +0000 (12:56 +0100)]
sg-report-flight: Use WITH to use best index use for $flightsq

While we're here, convert this EXISTS subquery to a JOIN.

Perf: runtime of my test case now ~200-300s.

Example query before (from the Perl DBI trace):

      SELECT * FROM (
        SELECT DISTINCT flight, blessing
             FROM flights
             JOIN runvars r1 USING (flight)

            WHERE (branch='xen-unstable')
              AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
                  AND EXISTS (SELECT 1
                            FROM jobs
                           WHERE jobs.flight = flights.flight
                             AND jobs.job = ?)

              AND r1.name LIKE 'built_revision_%'
              AND r1.name = ?
              AND r1.val= ?

            ORDER BY flight DESC
            LIMIT 1000
      ) AS sub
      ORDER BY blessing ASC, flight DESC

With bind variables:

     "test-armhf-armhf-libvirt"
     'built_revision_xen'
     '165f3afbfc3db70fcfdccad07085cde0a03c858b'

After:

      WITH sub AS (
        SELECT DISTINCT flight, blessing
             FROM flights
             JOIN runvars r1 USING (flight)

            WHERE (branch='xen-unstable')
              AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
              AND r1.name LIKE 'built_revision_%'
              AND r1.name = ?
              AND r1.val= ?

            ORDER BY flight DESC
            LIMIT 1000
      )
      SELECT *
        FROM sub
        JOIN jobs USING (flight)

       WHERE (1=1)
                  AND jobs.job = ?

      ORDER BY blessing ASC, flight DESC

With bind variables:

    'built_revision_xen'
    '165f3afbfc3db70fcfdccad07085cde0a03c858b'
    "test-armhf-armhf-libvirt"

Diff to the query:

-      SELECT * FROM (
+      WITH sub AS (
         SELECT DISTINCT flight, blessing
              FROM flights
              JOIN runvars r1 USING (flight)

             WHERE (branch='xen-unstable')
               AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
-                  AND EXISTS (SELECT 1
-                            FROM jobs
-                           WHERE jobs.flight = flights.flight
-                             AND jobs.job = ?)
-
               AND r1.name LIKE 'built_revision_%'
               AND r1.name = ?
               AND r1.val= ?

             ORDER BY flight DESC
             LIMIT 1000
-      ) AS sub
+      )
+      SELECT *
+        FROM sub
+        JOIN jobs USING (flight)
+
+       WHERE (1=1)
+                  AND jobs.job = ?
+
       ORDER BY blessing ASC, flight DESC

Reviewed-by: George Dunlap <George.Dunlap@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-flight: Ask the db for flights of interest
Ian Jackson [Fri, 17 Jul 2020 15:04:50 +0000 (16:04 +0100)]
sg-report-flight: Ask the db for flights of interest

Specifically, we narrow the initial query to flights which have at
least some job with the built_revision_foo we are looking for.

This condition is strictly broader than that implemented inside the
flight search loop, so there is no functional change.

Perf: runtime of my test case now ~300s-500s.

Example query before (from the Perl DBI trace):

      SELECT * FROM (
        SELECT flight, blessing FROM flights
            WHERE (branch='xen-unstable')
              AND                   EXISTS (SELECT 1
                            FROM jobs
                           WHERE jobs.flight = flights.flight
                             AND jobs.job = ?)

              AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
            ORDER BY flight DESC
            LIMIT 1000
      ) AS sub
      ORDER BY blessing ASC, flight DESC

With these bind variables:

    "test-armhf-armhf-libvirt"

After:

      SELECT * FROM (
        SELECT DISTINCT flight, blessing
             FROM flights
             JOIN runvars r1 USING (flight)

            WHERE (branch='xen-unstable')
              AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
                  AND EXISTS (SELECT 1
                            FROM jobs
                           WHERE jobs.flight = flights.flight
                             AND jobs.job = ?)

              AND r1.name LIKE 'built\_revision\_%'
              AND r1.name = ?
              AND r1.val= ?

            ORDER BY flight DESC
            LIMIT 1000
      ) AS sub
      ORDER BY blessing ASC, flight DESC

With these bind variables:

      "test-armhf-armhf-libvirt"
      'built_revision_xen'
      '165f3afbfc3db70fcfdccad07085cde0a03c858b'

Diff to the query:

      SELECT * FROM (
-        SELECT flight, blessing FROM flights
+        SELECT DISTINCT flight, blessing
+             FROM flights
+             JOIN runvars r1 USING (flight)
+
             WHERE (branch='xen-unstable')
+              AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
               AND                   EXISTS (SELECT 1
                             FROM jobs
                            WHERE jobs.flight = flights.flight
                              AND jobs.job = ?)

-              AND ( (TRUE AND flight <= 151903) AND (blessing='real') )
+              AND r1.name LIKE 'built\_revision\_%'
+              AND r1.name = ?
+              AND r1.val= ?
+
             ORDER BY flight DESC
             LIMIT 1000
       ) AS sub

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: George Dunlap <George.Dunlap@citrix.com>
---
v3: Add more formal correctness argument
v2: Use proper \ escaping for underscores in LIKE

4 years agosg-report-flight: Sort failures by job name as last resort
Ian Jackson [Tue, 21 Jul 2020 13:40:37 +0000 (14:40 +0100)]
sg-report-flight: Sort failures by job name as last resort

This removes some nondeterminism from the output.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-flight: Add a comment re same-flight search narrowing
Ian Jackson [Tue, 21 Jul 2020 11:23:14 +0000 (12:23 +0100)]
sg-report-flight: Add a comment re same-flight search narrowing

In afe851ca1771e5da6395b596afa69e509dbbc278
  sg-report-flight: When justifying, disregard out-of-flight build jobs
we narrowed sg-report-flight's search algorith.

An extensive justification is in the commit message.  I think much of
this information belongs in-tree, so c&p it (with slight edits) here.

No code change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoDisable mercurial support
Ian Jackson [Fri, 31 Jul 2020 15:52:06 +0000 (16:52 +0100)]
Disable mercurial support

This is in order that we can substantially simplify forthcoming
database changes.  If mercurial support were still desired, the right
thing to do would be to rework it now along the lines of this request.
But we haven't used it for some years.

It could be reenabled later, if this work were done then.  (Of course
there might be other bitrot already that we don't know about.)

CC: committers@xenproject.org
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Andrew Cooper <Andrew.Cooper3@citrix.com>
4 years agoSQL: Fix incorrect LIKE pattern syntax (program variables)
Ian Jackson [Mon, 27 Jul 2020 11:44:48 +0000 (12:44 +0100)]
SQL: Fix incorrect LIKE pattern syntax (program variables)

In two places the pattern for LIKE is constructed programmatically.
In this case, too, we need to escape % and _.

We pass the actual pattern (or pattern fragment) via ?, so we do not
need to worry about '.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
New in v2.

4 years agoSQL: Fix incorrect LIKE pattern syntax (literals)
Ian Jackson [Mon, 27 Jul 2020 11:44:40 +0000 (12:44 +0100)]
SQL: Fix incorrect LIKE pattern syntax (literals)

LIKE takes a weird SQLish glob pattern, where % is like a glob *
and (relevantly, here) _ is like a glob ?.

Every _ in one of these LIKE patterns needs to be escaped with \.

Do that for all the literal LIKE patterns.

This fixes bugs.  Generally, bugs where the wrong rows might be
returned (except that the data probably doesn't have any such rows).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
New in v2.

4 years agoSQL: Use "LIKE" rather than "like", etc.
Ian Jackson [Mon, 27 Jul 2020 11:43:27 +0000 (12:43 +0100)]
SQL: Use "LIKE" rather than "like", etc.

This is more like the rest of the style.  It will also make it easier
to find instances of the mistaken LIKE syntax.

I found these with "git grep" and manually edited them.  I have
checked the before-and-after result of
   find * -type f | xargs perl -i~ -pe 's/\bLIKE\b/like/g'
and it has only the few expected changes to ANDs and ORs.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
New in v2.

4 years agoschema: Add index to help cs-bisection-step
Ian Jackson [Fri, 24 Jul 2020 17:43:40 +0000 (18:43 +0100)]
schema: Add index to help cs-bisection-step

cs-bisection step basis search involves looking for recent flights
that weren't broken.  A flight is broken if it has broken steps.
Make an index for this to save it scanning the steps table.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoschema: Add index for quick lookup by host
Ian Jackson [Fri, 24 Jul 2020 13:54:32 +0000 (14:54 +0100)]
schema: Add index for quick lookup by host

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: Use proper \ escaping for underscores in LIKE

4 years agoschema: Provide indices for sg-report-flight
Ian Jackson [Fri, 17 Jul 2020 16:04:45 +0000 (17:04 +0100)]
schema: Provide indices for sg-report-flight

These indexes allow very fast lookup of "relevant" flights eg when
trying to justify failures.

In my ad-hoc test case, these indices (along with the subsequent
changes to sg-report-flight and Executive.pm, reduce the runtime of
sg-report-flight from 2-3ks (unacceptably long!) to as little as
5-7s seconds - a speedup of about 500x.

(Getting the database snapshot may take a while first, but deploying
this code should help with that too by reducing long-running
transactions.  Quoted perf timings are from snapshot acquisition.)

Without these new indexes there may be a performance change from the
query changes.  I haven't benchmarked this so I am setting the schema
updates to be Preparatory/Needed (ie, "Schema first" as
schema/README.updates has it), to say that the index should be created
before the new code is deployed.

Testing: I have tested this series by creating experimental indices
"trial_..." in the actual production instance.  (Transactional DDL was
very helpful with this.)  I have verified with \d that schema update
instructions in this commit generate indexes which are equivalent to
the trial indices.

Deployment: AFter these schema updates are applied, the trial indices
are redundant duplicates and should be deleted.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: George Dunlap <George.Dunlap@citrix.com>
---
v2: Use proper \ escaping for underscores in LIKE

4 years agoAdd cperl-indent-level to .dir-locals.el
Ian Jackson [Mon, 27 Jul 2020 11:52:27 +0000 (12:52 +0100)]
Add cperl-indent-level to .dir-locals.el

My personal config on my laptop has this set to 2 and that makes
editing osstest, which uses 4, quite annoying.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
New in v2.

4 years agodom0pvh: assign 1GB of memory to PVH dom0
Roger Pau Monne [Wed, 22 Jul 2020 15:04:16 +0000 (16:04 +0100)]
dom0pvh: assign 1GB of memory to PVH dom0

Current tests use 512MB of memory for dom0, but that's too low for a
PVH dom0 on some hosts and will cause errors because memory is
ballooned out in order to obtain physical memory ranges to map foreign
pages.

Using ballooned out pages for foreign mappings also doesn't seem to
work properly with the current Linux kernel version, so increase the
memory assigned to dom0 to 1GB for PVH dom0 tests. We should see about
reverting this when using ballooned pages is fixed.

The runvar diff is:

+test-amd64-amd64-dom0pvh-xl-amd   dom0_mem 1024
+test-amd64-amd64-dom0pvh-xl-intel dom0_mem 1024

I've done a repro of the failed test on elbling0 with dom0_mem set to
1GB and it seems to prevent the issue, the flight is 152111.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agofreebsd: remove freebsd- hostflags request from guest tests
Roger Pau Monne [Tue, 21 Jul 2020 11:20:16 +0000 (12:20 +0100)]
freebsd: remove freebsd- hostflags request from guest tests

Guest tests shouldn't care about the capabilities or firmware of the
underlying hosts, so drop the request of specific freebsd-<version>
hostflags for FreeBSD guest tests.

While there request the presence of the hvm hostflag since the FreeBSD
guest tests are run in HVM mode.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agofreebsd: add FreeBSD 11 and 12 guest jobs
Roger Pau Monne [Thu, 28 May 2020 10:26:48 +0000 (11:26 +0100)]
freebsd: add FreeBSD 11 and 12 guest jobs

Those are based on the upstream images and are run on an amd64 dom0.
The runvar difference is:

+test-amd64-amd64-qemuu-freebsd11-amd64 all_host_di_version 2020-02-10
+test-amd64-amd64-qemuu-freebsd12-amd64 all_host_di_version 2020-02-10
+test-amd64-amd64-qemuu-freebsd11-amd64 all_host_suite      stretch
+test-amd64-amd64-qemuu-freebsd12-amd64 all_host_suite      stretch
+test-amd64-amd64-qemuu-freebsd11-amd64 all_hostflags       arch-amd64,arch-xen-amd64,suite-stretch,purpose-test,freebsd-11
+test-amd64-amd64-qemuu-freebsd12-amd64 all_hostflags       arch-amd64,arch-xen-amd64,suite-stretch,purpose-test,freebsd-12
+test-amd64-amd64-qemuu-freebsd11-amd64 arch                amd64
+test-amd64-amd64-qemuu-freebsd12-amd64 arch                amd64
+test-amd64-amd64-qemuu-freebsd11-amd64 buildjob            build-amd64
+test-amd64-amd64-qemuu-freebsd12-amd64 buildjob            build-amd64
+test-amd64-amd64-qemuu-freebsd11-amd64 freebsd_arch        amd64
+test-amd64-amd64-qemuu-freebsd12-amd64 freebsd_arch        amd64
+test-amd64-amd64-qemuu-freebsd11-amd64 freebsd_image       FreeBSD-11.3-RELEASE-amd64.raw.xz
+test-amd64-amd64-qemuu-freebsd12-amd64 freebsd_image       FreeBSD-12.1-RELEASE-amd64.raw.xz
+test-amd64-amd64-qemuu-freebsd11-amd64 kernbuildjob        build-amd64-pvops
+test-amd64-amd64-qemuu-freebsd12-amd64 kernbuildjob        build-amd64-pvops
+test-amd64-amd64-qemuu-freebsd11-amd64 kernkind            pvops
+test-amd64-amd64-qemuu-freebsd12-amd64 kernkind            pvops
+test-amd64-amd64-qemuu-freebsd11-amd64 toolstack           xl
+test-amd64-amd64-qemuu-freebsd12-amd64 toolstack           xl
+test-amd64-amd64-qemuu-freebsd11-amd64 xenbuildjob         build-amd64
+test-amd64-amd64-qemuu-freebsd12-amd64 xenbuildjob         build-amd64

Note that only amd64 versions are tested at the moment, i386 had some
bugs that are being fixed so new releases can be tested.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agofreebsd10: refactor code to generate jobs
Roger Pau Monne [Thu, 28 May 2020 10:26:47 +0000 (11:26 +0100)]
freebsd10: refactor code to generate jobs

Slightly adjust the code to generate the freebsd10 jobs in order to
avoid exiting early from the function if the dom0 arch is different
than i386. No functional change expected, the freebsd10 jobs are still
limited to run on an i386 dom0. No runvar diff created as part of this
change.

This is a preparatory change for adding new FreeBSD 11 and 12 jobs
that will instead use an amd64 dom0.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoRevert "make-flight: Temporarily disable flaky test"
Roger Pau Monne [Thu, 16 Jul 2020 15:34:24 +0000 (16:34 +0100)]
Revert "make-flight: Temporarily disable flaky test"

This reverts commit c436ff754810c15e4d2a434257d1d07498883acb.

Now that XSA-321 has been released we can try to enable PVH dom0
tests again.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoAdd qemu-xen 4.14 branch
Ian Jackson [Mon, 13 Jul 2020 13:40:11 +0000 (14:40 +0100)]
Add qemu-xen 4.14 branch

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoAdd Xen 4.14 branch
Ian Jackson [Mon, 13 Jul 2020 13:39:04 +0000 (14:39 +0100)]
Add Xen 4.14 branch

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agomake-flight: Test Xen 4.9 and Xen 4.10 on stretch
Ian Jackson [Tue, 16 Jun 2020 16:42:59 +0000 (17:42 +0100)]
make-flight: Test Xen 4.9 and Xen 4.10 on stretch

Xen 4.9 doesn't build on buster and won't be fixed for that.
Xen 4.10's "-prev" migration tests also fail for the same reason.

There is a (smallish) risk that Debian will break stretch before Xen
4.10 goes completely out of support from the Xen Project.  If that
happens we could revert this - but then the 4.10 -prev jobs will stop
building.

Xen 4.9 is nearly out of security support, so for the 4.9 tests this
is a no-brainer.

I have checked the runvar diff.  The results are to change
  all_host_di_version [*]
  all_host_suite
  all_hostflags
  debian_suite
  debianhvm_suite
  host_hostflags
in many jobs in
  qemu-upstream-4.9-testing
  qemu-upstream-4.10-testing
  xen-4.9-testing
  xen-4.10-testing
[*] this is not visible in standalone-generate-dump-flight-runvars
because it always just uses `current'.

This command produces no output:
   diff -ub a <(perl -pe 's/stretch/buster/g' c)
(where `a' is before and `c' is after.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agostandalone: Do not complain about ssh if AP_FETCH_PLACEHOLDERS=y
Ian Jackson [Tue, 16 Jun 2020 15:36:28 +0000 (16:36 +0100)]
standalone: Do not complain about ssh if AP_FETCH_PLACEHOLDERS=y

In this case, there is no need to ssh anywhere.

No change other than in dev-debugging setups.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agostandalone-generate-dump-flight-runvars: mkdir -p logs
Ian Jackson [Tue, 16 Jun 2020 15:35:31 +0000 (16:35 +0100)]
standalone-generate-dump-flight-runvars: mkdir -p logs

Otherwise if logs doesn't exist, the code in `standalone' which is
eventually called to build each flight will try to do it - but that
code is not idempotent in the presence of other racing copies of
itself.

Rather than trusting mkdir -p there, do it here.

No change other than to this dev-debugging script.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agostandalone: Fix spurious ]
Ian Jackson [Tue, 16 Jun 2020 15:35:26 +0000 (16:35 +0100)]
standalone: Fix spurious ]

This looks like this was once a call to test(1).  ssh-add, as it
happens, seems to ignore this spuriuous `]' (!) so there isn't any
significant change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoproduction-config: Update to current coverity tools
Ian Jackson [Tue, 9 Jun 2020 15:30:48 +0000 (15:30 +0000)]
production-config: Update to current coverity tools

The 2017.07 tarball had a leading "./" but the 2019.03 one doesn't,
so we must change CoverityToolsStripComponents.

The old tools we are currently using do not work any more - they are
rejected by Coverity Scan.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reported-by: Matthew Krasnick <Matthew.Krasnick@synopsys.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <Andrew.Cooper3@citrix.com>
CC: Paul Durrant <xadimgnik@gmail.com>
4 years agobuster: Switch to Debian buster as the default suite
Ian Jackson [Tue, 24 Sep 2019 15:34:45 +0000 (16:34 +0100)]
buster: Switch to Debian buster as the default suite

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster 20_linux_xen: Only load policy in XSM-enabled builds
Ian Jackson [Wed, 27 May 2020 15:48:21 +0000 (16:48 +0100)]
buster 20_linux_xen: Only load policy in XSM-enabled builds

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosetupboot_grub2: Do not boot with XSM policy etc. unless xsm=1
Ian Jackson [Wed, 27 May 2020 15:42:27 +0000 (16:42 +0100)]
setupboot_grub2: Do not boot with XSM policy etc. unless xsm=1

This prevents us from passing an XSM policy file, and
`flask=enforcing', in supposedly-non-XSM tests.

These bootloader entries can appear because the Xen upstream build
ships XSM policy files by default even if XSM is disabled in the
hypervisor, causing update-grub to generate useless `XSM enabled'
entries.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosetupboot_grub2: Copy hv command line from grub to xen.cfg
Ian Jackson [Wed, 27 May 2020 15:16:52 +0000 (16:16 +0100)]
setupboot_grub2: Copy hv command line from grub to xen.cfg

This reuses all of the stuff that update-grub, etc., have put there.

In particular without this we never have flask=enforcing!

We have to do something about the ${xen_rm_opts} that appear in these
entries.  In principle there might be many variable expansions, but in
practice there is only this one It applies only to x86, and this use
of chainloading to xen.efi and reading xen.cfg applies only to arm64.
And anyway we weren't putting it these things in before.  So OK...

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosetupboot_grub2: Recognise --nounzip for initramfs
Ian Jackson [Wed, 27 May 2020 14:35:36 +0000 (15:35 +0100)]
setupboot_grub2: Recognise --nounzip for initramfs

Modern versions of update-grub like to add this.  We need to spot this
so that under EFI we generate the right things in xen.cfg.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosetupboot_grub2: Print line number of entry we are using
Ian Jackson [Wed, 27 May 2020 14:35:08 +0000 (15:35 +0100)]
setupboot_grub2: Print line number of entry we are using

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosetupboot_grub2: Insist on space after directives
Ian Jackson [Wed, 27 May 2020 14:34:26 +0000 (15:34 +0100)]
setupboot_grub2: Insist on space after directives

These parsing regexps were all wrong!

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: Install own linux-libc-dev package (!)
Ian Jackson [Thu, 21 May 2020 13:50:42 +0000 (14:50 +0100)]
buster: Install own linux-libc-dev package (!)

As reported here:
  https://patchew.org/QEMU/20200513120147.21443-1-f4bug@amsat.org/
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=960271
the kernel has broken the build of upstream qemu.  This made it
into a Debian stable kernel update.  This breaks our CI runs almost
completely, when they run with buster.

I spoke to the Debian kernel folks and apparently there is no intent
to fast-track a fix to this.  So instead I have made a kernel source
package with the patch from that bug report, and built the
linux-libc-dev package fromk it.  The source is here for the time
being:
  https://www.chiark.greenend.org.uk/~ijackson/quicksand/2020/libc-kernel-bug.960271/

Deployment note: the source and linux-libc-dev_*.deb are in the
images directory on osstest@test-lab.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoDebian.pm: Move standard_extradebs to ts-host-install
Ian Jackson [Thu, 21 May 2020 17:04:49 +0000 (18:04 +0100)]
Debian.pm: Move standard_extradebs to ts-host-install

This makes it effect builds on Debian, too.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoDebian.pm: Break out standard_extradebs
Ian Jackson [Thu, 21 May 2020 17:03:51 +0000 (18:03 +0100)]
Debian.pm: Break out standard_extradebs

Refactor this out of ts-xen-install.  We are going to run it in
ts-host-install.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agots-xen-install: Move some_extradebs to Debian.pm
Ian Jackson [Thu, 21 May 2020 17:00:33 +0000 (18:00 +0100)]
ts-xen-install: Move some_extradebs to Debian.pm

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agots-xen-install: Add $ho argument to some_extradebs
Ian Jackson [Thu, 21 May 2020 16:59:19 +0000 (17:59 +0100)]
ts-xen-install: Add $ho argument to some_extradebs

This is going to move to Debian.pm.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: Extend workaround for dhcpd EROFS bug
Ian Jackson [Tue, 14 Apr 2020 17:13:04 +0000 (18:13 +0100)]
buster: Extend workaround for dhcpd EROFS bug

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: setupboot_grub2: Handle missing policy file bug
Ian Jackson [Thu, 2 Apr 2020 17:52:32 +0000 (18:52 +0100)]
buster: setupboot_grub2: Handle missing policy file bug

This is a complex interaction between update-grub and the Xen build
system on ARM64.  Not sure exactly who to blame but since we have our
own 20_linux_xen bodge, let's wait until we don't.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: setupboot_grub2: Note what files exist in /boot
Ian Jackson [Thu, 2 Apr 2020 17:52:01 +0000 (18:52 +0100)]
buster: setupboot_grub2: Note what files exist in /boot

Nothing uses this yet.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: grub, arm64: extend chainloading workaround
Ian Jackson [Thu, 2 Apr 2020 16:45:47 +0000 (17:45 +0100)]
buster: grub, arm64: extend chainloading workaround

multiboot[2] isn't supported.

Also link to the bug report.

CC: Julien Grall <julien@xen.org>
CC: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: Provide TftpDiVersion
Ian Jackson [Tue, 24 Sep 2019 15:44:49 +0000 (16:44 +0100)]
buster: Provide TftpDiVersion

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: chiark-scripts: Install a new version on buster too
Ian Jackson [Fri, 20 Dec 2019 17:52:21 +0000 (17:52 +0000)]
buster: chiark-scripts: Install a new version on buster too

We need various fixes that are not in buster, sadly.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agooverlay-initrd-buster/sbin/reopen-console: Fix #932416
Ian Jackson [Mon, 23 Dec 2019 13:43:36 +0000 (13:43 +0000)]
overlay-initrd-buster/sbin/reopen-console: Fix #932416

This bug affects us.  Cherry pick the changes to the relevant file
from the commit in the upstream debian-installer repo:

  https://salsa.debian.org/installer-team/rootskel/commit/0ee43d05b83f8ef5a856f3282e002a111809cef9

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agooverlay-initrd-buster/sbin/reopen-console: Copy from Debian
Ian Jackson [Mon, 23 Dec 2019 13:42:45 +0000 (13:42 +0000)]
overlay-initrd-buster/sbin/reopen-console: Copy from Debian

We are going to patch this file to work around a bug, using the new
overlay mechanism.

The first step is to include the file in our overlay so we overwrite
it.  Currently, this is a no-op, so no functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agomg-debian-installer-update: support overlay-intramfs-SUITE
Ian Jackson [Mon, 23 Dec 2019 14:04:24 +0000 (14:04 +0000)]
mg-debian-installer-update: support overlay-intramfs-SUITE

This lets us patch the installer more easily.

No uses yet.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years ago20_linux_xen: Support Xen Security Modules (XSM/FLASK)
Ian Jackson [Tue, 19 May 2020 18:15:31 +0000 (19:15 +0100)]
20_linux_xen: Support Xen Security Modules (XSM/FLASK)

XSM is enabled by adding "flask=enforcing" as a Xen command line
argument, and providing the policy file as a grub module.

We make entries for both with and without XSM.  If XSM is not compiled
into Xen, then there are no policy files, so no change to the boot
options.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years ago20_linux_xen: Ignore xenpolicy and config files too
Ian Jackson [Tue, 19 May 2020 18:13:18 +0000 (19:13 +0100)]
20_linux_xen: Ignore xenpolicy and config files too

"file_is_not_sym" currently only checks for xen-syms.  Extend it to
disregard xenpolicy (XSM policy files) and files ending .config (which
are built by the Xen upstream build system in some configurations and
can therefore end up in /boot).

Rename the function accordingly, to "file_is_not_xen_garbage".

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years ago20_linux_xen: Adhoc template substitution
Ian Jackson [Tue, 19 May 2020 18:18:11 +0000 (19:18 +0100)]
20_linux_xen: Adhoc template substitution

This file is a template that various build-time variables get
substituted into.  Make thos substitutions by hand (actually, by
copying the values our file for stretch).  And rename the file.

So now we are using our file instead of the grub package's.  But it is
the same...

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years ago20_linux_xen: Copy Debian buster version into our initramfs area
Ian Jackson [Mon, 16 Dec 2019 16:40:42 +0000 (16:40 +0000)]
20_linux_xen: Copy Debian buster version into our initramfs area

This is from 41e42571ebc50fa351cd63ce40044946652c5c72 in Debian's grub
package.

We are going to want to modify this to support XSM/FLASK and cope with
upstream build outputs.

In this commit we dump the exact file contents across.  It's not
effective right now because of the ".in" extension.  In fact, the file
is a template.

At the time of writing I am trying to send our substantive changes
upstream via Debian's Gitlab:
  https://salsa.debian.org/grub-team/grub/-/merge_requests/18

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: Specify DebianImageFile_SUITE_ARCH
Ian Jackson [Fri, 13 Dec 2019 16:55:24 +0000 (16:55 +0000)]
buster: Specify DebianImageFile_SUITE_ARCH

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoHonour DebianImageFile_SUITE_ARCH
Ian Jackson [Fri, 13 Dec 2019 16:50:03 +0000 (16:50 +0000)]
Honour DebianImageFile_SUITE_ARCH

This lets us specify the whole filename, not just a version.
This is needed because for buster we are going to use
   debian-10.2.0-ARCH-xfce-CD-1.iso

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: Extend guest bootloader workaround
Ian Jackson [Fri, 13 Dec 2019 16:39:10 +0000 (16:39 +0000)]
buster: Extend guest bootloader workaround

CC: Julien Grall <julien@xen.org>
CC: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: Extend ARM clock workaround
Ian Jackson [Fri, 13 Dec 2019 16:38:18 +0000 (16:38 +0000)]
buster: Extend ARM clock workaround

CC: Julien Grall <julien@xen.org>
CC: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: ts-host-install: NTP not honoured bug remains
Ian Jackson [Mon, 30 Sep 2019 15:15:51 +0000 (16:15 +0100)]
buster: ts-host-install: NTP not honoured bug remains

Debian #778564 remains open.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: preseed partman-auto-lvm/guided_size
Ian Jackson [Fri, 27 Sep 2019 16:51:44 +0000 (17:51 +0100)]
buster: preseed partman-auto-lvm/guided_size

Otherwise we get this question:

  | You may use the whole volume group for guided partitioning, or part
  | of it.  [...]
  | Amount of volume group to use for guided partitioning:

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: Deinstall the "systemd" package
Ian Jackson [Fri, 27 Sep 2019 16:47:52 +0000 (17:47 +0100)]
buster: Deinstall the "systemd" package

This installs a pam rule which causes logins to hang.  It also seems
to cause some kind of udev wedge.

We are using sysvinit so this package is not desirable.  Empirically,
removing it makes the system work.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: ts-host-install: Extend net.ifnames workaround
Ian Jackson [Fri, 27 Sep 2019 16:46:27 +0000 (17:46 +0100)]
buster: ts-host-install: Extend net.ifnames workaround

Really we should fix this by making a .deb in Debian that we could
install.  But this is a longer-term project.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: Extend grub2 uefi no install workaround
Ian Jackson [Tue, 24 Sep 2019 15:52:45 +0000 (16:52 +0100)]
buster: Extend grub2 uefi no install workaround

src:grub2 is RFH in Debian, which is a contributory factor to these
patches in #789798 and #792547 languishing.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agobuster: make-hosts-flight: Add to possible suites for hosts flight
Ian Jackson [Tue, 5 Nov 2019 17:15:45 +0000 (17:15 +0000)]
buster: make-hosts-flight: Add to possible suites for hosts flight

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoHonour 'LinuxSerialConsole <suite>' host property
Ian Jackson [Tue, 17 Dec 2019 17:56:16 +0000 (17:56 +0000)]
Honour 'LinuxSerialConsole <suite>' host property

This works like LinuxSerialConsole.

I originally wrote this to try to work around #940028, where multiple
d-i autoinstalls run in parallel leading to hard-to-debug lossage!
Explicitly specing the console causes it to run only on that one.

However, it turns out that explicitly specifying the console does not
always work and a better fix is needed.  Nevertheless, having added
this feature it seems foolish to throw it away.

Currently there are no hosts with this property so no functiaonal
change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoDebian: Specify `priority=critical' rather than locale
Ian Jackson [Tue, 17 Dec 2019 17:57:32 +0000 (17:57 +0000)]
Debian: Specify `priority=critical' rather than locale

In buster, it appears that specifying locale on the command line is
not sufficient.  Rather than adding more things to the command line,
instead, just say `priority=critical', by defaulting $debconf_priority
to 'critical'.

I think this change should be fine for earlier suites too.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoDebian: preseed: use priority= alias
Ian Jackson [Thu, 7 May 2020 15:28:15 +0000 (16:28 +0100)]
Debian: preseed: use priority= alias

This marginally reduces command line clobber.  This alias has been
supported approximately forever.  (And this code is currently only
used when DebconfPriority is set, which it generally isn't.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agots-debian-di-install: Provide guest with more RAM
Ian Jackson [Thu, 19 Dec 2019 18:36:03 +0000 (18:36 +0000)]
ts-debian-di-install: Provide guest with more RAM

buster cannot boot in so little because its initramfs and kernel are
too large.  Bump it to 2G.

However, our armhf test nodes have very little RAM.  And the Debian
armhf does fit in them as a guest still, so use a smaller value there.

Keying this off the architecture rather than the available host memory
is better because you do need the bigger value precisely if you are
not using armhf, and this makes osstest less dependent on a completely
accurate and populated host properties database.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoDebian guests made with xen-tools: Write systemd random seed file
Ian Jackson [Thu, 28 May 2020 17:19:07 +0000 (18:19 +0100)]
Debian guests made with xen-tools: Write systemd random seed file

When the Debian guest is not made with d-i, we must still provide this
random seed file.  This can be done in ts-debian-fixup.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoBodge systemd random seed arrangements
Ian Jackson [Thu, 28 May 2020 17:18:06 +0000 (18:18 +0100)]
Bodge systemd random seed arrangements

systemd does not regard the contents of the random seed file as useful
for the purposes of placating the kernel's entropy tracker.  As a
result, the system hangs at boot waiting for entropy.

Fix this by providing a small program which can be used to load a seed
file into /dev/random and also call RNDADDTOENTCNT to add the
appropriate amount to the kernel's counter.

Arrange to run this program instead of
   /lib/systemd/systemd-random-seed load

With systemd the random seed file is in /var/lib/systemd/random-seed
rather than /var/lib/urandom/random-seed.

And, provide an initial contents of this file, via a d-i late_command.

Unfortunately we must hardcode the actual numerical value of
RNDADDTOENTCNT because we don't have a suitable compiler anywhere
nearby.  It seems to have the same value on i386, amd64, armhf and
arm64, our currently supported architectures.

Thanks to Colin Watson for pointers to the systemd random unit and
Matthew Vernon for instructions on overriding just ExecStart.

I think this change should be a no-op on non-systemd systems.

In principle this is a bug in Debian or in systemd, that ought to be
reported upstream.  However, it has been extensively discussed on
debian-devel and it does not seem that any improvement is likely.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agots-leak-check: Ignore buster's udevd too
Ian Jackson [Thu, 5 Dec 2019 17:02:18 +0000 (17:02 +0000)]
ts-leak-check: Ignore buster's udevd too

For reasons I don't propose to investigate, on buster udevd shows up
like this:

  2019-11-26 18:13:48 Z LEAKED [process 2633 /lib/systemd/systemd-udevd] process: root      2633  1555  0 18:10 ?        00:00:00 /lib/systemd/systemd-udevd

This does not match our suppression.  Add an additional suppression.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosetupboot_grub2: Drop $submenu variable
Ian Jackson [Thu, 5 Dec 2019 16:42:01 +0000 (16:42 +0000)]
setupboot_grub2: Drop $submenu variable

We really only used this to check how many levels deep in { we are.
That can be done by checking $#offsets, which is >0 if we are in a
submenu and not otherwise.  We lose the ability to report the start
line of the submenu, but that's OK.

But as a bonus, we no longer bomb out on nested submenus: previously
the first } would cause $submenu to be undef.  Now we pop from
@offsets and all is fine.

Nested submenus are present in Debian buster.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agodi_installcmdline_core: Pass locale on d-i command line
Ian Jackson [Thu, 5 Dec 2019 16:25:01 +0000 (16:25 +0000)]
di_installcmdline_core: Pass locale on d-i command line

In buster, d-i wants when setting up the network, ie before the
preseed is loaded.

We leave it in the preseed too because why not.

I think this change should be fine for older versions of Debian.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoBooting: Use `--' rather than `---' to introduce host cmdline
Ian Jackson [Tue, 1 Oct 2019 14:52:08 +0000 (15:52 +0100)]
Booting: Use `--' rather than `---' to introduce host cmdline

Because systemd did something obnoxious, the kernel retaliated in the
game of Core Wars by hiding all arguments before `--' from userspace.
So use `---' instead so that all the arguments remain visible.

This in some sense now applies to host installs a change we had
already made to Debian HVM guests.  See osstest#493b7395
  ts-debian-hvm-install: Use ---, and no longer duplicate $gconsole
and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=762007
  Kernel command line handling change breaks d-i user-params functionality

This change is fine for all non-ancient versions of Debian, so I have
not made it conditional.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoTestSupport: allow more time for apt
Ian Jackson [Tue, 10 Mar 2020 18:49:50 +0000 (18:49 +0000)]
TestSupport: allow more time for apt

Empirically some of these operations can take longer than 30s,
especially with a cold cache.

Note that because of host sharing and our on-host apt lock, the
timeout needs to be the same for every apt operation: a fast operation
could be blocked behind a slow one.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agolvcreate argments: pass --yes -Z y -W y
Ian Jackson [Thu, 5 Mar 2020 15:58:39 +0000 (15:58 +0000)]
lvcreate argments: pass --yes -Z y -W y

The documentation seesm to think this is the default but empirically
it isn't.  In our environment --yes is fine.

I have reported this to Debian as #953183.  Also vaguely related (and
discovered by me at the same time) is #953185.

This came up while trying to get things work on buster.  I don't know
what has changed.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agots-xen-build-prep: Install rsync
Ian Jackson [Tue, 1 Oct 2019 13:18:34 +0000 (14:18 +0100)]
ts-xen-build-prep: Install rsync

osstest uses this for transferring configuration, build artefacts, and
so on.

In Debian stretch and earlier, rsync happened to be pulled in by
something else.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agots-logs-capture: Cope if xl shutdown leaves domain running for a bit
Ian Jackson [Tue, 14 Apr 2020 15:05:20 +0000 (16:05 +0100)]
ts-logs-capture: Cope if xl shutdown leaves domain running for a bit

This seems mostly to affect buster but it could in principle affect
earlier releases too I think.

In principle it would be nice to fix this bug, and to have a proper
test for it, but a reliable test is hard and an unreliable one is not
useful.  So I guess we are going to have this workaround
indefinitely...

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agocs-bisection-step: Do not needlessly repro on tip
Ian Jackson [Thu, 4 Jun 2020 12:38:33 +0000 (13:38 +0100)]
cs-bisection-step: Do not needlessly repro on tip

If we were halfway through bisecting, we treat the incident failure as
the basis failure.  But our previous bisection results can count as
indications that things are really failing - we don't need to repro on
the very final commit.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agocs-bisection-step: need_repro: Support $consider_parents
Ian Jackson [Thu, 4 Jun 2020 12:37:19 +0000 (13:37 +0100)]
cs-bisection-step: need_repro: Support $consider_parents

This flag tells need_repro to look at parent commits of the indicated
rtuple node, as well as the node itself.  We walk up the tree.  If
there are multiple parents, we stop; likewise if we find any rtuple
which doesn't have the expected results.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agocs-bisection-step: need_repro: Provision for $xinfo
Ian Jackson [Thu, 4 Jun 2020 12:36:37 +0000 (13:36 +0100)]
cs-bisection-step: need_repro: Provision for $xinfo

This becomes part of the message but right now it is juse "".

So no functional change yet.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agocs-bisection-step: need_repro_sequence: Provide info to callback
Ian Jackson [Thu, 4 Jun 2020 12:35:36 +0000 (13:35 +0100)]
cs-bisection-step: need_repro_sequence: Provide info to callback

This will be used by the callback in a moment.

No functional change yet.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agocs-bisection-step: Do not insist on urls in main history search
Ian Jackson [Mon, 1 Jun 2020 11:31:02 +0000 (12:31 +0100)]
cs-bisection-step: Do not insist on urls in main history search

If a Xen build fails, but we are trying to bisect something involving
libvirt, the libvirt job does not really run.  It does not populate
the tree_<tree> values for its git submodules - that would involve
actually booking out a host and cloning it.

The effect is that xen build failures which occur somewhere in the
range of a libvirt bisection cause total failure (actually, looping
bisection) rather than treating the build failure as `blocked'.

Fix this by tolerating trees with missing urls - but only during the
main history search.  Most of the rest of the time we need the urls,
mainly because we are going to feed them to adhoc-revtuple-generator
and mention them in our output.

It could now happen that trees appear in the main bisection history
which weren't in our bases.  These end up being ignored by
flight_rtuple.  This is not ideal but it will do for now.  In any case
that aspect is no worse than before.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agocs-bisection-step: Provide no-urls variant of the main query
Ian Jackson [Mon, 1 Jun 2020 12:19:48 +0000 (13:19 +0100)]
cs-bisection-step: Provide no-urls variant of the main query

This variant just returns '' for urls.  Unlike the with-urls variant,
it does not ignore trees without urls.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agocs-bisection-step: flight_rmap Disassemble the revisions query
Ian Jackson [Mon, 1 Jun 2020 11:50:29 +0000 (12:50 +0100)]
cs-bisection-step: flight_rmap Disassemble the revisions query

Break out various pieces that we are going to need to reuse for the
other version of this query (which won't have the url join).

Also, rather than retrieving the `tree_<tree>' runvar and calculating
the tree name from that, use the `[built_]revision_<tree>' runvar from
rev.

No overall functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agocs-bisection-step: Change some url. references to job.
Ian Jackson [Mon, 1 Jun 2020 11:35:01 +0000 (12:35 +0100)]
cs-bisection-step: Change some url. references to job.

This query is going to turn into two variants, one of which doesn't
have the url join.

In the output, prefer to refer to fields from job.  They are
constrained to be equal (and they are not null) so this has no
functional change.

Also swap the conditions over for clarity.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>