Dump the ERC report as part of the erc failure
This commit is contained in:
parent
0147dd8699
commit
1981997ee2
|
@ -41,13 +41,8 @@ ERC_REPORT::ERC_REPORT( SCHEMATIC* aSchematic, EDA_UNITS aReportUnits ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ERC_REPORT::WriteTextReport( const wxString& aFullFileName )
|
wxString ERC_REPORT::GetTextReport()
|
||||||
{
|
{
|
||||||
wxFFile file( aFullFileName, wxT( "wt" ) );
|
|
||||||
|
|
||||||
if( !file.IsOpened() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
UNITS_PROVIDER unitsProvider( schIUScale, m_reportUnits );
|
UNITS_PROVIDER unitsProvider( schIUScale, m_reportUnits );
|
||||||
|
|
||||||
wxString msg = wxString::Format( _( "ERC report (%s, Encoding UTF8)\n" ),
|
wxString msg = wxString::Format( _( "ERC report (%s, Encoding UTF8)\n" ),
|
||||||
|
@ -93,13 +88,20 @@ bool ERC_REPORT::WriteTextReport( const wxString& aFullFileName )
|
||||||
msg << wxString::Format( _( "\n ** ERC messages: %d Errors %d Warnings %d\n" ), total_count,
|
msg << wxString::Format( _( "\n ** ERC messages: %d Errors %d Warnings %d\n" ), total_count,
|
||||||
err_count, warn_count );
|
err_count, warn_count );
|
||||||
|
|
||||||
// Currently: write report using UTF8 (as usual in Kicad).
|
return msg;
|
||||||
// TODO: see if we can use the current encoding page (mainly for Windows users),
|
}
|
||||||
// Or other format (HTML?)
|
|
||||||
file.Write( msg );
|
|
||||||
|
bool ERC_REPORT::WriteTextReport( const wxString& aFullFileName )
|
||||||
|
{
|
||||||
|
wxFFile file( aFullFileName, wxT( "wt" ) );
|
||||||
|
|
||||||
|
if( !file.IsOpened() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
file.Write( GetTextReport() );
|
||||||
|
|
||||||
// wxFFile dtor will close the file.
|
// wxFFile dtor will close the file.
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,25 @@ class ERC_REPORT
|
||||||
public:
|
public:
|
||||||
ERC_REPORT( SCHEMATIC* aSchematic, EDA_UNITS aReportUnits );
|
ERC_REPORT( SCHEMATIC* aSchematic, EDA_UNITS aReportUnits );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the ERC report in "text" (human readable) format
|
||||||
|
*
|
||||||
|
* @return The complete report
|
||||||
|
*/
|
||||||
|
wxString GetTextReport();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the text report also available via GetTextReport directly to a given file path
|
||||||
|
*
|
||||||
|
* @return True if the file write completed successfully, false otherwise
|
||||||
|
*/
|
||||||
bool WriteTextReport( const wxString& aFullFileName );
|
bool WriteTextReport( const wxString& aFullFileName );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a JSON formatted ERC Report to the given file path
|
||||||
|
*
|
||||||
|
* @return True if the file write completed successfully, false otherwise
|
||||||
|
*/
|
||||||
bool WriteJsonReport( const wxString& aFullFileName );
|
bool WriteJsonReport( const wxString& aFullFileName );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <schematic.h>
|
#include <schematic.h>
|
||||||
#include <erc_settings.h>
|
#include <erc_settings.h>
|
||||||
#include <erc.h>
|
#include <erc.h>
|
||||||
|
#include <erc_report.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
#include <locale_io.h>
|
#include <locale_io.h>
|
||||||
|
|
||||||
|
@ -72,8 +73,12 @@ BOOST_FIXTURE_TEST_CASE( ERCGlobalLabels, ERC_REGRESSION_TEST_FIXTURE )
|
||||||
|
|
||||||
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
|
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
|
||||||
|
|
||||||
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second
|
ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES );
|
||||||
<< " errors in " << test.first.ToStdString() << " but got " << errors.GetCount() );
|
|
||||||
|
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second,
|
||||||
|
"Expected " << test.second << " errors in " << test.first.ToStdString()
|
||||||
|
<< " but got " << errors.GetCount() << "\n"
|
||||||
|
<< reportWriter.GetTextReport() );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <schematic.h>
|
#include <schematic.h>
|
||||||
#include <erc_settings.h>
|
#include <erc_settings.h>
|
||||||
#include <erc.h>
|
#include <erc.h>
|
||||||
|
#include <erc_report.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
#include <locale_io.h>
|
#include <locale_io.h>
|
||||||
|
|
||||||
|
@ -74,8 +75,11 @@ BOOST_FIXTURE_TEST_CASE( ERCHierarchicalSchematics, ERC_REGRESSION_TEST_FIXTURE
|
||||||
|
|
||||||
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
|
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
|
||||||
|
|
||||||
|
ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES );
|
||||||
|
|
||||||
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second,
|
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second,
|
||||||
"Expected " << test.second << " errors in " << test.first.ToStdString()
|
"Expected " << test.second << " errors in " << test.first.ToStdString()
|
||||||
<< " but got " << errors.GetCount() );
|
<< " but got " << errors.GetCount() << "\n"
|
||||||
|
<< reportWriter.GetTextReport() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <schematic.h>
|
#include <schematic.h>
|
||||||
#include <erc_settings.h>
|
#include <erc_settings.h>
|
||||||
#include <erc.h>
|
#include <erc.h>
|
||||||
|
#include <erc_report.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
#include <locale_io.h>
|
#include <locale_io.h>
|
||||||
|
|
||||||
|
@ -77,8 +78,11 @@ BOOST_FIXTURE_TEST_CASE( ERCLabelNotConnected, ERC_REGRESSION_TEST_FIXTURE )
|
||||||
|
|
||||||
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
|
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
|
||||||
|
|
||||||
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second
|
ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES );
|
||||||
<< " errors in " << test.first.ToStdString() << " but got " << errors.GetCount() );
|
|
||||||
|
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString()
|
||||||
|
<< " but got " << errors.GetCount() << "\n"
|
||||||
|
<< reportWriter.GetTextReport() );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <schematic.h>
|
#include <schematic.h>
|
||||||
#include <erc_settings.h>
|
#include <erc_settings.h>
|
||||||
#include <erc.h>
|
#include <erc.h>
|
||||||
|
#include <erc_report.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
#include <locale_io.h>
|
#include <locale_io.h>
|
||||||
|
|
||||||
|
@ -79,8 +80,11 @@ BOOST_FIXTURE_TEST_CASE( ERCNoConnect, ERC_REGRESSION_TEST_FIXTURE )
|
||||||
|
|
||||||
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
|
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
|
||||||
|
|
||||||
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second
|
ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES );
|
||||||
<< " errors in " << test.first.ToStdString() << " but got " << errors.GetCount() );
|
|
||||||
|
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString()
|
||||||
|
<< " but got " << errors.GetCount() << "\n"
|
||||||
|
<< reportWriter.GetTextReport() );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <schematic.h>
|
#include <schematic.h>
|
||||||
#include <erc_settings.h>
|
#include <erc_settings.h>
|
||||||
#include <erc.h>
|
#include <erc.h>
|
||||||
|
#include <erc_report.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
#include <locale_io.h>
|
#include <locale_io.h>
|
||||||
|
|
||||||
|
@ -73,8 +74,11 @@ BOOST_FIXTURE_TEST_CASE( ERCStackingPins, ERC_REGRESSION_TEST_FIXTURE )
|
||||||
|
|
||||||
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
|
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING );
|
||||||
|
|
||||||
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second
|
ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES );
|
||||||
<< " errors in " << test.first.ToStdString() << " but got " << errors.GetCount() );
|
|
||||||
|
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString()
|
||||||
|
<< " but got " << errors.GetCount() << "\n"
|
||||||
|
<< reportWriter.GetTextReport() );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue