summaryrefslogtreecommitdiff
path: root/tests/database.scm
Commit message (Collapse)AuthorAge
* database: Make 'db-add-derivation' idempotent.Ludovic Courtès2018-02-14
| | | | | | | | * src/cuirass/database.scm (db-add-derivation): Catch 'sqlite-error and handle SQLITE_CONSTRAINT_PRIMARYKEY. (SQLITE_CONSTRAINT_UNIQUE): New variable. * tests/database.scm ("database")["db-add-derivation"]: Add extra call to 'db-add-derivation'.
* database: Use argument binding in 'db-get-builds' queries.Ludovic Courtès2018-02-08
| | | | | | | | | That makes it safe from SQL injection. * src/cuirass/database.scm (db-get-builds): Rewrite to use question marks in SQL queries and binding through '%sqlite-exec'. * tests/database.scm ("database")["db-get-builds"]: Exercise 'WHERE' clauses.
* database: 'db-update-build-status!' keeps stoptime unchanged when nothing new.Ludovic Courtès2018-02-08
| | | | | | | * src/cuirass/database.scm (db-update-build-status!): And "AND status != ?" in SQL queries. * tests/database.scm ("database")["db-update-build-status!"]: Add call to 'db-update-build-status!'.
* database: Use 'sqlite-bind' to avoid SQL injection.Danny Milosavljevic2018-02-08
| | | | | | | | | | | | | | | | | | | * src/cuirass/database.scm (%sqlite-exec): Remove. (sqlite-exec): Turn back into a procedure. Use 'sqlite-bind'. Add 'normalize' procedure and use it. (db-add-specification, db-add-derivation, db-get-derivation) (db-add-evaluation, db-add-build, db-update-build-status!) (db-get-build, db-get-stamp, db-add-stamp): Use question marks in SQL queries. * src/cuirass/base.scm (build-packages)[register]: Make #:log non-false. * tests/database.scm (make-dummy-job): Add #:job-name, #:system, #:nix-name, and #:eval-id. This is necessary because 'sqlite-bind' would now translate #f to a real NULL (before it would translate to the string "#f"...), and would thus report violations of the non-NULL constraint. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* database: 'db-update-build-status!' takes a #:log-file parameter.Ludovic Courtès2018-01-24
| | | | | | * src/cuirass/database.scm (sqlite-exec): Use (ice-9 format). (db-update-build-status!): Add #:log-file parameter and honor it. * tests/database.scm ("database")["db-update-build-status!"]: Test it.
* database: Add 'db-update-build-status!'.Ludovic Courtès2018-01-23
| | | | | | | | | * src/cuirass/database.scm (build-status): Add 'scheduled' and 'started'. (db-add-build): Make sure #:timestamp, #:starttime, #:stoptime, and #:status are integers. (db-update-build-status!): New procedure. * tests/database.scm ("database")["db-update-build-status!"]: New test.
* tests: Fix malformed Emacs local variable line.Ludovic Courtès2018-01-23
| | | | * tests/database.scm: Add missing "eval:".
* database: Extend and test 'db-get-builds'.Ludovic Courtès2018-01-07
| | | | | | | | | | * src/cuirass/database.scm (db-get-builds): Make 'order' a separate filter. Add 'format-limit-clause'. Reverse OUTPUTS. * tests/database.scm (make-dummy-eval, make-dummy-derivation) (make-dummy-build): New procedures. (with-temporary-database): New macro. ("database"): Use 'make-dummy-build'. ("db-get-builds"): New test.
* cuirass: Store new information in database to prepare new HTTP APIMathieu Othacehe2017-09-08
| | | | | | | | | | | | | | | | | | | | | integration. * bin/evaluate.in (fill-job): New procedure. (main): Use it to fill informations (nix-name, system) that will later be added to database. * doc/cuirass.texi (Database)[Derivation]: Add system and nix_name fields. (Database)[Builds]: Add id, status, timestamp, starttime and stoptime fields. Remove output field. (Database)[Outputs]: New table describing the build outputs. * src/cuirass/base.scm (build-packages): Add new fields to build object before adding it to database. * src/cuirass/database.scm (db-get-build, db-get-builds): New procedures to get a build by id from database and a list of builds using filter parameters respectively. * src/schema.sql (Outputs) : New table. (Derivations): Add system and nix_name columns. (Builds): Remove output column and add id, status, timestamp, starttime and stoptime columns.
* database: 'db-add-build' is now idempotent.Ludovic Courtès2017-08-26
| | | | | | | | | | | Fixes <https://bugs.gnu.org/28094>. Reported by Ricardo Wurmus <rekado@elephly.net>. * src/cuirass/database.scm (SQLITE_CONSTRAINT) (SQLITE_CONSTRAINT_PRIMARYKEY): New variables. (db-add-build): Catch 'sqlite-error, and swallow SQLITE_CONSTRAINT_PRIMARYKEY errors. * tests/database.scm ("db-add-build"): New test.
* db: Forbid inserting the same specification twice.Mathieu Lirzin2016-11-17
| | | | | | | | * src/schema.sql (Specifications): Make 'repo_name' the primary key. (Stamps, Evaluations): Adapt. * src/cuirass/database.scm (db-get-specifications): Likewise. (db-add-specification): Ignore if SPEC has already been added. * tests/database.scm (example-spec): Adapt.
* base: Support tracking of a Guix package's git.Jan Nieuwenhuizen2016-09-23
| | | | | | | | | | * src/schema.sql (Specifications): Add no_compile_p column. * src/cuirass/database.scm (db-add-specification) (db-get-specifications): Handle #:no-compile? property. * tests/database.scm (example-spec): Adapt. * src/cuirass/base.scm (process-specs): Skip compilation if #:no-compile?. Signed-off-by: Mathieu Lirzin <mthl@gnu.org>
* tests: database: Use 'test-group-cleanup'.Mathieu Lirzin2016-08-28
| | | | * tests/database.scm: Use 'test-group-cleanup'.
* schema: Evaluations: Add 'revision' column.Mathieu Lirzin2016-07-30
| | | | | | * src/schema.sql (Evaluations): Add 'revision' column. * src/cuirass/database.scm (db-add-evaluation): Adapt. All callers changed.
* tests: Add missing test group statements.Mathieu Lirzin2016-07-27
| | | | | | | * tests/base.scm: Add missing 'test-begin' and 'test-end'. * tests/database.scm: Likewise. * tests/ui.scm: Likewise. * tests/utils.scm: Likewise.
* schema: Separate "Derivations" from "Evaluations".Mathieu Lirzin2016-07-27
| | | | | | | | | | | | | * src/schema.sql (Derivations): New table. (Evaluations): Remove 'derivation' and 'job_name' columns. Add 'id' column. * src/cuirass/database.scm (db-add-evaluation): Adapt. (db-get-derivation, db-add-derivation): New procedures. (evaluation-exists?, db-get-evaluation): Delete. * bin/evaluate.in (main): Adapt. * tests/database.scm ("sqlite-exec"): Likewise. ("db-add-derivation", "db-get-derivation"): New tests. ("db-add-evaluation", "db-get-evaluation"): Delete.
* database: Remove "db-add-build-log" test.Mathieu Lirzin2016-07-27
| | | | * tests/database/scm ("db-add-build-log"): Delete.
* cuirass: Use database to store specifications.Mathieu Lirzin2016-07-25
|
* schema: Separate 'Evaluations' from 'Builds'.Mathieu Lirzin2016-07-25
| | | | Adapt src/cuirass/database.scm and its tests.
* database: sqlite-exec: Return every rows.Mathieu Lirzin2016-07-25
| | | | Export it. Add a test.
* Remove unnecessary (cuirass job) module.Mathieu Lirzin2016-07-13
|
* Evaluate derivations in a separate process.Mathieu Lirzin2016-07-13
| | | | | This fixes a bug where different Guix branches gave the same derivations.
* Store build logs in the database.Mathieu Lirzin2016-06-29
|
* Fix temporary database location.Mathieu Lirzin2016-06-26
| | | | Don't create it in 'srcdir' to please 'make distcheck'.
* Make %package-database a parameter object.Mathieu Lirzin2016-06-26
| | | | Move it to (cuirass database).
* Add (cuirass database) module.Mathieu Lirzin2016-06-26