onnxruntime
db840429 - Add model-ingestion error-path tests for InferenceSession (#29558)

Commit
26 days ago
Add model-ingestion error-path tests for InferenceSession (#29558) ### Description Extends error-path / negative test coverage for `InferenceSession` model ingestion (continuation of the audit's "thin error-path coverage" finding). Adds two tests to `inference_session_test.cc`: - **`LoadModelTwiceReturnsError`** — a second `Load()` on a session that already holds a model must be rejected with `MODEL_LOADED` ("This session already contains a loaded model"). - **`LoadInvalidGraphReturnsError`** — a model whose only node consumes an input that is never defined (not a graph input, initializer, or another node's output) is constructed via the ONNX proto API, serialized, and loaded. Graph `Resolve` must reject it gracefully (error at `Load` or `Initialize`) rather than crash or silently accept it. ### Motivation and Context Failure/validation paths are under-tested relative to the numeric happy-path bulk. These cover the double-load guard and the graph-resolve rejection path for a malformed graph. ### Verification Built `onnxruntime_test_all` (Release, CPU) and ran both tests locally — both pass: ``` [ OK ] InferenceSessionTests.LoadModelTwiceReturnsError [ OK ] InferenceSessionTests.LoadInvalidGraphReturnsError [ PASSED ] 2 tests. ``` Co-authored-by: Gopalakrishnan Nallasamy <gopalakrishnan.nallasamy@microsoft.com>
Parents
Loading