-
Notifications
You must be signed in to change notification settings - Fork 1
Reintroduce tests #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,35 @@ | ||
| # Regular Expression for Parsing R CMD check checks | ||
| # nolint start, styler: off | ||
| RE_CHECK <- paste0( | ||
| "(?<=^|\n)", # starts on a new line (or start of string) | ||
| "\\* checking ", # literal "* checking " | ||
| "(?<check>.*?)", # capture any check content as "check" | ||
| " \\.\\.\\.", # until literal "..." | ||
| "(?:", # ignore additional check details: | ||
| "[\\s\\*]{2,}", # any content starting with two or more of spaces or "*" | ||
| ".*?(?:\n|$)", # until a newline (or end of string) | ||
| ")*", # repeating until | ||
| "(?<status>.*?)", # capturing a status as "status" | ||
| "(?=\n|$)" # terminated by a new line (or end of string) | ||
| "(?<=^|\\n)", # must start at beginning of string OR right after a newline | ||
| "\\* checking ", # literal "* checking " | ||
| "(?<check>.*?)", # capture check name/content (non-greedy) as "check" | ||
| " \\.\\.\\.", # followed by literal " ..." | ||
| "(?:", # zero or more "detail" lines that belong to this check | ||
| "\\n[ \\t]*(?=\\n)", # a blank line (newline + optional spaces/tabs + next newline) | ||
| "|", | ||
| "\\n", # or: a normal detail line starting on the next line | ||
| "(?:[ \\t]{2,}", # either indented (2+ spaces/tabs) | ||
| "|\\*(?! (?:DONE|checking )))", # or a '*' line that is NOT "* DONE" and NOT "* checking ..." | ||
| "[^\\n]*(?:\\n|$)", # consume the rest of that detail line (to newline/end) | ||
| ")*", | ||
| "[ \\t]*", # allow extra spaces/tabs after "..." on the SAME line | ||
| "(?:", # position the engine right before a status token if one exists | ||
| # Case 1: status token is on the current line (possibly preceded by comment text) | ||
| "(?:[^\\n]*[ \\t]+)?(?=(?:[A-Z]{2}[A-Z0-9_-]*)\\s*(?:\\n|$))", | ||
| "|", | ||
| # Case 2: status token is on the next line: | ||
| # consume remainder of current line + newline + optional indent, | ||
| # but only if the next thing is a status token at end-of-line | ||
| "[^\\n]*\\n[ \\t]*(?=(?:[A-Z]{2}[A-Z0-9_-]*)\\s*(?:\\n|$))", | ||
| "|", | ||
| # Case 3: no status token (eat remainder/comment and stop here) | ||
| "[^\\n]*", | ||
| ")", | ||
| "(?<status>(?:[A-Z]{2}[A-Z0-9_-]*)|)", # capture status token, or capture empty string if absent | ||
| "(?=\\s*(?:\\n|$))" # must end at newline/end (allow trailing whitespace) | ||
| ) | ||
|
|
||
| # nolint end, styler: on | ||
|
|
||
| #' @importFrom R6 R6Class | ||
|
|
@@ -46,9 +64,17 @@ check_process <- R6::R6Class( | |
| if (!self$is_alive()) callback(self) | ||
| }, | ||
| finish = function() { | ||
| self$poll_output() | ||
| self$save_results() | ||
| if (is.function(f <- private$finish_callback)) f(self) | ||
| # self$checks active binding calls poll_output so there is not need | ||
| # to call it explicitly | ||
| checks <- self$checks | ||
| # In some cases, check subprocess might suffer from a race condition, when | ||
| # process itself finished, but the final results of the last subcheck | ||
| # are not yet available to parse. Therefore we allow the process to | ||
| # finalize only if the last subcheck has reported status. | ||
| if (checks[length(checks)] != "") { | ||
| self$save_results() | ||
| if (is.function(f <- private$finish_callback)) f(self) | ||
| } | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As the comments say, we had a race condition in our reported, and in some cases, the finisher (and thus parsing results to the file) was called before the process object consumed the output from the subprocess stream. In such cases, the serialized rcmdcheck file did not include test results (or more broadly, the last subcheck in the rcmd check). That's why we now make sure that the last subcheck was properly consumed by the process object, before we serialize the entire output. That also spawned some problems with the regexp, described above, because in fact the subchecks parsing mechanism was, in some cases, mismatching, but they are also fixed in this PR. |
||
| }, | ||
| get_time_last_check_start = function() { | ||
| private$time_last_check_start | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,19 @@ | ||
| #' @export | ||
| report_start_setup.NULL <- function(...) {} | ||
|
|
||
| #' @export | ||
| report_start_checks.NULL <- function(...) {} | ||
|
|
||
| #' @export | ||
| report_finalize.NULL <- function(...) {} | ||
|
|
||
| #' @export | ||
| report_status.NULL <- function(...) {} | ||
|
|
||
| #' @export | ||
| report_finalize.NULL <- function(...) {} | ||
|
|
||
| #' @export | ||
| report_step.NULL <- function(reporter, checker) { | ||
| checker$start_next_task() >= 0 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -227,7 +227,6 @@ filter_results <- function(x, keep, ...) { | |
| } else { | ||
| x | ||
| } | ||
|
|
||
| } | ||
|
|
||
| count <- function(d, ...) { | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous regexp did not match the status of the test in certain edge cases. Especially where some additional content (like a description of which test file is run). The other problem was that the output passed to this regexp is a stream, and depending on when that stream was consumed, the output could not have the expected form. Therefore, now we have that monstrosity, which however should be roboutes to any variations on that stream