KiCad PCB EDA Suite
KI_TEST::BOARD_DUMPER Class Reference

A helper that contains logic to assist in dumping boards to disk depending on some environment variables. More...

#include <board_test_utils.h>

Public Member Functions

 BOARD_DUMPER ()
 
void DumpBoardToFile (BOARD &aBoard, const std::string &aName) const
 

Public Attributes

const bool m_dump_boards
 

Detailed Description

A helper that contains logic to assist in dumping boards to disk depending on some environment variables.

This is useful when setting up or verifying unit tests that work on BOARD objects.

To dump files set the KICAD_TEST_DUMP_BOARD_FILES environment variable. Files will be written to the system temp directory (/tmp on Linux, or as set by $TMP and friends).

Definition at line 51 of file board_test_utils.h.

Constructor & Destructor Documentation

◆ BOARD_DUMPER()

KI_TEST::BOARD_DUMPER::BOARD_DUMPER ( )

Definition at line 36 of file board_test_utils.cpp.

36  : m_dump_boards( std::getenv( "KICAD_TEST_DUMP_BOARD_FILES" ) )
37 {
38 }

Member Function Documentation

◆ DumpBoardToFile()

void KI_TEST::BOARD_DUMPER::DumpBoardToFile ( BOARD aBoard,
const std::string &  aName 
) const

Definition at line 41 of file board_test_utils.cpp.

42 {
43  if( !m_dump_boards )
44  return;
45 
46  auto path = boost::filesystem::temp_directory_path() / aName;
47  path += ".kicad_pcb";
48 
49  BOOST_TEST_MESSAGE( "Dumping board file: " << path.string() );
50  ::KI_TEST::DumpBoardToFile( aBoard, path.string() );
51 }
void DumpBoardToFile(BOARD &board, const std::string &aFilename)
Utility function to simply write a Board out to a file.

References KI_TEST::DumpBoardToFile(), and m_dump_boards.

Referenced by DoCourtyardInvalidTest(), and DoCourtyardOverlapTest().

Member Data Documentation

◆ m_dump_boards

const bool KI_TEST::BOARD_DUMPER::m_dump_boards

Definition at line 58 of file board_test_utils.h.

Referenced by DumpBoardToFile().


The documentation for this class was generated from the following files: