Skip to content

Fixes to workflow and precompilation#77

Merged
JKRT merged 16 commits into
OpenModelica:masterfrom
JKRT:dev-fix
Jun 28, 2026
Merged

Fixes to workflow and precompilation#77
JKRT merged 16 commits into
OpenModelica:masterfrom
JKRT:dev-fix

Conversation

@JKRT

@JKRT JKRT commented Jun 24, 2026

Copy link
Copy Markdown
Member

Attempting to fix the slow precompilation issue on windows

JKRT and others added 11 commits June 16, 2026 11:46
…s Spice3 in_c)

Algorithmic Modelica function bodies kept a record used as a whole value as a bare
symbol, so a record copy / call argument / return / field-index referenced an
undeclared symbol (e.g. `in_c` in the Spice3 MOSFET functions), failing the
in-backend structural_simplify build. Scalarise every record use onto the
flattened `<base>_<field>` symbols (the naming flattenRecordInput already emits):

  - whole-record copy  lhs := rhs        -> per-field assignments
  - record call argument               -> splat into its flat field symbols
  - record-valued call assignment      -> scatter the flat-tuple return
  - record cref indexed by a constant  -> the kth flat field symbol

All four Spice3 examples (Inverter, Nor, Nand, FourInverters) now build via the
in-backend structural_simplify path (previously they fell back). Detection is
fully structural (cref/type pattern-matching, no string parsing); helpers carry
strict argument types and signature docstrings.

LRT green (289 pass / 0 fail / 6 broken) with this change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Three test-only fixes for type mismatches against production:
- mock stringToSimVarHT used Tuple{Integer, SimVar}; SIM_CODE requires
  Tuple{Int, SimVar} (backendTestMocks.jl, simCodeTraverseTests.jl)
- mkWhenEq passed nothing for the attr field added to WHEN_EQUATION;
  use EQ_ATTR_DEFAULT_UNKNOWN (runtests.jl)

Suite: 228/228 pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.40%. Comparing base (48757b0) to head (fdbccf4).
⚠️ Report is 27 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #77      +/-   ##
==========================================
- Coverage   24.78%   21.40%   -3.38%     
==========================================
  Files          28       44      +16     
  Lines        3430    21213   +17783     
==========================================
+ Hits          850     4541    +3691     
- Misses       2580    16672   +14092     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

JKRT and others added 5 commits June 24, 2026 20:10
On Windows the umbrella precompile/load failed with
  could not load library "...\artifacts\...\libgio-2.0-0.dll"
  The specified procedure could not be found.
(and a blocking Windows error popup).

Root cause: OMRuntimeExternalC loads its own bundled mingw libintl-8.dll /
libiconv-2.dll into the process. If that happens before Glib is loaded, Glib's
libgio-2.0-0.dll binds against the older gettext runtime and fails to resolve an
entry point. It is order-dependent (so it appeared intermittent) and Windows-only
(Linux resolves each library against its own RPATH).

Fix: import Plots at the top of the OMBackend module, before the includes that pull
in OMRuntimeExternalC, so Glib's gettext wins the libintl-8.dll name first;
OMRuntimeExternalC tolerates the newer runtime. Verified: full OM.jl umbrella now
precompiles (exit 0) and `using OM` loads on Windows + Julia 1.12.6.

Co-authored-by: JKRT <jtinnerholm@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
…anging

The Windows CI test job hung silently for the full 90-minute timeout: the build
precompiled fine, but `Run tests` emitted "Running tests..." and then nothing.
That signature is a blocking modal dialog (Windows Error Reporting) from a failed
DLL load or a segfault in an external Modelica C function (the ModelicaCallbacks
shim is unavailable on Windows) — the headless runner can't dismiss it, so the job
stalls until it is cancelled.

Call SetErrorMode(0x8003) at the very top of runtests.jl on Windows so such a
failure surfaces as a visible crash/error in the log instead of an invisible hang.
This is also diagnostic: the next run will show the actual failing test rather than
timing out in silence.

Co-authored-by: JKRT <jtinnerholm@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
The Windows build precompiles fine, but `using OMBackend` in the test process
still failed to load Glib's libgio-2.0-0.dll. The in-module `import Plots` fixes
the order at precompile time, but the package __init__ order when LOADING the
precompiled OMBackend is not guaranteed, so on the CI runner OMRuntimeExternalC's
bundled libintl-8.dll loaded first and broke Glib.

Preload Plots at the very top of runtests.jl (the test entry script runs in
order), before `using OMBackend`, so Glib's gettext is resident before
OMRuntimeExternalC loads. Could not reproduce locally (the __init__ order happens
to work here), so this is verified on CI.

Co-authored-by: JKRT <jtinnerholm@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@JKRT JKRT merged commit c08c171 into OpenModelica:master Jun 28, 2026
5 of 7 checks passed
SVAGEN26 added a commit to SVAGEN26/OMBackend.jl that referenced this pull request Jul 2, 2026
Rebuilt on current master (the previous branch was based on a pre-dev-fix
OMBackend, so master's src — including the new src/precompile.jl from OpenModelica#77 — was
never brought to standard, and the license check failed on the merge).

- .github/workflows/check-license.yml: runs check_julia_license.py on src per PR.
- .CI/scripts/check_julia_license.py: the checker (Julia #= =# headers, OSMC-PL 1.8
  + current year), plus julia-license-exceptions.txt.
- .gitignore: negate /.CI/ (the `/.*` rule was silently excluding it).
- Bring all 51 src/*.jl to the OSMC-PL 1.8 header (was a mix of missing and 1.2).
  src/CodeGeneration/mtkExternals.jl is excluded — vendored MIT ModelingToolkit
  code — and left untouched.

Verified: check_julia_license.py --summary src -> PASSED (51 checked, 1 skipped).
All modified .jl files still parse under Julia 1.12.

Co-authored-by: JKRT <jtinnerholm@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants