1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-05-05 00:35:03 +02:00

Moved all unit tests to src/unit_tests (refs #1826)

This commit is contained in:
Roman Bovsunovsky 2010-11-04 18:34:24 +02:00
parent 8056c5c8b9
commit fb341e72a7
194 changed files with 175 additions and 451 deletions

View File

@ -1,3 +0,0 @@
*.a
/*Test

View File

@ -1,63 +0,0 @@
#-*- mode: makefile; tab-width: 4; -*-
include(../../../qmake.inc)
# exists(../../qmake.inc):include( ../../qmake.inc)
QMAKE_CXX = g++
TEMPLATE = app
TARGET = interfacePropertiesTest
DEPENDPATH += .
SOURCES = ../CompilerDriver.cpp \
../CompilerDriver_compile.cpp \
../CompilerDriver_generators.cpp \
../Configlet.cpp \
../interfaceProperties.cpp \
../linux24Interfaces.cpp \
../bsdInterfaces.cpp \
../iosInterfaces.cpp \
../procurveInterfaces.cpp \
../pixInterfaces.cpp \
../interfacePropertiesObjectFactory.cpp
HEADERS = ../../../config.h \
../CompilerDriver.h \
../Configlet.h \
../interfaceProperties.h \
../linux24Interfaces.h \
../bsdInterfaces.h \
../iosInterfaces.h \
../procurveInterfaces.h \
../pixInterfaces.h \
../interfacePropertiesObjectFactory.h
# Actual tests
HEADERS += interfacePropertiesTest.h
SOURCES += tests_main.cpp interfacePropertiesTest.cpp
CONFIG -= release
CONFIG += debug
OBJECTS_DIR = .
QMAKE_CXXFLAGS += $$CPPUNIT_CFLAGS
LIBS += $$LIBS_FWCOMPILER $$LIBS_FWBUILDER $$CPPUNIT_LIBS
!win32:LIBS += ../../common/libcommon.a
!win32:PRE_TARGETDEPS = ../../common/libcommon.a
win32:CONFIG += console
win32:LIBS += ../../common/release/common.lib
win32:PRE_TARGETDEPS = ../../common/release/common.lib
run_tests.commands = echo "Running tests..." && \
./${TARGET} && \
echo "OK" || { echo "FAILED"; exit 1; }
run_tests.depends = build_tests
build_tests.depends = all
clean_tests.depends = clean
QMAKE_EXTRA_TARGETS += run_tests build_tests clean_tests

View File

@ -1,57 +0,0 @@
include(../../../../qmake.inc)
QT += gui network
TEMPLATE = app
LANGUAGE = C++
CONFIG += console
INCLUDEPATH += ../../../.. \
../.. \
../../../compiler_lib/ \
../../../common
DEPENDPATH = ../../../.. \
../.. \
../../../compiler_lib/ \
../../../common
HEADERS = generatedScriptTestsLinux.h
SOURCES = main_generatedScriptTestsLinux.cpp \
generatedScriptTestsLinux.cpp
TARGET = generatedScriptTestsLinux
CONFIG -= release
CONFIG += debug
win32:CONFIG += console
QMAKE_CXXFLAGS += $$CPPUNIT_CFLAGS
LIBS += $$LIBS_FWCOMPILER $$LIBS_FWBUILDER $$CPPUNIT_LIBS
win32:LIBS += ../../../common/release/common.lib \
../../release/iptlib.lib \
../../../compiler_lib/release/compilerdriver.lib
!win32:LIBS += ../../../common/libcommon.a \
../../libiptlib.a \
../../../compiler_lib/libcompilerdriver.a
win32:PRE_TARGETDEPS = ../../../common/release/common.lib \
../../release/iptlib.lib \
../compiler_lib/release/compilerdriver.lib
!win32:PRE_TARGETDEPS = ../../../common/libcommon.a \
../../libiptlib.a \
../../../compiler_lib/libcompilerdriver.a
run_tests.commands = echo "Running tests..." && \
rm -f *.fw && \
./${TARGET} && \
echo "OK" || { echo "FAILED"; exit 1; }
run_tests.depends = build_tests
build_tests.depends = all
clean_tests.depends = all
QMAKE_EXTRA_TARGETS += run_tests build_tests clean_tests

View File

@ -1,62 +0,0 @@
include(../../../../qmake.inc)
QT += gui network
TEMPLATE = app
LANGUAGE = C++
CONFIG += console
INCLUDEPATH += ../../../.. \
../.. \
../../../compiler_lib/ \
../../../common
DEPENDPATH = ../../../.. \
../.. \
../../../compiler_lib/ \
../../../common
HEADERS = generatedScriptTestsSecuwall.h
SOURCES = main_generatedScriptTestsSecuwall.cpp \
generatedScriptTestsSecuwall.cpp
TARGET = generatedScriptTestsSecuwall
CONFIG -= release
CONFIG += debug
win32:CONFIG += console
QMAKE_CXXFLAGS += $$CPPUNIT_CFLAGS
LIBS += $$LIBS_FWCOMPILER $$LIBS_FWBUILDER $$CPPUNIT_LIBS
win32:LIBS += ../../../common/release/common.lib \
../../release/iptlib.lib \
../../../compiler_lib/release/compilerdriver.lib
!win32:LIBS += ../../../common/libcommon.a \
../../libiptlib.a \
../../../compiler_lib/libcompilerdriver.a
win32:PRE_TARGETDEPS = ../../../common/release/common.lib \
../../release/iptlib.lib \
../compiler_lib/release/compilerdriver.lib
!win32:PRE_TARGETDEPS = ../../../common/libcommon.a \
../../libiptlib.a \
../../../compiler_lib/libcompilerdriver.a
run_tests.commands = echo "Running tests..." && \
./${TARGET} && \
echo "OK" || { echo "FAILED"; exit 1; }
build_tests.commands = @tar -zxf ./ref.secuwall-1.tar.gz
clean_tests.commands = @rm -rf ./secuwall-* && \
rm -rf ./ref.secuwall-1 && \
rm -f ${TARGET}
run_tests.depends = build_tests
build_tests.depends = all
clean_tests.depends = all
QMAKE_EXTRA_TARGETS += run_tests build_tests clean_tests

View File

@ -1,3 +0,0 @@
*.a
/*Test

View File

@ -1,86 +0,0 @@
include(../../../qmake.inc)
macx:exists(../../gui/qmake.inc):include(../../gui/qmake.inc)
macx:SOURCES -= main_mac.cpp
OBJECTS_DIR = .obj
MOC_DIR = .moc
LIBS += ../../libgui.a
CONFIG -= release
CONFIG += debug
LIBS += $$LIBS_FWCOMPILER $$LIBS_FWBUILDER $$CPPUNIT_LIBS
INCLUDEPATH += ../../.ui
INCLUDEPATH += ../../../compiler_lib
INCLUDEPATH += ../../../iptlib
INCLUDEPATH += ../../../.. \
../../../cisco_lib \
../../../pflib \
../../..
DEPENDPATH = ../../../common
!win32:LIBS += ../../../common/libcommon.a
!win32:PRE_TARGETDEPS = ../../../common/libcommon.a
win32:CONFIG += console
win32:LIBS += ../../../common/release/common.lib
win32:PRE_TARGETDEPS = ../../../common/release/common.lib
run_tests.commands = echo "Running tests..."; \
./${TARGET}
run_tests.depends = build_tests
build_tests.depends = all
clean_tests.depends = all
QMAKE_EXTRA_TARGETS += run_tests build_tests clean_tests
INCLUDEPATH += $$ANTLR_INCLUDEPATH
LIBS += ../../$$FWBPARSER_LIB
DEFINES += $$ANTLR_DEFINES
LIBS += $$LIBS_FWCOMPILER
LIBS += $$ANTLR_LIBS
# fwtransfer lib. Add this before adding -lQtDBus to LIBS below
LIBS += ../../$$FWTRANSFER_LIB
contains( HAVE_QTDBUS, 1 ):unix {
!macx:QT += network \
dbus
macx:LIBS += -framework \
QtDBus
}
# !macx:LIBS += -lQtDBus # workaround for QT += dbus not working with Qt < 4.4.0
INCLUDEPATH += ../../../common \
../../../iptlib \
../../../pflib \
../../../cisco_lib/ \
../../../compiler_lib/
DEPENDPATH = ../../../common \
../../../iptlib \
../../../pflib \
../../../cisco_lib/ \
../../../compiler_lib
win32:LIBS += ../../../common/release/common.lib \
../../../iptlib/release/iptlib.lib \
../../../pflib/release/fwbpf.lib \
../../../cisco_lib/release/fwbcisco.lib \
../../../compiler_lib/release/compilerdriver.lib
!win32:LIBS += ../../../common/libcommon.a \
../../../iptlib/libiptlib.a \
../../../pflib/libfwbpf.a \
../../../cisco_lib/libfwbcisco.a \
../../../compiler_lib/libcompilerdriver.a
win32:PRE_TARGETDEPS = ../../../common/release/common.lib \
../../../iptlib/release/iptlib.lib \
../../../pflib/release/fwbpf.lib \
../../../cisco_lib/release/fwbcisco.lib \
../../../compiler_lib/release/compilerdriver.lib
!win32:PRE_TARGETDEPS = ../../../common/libcommon.a \
../../../iptlib/libiptlib.a \
../../../pflib/libfwbpf.a \
../../../cisco_lib/libfwbcisco.a \
../../../compiler_lib/libcompilerdriver.a

View File

@ -1,57 +0,0 @@
include(../../../../qmake.inc)
QT += gui network
TEMPLATE = app
LANGUAGE = C++
CONFIG += console
INCLUDEPATH += ../../../.. \
../.. \
../../../compiler_lib/ \
../../../common
DEPENDPATH = ../../../.. \
../.. \
../../../compiler_lib/ \
../../../common
HEADERS = generatedScriptTestsIpfilter.h
SOURCES = main_generatedScriptTestsIpfilter.cpp \
generatedScriptTestsIpfilter.cpp
TARGET = generatedScriptTestsIpfilter
CONFIG -= release
CONFIG += debug
win32:CONFIG += console
QMAKE_CXXFLAGS += $$CPPUNIT_CFLAGS
LIBS += $$LIBS_FWCOMPILER $$LIBS_FWBUILDER $$CPPUNIT_LIBS
win32:LIBS += ../../../common/release/common.lib \
../../release/fwbpf.lib \
../../../compiler_lib/release/compilerdriver.lib
!win32:LIBS += ../../../common/libcommon.a \
../../libfwbpf.a \
../../../compiler_lib/libcompilerdriver.a
win32:PRE_TARGETDEPS = ../../../common/release/common.lib \
../../release/fwbpf.lib \
../compiler_lib/release/compilerdriver.lib
!win32:PRE_TARGETDEPS = ../../../common/libcommon.a \
../../libfwbpf.a \
../../../compiler_lib/libcompilerdriver.a
run_tests.commands = echo "Running tests..." && \
rm -f *.fw *.conf && \
./${TARGET} && \
echo "OK" || { echo "FAILED"; exit 1; }
run_tests.depends = build_tests
build_tests.depends = all
clean_tests.depends = all
QMAKE_EXTRA_TARGETS += run_tests build_tests clean_tests

View File

@ -1,57 +0,0 @@
include(../../../../qmake.inc)
QT += gui network
TEMPLATE = app
LANGUAGE = C++
CONFIG += console
INCLUDEPATH += ../../../.. \
../.. \
../../../compiler_lib/ \
../../../common
DEPENDPATH = ../../../.. \
../.. \
../../../compiler_lib/ \
../../../common
HEADERS = generatedScriptTestsIpfw.h
SOURCES = main_generatedScriptTestsIpfw.cpp \
generatedScriptTestsIpfw.cpp
TARGET = generatedScriptTestsIpfw
CONFIG -= release
CONFIG += debug
win32:CONFIG += console
QMAKE_CXXFLAGS += $$CPPUNIT_CFLAGS
LIBS += $$LIBS_FWCOMPILER $$LIBS_FWBUILDER $$CPPUNIT_LIBS
win32:LIBS += ../../../common/release/common.lib \
../../release/fwbpf.lib \
../../../compiler_lib/release/compilerdriver.lib
!win32:LIBS += ../../../common/libcommon.a \
../../libfwbpf.a \
../../../compiler_lib/libcompilerdriver.a
win32:PRE_TARGETDEPS = ../../../common/release/common.lib \
../../release/fwbpf.lib \
../compiler_lib/release/compilerdriver.lib
!win32:PRE_TARGETDEPS = ../../../common/libcommon.a \
../../libfwbpf.a \
../../../compiler_lib/libcompilerdriver.a
run_tests.commands = echo "Running tests..." && \
rm -f *.fw *.conf && \
./${TARGET} && \
echo "OK" || { echo "FAILED"; exit 1; }
run_tests.depends = build_tests
build_tests.depends = all
clean_tests.depends = all
QMAKE_EXTRA_TARGETS += run_tests build_tests clean_tests

View File

@ -1,57 +0,0 @@
include(../../../../qmake.inc)
QT += gui network
TEMPLATE = app
LANGUAGE = C++
CONFIG += console
INCLUDEPATH += ../../../.. \
../.. \
../../../compiler_lib/ \
../../../common
DEPENDPATH = ../../../.. \
../.. \
../../../compiler_lib/ \
../../../common
HEADERS = generatedScriptTestsPF.h
SOURCES = main_generatedScriptTestsPF.cpp \
generatedScriptTestsPF.cpp
TARGET = generatedScriptTestsPF
CONFIG -= release
CONFIG += debug
win32:CONFIG += console
QMAKE_CXXFLAGS += $$CPPUNIT_CFLAGS
LIBS += $$LIBS_FWCOMPILER $$LIBS_FWBUILDER $$CPPUNIT_LIBS
win32:LIBS += ../../../common/release/common.lib \
../../release/fwbpf.lib \
../../../compiler_lib/release/compilerdriver.lib
!win32:LIBS += ../../../common/libcommon.a \
../../libfwbpf.a \
../../../compiler_lib/libcompilerdriver.a
win32:PRE_TARGETDEPS = ../../../common/release/common.lib \
../../release/fwbpf.lib \
../compiler_lib/release/compilerdriver.lib
!win32:PRE_TARGETDEPS = ../../../common/libcommon.a \
../../libfwbpf.a \
../../../compiler_lib/libcompilerdriver.a
run_tests.commands = echo "Running tests..." && \
rm -f *.fw *.conf && \
./${TARGET} && \
echo "OK" || { echo "FAILED"; exit 1; }
run_tests.depends = build_tests
build_tests.depends = all
clean_tests.depends = all
QMAKE_EXTRA_TARGETS += run_tests build_tests clean_tests

2
src/unit_tests/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.a

View File

@ -33,8 +33,8 @@
#include "fwbuilder/Resources.h"
#include "fwbuilder/Interface.h"
#include "fwbuilder/Cluster.h"
#include "../interfaceProperties.h"
#include "../interfacePropertiesObjectFactory.h"
#include "interfaceProperties.h"
#include "interfacePropertiesObjectFactory.h"
#include <cppunit/extensions/HelperMacros.h>

View File

@ -0,0 +1,5 @@
include(../tests_common.pri)
TARGET = interfacePropertiesTest
SOURCES = interfacePropertiesTest.cpp tests_main.cpp
HEADERS = interfacePropertiesTest.h

View File

@ -23,9 +23,9 @@
*/
#include "../../config.h"
#include "config.h"
#include "../../common/init.cpp"
#include "common/init.cpp"
#include "interfacePropertiesTest.h"
#include <cppunit/ui/text/TestRunner.h>

View File

@ -0,0 +1,15 @@
include(../tests_common.pri)
QT += gui network
HEADERS = generatedScriptTestsIpfilter.h
SOURCES = main_generatedScriptTestsIpfilter.cpp \
generatedScriptTestsIpfilter.cpp
TARGET = generatedScriptTestsIpfilter
run_tests.commands = echo "Running tests..." && \
rm -f *.fw *.conf && \
./${TARGET} && \
echo "OK" || { echo "FAILED"; exit 1; }

View File

@ -0,0 +1,15 @@
include(../tests_common.pri)
QT += gui network
HEADERS = generatedScriptTestsIpfw.h
SOURCES = main_generatedScriptTestsIpfw.cpp \
generatedScriptTestsIpfw.cpp
TARGET = generatedScriptTestsIpfw
run_tests.commands = echo "Running tests..." && \
rm -f *.fw *.conf && \
./${TARGET} && \
echo "OK" || { echo "FAILED"; exit 1; }

View File

@ -0,0 +1,12 @@
include(../tests_common.pri)
QT += gui network
HEADERS = generatedScriptTestsLinux.h
SOURCES = main_generatedScriptTestsLinux.cpp \
generatedScriptTestsLinux.cpp
TARGET = generatedScriptTestsLinux
run_tests.commands = echo "Running tests..." && \
rm -f *.fw && \
./${TARGET}

View File

@ -0,0 +1,13 @@
include(../tests_common.pri)
QT += gui network
HEADERS = generatedScriptTestsPF.h
SOURCES = main_generatedScriptTestsPF.cpp \
generatedScriptTestsPF.cpp
TARGET = generatedScriptTestsPF
run_tests.commands = echo "Running tests..." && \
rm -f *.fw *.conf && \
./${TARGET} && \
echo "OK" || { echo "FAILED"; exit 1; }

View File

@ -0,0 +1,21 @@
include(../tests_common.pri)
QT += gui network
HEADERS = generatedScriptTestsSecuwall.h
SOURCES = main_generatedScriptTestsSecuwall.cpp \
generatedScriptTestsSecuwall.cpp
TARGET = generatedScriptTestsSecuwall
run_tests.commands = echo "Running tests..." && \
./${TARGET} && \
echo "OK" || { echo "FAILED"; exit 1; }
build_tests.commands = @tar -zxf ./ref.secuwall-1.tar.gz
clean_tests.commands = @rm -rf ./secuwall-* && \
rm -rf ./ref.secuwall-1 && \
rm -f ${TARGET}
run_tests.depends = build_tests
build_tests.depends = all
clean_tests.depends = all
QMAKE_EXTRA_TARGETS += run_tests build_tests clean_tests

View File

@ -0,0 +1,86 @@
include(../../qmake.inc)
macx:exists(../gui/qmake.inc):include(../gui/qmake.inc)
macx:SOURCES -= main_mac.cpp
OBJECTS_DIR = .obj
MOC_DIR = .moc
LIBS += ../../libgui/libgui.a
CONFIG -= release
CONFIG += debug
LIBS += $$LIBS_FWCOMPILER $$LIBS_FWBUILDER $$CPPUNIT_LIBS
INCLUDEPATH += ../.ui
INCLUDEPATH += ../../compiler_lib
INCLUDEPATH += ../../iptlib
INCLUDEPATH += ../../.. \
../../cisco_lib \
../../pflib \
../..
DEPENDPATH = ../../common
!win32:LIBS += ../../common/libcommon.a
!win32:PRE_TARGETDEPS = ../../common/libcommon.a
win32:CONFIG += console
win32:LIBS += ../../common/release/common.lib
win32:PRE_TARGETDEPS = ../../common/release/common.lib
run_tests.commands = echo "Running tests..."; \
./${TARGET}
run_tests.depends = build_tests
build_tests.depends = all
clean_tests.depends = all
QMAKE_EXTRA_TARGETS += run_tests build_tests clean_tests
INCLUDEPATH += $$ANTLR_INCLUDEPATH
LIBS += ../$$FWBPARSER_LIB
DEFINES += $$ANTLR_DEFINES
LIBS += $$LIBS_FWCOMPILER
LIBS += $$ANTLR_LIBS
# fwtransfer lib. Add this before adding -lQtDBus to LIBS below
LIBS += ../$$FWTRANSFER_LIB
contains( HAVE_QTDBUS, 1 ):unix {
!macx:QT += network \
dbus
macx:LIBS += -framework \
QtDBus
}
# !macx:LIBS += -lQtDBus # workaround for QT += dbus not working with Qt < 4.4.0
INCLUDEPATH += ../../common \
../../iptlib \
../../pflib \
../../cisco_lib/ \
../../compiler_lib/
DEPENDPATH = ../../common \
../../iptlib \
../../pflib \
../../cisco_lib/ \
../../compiler_lib
win32:LIBS += ../../common/release/common.lib \
../../iptlib/release/iptlib.lib \
../../pflib/release/fwbpf.lib \
../../cisco_lib/release/fwbcisco.lib \
../../compiler_lib/release/compilerdriver.lib
!win32:LIBS += ../../common/libcommon.a \
../../iptlib/libiptlib.a \
../../pflib/libfwbpf.a \
../../cisco_lib/libfwbcisco.a \
../../compiler_lib/libcompilerdriver.a
win32:PRE_TARGETDEPS = ../../common/release/common.lib \
../../iptlib/release/iptlib.lib \
../../pflib/release/fwbpf.lib \
../../cisco_lib/release/fwbcisco.lib \
../../compiler_lib/release/compilerdriver.lib
!win32:PRE_TARGETDEPS = ../../common/libcommon.a \
../../iptlib/libiptlib.a \
../../pflib/libfwbpf.a \
../../cisco_lib/libfwbcisco.a \
../../compiler_lib/libcompilerdriver.a

View File

@ -1,7 +1,7 @@
DOLLAR = $
libgui.target = ../libgui.a
libgui.commands = cd .. && qmake -spec $$QMAKESPEC && make && cd -
libgui.target = ../libgui/libgui.a
libgui.commands = cd ../libgui && qmake -spec $$QMAKESPEC && make && cd -
build_tests.commands = echo "Building tests..."; \
./unit_tests.sh make build_tests