From 638a117a5f7efb5529b9c1c77a2fdfd2e4ff50a0 Mon Sep 17 00:00:00 2001 From: Sirius Bakke Date: Sun, 23 Feb 2020 23:52:40 +0100 Subject: [PATCH] test: Add unit tests to CMake --- CMakeLists.txt | 2 + cmake/FindCppUnit.cmake | 48 ++++++++++++++++ .../AddressRangeDialogTest/CMakeLists.txt | 6 ++ .../main_AddressRangeDialogTest.cpp | 1 - .../AddressTableTest/CMakeLists.txt | 9 +++ src/unit_tests/CMakeLists.txt | 55 +++++++++++++++++++ .../CustomServiceDialogTest/CMakeLists.txt | 6 ++ .../main_CustomServiceDialogTest.cpp | 1 - src/unit_tests/DNSTest/CMakeLists.txt | 4 ++ src/unit_tests/FWBTreeTest/CMakeLists.txt | 4 ++ src/unit_tests/FWObjectTest/CMakeLists.txt | 4 ++ src/unit_tests/FWWindowTest/CMakeLists.txt | 8 +++ .../FWWindowTest/main_FWWindowTest.cpp | 1 - .../FirewallDialogTest/CMakeLists.txt | 6 ++ .../main_FirewallDialogTest.cpp | 1 - .../GroupObjectDialogTest/CMakeLists.txt | 6 ++ .../main_GroupObjectDialogTest.cpp | 1 - .../ICMP6ServiceDialogTest/CMakeLists.txt | 6 ++ .../main_ICMP6ServiceDialogTest.cpp | 1 - .../ICMPServiceDialogTest/CMakeLists.txt | 6 ++ .../main_ICMPServiceDialogTest.cpp | 1 - src/unit_tests/IPDialogTest/CMakeLists.txt | 6 ++ .../IPDialogTest/main_IPDialogTest.cpp | 1 - .../IPServiceDialogTest/CMakeLists.txt | 6 ++ .../main_IPServiceDialogTest.cpp | 1 - src/unit_tests/ImporterTest/CMakeLists.txt | 8 +++ .../ImporterTest/main_ImporterTest.cpp | 3 +- .../Inet6AddrMaskTest/CMakeLists.txt | 4 ++ .../InetAddrMaskTest/CMakeLists.txt | 4 ++ .../InterfaceDialogTest/CMakeLists.txt | 6 ++ .../main_InterfaceDialogTest.cpp | 1 - .../NetworkDialogTest/CMakeLists.txt | 6 ++ .../main_NetworkDialogTest.cpp | 1 - .../ObjectManipulatorTest/CMakeLists.txt | 8 +++ .../main_ObjectManipulatorTest.cpp | 2 +- .../ObjectMatcherTest/CMakeLists.txt | 6 ++ .../ObjectMatcherTest/ObjectMatcherTest.cpp | 44 +++++++-------- src/unit_tests/PFImporterTest/CMakeLists.txt | 8 +++ .../PFImporterTest/main_PFImporterTest.cpp | 3 +- src/unit_tests/PIXImporterTest/CMakeLists.txt | 8 +++ .../PIXImporterTest/PIXImporterTest.h | 1 + .../PIXImporterTest/main_PIXImporterTest.cpp | 3 +- src/unit_tests/RCS/CMakeLists.txt | 6 ++ .../RuleSetViewContextMenuTest/CMakeLists.txt | 6 ++ .../main_RuleSetViewContextMenuTest.cpp | 1 - src/unit_tests/RuleSetViewTest/CMakeLists.txt | 6 ++ .../RuleSetViewTest/main_RuleSetViewTest.cpp | 1 - .../TCPServiceDialogTest/CMakeLists.txt | 6 ++ .../main_TCPServiceDialogTest.cpp | 1 - .../TagServiceDialogTest/CMakeLists.txt | 6 ++ .../main_TagServiceDialogTest.cpp | 1 - .../UDPServiceDialogTest/CMakeLists.txt | 6 ++ .../main_UDPServiceDialogTest.cpp | 1 - .../UsageResolverTest/CMakeLists.txt | 4 ++ .../UserSerivceDialogTest/CMakeLists.txt | 6 ++ .../main_UserServiceDialogTest.cpp | 1 - .../commandLinePrintingTest/CMakeLists.txt | 4 ++ .../commandLinePrintingTest | 2 + src/unit_tests/compilerLibTest/CMakeLists.txt | 10 ++++ .../CMakeLists.txt | 8 +++ .../main_generatedScriptTestsIpfilter.cpp | 2 +- .../generatedScriptTestsIpfw/CMakeLists.txt | 8 +++ .../main_generatedScriptTestsIpfw.cpp | 2 +- .../generatedScriptTestsLinux/CMakeLists.txt | 8 +++ .../main_generatedScriptTestsLinux.cpp | 2 +- .../generatedScriptTestsPF/CMakeLists.txt | 8 +++ .../main_generatedScriptTestsPF.cpp | 2 +- .../CMakeLists.txt | 8 +++ .../main_generatedScriptTestsSecuwall.cpp | 2 +- .../genericDialogTest/CMakeLists.txt | 6 ++ .../genericDialogTest/genericDialogTest.cpp | 1 + .../main_genericDialogTest.cpp | 1 - .../instDialogClusterTest/CMakeLists.txt | 8 +++ .../main_instDialogClusterTest.cpp | 2 +- .../instDialogCompileTest/CMakeLists.txt | 8 +++ .../main_instDialogCompileTest.cpp | 2 +- .../instDialogInspectTest/CMakeLists.txt | 8 +++ .../main_instDialogInspectTest.cpp | 2 +- .../instDialogInstallTest/CMakeLists.txt | 8 +++ .../main_instDialogInstallTest.cpp | 2 +- .../instDialogObjectListTest/CMakeLists.txt | 8 +++ .../main_instDialogObjectListTest.cpp | 2 +- src/unit_tests/main/CMakeLists.txt | 6 ++ .../newClusterDialogTest/CMakeLists.txt | 8 +++ .../main_newClusterDialogTest.cpp | 2 +- .../parseCommandLineTest/CMakeLists.txt | 4 ++ .../main_parseCommandLineTest.cpp | 1 - .../startTipDialogTest/CMakeLists.txt | 6 ++ .../main_startTipDialogTest.cpp | 1 - .../startTipDialogTest/startTipDialogTest.cpp | 2 + 90 files changed, 453 insertions(+), 60 deletions(-) create mode 100644 cmake/FindCppUnit.cmake create mode 100644 src/unit_tests/AddressRangeDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/AddressTableTest/CMakeLists.txt create mode 100644 src/unit_tests/CMakeLists.txt create mode 100644 src/unit_tests/CustomServiceDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/DNSTest/CMakeLists.txt create mode 100644 src/unit_tests/FWBTreeTest/CMakeLists.txt create mode 100644 src/unit_tests/FWObjectTest/CMakeLists.txt create mode 100644 src/unit_tests/FWWindowTest/CMakeLists.txt create mode 100644 src/unit_tests/FirewallDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/GroupObjectDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/ICMP6ServiceDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/ICMPServiceDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/IPDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/IPServiceDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/ImporterTest/CMakeLists.txt create mode 100644 src/unit_tests/Inet6AddrMaskTest/CMakeLists.txt create mode 100644 src/unit_tests/InetAddrMaskTest/CMakeLists.txt create mode 100644 src/unit_tests/InterfaceDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/NetworkDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/ObjectManipulatorTest/CMakeLists.txt create mode 100644 src/unit_tests/ObjectMatcherTest/CMakeLists.txt create mode 100644 src/unit_tests/PFImporterTest/CMakeLists.txt create mode 100644 src/unit_tests/PIXImporterTest/CMakeLists.txt create mode 100644 src/unit_tests/RCS/CMakeLists.txt create mode 100644 src/unit_tests/RuleSetViewContextMenuTest/CMakeLists.txt create mode 100644 src/unit_tests/RuleSetViewTest/CMakeLists.txt create mode 100644 src/unit_tests/TCPServiceDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/TagServiceDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/UDPServiceDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/UsageResolverTest/CMakeLists.txt create mode 100644 src/unit_tests/UserSerivceDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/commandLinePrintingTest/CMakeLists.txt create mode 100644 src/unit_tests/compilerLibTest/CMakeLists.txt create mode 100644 src/unit_tests/generatedScriptTestsIpfilter/CMakeLists.txt create mode 100644 src/unit_tests/generatedScriptTestsIpfw/CMakeLists.txt create mode 100644 src/unit_tests/generatedScriptTestsLinux/CMakeLists.txt create mode 100644 src/unit_tests/generatedScriptTestsPF/CMakeLists.txt create mode 100644 src/unit_tests/generatedScriptTestsSecuwall/CMakeLists.txt create mode 100644 src/unit_tests/genericDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/instDialogClusterTest/CMakeLists.txt create mode 100644 src/unit_tests/instDialogCompileTest/CMakeLists.txt create mode 100644 src/unit_tests/instDialogInspectTest/CMakeLists.txt create mode 100644 src/unit_tests/instDialogInstallTest/CMakeLists.txt create mode 100644 src/unit_tests/instDialogObjectListTest/CMakeLists.txt create mode 100644 src/unit_tests/main/CMakeLists.txt create mode 100644 src/unit_tests/newClusterDialogTest/CMakeLists.txt create mode 100644 src/unit_tests/parseCommandLineTest/CMakeLists.txt create mode 100644 src/unit_tests/startTipDialogTest/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 656029cd2..ecdbea48f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,7 @@ if(NOT CMAKE_BUILD_TYPE) "Choose the type of build, options are: Debug or Release." FORCE) endif() +include( CTest ) ### Dependencies @@ -107,6 +108,7 @@ add_subdirectory(src/libfwbuilder/etc) add_subdirectory(src/libfwbuilder/migration) add_subdirectory(src/res) add_subdirectory(doc) +add_subdirectory(src/unit_tests) ### Packaging add_subdirectory(packaging) diff --git a/cmake/FindCppUnit.cmake b/cmake/FindCppUnit.cmake new file mode 100644 index 000000000..b038ad467 --- /dev/null +++ b/cmake/FindCppUnit.cmake @@ -0,0 +1,48 @@ +# +# Find the CppUnit includes and library +# +# This module defines +# CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc. +# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit. +# CPPUNIT_FOUND, If false, do not try to use CppUnit. + +# also defined, but not for general use are +# CPPUNIT_LIBRARY, where to find the CppUnit library. +# CPPUNIT_DEBUG_LIBRARY, where to find the CppUnit library in debug mode. + +FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h HINTS + /usr/local/include + /usr/include + ENV CppUnit_ROOT + ) + +# With Win32, important to have both +IF(WIN32) + FIND_LIBRARY(CPPUNIT_LIBRARY cppunit + ${CPPUNIT_INCLUDE_DIR}/../lib + /usr/local/lib + /usr/lib) + FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunitd + ${CPPUNIT_INCLUDE_DIR}/../lib + /usr/local/lib + /usr/lib) +ELSE(WIN32) +# On unix system, debug and release have the same name + FIND_LIBRARY(CPPUNIT_LIBRARY cppunit + ${CPPUNIT_INCLUDE_DIR}/../lib + /usr/local/lib + /usr/lib) + FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunit + ${CPPUNIT_INCLUDE_DIR}/../lib + /usr/local/lib + /usr/lib) +ENDIF(WIN32) + + IF(CPPUNIT_INCLUDE_DIR) +IF(CPPUNIT_LIBRARY) + SET(CPPUNIT_FOUND "YES") +SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS}) + SET(CPPUNIT_DEBUG_LIBRARIES ${CPPUNIT_DEBUG_LIBRARY} + ${CMAKE_DL_LIBS}) + ENDIF(CPPUNIT_LIBRARY) +ENDIF(CPPUNIT_INCLUDE_DIR) diff --git a/src/unit_tests/AddressRangeDialogTest/CMakeLists.txt b/src/unit_tests/AddressRangeDialogTest/CMakeLists.txt new file mode 100644 index 000000000..2ef40b287 --- /dev/null +++ b/src/unit_tests/AddressRangeDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(AddressRangeDialogTest AddressRangeDialogTest.cpp main_AddressRangeDialogTest.cpp) +add_test(NAME AddressRangeDialogTest COMMAND AddressRangeDialogTest) + +target_link_libraries(AddressRangeDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/AddressRangeDialogTest/main_AddressRangeDialogTest.cpp b/src/unit_tests/AddressRangeDialogTest/main_AddressRangeDialogTest.cpp index 4577f4c3a..c52b948a7 100644 --- a/src/unit_tests/AddressRangeDialogTest/main_AddressRangeDialogTest.cpp +++ b/src/unit_tests/AddressRangeDialogTest/main_AddressRangeDialogTest.cpp @@ -41,7 +41,6 @@ FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/AddressTableTest/CMakeLists.txt b/src/unit_tests/AddressTableTest/CMakeLists.txt new file mode 100644 index 000000000..7ff4348ea --- /dev/null +++ b/src/unit_tests/AddressTableTest/CMakeLists.txt @@ -0,0 +1,9 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(AddressTableTest AddressTableTest.cpp main.cpp) +add_test(NAME AddressTableTest COMMAND AddressTableTest) + +target_link_libraries(AddressTableTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) + +file(COPY addresstable-1.txt addresstable-2.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + diff --git a/src/unit_tests/CMakeLists.txt b/src/unit_tests/CMakeLists.txt new file mode 100644 index 000000000..b2a50ccd6 --- /dev/null +++ b/src/unit_tests/CMakeLists.txt @@ -0,0 +1,55 @@ +include( CTest ) + +find_package(CppUnit REQUIRED) +find_package(Qt5Test REQUIRED) + +enable_testing(TRUE) + +add_subdirectory(main) + +add_subdirectory(AddressRangeDialogTest) +add_subdirectory(AddressTableTest) +add_subdirectory(commandLinePrintingTest) +add_subdirectory(compilerLibTest) +add_subdirectory(CustomServiceDialogTest) +add_subdirectory(DNSTest) +add_subdirectory(FirewallDialogTest) +add_subdirectory(FWBTreeTest) +add_subdirectory(FWObjectTest) +add_subdirectory(FWWindowTest) +add_subdirectory(generatedScriptTestsIpfilter) +add_subdirectory(generatedScriptTestsIpfw) +add_subdirectory(generatedScriptTestsLinux) +add_subdirectory(generatedScriptTestsPF) +add_subdirectory(generatedScriptTestsSecuwall) +add_subdirectory(genericDialogTest) +add_subdirectory(GroupObjectDialogTest) +add_subdirectory(ICMP6ServiceDialogTest) +add_subdirectory(ICMPServiceDialogTest) +add_subdirectory(ImporterTest) +add_subdirectory(Inet6AddrMaskTest) +add_subdirectory(InetAddrMaskTest) +add_subdirectory(instDialogClusterTest) +add_subdirectory(instDialogCompileTest) +add_subdirectory(instDialogInspectTest) +add_subdirectory(instDialogInstallTest) +add_subdirectory(instDialogObjectListTest) +add_subdirectory(InterfaceDialogTest) +add_subdirectory(IPDialogTest) +add_subdirectory(IPServiceDialogTest) +add_subdirectory(NetworkDialogTest) +add_subdirectory(newClusterDialogTest) +add_subdirectory(ObjectManipulatorTest) +add_subdirectory(ObjectMatcherTest) +add_subdirectory(parseCommandLineTest) +add_subdirectory(PFImporterTest) +add_subdirectory(PIXImporterTest) +add_subdirectory(RCS) +add_subdirectory(RuleSetViewContextMenuTest) +add_subdirectory(RuleSetViewTest) +add_subdirectory(startTipDialogTest) +add_subdirectory(TagServiceDialogTest) +add_subdirectory(TCPServiceDialogTest) +add_subdirectory(UDPServiceDialogTest) +add_subdirectory(UsageResolverTest) +add_subdirectory(UserSerivceDialogTest) diff --git a/src/unit_tests/CustomServiceDialogTest/CMakeLists.txt b/src/unit_tests/CustomServiceDialogTest/CMakeLists.txt new file mode 100644 index 000000000..1d74decc0 --- /dev/null +++ b/src/unit_tests/CustomServiceDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(CustomServiceDialogTest CustomServiceDialogTest.cpp main_CustomServiceDialogTest.cpp) +add_test(NAME CustomServiceDialogTest COMMAND CustomServiceDialogTest) + +target_link_libraries(CustomServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/CustomServiceDialogTest/main_CustomServiceDialogTest.cpp b/src/unit_tests/CustomServiceDialogTest/main_CustomServiceDialogTest.cpp index 59eb7777b..7cfd77792 100644 --- a/src/unit_tests/CustomServiceDialogTest/main_CustomServiceDialogTest.cpp +++ b/src/unit_tests/CustomServiceDialogTest/main_CustomServiceDialogTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/DNSTest/CMakeLists.txt b/src/unit_tests/DNSTest/CMakeLists.txt new file mode 100644 index 000000000..dfe8bba11 --- /dev/null +++ b/src/unit_tests/DNSTest/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(DNSTest DNSTest.cpp main.cpp) +add_test(NAME DNSTest COMMAND DNSTest) + +target_link_libraries(DNSTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) diff --git a/src/unit_tests/FWBTreeTest/CMakeLists.txt b/src/unit_tests/FWBTreeTest/CMakeLists.txt new file mode 100644 index 000000000..c7b08a60d --- /dev/null +++ b/src/unit_tests/FWBTreeTest/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(FWBTreeTest FWBTreeTest.cpp main_FWBTreeTest.cpp) +add_test(NAME FWBTreeTest COMMAND FWBTreeTest) + +target_link_libraries(FWBTreeTest PRIVATE gui fwbuilder xml2 xslt z cppunit) diff --git a/src/unit_tests/FWObjectTest/CMakeLists.txt b/src/unit_tests/FWObjectTest/CMakeLists.txt new file mode 100644 index 000000000..884535fb6 --- /dev/null +++ b/src/unit_tests/FWObjectTest/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(FWObjectTest FWObjectTest.cpp main.cpp) +add_test(NAME FWObjectTest COMMAND FWObjectTest) + +target_link_libraries(FWObjectTest PRIVATE fwbuilder xml2 xslt z cppunit) diff --git a/src/unit_tests/FWWindowTest/CMakeLists.txt b/src/unit_tests/FWWindowTest/CMakeLists.txt new file mode 100644 index 000000000..3dc1a951f --- /dev/null +++ b/src/unit_tests/FWWindowTest/CMakeLists.txt @@ -0,0 +1,8 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(FWWindowTest FWWindowTest.cpp main_FWWindowTest.cpp) +add_test(NAME FWWindowTest COMMAND FWWindowTest) + +target_link_libraries(FWWindowTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) +#target_link_libraries(fwb_ipt common iptlib compilerdriver fwcompiler fwbuilder xml2 pthread m xslt z) +#target_link_libraries(fwbuilder-gui gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 m xslt z OpenSSL::Crypto pthread) diff --git a/src/unit_tests/FWWindowTest/main_FWWindowTest.cpp b/src/unit_tests/FWWindowTest/main_FWWindowTest.cpp index 2f0f58fd6..e750116ce 100644 --- a/src/unit_tests/FWWindowTest/main_FWWindowTest.cpp +++ b/src/unit_tests/FWWindowTest/main_FWWindowTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/FirewallDialogTest/CMakeLists.txt b/src/unit_tests/FirewallDialogTest/CMakeLists.txt new file mode 100644 index 000000000..db139ad57 --- /dev/null +++ b/src/unit_tests/FirewallDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(FirewallDialogTest FirewallDialogTest.cpp main_FirewallDialogTest.cpp) +add_test(NAME FirewallDialogTest COMMAND FirewallDialogTest) + +target_link_libraries(FirewallDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/FirewallDialogTest/main_FirewallDialogTest.cpp b/src/unit_tests/FirewallDialogTest/main_FirewallDialogTest.cpp index 106676bf9..63e05b33a 100644 --- a/src/unit_tests/FirewallDialogTest/main_FirewallDialogTest.cpp +++ b/src/unit_tests/FirewallDialogTest/main_FirewallDialogTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/GroupObjectDialogTest/CMakeLists.txt b/src/unit_tests/GroupObjectDialogTest/CMakeLists.txt new file mode 100644 index 000000000..cf1acaf89 --- /dev/null +++ b/src/unit_tests/GroupObjectDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(GroupObjectDialogTest GroupObjectDialogTest.cpp main_GroupObjectDialogTest.cpp) +add_test(NAME GroupObjectDialogTest COMMAND GroupObjectDialogTest) + +target_link_libraries(GroupObjectDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/GroupObjectDialogTest/main_GroupObjectDialogTest.cpp b/src/unit_tests/GroupObjectDialogTest/main_GroupObjectDialogTest.cpp index d9601a007..46b7e765f 100644 --- a/src/unit_tests/GroupObjectDialogTest/main_GroupObjectDialogTest.cpp +++ b/src/unit_tests/GroupObjectDialogTest/main_GroupObjectDialogTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/ICMP6ServiceDialogTest/CMakeLists.txt b/src/unit_tests/ICMP6ServiceDialogTest/CMakeLists.txt new file mode 100644 index 000000000..19dec4752 --- /dev/null +++ b/src/unit_tests/ICMP6ServiceDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(ICMP6ServiceDialogTest ICMP6ServiceDialogTest.cpp main_ICMP6ServiceDialogTest.cpp) +add_test(NAME ICMP6ServiceDialogTest COMMAND ICMP6ServiceDialogTest) + +target_link_libraries(ICMP6ServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/ICMP6ServiceDialogTest/main_ICMP6ServiceDialogTest.cpp b/src/unit_tests/ICMP6ServiceDialogTest/main_ICMP6ServiceDialogTest.cpp index 23021edd8..ee2f73898 100644 --- a/src/unit_tests/ICMP6ServiceDialogTest/main_ICMP6ServiceDialogTest.cpp +++ b/src/unit_tests/ICMP6ServiceDialogTest/main_ICMP6ServiceDialogTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/ICMPServiceDialogTest/CMakeLists.txt b/src/unit_tests/ICMPServiceDialogTest/CMakeLists.txt new file mode 100644 index 000000000..1cd2661c9 --- /dev/null +++ b/src/unit_tests/ICMPServiceDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(ICMPServiceDialogTest ICMPServiceDialogTest.cpp main_ICMPServiceDialogTest.cpp) +add_test(NAME ICMPServiceDialogTest COMMAND ICMPServiceDialogTest) + +target_link_libraries(ICMPServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/ICMPServiceDialogTest/main_ICMPServiceDialogTest.cpp b/src/unit_tests/ICMPServiceDialogTest/main_ICMPServiceDialogTest.cpp index 3a4481c79..63984c252 100644 --- a/src/unit_tests/ICMPServiceDialogTest/main_ICMPServiceDialogTest.cpp +++ b/src/unit_tests/ICMPServiceDialogTest/main_ICMPServiceDialogTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/IPDialogTest/CMakeLists.txt b/src/unit_tests/IPDialogTest/CMakeLists.txt new file mode 100644 index 000000000..39e0d5f63 --- /dev/null +++ b/src/unit_tests/IPDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(IPDialogTest IPDialogTest.cpp main_IPDialogTest.cpp) +add_test(NAME IPDialogTest COMMAND IPDialogTest) + +target_link_libraries(IPDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/IPDialogTest/main_IPDialogTest.cpp b/src/unit_tests/IPDialogTest/main_IPDialogTest.cpp index abab374e2..cbd7cd500 100644 --- a/src/unit_tests/IPDialogTest/main_IPDialogTest.cpp +++ b/src/unit_tests/IPDialogTest/main_IPDialogTest.cpp @@ -40,7 +40,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/IPServiceDialogTest/CMakeLists.txt b/src/unit_tests/IPServiceDialogTest/CMakeLists.txt new file mode 100644 index 000000000..b2943b24e --- /dev/null +++ b/src/unit_tests/IPServiceDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(IPServiceDialogTest IPServiceDialogTest.cpp main_IPServiceDialogTest.cpp) +add_test(NAME IPServiceDialogTest COMMAND IPServiceDialogTest) + +target_link_libraries(IPServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/IPServiceDialogTest/main_IPServiceDialogTest.cpp b/src/unit_tests/IPServiceDialogTest/main_IPServiceDialogTest.cpp index 3d7d4c2d1..743f5b3a5 100644 --- a/src/unit_tests/IPServiceDialogTest/main_IPServiceDialogTest.cpp +++ b/src/unit_tests/IPServiceDialogTest/main_IPServiceDialogTest.cpp @@ -40,7 +40,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/ImporterTest/CMakeLists.txt b/src/unit_tests/ImporterTest/CMakeLists.txt new file mode 100644 index 000000000..fd9482374 --- /dev/null +++ b/src/unit_tests/ImporterTest/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(ImporterTest ImporterTest.cpp main_ImporterTest.cpp) +add_test(NAME ImporterTest COMMAND ImporterTest) + +target_link_libraries(ImporterTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) + +file(COPY test_data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\") diff --git a/src/unit_tests/ImporterTest/main_ImporterTest.cpp b/src/unit_tests/ImporterTest/main_ImporterTest.cpp index 7d386aa0f..06e36f774 100644 --- a/src/unit_tests/ImporterTest/main_ImporterTest.cpp +++ b/src/unit_tests/ImporterTest/main_ImporterTest.cpp @@ -36,14 +36,13 @@ #include #include -#include "../../../common/init.cpp" +#include "common/init.cpp" int fwbdebug = 0; //QString user_name; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; std::string platform; int main(int argc, char** argv) diff --git a/src/unit_tests/Inet6AddrMaskTest/CMakeLists.txt b/src/unit_tests/Inet6AddrMaskTest/CMakeLists.txt new file mode 100644 index 000000000..020f79dc1 --- /dev/null +++ b/src/unit_tests/Inet6AddrMaskTest/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(Inet6AddrMaskTest Inet6AddrMaskTest.cpp main.cpp) +add_test(NAME Inet6AddrMaskTest COMMAND Inet6AddrMaskTest) + +target_link_libraries(Inet6AddrMaskTest PRIVATE fwbuilder xml2 xslt z cppunit) diff --git a/src/unit_tests/InetAddrMaskTest/CMakeLists.txt b/src/unit_tests/InetAddrMaskTest/CMakeLists.txt new file mode 100644 index 000000000..33edaf7f8 --- /dev/null +++ b/src/unit_tests/InetAddrMaskTest/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(InetAddrMaskTest InetAddrMaskTest.cpp main.cpp) +add_test(NAME InetAddrMaskTest COMMAND InetAddrMaskTest) + +target_link_libraries(InetAddrMaskTest PRIVATE fwbuilder xml2 xslt z cppunit) diff --git a/src/unit_tests/InterfaceDialogTest/CMakeLists.txt b/src/unit_tests/InterfaceDialogTest/CMakeLists.txt new file mode 100644 index 000000000..d392ea7b8 --- /dev/null +++ b/src/unit_tests/InterfaceDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(InterfaceDialogTest InterfaceDialogTest.cpp main_InterfaceDialogTest.cpp) +add_test(NAME InterfaceDialogTest COMMAND InterfaceDialogTest) + +target_link_libraries(InterfaceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/InterfaceDialogTest/main_InterfaceDialogTest.cpp b/src/unit_tests/InterfaceDialogTest/main_InterfaceDialogTest.cpp index c2b5a4506..54e060667 100644 --- a/src/unit_tests/InterfaceDialogTest/main_InterfaceDialogTest.cpp +++ b/src/unit_tests/InterfaceDialogTest/main_InterfaceDialogTest.cpp @@ -40,7 +40,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/NetworkDialogTest/CMakeLists.txt b/src/unit_tests/NetworkDialogTest/CMakeLists.txt new file mode 100644 index 000000000..85f5373a6 --- /dev/null +++ b/src/unit_tests/NetworkDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(NetworkDialogTest NetworkDialogTest.cpp main_NetworkDialogTest.cpp) +add_test(NAME NetworkDialogTest COMMAND NetworkDialogTest) + +target_link_libraries(NetworkDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/NetworkDialogTest/main_NetworkDialogTest.cpp b/src/unit_tests/NetworkDialogTest/main_NetworkDialogTest.cpp index 9117d919b..d8e34cf10 100644 --- a/src/unit_tests/NetworkDialogTest/main_NetworkDialogTest.cpp +++ b/src/unit_tests/NetworkDialogTest/main_NetworkDialogTest.cpp @@ -40,7 +40,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/ObjectManipulatorTest/CMakeLists.txt b/src/unit_tests/ObjectManipulatorTest/CMakeLists.txt new file mode 100644 index 000000000..810102d27 --- /dev/null +++ b/src/unit_tests/ObjectManipulatorTest/CMakeLists.txt @@ -0,0 +1,8 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(ObjectManipulatorTest ObjectManipulatorTest.cpp main_ObjectManipulatorTest.cpp) +add_test(NAME ObjectManipulatorTest COMMAND ObjectManipulatorTest) + +target_link_libraries(ObjectManipulatorTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) + +file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/unit_tests/ObjectManipulatorTest/main_ObjectManipulatorTest.cpp b/src/unit_tests/ObjectManipulatorTest/main_ObjectManipulatorTest.cpp index 1f8d3a359..d2d9f7632 100644 --- a/src/unit_tests/ObjectManipulatorTest/main_ObjectManipulatorTest.cpp +++ b/src/unit_tests/ObjectManipulatorTest/main_ObjectManipulatorTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, @@ -56,6 +55,7 @@ int main(int argc, char** argv) build_app(argc, argv, &app, &st); + QFile::copy("test.fwb", "test_work.fwb"); QTest::qExec(new ObjectManipulatorTest()); diff --git a/src/unit_tests/ObjectMatcherTest/CMakeLists.txt b/src/unit_tests/ObjectMatcherTest/CMakeLists.txt new file mode 100644 index 000000000..7e0a81efc --- /dev/null +++ b/src/unit_tests/ObjectMatcherTest/CMakeLists.txt @@ -0,0 +1,6 @@ +add_executable(ObjectMatcherTest ObjectMatcherTest.cpp main.cpp) +add_test(NAME ObjectMatcherTest COMMAND ObjectMatcherTest) + +target_link_libraries(ObjectMatcherTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) + +file(COPY test_data.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/unit_tests/ObjectMatcherTest/ObjectMatcherTest.cpp b/src/unit_tests/ObjectMatcherTest/ObjectMatcherTest.cpp index 71fd0869b..5f140da28 100644 --- a/src/unit_tests/ObjectMatcherTest/ObjectMatcherTest.cpp +++ b/src/unit_tests/ObjectMatcherTest/ObjectMatcherTest.cpp @@ -130,35 +130,35 @@ void ObjectMatcherTest::matchTest() CPPUNIT_ASSERT(om.dispatch(host1_eth0, fw1)); CPPUNIT_ASSERT(om.dispatch(host1, fw1)); - CPPUNIT_ASSERT(om.dispatch(host2_eth0_ip, fw1) == false); - CPPUNIT_ASSERT(om.dispatch(host2_eth0, fw1) == false); - CPPUNIT_ASSERT(om.dispatch(host2, fw1) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(host2_eth0_ip, fw1)) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(host2_eth0, fw1)) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(host2, fw1)) == false); om.setMatchSubnets(true); CPPUNIT_ASSERT(om.dispatch(host2_eth0_ip, fw1)); om.setMatchSubnets(false); - CPPUNIT_ASSERT(om.dispatch(host3_eth0, fw1) == false); - CPPUNIT_ASSERT(om.dispatch(host3_eth1, fw1) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(host3_eth0, fw1)) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(host3_eth1, fw1)) == false); CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.1")), fw1)); CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.1")), fw1_eth1)); - CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.1")), fw1_eth0) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(IPv4::cast(o("addr-192.168.1.1")), fw1_eth0)) == false); om.setIPV6(true); CPPUNIT_ASSERT(om.dispatch(IPv6::cast(o("addr-ipv6-1")), fw1)); - CPPUNIT_ASSERT(om.dispatch(IPv6::cast(o("addr-ipv6-2")), fw1) == false); - CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.1")), fw1) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(IPv6::cast(o("addr-ipv6-2")), fw1)) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(IPv4::cast(o("addr-192.168.1.1")), fw1)) == false); om.setIPV6(false); - CPPUNIT_ASSERT(om.dispatch(IPv6::cast(o("addr-ipv6-1")), fw1) == false); - CPPUNIT_ASSERT(om.dispatch(IPv6::cast(o("addr-ipv6-2")), fw1) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(IPv6::cast(o("addr-ipv6-1")), fw1)) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(IPv6::cast(o("addr-ipv6-2")), fw1)) == false); - CPPUNIT_ASSERT(om.dispatch(Network::cast(o("net-192.168.1.0")), fw1) == false); - CPPUNIT_ASSERT(om.dispatch(Network::cast(o("net-192.168.1.0")), fw1_eth1) == false); - CPPUNIT_ASSERT(om.dispatch(Network::cast(o("net-192.168.1.0")), fw1_eth0) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(Network::cast(o("net-192.168.1.0")), fw1)) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(Network::cast(o("net-192.168.1.0")), fw1_eth1)) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(Network::cast(o("net-192.168.1.0")), fw1_eth0)) == false); CPPUNIT_ASSERT(om.dispatch(Network::cast(o("net-192.168.1.1")), fw1)); CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.255")), fw1)); @@ -166,8 +166,8 @@ void ObjectMatcherTest::matchTest() CPPUNIT_ASSERT(om.dispatch(Network::cast(o("all multicasts")), fw1)); om.setRecognizeBroadcasts(false); - CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.255")), fw1) == false); - CPPUNIT_ASSERT(om.dispatch(IPv4::cast(o("addr-192.168.1.0")), fw1) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(IPv4::cast(o("addr-192.168.1.255")), fw1)) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(IPv4::cast(o("addr-192.168.1.0")), fw1)) == false); // ================================================================ // AddressRange tests @@ -175,16 +175,16 @@ void ObjectMatcherTest::matchTest() // range1 192.168.1.10 - 192.168.1.20 // does not match fw1 exactly, but matches when match_subnets == true - CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range1")), fw1) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(AddressRange::cast(o("range1")), fw1)) == false); // range2 192.168.2.1-192.168.2.3 does not match fw1:eth2 at all - CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range2")), fw1) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(AddressRange::cast(o("range2")), fw1)) == false); // range3 192.168.2.27-192.168.2.50 partially overlaps with fw1:eth2 subnet - CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range3")), fw1) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(AddressRange::cast(o("range3")), fw1)) == false); // range4 192.168.2.27-192.168.2.30 is completely inside fw1:eth2 subnet - CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range4")), fw1) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(AddressRange::cast(o("range4")), fw1)) == false); // ================================================================ om.setAddressRangeMatchMode(ObjectMatcher::PARTIAL); @@ -195,10 +195,10 @@ void ObjectMatcherTest::matchTest() // range3 192.168.2.27-192.168.2.50 partially overlaps with fw1:eth2 subnet // but address of interface 192.168.2.24 is outside the range - CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range3")), fw1) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(AddressRange::cast(o("range3")), fw1)) == false); // range4 192.168.2.27-192.168.2.30 is completely inside fw1:eth2 subnet - CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range4")), fw1) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(AddressRange::cast(o("range4")), fw1)) == false); // fw1:eth2:ip 192.168.2.24 falls inside range5 CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range5")), fw1)); @@ -211,7 +211,7 @@ void ObjectMatcherTest::matchTest() CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range1")), fw1)); // range2 192.168.2.1-192.168.2.3 does not match fw1:eth2 at all - CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range2")), fw1) == false); + CPPUNIT_ASSERT(static_cast(om.dispatch(AddressRange::cast(o("range2")), fw1)) == false); // range3 192.168.2.27-192.168.2.50 partially overlaps with fw1:eth2 subnet CPPUNIT_ASSERT(om.dispatch(AddressRange::cast(o("range3")), fw1)); diff --git a/src/unit_tests/PFImporterTest/CMakeLists.txt b/src/unit_tests/PFImporterTest/CMakeLists.txt new file mode 100644 index 000000000..425ff0cad --- /dev/null +++ b/src/unit_tests/PFImporterTest/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(PFImporterTest PFImporterTest.cpp main_PFImporterTest.cpp) +add_test(NAME PFImporterTest COMMAND PFImporterTest) + +target_link_libraries(PFImporterTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) + +file(COPY test_data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\") diff --git a/src/unit_tests/PFImporterTest/main_PFImporterTest.cpp b/src/unit_tests/PFImporterTest/main_PFImporterTest.cpp index 34ef51b2a..ec717671b 100644 --- a/src/unit_tests/PFImporterTest/main_PFImporterTest.cpp +++ b/src/unit_tests/PFImporterTest/main_PFImporterTest.cpp @@ -34,14 +34,13 @@ #include #include -#include "../../../common/init.cpp" +#include "common/init.cpp" int fwbdebug = 0; //QString user_name; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; std::string platform; int main(int argc, char** argv) diff --git a/src/unit_tests/PIXImporterTest/CMakeLists.txt b/src/unit_tests/PIXImporterTest/CMakeLists.txt new file mode 100644 index 000000000..9cd53892f --- /dev/null +++ b/src/unit_tests/PIXImporterTest/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(PIXImporterTest PIXImporterTest.cpp main_PIXImporterTest.cpp) +add_test(NAME PIXImporterTest COMMAND PIXImporterTest) + +target_link_libraries(PIXImporterTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) + +file(COPY test_data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\") diff --git a/src/unit_tests/PIXImporterTest/PIXImporterTest.h b/src/unit_tests/PIXImporterTest/PIXImporterTest.h index 06350d7e6..71ea3e2be 100644 --- a/src/unit_tests/PIXImporterTest/PIXImporterTest.h +++ b/src/unit_tests/PIXImporterTest/PIXImporterTest.h @@ -39,6 +39,7 @@ #include + class PIXImporterTest : public CppUnit::TestFixture { libfwbuilder::FWObjectDatabase *db; diff --git a/src/unit_tests/PIXImporterTest/main_PIXImporterTest.cpp b/src/unit_tests/PIXImporterTest/main_PIXImporterTest.cpp index 6e63386b9..68d5f0a2b 100644 --- a/src/unit_tests/PIXImporterTest/main_PIXImporterTest.cpp +++ b/src/unit_tests/PIXImporterTest/main_PIXImporterTest.cpp @@ -34,14 +34,13 @@ #include #include -#include "../../../common/init.cpp" +#include "common/init.cpp" int fwbdebug = 0; //QString user_name; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; std::string platform; int main(int argc, char** argv) diff --git a/src/unit_tests/RCS/CMakeLists.txt b/src/unit_tests/RCS/CMakeLists.txt new file mode 100644 index 000000000..c03dfa849 --- /dev/null +++ b/src/unit_tests/RCS/CMakeLists.txt @@ -0,0 +1,6 @@ +add_executable(RCSTest RCSTest.cpp main_RCS.cpp) +add_test(NAME RCSTest COMMAND RCSTest) + +target_link_libraries(RCSTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) + +file(COPY rlog_unit_test.log "zu.fwb,v" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/unit_tests/RuleSetViewContextMenuTest/CMakeLists.txt b/src/unit_tests/RuleSetViewContextMenuTest/CMakeLists.txt new file mode 100644 index 000000000..4a98e4936 --- /dev/null +++ b/src/unit_tests/RuleSetViewContextMenuTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(RuleSetViewContextMenuTest RuleSetViewContextMenuTest.cpp main_RuleSetViewContextMenuTest.cpp) +add_test(NAME RuleSetViewContextMenuTest COMMAND RuleSetViewContextMenuTest) + +target_link_libraries(RuleSetViewContextMenuTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/RuleSetViewContextMenuTest/main_RuleSetViewContextMenuTest.cpp b/src/unit_tests/RuleSetViewContextMenuTest/main_RuleSetViewContextMenuTest.cpp index 6342d586c..5215479d9 100644 --- a/src/unit_tests/RuleSetViewContextMenuTest/main_RuleSetViewContextMenuTest.cpp +++ b/src/unit_tests/RuleSetViewContextMenuTest/main_RuleSetViewContextMenuTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/RuleSetViewTest/CMakeLists.txt b/src/unit_tests/RuleSetViewTest/CMakeLists.txt new file mode 100644 index 000000000..67231b9a1 --- /dev/null +++ b/src/unit_tests/RuleSetViewTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(RuleSetViewTest RuleSetViewTest.cpp main_RuleSetViewTest.cpp) +add_test(NAME RuleSetViewTest COMMAND RuleSetViewTest) + +target_link_libraries(RuleSetViewTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/RuleSetViewTest/main_RuleSetViewTest.cpp b/src/unit_tests/RuleSetViewTest/main_RuleSetViewTest.cpp index c843efd69..ff21e494c 100644 --- a/src/unit_tests/RuleSetViewTest/main_RuleSetViewTest.cpp +++ b/src/unit_tests/RuleSetViewTest/main_RuleSetViewTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/TCPServiceDialogTest/CMakeLists.txt b/src/unit_tests/TCPServiceDialogTest/CMakeLists.txt new file mode 100644 index 000000000..d4b4e5e3a --- /dev/null +++ b/src/unit_tests/TCPServiceDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(TCPServiceDialogTest TCPServiceDialogTest.cpp main_TCPServiceDialogTest.cpp) +add_test(NAME TCPServiceDialogTest COMMAND TCPServiceDialogTest) + +target_link_libraries(TCPServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/TCPServiceDialogTest/main_TCPServiceDialogTest.cpp b/src/unit_tests/TCPServiceDialogTest/main_TCPServiceDialogTest.cpp index 50e1953a6..75abc37f8 100644 --- a/src/unit_tests/TCPServiceDialogTest/main_TCPServiceDialogTest.cpp +++ b/src/unit_tests/TCPServiceDialogTest/main_TCPServiceDialogTest.cpp @@ -40,7 +40,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/TagServiceDialogTest/CMakeLists.txt b/src/unit_tests/TagServiceDialogTest/CMakeLists.txt new file mode 100644 index 000000000..b9f43080a --- /dev/null +++ b/src/unit_tests/TagServiceDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(TagServiceDialogTest TagServiceDialogTest.cpp main_TagServiceDialogTest.cpp) +add_test(NAME TagServiceDialogTest COMMAND TagServiceDialogTest) + +target_link_libraries(TagServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/TagServiceDialogTest/main_TagServiceDialogTest.cpp b/src/unit_tests/TagServiceDialogTest/main_TagServiceDialogTest.cpp index 3bf4f4aaf..bb9ff4b7e 100644 --- a/src/unit_tests/TagServiceDialogTest/main_TagServiceDialogTest.cpp +++ b/src/unit_tests/TagServiceDialogTest/main_TagServiceDialogTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/UDPServiceDialogTest/CMakeLists.txt b/src/unit_tests/UDPServiceDialogTest/CMakeLists.txt new file mode 100644 index 000000000..cd20f8119 --- /dev/null +++ b/src/unit_tests/UDPServiceDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(UDPServiceDialogTest UDPServiceDialogTest.cpp main_UDPServiceDialogTest.cpp) +add_test(NAME UDPServiceDialogTest COMMAND UDPServiceDialogTest) + +target_link_libraries(UDPServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/UDPServiceDialogTest/main_UDPServiceDialogTest.cpp b/src/unit_tests/UDPServiceDialogTest/main_UDPServiceDialogTest.cpp index c6007369d..55fe8aca2 100644 --- a/src/unit_tests/UDPServiceDialogTest/main_UDPServiceDialogTest.cpp +++ b/src/unit_tests/UDPServiceDialogTest/main_UDPServiceDialogTest.cpp @@ -40,7 +40,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/UsageResolverTest/CMakeLists.txt b/src/unit_tests/UsageResolverTest/CMakeLists.txt new file mode 100644 index 000000000..1379b454f --- /dev/null +++ b/src/unit_tests/UsageResolverTest/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(UsageResolverTest UsageResolverTest.cpp main_UsageResolverTest.cpp) +add_test(NAME UsageResolverTest COMMAND UsageResolverTest) + +target_link_libraries(UsageResolverTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) diff --git a/src/unit_tests/UserSerivceDialogTest/CMakeLists.txt b/src/unit_tests/UserSerivceDialogTest/CMakeLists.txt new file mode 100644 index 000000000..d1afbb881 --- /dev/null +++ b/src/unit_tests/UserSerivceDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(UserServiceDialogTest UserServiceDialogTest.cpp main_UserServiceDialogTest.cpp) +add_test(NAME UserServiceDialogTest COMMAND UserServiceDialogTest) + +target_link_libraries(UserServiceDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/UserSerivceDialogTest/main_UserServiceDialogTest.cpp b/src/unit_tests/UserSerivceDialogTest/main_UserServiceDialogTest.cpp index 692651af9..67ffe6491 100644 --- a/src/unit_tests/UserSerivceDialogTest/main_UserServiceDialogTest.cpp +++ b/src/unit_tests/UserSerivceDialogTest/main_UserServiceDialogTest.cpp @@ -40,7 +40,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/commandLinePrintingTest/CMakeLists.txt b/src/unit_tests/commandLinePrintingTest/CMakeLists.txt new file mode 100644 index 000000000..e003ed266 --- /dev/null +++ b/src/unit_tests/commandLinePrintingTest/CMakeLists.txt @@ -0,0 +1,4 @@ +add_test(NAME commandLinePrintingTest COMMAND commandLinePrintingTest) + +file(COPY commandLinePrintingTest test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + diff --git a/src/unit_tests/commandLinePrintingTest/commandLinePrintingTest b/src/unit_tests/commandLinePrintingTest/commandLinePrintingTest index b9e8fcf88..1f98969cb 100755 --- a/src/unit_tests/commandLinePrintingTest/commandLinePrintingTest +++ b/src/unit_tests/commandLinePrintingTest/commandLinePrintingTest @@ -1,5 +1,7 @@ #!/bin/sh +pushd "$( dirname "${BASH_SOURCE[0]}" )" + rm -f print.pdf >/dev/null 2>/dev/null QTVERSION=$(${QMAKE:-qmake} --version 2>&1 | tail -n1| cut -d' ' -f4) diff --git a/src/unit_tests/compilerLibTest/CMakeLists.txt b/src/unit_tests/compilerLibTest/CMakeLists.txt new file mode 100644 index 000000000..90ca1082f --- /dev/null +++ b/src/unit_tests/compilerLibTest/CMakeLists.txt @@ -0,0 +1,10 @@ +SET(CMAKE_AUTOMOC ON) + +add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\") + +add_executable(compilerLibTest interfacePropertiesTest.cpp tests_main.cpp) +add_test(NAME compilerLibTest COMMAND compilerLibTest) + +target_link_libraries(compilerLibTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) + +file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/unit_tests/generatedScriptTestsIpfilter/CMakeLists.txt b/src/unit_tests/generatedScriptTestsIpfilter/CMakeLists.txt new file mode 100644 index 000000000..713247e0f --- /dev/null +++ b/src/unit_tests/generatedScriptTestsIpfilter/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(generatedScriptTestsIpfilter generatedScriptTestsIpfilter.cpp main_generatedScriptTestsIpfilter.cpp) +add_test(NAME generatedScriptTestsIpfilter COMMAND generatedScriptTestsIpfilter) + +target_link_libraries(generatedScriptTestsIpfilter PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) + +file(COPY test1.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\") diff --git a/src/unit_tests/generatedScriptTestsIpfilter/main_generatedScriptTestsIpfilter.cpp b/src/unit_tests/generatedScriptTestsIpfilter/main_generatedScriptTestsIpfilter.cpp index e83cdb7cf..ea8bb624c 100644 --- a/src/unit_tests/generatedScriptTestsIpfilter/main_generatedScriptTestsIpfilter.cpp +++ b/src/unit_tests/generatedScriptTestsIpfilter/main_generatedScriptTestsIpfilter.cpp @@ -35,7 +35,7 @@ #include #include -#include "../../../common/init.cpp" +#include "common/init.cpp" using namespace std; using namespace libfwbuilder; diff --git a/src/unit_tests/generatedScriptTestsIpfw/CMakeLists.txt b/src/unit_tests/generatedScriptTestsIpfw/CMakeLists.txt new file mode 100644 index 000000000..78632bbb1 --- /dev/null +++ b/src/unit_tests/generatedScriptTestsIpfw/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(generatedScriptTestsIpfw generatedScriptTestsIpfw.cpp main_generatedScriptTestsIpfw.cpp) +add_test(NAME generatedScriptTestsIpfw COMMAND generatedScriptTestsIpfw) + +target_link_libraries(generatedScriptTestsIpfw PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) + +file(COPY test1.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\") diff --git a/src/unit_tests/generatedScriptTestsIpfw/main_generatedScriptTestsIpfw.cpp b/src/unit_tests/generatedScriptTestsIpfw/main_generatedScriptTestsIpfw.cpp index f98e595e8..ba1dff2b0 100644 --- a/src/unit_tests/generatedScriptTestsIpfw/main_generatedScriptTestsIpfw.cpp +++ b/src/unit_tests/generatedScriptTestsIpfw/main_generatedScriptTestsIpfw.cpp @@ -35,7 +35,7 @@ #include #include -#include "../../../common/init.cpp" +#include "common/init.cpp" using namespace std; using namespace libfwbuilder; diff --git a/src/unit_tests/generatedScriptTestsLinux/CMakeLists.txt b/src/unit_tests/generatedScriptTestsLinux/CMakeLists.txt new file mode 100644 index 000000000..5e51fbb2c --- /dev/null +++ b/src/unit_tests/generatedScriptTestsLinux/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(generatedScriptTestsLinux generatedScriptTestsLinux.cpp main_generatedScriptTestsLinux.cpp) +add_test(NAME generatedScriptTestsLinux COMMAND generatedScriptTestsLinux) + +target_link_libraries(generatedScriptTestsLinux PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) + +file(COPY test1.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\") diff --git a/src/unit_tests/generatedScriptTestsLinux/main_generatedScriptTestsLinux.cpp b/src/unit_tests/generatedScriptTestsLinux/main_generatedScriptTestsLinux.cpp index 20e30bdcf..24c69ddda 100644 --- a/src/unit_tests/generatedScriptTestsLinux/main_generatedScriptTestsLinux.cpp +++ b/src/unit_tests/generatedScriptTestsLinux/main_generatedScriptTestsLinux.cpp @@ -35,7 +35,7 @@ #include #include -#include "../../../common/init.cpp" +#include "common/init.cpp" using namespace std; using namespace libfwbuilder; diff --git a/src/unit_tests/generatedScriptTestsPF/CMakeLists.txt b/src/unit_tests/generatedScriptTestsPF/CMakeLists.txt new file mode 100644 index 000000000..9c5cfc86d --- /dev/null +++ b/src/unit_tests/generatedScriptTestsPF/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(generatedScriptTestsPF generatedScriptTestsPF.cpp main_generatedScriptTestsPF.cpp) +add_test(NAME generatedScriptTestsPF COMMAND generatedScriptTestsPF) + +target_link_libraries(generatedScriptTestsPF PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) + +file(COPY test1.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\") diff --git a/src/unit_tests/generatedScriptTestsPF/main_generatedScriptTestsPF.cpp b/src/unit_tests/generatedScriptTestsPF/main_generatedScriptTestsPF.cpp index bdd9942be..10da43bb4 100644 --- a/src/unit_tests/generatedScriptTestsPF/main_generatedScriptTestsPF.cpp +++ b/src/unit_tests/generatedScriptTestsPF/main_generatedScriptTestsPF.cpp @@ -35,7 +35,7 @@ #include #include -#include "../../../common/init.cpp" +#include "common/init.cpp" using namespace std; using namespace libfwbuilder; diff --git a/src/unit_tests/generatedScriptTestsSecuwall/CMakeLists.txt b/src/unit_tests/generatedScriptTestsSecuwall/CMakeLists.txt new file mode 100644 index 000000000..2a5359b8e --- /dev/null +++ b/src/unit_tests/generatedScriptTestsSecuwall/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(generatedScriptTestsSecuwall generatedScriptTestsSecuwall.cpp main_generatedScriptTestsSecuwall.cpp) +add_test(NAME generatedScriptTestsSecuwall COMMAND generatedScriptTestsSecuwall) + +target_link_libraries(generatedScriptTestsSecuwall PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) + +file(COPY test1.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions(-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\") diff --git a/src/unit_tests/generatedScriptTestsSecuwall/main_generatedScriptTestsSecuwall.cpp b/src/unit_tests/generatedScriptTestsSecuwall/main_generatedScriptTestsSecuwall.cpp index 26a8056dc..49738b681 100644 --- a/src/unit_tests/generatedScriptTestsSecuwall/main_generatedScriptTestsSecuwall.cpp +++ b/src/unit_tests/generatedScriptTestsSecuwall/main_generatedScriptTestsSecuwall.cpp @@ -26,7 +26,7 @@ #include #include -#include "../../../common/init.cpp" +#include "common/init.cpp" using namespace std; using namespace libfwbuilder; diff --git a/src/unit_tests/genericDialogTest/CMakeLists.txt b/src/unit_tests/genericDialogTest/CMakeLists.txt new file mode 100644 index 000000000..25df3210c --- /dev/null +++ b/src/unit_tests/genericDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(genericDialogTest genericDialogTest.cpp main_genericDialogTest.cpp) +add_test(NAME genericDialogTest COMMAND genericDialogTest) + +target_link_libraries(genericDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/genericDialogTest/genericDialogTest.cpp b/src/unit_tests/genericDialogTest/genericDialogTest.cpp index f79d4a7f8..493b64257 100644 --- a/src/unit_tests/genericDialogTest/genericDialogTest.cpp +++ b/src/unit_tests/genericDialogTest/genericDialogTest.cpp @@ -39,6 +39,7 @@ #include #include +#include #include #include #include diff --git a/src/unit_tests/genericDialogTest/main_genericDialogTest.cpp b/src/unit_tests/genericDialogTest/main_genericDialogTest.cpp index 9ab72c1fc..30e9e81ac 100644 --- a/src/unit_tests/genericDialogTest/main_genericDialogTest.cpp +++ b/src/unit_tests/genericDialogTest/main_genericDialogTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/instDialogClusterTest/CMakeLists.txt b/src/unit_tests/instDialogClusterTest/CMakeLists.txt new file mode 100644 index 000000000..43ea87b9b --- /dev/null +++ b/src/unit_tests/instDialogClusterTest/CMakeLists.txt @@ -0,0 +1,8 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(instDialogClusterTest instDialogClusterTest.cpp main_instDialogClusterTest.cpp) +add_test(NAME instDialogClusterTest COMMAND instDialogClusterTest) + +target_link_libraries(instDialogClusterTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) + +file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/unit_tests/instDialogClusterTest/main_instDialogClusterTest.cpp b/src/unit_tests/instDialogClusterTest/main_instDialogClusterTest.cpp index 68ee8b10e..3f156fe28 100644 --- a/src/unit_tests/instDialogClusterTest/main_instDialogClusterTest.cpp +++ b/src/unit_tests/instDialogClusterTest/main_instDialogClusterTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, @@ -56,6 +55,7 @@ int main(int argc, char** argv) build_app(argc, argv, &app, &st); + QFile::copy("test.fwb", "test_work.fwb"); QTest::qExec(new instDialogClusterTest()); diff --git a/src/unit_tests/instDialogCompileTest/CMakeLists.txt b/src/unit_tests/instDialogCompileTest/CMakeLists.txt new file mode 100644 index 000000000..3292c010c --- /dev/null +++ b/src/unit_tests/instDialogCompileTest/CMakeLists.txt @@ -0,0 +1,8 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(instDialogCompileTest instDialogCompileTest.cpp main_instDialogCompileTest.cpp) +add_test(NAME instDialogCompileTest COMMAND instDialogCompileTest) + +target_link_libraries(instDialogCompileTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) + +file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/unit_tests/instDialogCompileTest/main_instDialogCompileTest.cpp b/src/unit_tests/instDialogCompileTest/main_instDialogCompileTest.cpp index af4749387..ac2262472 100644 --- a/src/unit_tests/instDialogCompileTest/main_instDialogCompileTest.cpp +++ b/src/unit_tests/instDialogCompileTest/main_instDialogCompileTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, @@ -56,6 +55,7 @@ int main(int argc, char** argv) build_app(argc, argv, &app, &st); + QFile::copy("test.fwb", "test_work.fwb"); QTest::qExec(new instDialogCompileTest()); diff --git a/src/unit_tests/instDialogInspectTest/CMakeLists.txt b/src/unit_tests/instDialogInspectTest/CMakeLists.txt new file mode 100644 index 000000000..4e1c8eb65 --- /dev/null +++ b/src/unit_tests/instDialogInspectTest/CMakeLists.txt @@ -0,0 +1,8 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(instDialogInspectTest instDialogInspectTest.cpp main_instDialogInspectTest.cpp) +add_test(NAME instDialogInspectTest COMMAND instDialogInspectTest) + +target_link_libraries(instDialogInspectTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) + +file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/unit_tests/instDialogInspectTest/main_instDialogInspectTest.cpp b/src/unit_tests/instDialogInspectTest/main_instDialogInspectTest.cpp index 37dac8790..2ac2746f1 100644 --- a/src/unit_tests/instDialogInspectTest/main_instDialogInspectTest.cpp +++ b/src/unit_tests/instDialogInspectTest/main_instDialogInspectTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, @@ -56,6 +55,7 @@ int main(int argc, char** argv) build_app(argc, argv, &app, &st); + QFile::copy("test.fwb", "test_work.fwb"); QTest::qExec(new instDialogInspectTest()); diff --git a/src/unit_tests/instDialogInstallTest/CMakeLists.txt b/src/unit_tests/instDialogInstallTest/CMakeLists.txt new file mode 100644 index 000000000..961cea38c --- /dev/null +++ b/src/unit_tests/instDialogInstallTest/CMakeLists.txt @@ -0,0 +1,8 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(instDialogInstallTest instDialogInstallTest.cpp main_instDialogInstallTest.cpp) +add_test(NAME instDialogInstallTest COMMAND instDialogInstallTest) + +target_link_libraries(instDialogInstallTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) + +file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/unit_tests/instDialogInstallTest/main_instDialogInstallTest.cpp b/src/unit_tests/instDialogInstallTest/main_instDialogInstallTest.cpp index 73dbe8af4..e5d436423 100644 --- a/src/unit_tests/instDialogInstallTest/main_instDialogInstallTest.cpp +++ b/src/unit_tests/instDialogInstallTest/main_instDialogInstallTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, @@ -56,6 +55,7 @@ int main(int argc, char** argv) build_app(argc, argv, &app, &st); + QFile::copy("test.fwb", "test_work.fwb"); QTest::qExec(new instDialogInstallTest()); diff --git a/src/unit_tests/instDialogObjectListTest/CMakeLists.txt b/src/unit_tests/instDialogObjectListTest/CMakeLists.txt new file mode 100644 index 000000000..8c85a26ce --- /dev/null +++ b/src/unit_tests/instDialogObjectListTest/CMakeLists.txt @@ -0,0 +1,8 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(instDialogObjectListTest instDialogObjectListTest.cpp main_instDialogObjectListTest.cpp) +add_test(NAME instDialogObjectListTest COMMAND instDialogObjectListTest) + +target_link_libraries(instDialogObjectListTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) + +file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/unit_tests/instDialogObjectListTest/main_instDialogObjectListTest.cpp b/src/unit_tests/instDialogObjectListTest/main_instDialogObjectListTest.cpp index a17004679..b7bc86067 100644 --- a/src/unit_tests/instDialogObjectListTest/main_instDialogObjectListTest.cpp +++ b/src/unit_tests/instDialogObjectListTest/main_instDialogObjectListTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, @@ -56,6 +55,7 @@ int main(int argc, char** argv) build_app(argc, argv, &app, &st); + QFile::copy("test.fwb", "test_work.fwb"); QTest::qExec(new instDialogObjectListTest()); diff --git a/src/unit_tests/main/CMakeLists.txt b/src/unit_tests/main/CMakeLists.txt new file mode 100644 index 000000000..ec18355fd --- /dev/null +++ b/src/unit_tests/main/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(test_main STATIC main.cpp) + +target_link_libraries(test_main gui) + +qt5_use_modules(test_main Test) + diff --git a/src/unit_tests/newClusterDialogTest/CMakeLists.txt b/src/unit_tests/newClusterDialogTest/CMakeLists.txt new file mode 100644 index 000000000..60e6232dd --- /dev/null +++ b/src/unit_tests/newClusterDialogTest/CMakeLists.txt @@ -0,0 +1,8 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(newClusterDialogTest newClusterDialogTest.cpp main_newClusterDialogTest.cpp) +add_test(NAME newClusterDialogTest COMMAND newClusterDialogTest) + +target_link_libraries(newClusterDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) + +file(COPY test.fwb DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/unit_tests/newClusterDialogTest/main_newClusterDialogTest.cpp b/src/unit_tests/newClusterDialogTest/main_newClusterDialogTest.cpp index 1108fac9e..bcf0b2170 100644 --- a/src/unit_tests/newClusterDialogTest/main_newClusterDialogTest.cpp +++ b/src/unit_tests/newClusterDialogTest/main_newClusterDialogTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, @@ -56,6 +55,7 @@ int main(int argc, char** argv) build_app(argc, argv, &app, &st); + QFile::copy("test.fwb", "test_work.fwb"); QTest::qExec(new newClusterDialogTest()); diff --git a/src/unit_tests/parseCommandLineTest/CMakeLists.txt b/src/unit_tests/parseCommandLineTest/CMakeLists.txt new file mode 100644 index 000000000..97d0ec243 --- /dev/null +++ b/src/unit_tests/parseCommandLineTest/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(parseCommandLineTest parseCommandLineTest.cpp main_parseCommandLineTest.cpp) +add_test(NAME parseCommandLineTest COMMAND parseCommandLineTest) + +target_link_libraries(parseCommandLineTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread cppunit) diff --git a/src/unit_tests/parseCommandLineTest/main_parseCommandLineTest.cpp b/src/unit_tests/parseCommandLineTest/main_parseCommandLineTest.cpp index 958afc764..678dd4c90 100644 --- a/src/unit_tests/parseCommandLineTest/main_parseCommandLineTest.cpp +++ b/src/unit_tests/parseCommandLineTest/main_parseCommandLineTest.cpp @@ -38,7 +38,6 @@ void *mw = nullptr; void *st = nullptr; void *app = nullptr; void *wfl; -int sig = FWB_SIG; int main( int, char** ) { diff --git a/src/unit_tests/startTipDialogTest/CMakeLists.txt b/src/unit_tests/startTipDialogTest/CMakeLists.txt new file mode 100644 index 000000000..eae5f1bbe --- /dev/null +++ b/src/unit_tests/startTipDialogTest/CMakeLists.txt @@ -0,0 +1,6 @@ +SET(CMAKE_AUTOMOC ON) + +add_executable(startTipDialogTest startTipDialogTest.cpp main_startTipDialogTest.cpp) +add_test(NAME startTipDialogTest COMMAND startTipDialogTest) + +target_link_libraries(startTipDialogTest PRIVATE test_main netsnmp gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 xslt z pthread Qt5::Test) diff --git a/src/unit_tests/startTipDialogTest/main_startTipDialogTest.cpp b/src/unit_tests/startTipDialogTest/main_startTipDialogTest.cpp index c2db4cd90..4180d8f13 100644 --- a/src/unit_tests/startTipDialogTest/main_startTipDialogTest.cpp +++ b/src/unit_tests/startTipDialogTest/main_startTipDialogTest.cpp @@ -41,7 +41,6 @@ int fwbdebug = 0; FWWindow *mw = nullptr; FWBSettings *st = nullptr; FWBApplication *app = nullptr; -int sig = FWB_SIG; extern void build_app(int argc, char** argv, diff --git a/src/unit_tests/startTipDialogTest/startTipDialogTest.cpp b/src/unit_tests/startTipDialogTest/startTipDialogTest.cpp index cbd948026..a158209bd 100644 --- a/src/unit_tests/startTipDialogTest/startTipDialogTest.cpp +++ b/src/unit_tests/startTipDialogTest/startTipDialogTest.cpp @@ -26,6 +26,7 @@ #include "startTipDialogTest.h" #include "FWWindow.h" #include "FWBApplication.h" +#include "FWObjectClipboard.h" #include "StartTipDialog.h" #include #include "global.h" @@ -46,6 +47,7 @@ void startTipDialogTest::testDialogAppear() { st->setBool("UI/NoStartTip", false); st->setBool("UI/FirstRun", true); + new FWObjectClipboard(); mw = new FWWindow(); mw->show(); mw->startupLoad();