diff --git a/qa/tools/pns/logviewer.fbp b/qa/tools/pns/logviewer.fbp
index ed0d4b6c9c..77da26493f 100644
--- a/qa/tools/pns/logviewer.fbp
+++ b/qa/tools/pns/logviewer.fbp
@@ -728,6 +728,132 @@
onShowThinLinesChecked
+
+
+ 5
+ wxALL|wxALIGN_CENTER_VERTICAL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+ ,90,92,-1,70,0
+ 0
+ 0
+ wxID_ANY
+ MyLabel
+ 0
+
+ 0
+
+
+ 0
+
+ 1
+ m_algoStatus
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+
+ ; ; forward_declare
+ 0
+
+
+
+
+ -1
+
+
diff --git a/qa/tools/pns/main.cpp b/qa/tools/pns/main.cpp
index 23c0d4fc10..274922a601 100644
--- a/qa/tools/pns/main.cpp
+++ b/qa/tools/pns/main.cpp
@@ -1,33 +1,82 @@
+#include
+
#include
#include "pns_log_file.h"
#include "pns_log_viewer_frame.h"
+
+static const wxCmdLineEntryDesc g_cmdLineDesc[] = {
+ {
+ wxCMD_LINE_SWITCH,
+ "h",
+ "help",
+ _( "displays help on the command line parameters" ).mb_str(),
+ wxCMD_LINE_VAL_NONE,
+ wxCMD_LINE_OPTION_HELP,
+ },
+ {
+ wxCMD_LINE_OPTION,
+ "i",
+ "iteration-limit",
+ _( "Max number of iterations" ).mb_str(),
+ wxCMD_LINE_VAL_NUMBER,
+ wxCMD_LINE_PARAM_OPTIONAL,
+ },
+ {
+ wxCMD_LINE_OPTION,
+ "s",
+ "steps-limit",
+ _( "execute log up to steps-limit events" ).mb_str(),
+ wxCMD_LINE_VAL_NUMBER,
+ wxCMD_LINE_PARAM_OPTIONAL,
+ },
+ {
+ wxCMD_LINE_PARAM,
+ "filename",
+ "filename",
+ _( "log file name (no extensions)" ).mb_str(),
+ wxCMD_LINE_VAL_STRING,
+ wxCMD_LINE_OPTION_MANDATORY,
+ },
+ { wxCMD_LINE_NONE }
+};
+
int replay_main_func( int argc, char* argv[] )
{
+ wxCmdLineParser cl_parser( argc, argv );
+ cl_parser.SetDesc( g_cmdLineDesc );
+ cl_parser.AddUsageText( _( "PNS Log (Re)player. Allows to step through the log written by the ROUTER_TOOL "
+ "in debug KiCad builds." ) );
+
+ int cmd_parsed_ok = cl_parser.Parse();
+
+ if( cl_parser.Found("help") )
+ {
+ return 0;
+ }
+
+ if( cmd_parsed_ok != 0 )
+ {
+ printf("P&S Log Replay/Debug tool. For command line options, call %s -h.\n\n", argv[0] );
+ // Help and invalid input both stop here
+ return ( cmd_parsed_ok == -1 ) ? KI_TEST::RET_CODES::OK : KI_TEST::RET_CODES::BAD_CMDLINE;
+ }
+
+ wxString filename;
+
+ long iter_limit = 256;
+ long steps_limit = -1;
+ cl_parser.Found( "iteration-limit", &iter_limit );
+ cl_parser.Found( "steps-limit", &steps_limit );
+ filename = cl_parser.GetParam(0);
+
+ printf("iters %d steps %d file '%s'\n", iter_limit, steps_limit, (const char *) filename.c_str() );
+
auto frame = new PNS_LOG_VIEWER_FRAME( nullptr );
- // drcCreateTestsProviderClearance();
- // drcCreateTestsProviderEdgeClearance();
-
- if( argc >= 2 && std::string( argv[1] ) == "-h" )
- {
- printf( "PNS Log (Re)player. Allows to step through the log written by the ROUTER_TOOL "
- "in debug KiCad builds. " );
- printf( "Requires a board file with UUIDs and a matching log file. Both are written to "
- "/tmp when you press '0' during routing." );
- return 0;
- }
-
- if( argc < 3 )
- {
- printf( "Expected parameters: log_file.log board_file.dump\n" );
- return 0;
- }
-
PNS_LOG_FILE* logFile = new PNS_LOG_FILE;
- logFile->Load( argv[1], argv[2] );
-
+ logFile->Load( wxFileName( argv[1] ) );
frame->SetLogFile( logFile );
return 0;
diff --git a/qa/tools/pns/pns_log_file.cpp b/qa/tools/pns/pns_log_file.cpp
index a56a41dcec..25d170e11f 100644
--- a/qa/tools/pns/pns_log_file.cpp
+++ b/qa/tools/pns/pns_log_file.cpp
@@ -64,9 +64,21 @@ PNS_LOG_FILE::PNS_LOG_FILE()
}
-bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName )
+bool PNS_LOG_FILE::Load( const wxFileName& logFileName )
{
- FILE* f = fopen( logName.c_str(), "rb" );
+ wxFileName fname_log( logFileName );
+ fname_log.SetExt( wxT( "log" ) );
+
+ wxFileName fname_dump( logFileName );
+ fname_dump.SetExt( wxT( "dump" ) );
+
+ wxFileName fname_project( logFileName );
+ fname_project.SetExt( wxT( "kicad_pro" ) );
+ fname_project.MakeAbsolute();
+
+ FILE* f = fopen( fname_log.GetFullPath().c_str(), "rb" );
+
+ printf("Loading dump from '%s'\n", (const char*) fname_log.GetFullPath().c_str() );
if( !f )
return false;
@@ -101,10 +113,15 @@ bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName
fclose( f );
+
+ m_settingsMgr.reset( new SETTINGS_MANAGER ( true ) );
+ m_settingsMgr->LoadProject( fname_project.GetFullPath() );
+
try
{
PCB_PLUGIN io;
- m_board.reset( io.Load( boardName.c_str(), nullptr, nullptr ) );
+ m_board.reset( io.Load( fname_dump.GetFullPath(), nullptr, nullptr ) );
+ m_board->SetProject( m_settingsMgr->GetProject( fname_project.GetFullPath() ) );
std::shared_ptr drcEngine( new DRC_ENGINE );
@@ -113,6 +130,8 @@ bool PNS_LOG_FILE::Load( const std::string& logName, const std::string boardName
bds.m_DRCEngine = drcEngine;
+ m_board->SynchronizeNetsAndNetClasses();
+
drcEngine->SetBoard( m_board.get() );
drcEngine->SetDesignSettings( &bds );
drcEngine->SetLogReporter( new CONSOLE_MSG_REPORTER( &consoleLog ) );
diff --git a/qa/tools/pns/pns_log_file.h b/qa/tools/pns/pns_log_file.h
index eb3cddb916..a10d35852b 100644
--- a/qa/tools/pns/pns_log_file.h
+++ b/qa/tools/pns/pns_log_file.h
@@ -31,6 +31,8 @@
#include
#include
+#include
+
#include
#include