88 BOOST_REQUIRE_MESSAGE( m_board,
"Failed to load board issue21482" );
91 int trackCount = m_board->Tracks().size();
93 for(
FOOTPRINT* fp : m_board->Footprints() )
94 padCount += fp->Pads().size();
96 BOOST_TEST_MESSAGE( wxString::Format(
"Board has %d tracks and %d pads", trackCount, padCount ) );
98 std::vector<DRC_ITEM> violations;
101 BOOST_REQUIRE_MESSAGE( bds.
m_DRCEngine,
"DRC engine not initialized" );
110 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
111 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
114 violations.push_back( *aItem );
117 BOOST_TEST_CHECKPOINT(
"Running creepage DRC" );
120 auto start = std::chrono::high_resolution_clock::now();
126 catch(
const std::exception& e )
128 BOOST_ERROR( wxString::Format(
"DRC creepage exception: %s", e.what() ) );
132 auto end = std::chrono::high_resolution_clock::now();
133 double elapsedSeconds = std::chrono::duration<double>(
end - start ).count();
135 BOOST_TEST_MESSAGE( wxString::Format(
"DRC creepage completed in %.2f seconds", elapsedSeconds ) );
136 BOOST_TEST_MESSAGE( wxString::Format(
"Found %d creepage violations", (
int) violations.size() ) );
142 bool onGitLabCI = std::getenv(
"GITLAB_CI" ) !=
nullptr;
145 bool onDebianBuild =
false;
146 const char* debBuildOpts = std::getenv(
"DEB_BUILD_OPTIONS" );
148 if( debBuildOpts && std::string( debBuildOpts ).
find(
"nocheck" ) != std::string::npos )
149 onDebianBuild =
true;
151 if( onGitLabCI || onDebianBuild )
156 std::ofstream metricsFile(
"creepage_perf_metrics.txt" );
158 if( metricsFile.is_open() )
160 metricsFile <<
"creepage_drc_seconds " << elapsedSeconds <<
"\n";
161 metricsFile <<
"creepage_violations " << violations.size() <<
"\n";
166 else if( std::getenv(
"KICAD_ENABLE_DRC_PERFORMANCE_QA" ) !=
nullptr )
170 wxString::Format(
"Creepage DRC too slow: %.2f seconds (target: <20s)",
175 if( elapsedSeconds < 5.0 )
179 else if( elapsedSeconds < 10.0 )
183 else if( elapsedSeconds < 15.0 )
~DRC_CREEPAGE_PERF_TEST_FIXTURE()
std::unique_ptr< BOARD > m_board
SETTINGS_MANAGER m_settingsManager
BOOST_FIXTURE_TEST_CASE(CreepagePerformanceIssue21482, DRC_CREEPAGE_PERF_TEST_FIXTURE)
Test that creepage DRC check completes in a reasonable time.