From 9b20e7debbc4a9ca8f529f0f8aa53593d0631993 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 12 Aug 2022 10:49:57 +0200 Subject: [PATCH] QA eeschema tests: avoid crash if spice code models are not found. --- qa/unittests/eeschema/test_netlist_exporter_spice.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qa/unittests/eeschema/test_netlist_exporter_spice.cpp b/qa/unittests/eeschema/test_netlist_exporter_spice.cpp index 3faebe785c..7f19e265d4 100644 --- a/qa/unittests/eeschema/test_netlist_exporter_spice.cpp +++ b/qa/unittests/eeschema/test_netlist_exporter_spice.cpp @@ -120,6 +120,14 @@ public: BOOST_REQUIRE( ngspice->LoadNetlist( netlist.ToStdString() ) ); BOOST_REQUIRE( ngspice->Run() ); + // Test if ngspice cannot run a simulation (missing code models). + // in this case the log contains "MIF-ERROR" and/or "Error: circuit not parsed" + // when the simulation is not run the spice command "linearize" crashes. + bool err_found = m_log->Find( wxT( "Error: circuit not parsed" ) ) != wxNOT_FOUND; + + if( err_found ) + return; + // We need to make sure that the number of points always the same. ngspice->Command( "linearize" );