QA: Enable eeschema tests

Redesignate the eagle test as eeschema tests and build
more like the other unit tests.

Enable as a test in Ctest now that the test executes without
crashing.

The loading of the file with the hardocded part is still
not enabled, as this needs more infrastructure to support it.

(cherry picked from commit 4eb30f6b85)
This commit is contained in:
John Beard 2019-04-02 13:36:12 +01:00
parent d4883da98b
commit 3a5e01c44a
4 changed files with 72 additions and 36 deletions

View File

@ -356,6 +356,9 @@ target_link_libraries( eeschema_kiface
${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES}
)
target_include_directories( eeschema_kiface PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
if( KICAD_SPICE )
target_link_libraries( eeschema_kiface

View File

@ -21,31 +21,44 @@
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
find_package( Boost COMPONENTS unit_test_framework REQUIRED )
include_directories( BEFORE ${INC_BEFORE} )
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/eeschema
${CMAKE_SOURCE_DIR}/common
${INC_AFTER}
include_directories( AFTER ${INC_AFTER} )
add_executable( qa_eeschema
# A single top to load the pcnew kiface
# ../../common/single_top.cpp
# stuff from common due to...units?
../../common/base_units.cpp
../../common/eda_text.cpp
# stuff from common which is needed...why?
../../common/colors.cpp
../../common/observable.cpp
# The main test entry points
test_module.cpp
test_eagle_plugin.cpp
)
add_executable( qa_eagle_plugin
test_module.cpp
test_basic.cpp
)
target_compile_definitions( qa_eagle_plugin
PRIVATE -DBOOST_TEST_DYN_LINK )
add_dependencies( qa_eagle_plugin common eeschema_kiface )
target_link_libraries( qa_eagle_plugin
common
target_link_libraries( qa_eeschema
eeschema_kiface
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
${wxWidgets_LIBRARIES}
)
common
gal
qa_utils
unit_test_utils
${GDI_PLUS_LIBRARIES}
${Boost_LIBRARIES}
)
add_test( NAME eeschema
COMMAND qa_eeschema
)
# Eeschema tests, so pretend to be eeschema (for units, etc)
target_compile_definitions( qa_eeschema
PUBLIC EESCHEMA
)

View File

@ -22,10 +22,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <sch_io_mgr.h>
#include <boost/test/unit_test.hpp>
#include <kiway.h>
#include <sch_io_mgr.h>
#include <data/fixtures_eagle_plugin.h>
@ -34,16 +34,17 @@
*/
BOOST_AUTO_TEST_CASE( FindPlugin )
{
BOOST_CHECK( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE ) != NULL );
BOOST_CHECK_NE( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE ), nullptr );
}
/**
*
*/
BOOST_AUTO_TEST_CASE( Load )
{
SCH_PLUGIN* pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE );
// BOOST_AUTO_TEST_CASE( Load )
// {
// SCH_PLUGIN* pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE );
pi->Load("/home/alejandro/Proyectos/kicad/kicad-alejandro/eeschema/qa/data/eagle_schematics/empty.sch",
NULL);
}
// pi->Load(
// "/home/alejandro/Proyectos/kicad/kicad-alejandro/eeschema/qa/data/eagle_schematics/empty.sch",
// NULL );
// }

View File

@ -3,6 +3,7 @@
*
* Copyright (C) 2017 CERN
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -23,9 +24,27 @@
*/
/**
* Main file for the schematic eagle plugin tests to be compiled
* Main file for the Eeschema tests to be compiled
*/
#define BOOST_TEST_MODULE "Schematic Eagle plugin"
#include <boost/test/unit_test.hpp>
#include <wx/init.h>
bool init_unit_test()
{
boost::unit_test::framework::master_test_suite().p_name.value = "Common Eeschema module tests";
return wxInitialize();
}
int main( int argc, char* argv[] )
{
int ret = boost::unit_test::unit_test_main( &init_unit_test, argc, argv );
// This causes some glib warnings on GTK3 (http://trac.wxwidgets.org/ticket/18274)
// but without it, Valgrind notices a lot of leaks from WX
wxUninitialize();
return ret;
}