SummaryRefsLogTreeCommitDiffStats
path: root/tests/base.scm
Commit message (Expand)AuthorAgeFilesLines
* Give mcron --log option to turn logging on....This makes the behaviour backwards compatible with all previous uses of mcron. * src/mcron/base.scm: establish %do-logging parameter and act on it * src/mcron/scripts/mcron.scm: set %do-logging according to command line * tests/base.scm: some tests require %do-logging to be set Dale Mellor2022-07-071-8/+10
* base: Annotate output with job information....Before this change, it was difficult to discern which job emitted which output, as there was no information connecting the job to the output it produced. This change rectifies that by annotating each line output by cron/mcron with a prefix that contains a timestamp and the job name. It also reports about when the job runs and whether it completed successfully or failed. It was initially suggested here: <https://issues.guix.gnu.org/36510>. Thanks to the fine people from the #guile libera.chat IRC channel for providing ideas and help; this change would not have been possible without them! * src/mcron/base.scm (install-suspendable-ports!): Install suspendable ports. (%date-format, %log-format): New parameters. (validate-date-format, validate-log-format): New procedures. (<job-data>): New record. (run-job): Update doc. Redirect stdout and stderr to a pipe. Return a <job-data> instance containing the input port and other information about the job. Output job status messages. (process-output): New procedure. (child-cleanup): Add docstring. Use positive logic. Call 'process-output' one last time after a child process is collected. (run-job-loop): Add a CHILDREN-DATA variable to the loop. Provide the open file descriptors of the children ports to select*, and collect their output when they trigger select. * tests/base.scm ("run-job: basic"): Adjust and fix indentation. (dummy-job/capture-output): New procedure. ("run-job, output"): New test. ("validate-date-format, valid", "validate-date-format, invalid") ("validate-log-format, valid", "validate-log-format, invalid") ("run-job, output with custom format", "run-job, failure") ("run-job, failure in shell action"): New tests. * src/mcron/scripts/cron.scm (show-help): Document new options. (%options) [log-format, date-format]: New options. (main): Parameterize the main loop with the new parameter options (or their default values when not provided); move exception handling elsewhere (see below). * src/mcron/scripts/mcron.scm: Likewise. * src/cron.in: Install error handler here. * src/mcron.in: Likewise. * doc/mcron.texi: Document new cron and mcron options, as well as new (mcron base) APIs. * tests/basic.sh: Test the new options. Suggested-by: Robert Vollmert <rob@vllmrt.net> Maxim Cournoyer2022-07-071-14/+92
* base: Check how child processes are handled...* tests/base.scm ("run-job: basic"): Check the number of children too. ("child-cleanup: one", "update-number-children!: set value"): New tests. Mathieu Lirzin2018-03-261-6/+23
* tests: Remove unused schedule stubs...* tests/base.scm ("number-children: init") ("update-number-children!: 1+", "update-number-children!: 1-"): Remove 'let' form defining the schedule stub. Mathieu Lirzin2018-03-241-13/+12
* base: Check 'run-job'...* tests/base.scm ("run-job: basic"): New test. Mathieu Lirzin2018-03-241-0/+16
* base: Box 'number-children'...* src/mcron/base.scm (number-children): Box it using SRFI-111 to be explicit about the mutability of this object. (update-number-children!): New procedure. (run-job, child-cleanup): Use it. * tests/base.scm ("update-number-children!: 1+") ("number-children: init", "update-number-children!: 1-"): New tests. Mathieu Lirzin2018-03-241-0/+32
* tests: Add "tests/base.scm"...* tests/base.scm: New test. * Makefile.am (TESTS): Add it. Mathieu Lirzin2018-03-241-0/+151