Run the library testing on a pull request (#307) - #324
Merged
adrpo merged 1 commit intoAug 24, 2026
Conversation
The library testing runs against a branch and says what broke after a change was merged. This tests a pull request before that, and compares it against master. The compiler is built from refs/pull/<N>/merge - the pull request as it would land, not the branch on its own - fetched from GitHub itself, since refs/pull/* is not on the read-only mirror the job clones. It is checked out detached, so nothing is left in the shared workspace for the next run to trip over. The run fills a pr-<N> table like any other branch, which the shared database of OpenModelica#295 makes cheap: the claim is (branch, libname), so it cannot collide with a master run, and the results carry their own omcversion, so nothing else can reuse them by mistake. What did not exist is the comparison. all-reports.py reports a branch against its own previous run, which is exactly what a pull request must not do, and its query reads one table. pr-report.py takes the newest run of pr-<N> and the newest run of the baseline branch and compares them with the same rule and the same thresholds: the phase each model reached, and what each phase cost. Per library it compares the newest run each side has of it, because a run does not necessarily hold every library - one whose version, compiler and configuration were tested before keeps the results of the run that produced them. It writes the report next to the nightly ones, in history/pr-<N>/<baseline run>..<pull request run>.html, and a summary to comment on the pull request with beside it. Two things would make a difference mean something other than "the pull request did this", and the report says so when they apply: - the machine, since two runs produced on different hardware compare the hardware as much as the change. The parameter defaults to the node that produces the master runs, and the report names both machines, which OpenModelica#320 records per library; - the libraries, since two runs that tested different library versions, or verified against different reference files, differ for reasons of their own. The models one run has and the other does not are counted and listed rather than quietly left out of the comparison, since a library that failed to load looks like nothing at all otherwise. In Jenkins it is the pull_request parameter, with pull_request_baseline, pull_request_config and pull_request_node beside it. A full run takes days, so this is on demand and takes a configuration file: testing every pull request is not the idea. The tables accumulate, roughly 19500 rows each, and unlike a branch a pull request is tested once and never again. drop-pr-tables.py drops the tables of pull requests that have been merged or closed, and of those tested more than --older-than days ago, together with the rows their runs left in the other tables; it lists them and does nothing unless it is given --yes. The reports published for them are not touched. It is the drop_stale_pull_request_tables parameter in Jenkins, and the same stage keeps the per-pull-request omc builds on the test node from piling up. --- Generated by Claude Code.
This was referenced Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #307 (the testing side of it; the reports are pages, not comments - see
the open question at the end).
The library testing runs against a branch and tells us what broke after a
change was merged. This tests a pull request before that, against
master.Building the pull request
refs/pull/<N>/mergerather than/head: the question is what happens once itis merged, not what the branch looks like on its own. It is fetched from GitHub
itself, because
refs/pull/*is not on the read-only mirror the job clones, andchecked out detached so that nothing is left behind in the shared workspace for
the next run to trip over. A pull request GitHub cannot merge has no such ref,
and the job says so instead of failing obscurely.
The run fills a
pr-<N>table like any other branch, which the shared databaseof #295 makes cheap: the claim is
(branch, libname), so it cannot collide witha
masterrun, and the results carry their ownomcversion, so nothing else canreuse them by mistake.
The comparison, which did not exist
all-reports.pyreports a branch against its own previous run - what a pullrequest must not do - and its query reads one table.
pr-report.pytakes thenewest run of
pr-<N>and the newest run of the baseline branch and comparesthem with the same rule and the same thresholds as the nightly reports: the phase
each model reached, and what each phase cost.
Per library it compares the newest run each side has of that library, not the
two run dates: a run does not necessarily hold every library, since one whose
version, compiler and configuration were tested before keeps the results of the
run that produced them.
It writes
history/pr-<N>/<baseline run>..<pull request run>.htmlnext to thenightly reports, and
00_comment.mdbeside it - the same summary as markdown, tocomment on the pull request with. Both are published with everything else.
Two ways to be wrong, which the report says out loud
as much as the change.
pull_request_nodedefaults to the node that producesthe
masterruns, and the report names the machines of both runs, which Record the machine that produced each library's results #320records per library.
against different reference files, differ for reasons of their own; those
libraries are listed.
The baseline being the newest
masterrun rather than the commit the pullrequest is based on is stated in the report itself.
Models that one run has and the other does not are counted and listed rather than
quietly dropped from the comparison: a library that failed to load looks like
nothing at all otherwise.
In Jenkins
pull_requestpull_request_baselinemasterpull_request_configconfigs/conf.jsonpull_request_nodedrop_stale_pull_request_tablesA full run takes days, so this is on demand and takes a configuration file:
testing every pull request this way is not the idea. The pull request report is
its own stage - regenerating every overview for a job that tested one thing would
take longer than the report.
Housekeeping
The tables accumulate, roughly 19500 rows each, and unlike a branch a pull
request is tested once and never again.
drop-pr-tables.pydrops the tables ofpull requests that have been merged or closed, and of those tested more than
--older-thandays ago (60 by default), together with the rows their runs leftin
omcversion,libversion,historyandjob_claim. It lists them and doesnothing unless it is given
--yes; the reports published for them are nottouched. The same stage removes the per-pull-request
omcbuilds left in~/saved_omcon the test node.Tested
pr-report.pyagainst a sqlite database holding amasterrun and apr-1234run built from it:
Verify -> Failedhostcolumn)drop-pr-tables.pyagainst the same database, with the tables renamed to amerged pull request (16357) and an open one tested 100 days ago (15703): both
selected for the right reason, listed without
--yes, and dropped with it,including their rows in the other tables. A pull request that does not exist is
left alone.
The
Jenkinsfilechanges could not be run from here.The open question from the issue: both
The report is a page under
branches/history/pr-<N>/, and the summary isposted as a comment on the pull request when
--commentis given. It replacesthe comment an earlier run of the same pull request left rather than adding to a
pile - it recognises its own by a marker in the body - and it posts as whoever
the token belongs to:
GITHUB_TOKENorGH_TOKENin the environment, or theaccount
ghis logged in as, which is how it can berun by hand.
In Jenkins it is the
pull_request_commentparameter, taking the token from agithub-tokencredential. The credential is bound where it is used rather thanfor the stage, so a job that does not ask for a comment runs whether one is
configured or not.
Verified against a throwaway pull request in a fork,
adrpo/OpenModelicaLibraryTesting#1:
the first run posted the summary, the second updated the same comment rather
than posting a second one, a bad token fails loudly after the report has been
written, and no token at all is not an error - it says where the summary is.
Generated by Claude Code.