diff --git a/fwbuilder3.pro b/fwbuilder3.pro index 64aae7376..7bbbb4fae 100644 --- a/fwbuilder3.pro +++ b/fwbuilder3.pro @@ -7,15 +7,15 @@ SUBDIRS = src doc DOLLAR = $ -build_tests.commands = ./unit_tests.sh make build_tests +build_tests.commands = cd src/unit_tests; make build_tests; cd - build_tests.depends = all -run_tests.commands = ./unit_tests.sh make run_tests +run_tests.commands = cd src/unit_tests; make run_tests; cd - run_tests.depends = all tests.depends = run_tests -clean_tests.commands = /usr/bin/env python testclean.py +clean_tests.commands = cd src/unit_tests; make clean_tests; cd - QMAKE_EXTRA_TARGETS += build_tests run_tests clean_tests tests diff --git a/src/iptlib/unit_tests/.gitignore b/src/iptlib/unit_tests/.gitignore deleted file mode 100644 index c1ae950d2..000000000 --- a/src/iptlib/unit_tests/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.a -/*Test -generatedScriptTestsLinux -generatedScriptTestsSecuwall - diff --git a/src/iptlib/unit_tests/unit_tests.pro b/src/iptlib/unit_tests/unit_tests.pro deleted file mode 100644 index 25feaec01..000000000 --- a/src/iptlib/unit_tests/unit_tests.pro +++ /dev/null @@ -1,12 +0,0 @@ -DOLLAR = $ - -build_tests.commands = echo "Building tests..."; \ - ./unit_tests.sh make build_tests - -run_tests.commands = echo "Running tests..."; \ - ./unit_tests.sh make run_tests - -clean_tests.commands = echo "Cleaning tests..."; \ - ./unit_tests.sh make clean_tests - -QMAKE_EXTRA_TARGETS += run_tests clean_tests build_tests diff --git a/src/iptlib/unit_tests/unit_tests.sh b/src/iptlib/unit_tests/unit_tests.sh deleted file mode 100755 index 4cd18fbb6..000000000 --- a/src/iptlib/unit_tests/unit_tests.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -commands=$@ - -for directory in `find . -maxdepth 1 -type d -regex '\./[A-Za-z0-9\-\_]*'` -do - cd $directory - [ ! -e Makefile ] && qmake -spec $QMAKESPEC - $commands || exit 1; - cd - -done - diff --git a/src/pflib/unit_tests/.gitignore b/src/pflib/unit_tests/.gitignore deleted file mode 100644 index f2841ce5e..000000000 --- a/src/pflib/unit_tests/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.a -/*Test -generatedScriptTestsIpfilter -generatedScriptTestsIpfw -generatedScriptTestsPF - diff --git a/src/pflib/unit_tests/unit_tests.pro b/src/pflib/unit_tests/unit_tests.pro deleted file mode 100644 index 25feaec01..000000000 --- a/src/pflib/unit_tests/unit_tests.pro +++ /dev/null @@ -1,12 +0,0 @@ -DOLLAR = $ - -build_tests.commands = echo "Building tests..."; \ - ./unit_tests.sh make build_tests - -run_tests.commands = echo "Running tests..."; \ - ./unit_tests.sh make run_tests - -clean_tests.commands = echo "Cleaning tests..."; \ - ./unit_tests.sh make clean_tests - -QMAKE_EXTRA_TARGETS += run_tests clean_tests build_tests diff --git a/src/pflib/unit_tests/unit_tests.sh b/src/pflib/unit_tests/unit_tests.sh deleted file mode 100755 index 4cd18fbb6..000000000 --- a/src/pflib/unit_tests/unit_tests.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -commands=$@ - -for directory in `find . -maxdepth 1 -type d -regex '\./[A-Za-z0-9\-\_]*'` -do - cd $directory - [ ! -e Makefile ] && qmake -spec $QMAKESPEC - $commands || exit 1; - cd - -done - diff --git a/src/unit_tests/ImporterTest/ImporterTest.cpp b/src/unit_tests/ImporterTest/ImporterTest.cpp index 2fcd9f3f1..13077ddeb 100644 --- a/src/unit_tests/ImporterTest/ImporterTest.cpp +++ b/src/unit_tests/ImporterTest/ImporterTest.cpp @@ -25,7 +25,7 @@ #include "ImporterTest.h" -#include "../../config.h" +#include "config.h" #include "global.h" #include @@ -36,10 +36,10 @@ #include -#include "../../Importer.h" -#include "../../IOSImporter.h" -#include "../../IPTImporter.h" -#include "../../FWBTree.h" +#include "Importer.h" +#include "IOSImporter.h" +#include "IPTImporter.h" +#include "FWBTree.h" #include "fwbuilder/Policy.h" #include "fwbuilder/Rule.h" diff --git a/src/unit_tests/parseCommandLineTest/parseCommandLineTest.cpp b/src/unit_tests/parseCommandLineTest/parseCommandLineTest.cpp index 3259ae6ce..8004703f6 100644 --- a/src/unit_tests/parseCommandLineTest/parseCommandLineTest.cpp +++ b/src/unit_tests/parseCommandLineTest/parseCommandLineTest.cpp @@ -25,9 +25,8 @@ #include "parseCommandLineTest.h" -#include "../../../../config.h" -//#include "../../global.h" -#include "../../utils.h" +#include "config.h" +#include "utils.h" #include #include diff --git a/src/unit_tests/tests_common.pri b/src/unit_tests/tests_common.pri index ec9d09170..9afc6e2a8 100644 --- a/src/unit_tests/tests_common.pri +++ b/src/unit_tests/tests_common.pri @@ -12,7 +12,8 @@ CONFIG -= release CONFIG += debug LIBS += $$LIBS_FWCOMPILER $$LIBS_FWBUILDER $$CPPUNIT_LIBS -INCLUDEPATH += ../.ui +INCLUDEPATH += ../../libgui +INCLUDEPATH += ../../libgui/.ui INCLUDEPATH += ../../compiler_lib INCLUDEPATH += ../../iptlib INCLUDEPATH += ../../.. \ diff --git a/src/unit_tests/unit_tests.pro b/src/unit_tests/unit_tests.pro index c299ac2ec..ea760d18c 100644 --- a/src/unit_tests/unit_tests.pro +++ b/src/unit_tests/unit_tests.pro @@ -10,7 +10,7 @@ run_tests.commands = echo "Running tests..."; \ ./unit_tests.sh make run_tests clean_tests.commands = echo "Cleaning tests..."; \ - ./unit_tests.sh make clean_tests + ./unit_tests.sh make clean build_tests.depends = libgui run_tests.depends = libgui diff --git a/testclean.py b/testclean.py deleted file mode 100644 index 318a367c4..000000000 --- a/testclean.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python - -import os -import sys -import re -from glob import glob - -OBJRE = re.compile("^OBJECTS_DIR\s*=\s*(.*)\n", re.MULTILINE) -MOCRE = re.compile("^MOC_DIR\s*=\s*(.*)\n", re.MULTILINE) - -# find all unit tests directories -directories = set() -for item in os.walk("."): - if os.path.basename(item[0]) == "unit_tests": - for path in item[1]: - fullpath = os.path.join(item[0], path) - if path.startswith("."): continue - if path.endswith(".app"): continue # skip mac apps - if os.path.isdir(fullpath): - directories.add(fullpath) - -# this one does not contain unit test dirs, but is unit test by itself -directories.add(os.path.join('.','src','compiler_lib','unit_tests')) - -for directory in directories: - profiles = glob(directory+"/*.pro") - if not profiles: - print directory - print "No pro file found in specified directory. Skipping." - continue - - profile = open(profiles[0]).read() - objdirs = OBJRE.findall(profile) - objdir = directory - if not objdirs: - print "There is no OBJECTS_DIR variable set in pro file, using project directory." - else: - objdir = objdirs[0] - if objdir.startswith('.'): - objdir = os.path.join(directory, objdir) - - mocdirs = MOCRE.findall(profile) - mocdir = directory - if not mocdirs: - print "There is no MOC_DIR variable set in pro file, using project directory." - else: - mocdir = mocdirs[0] - if mocdir.startswith('.'): - mocdir = os.path.join(directory, mocdir) - - print "Cleaning files in directories:", objdir, mocdir - files = glob(directory+"/*.cpp") - for file in files: - directory = os.path.dirname(file) - basename = os.path.basename(file) - noext = '.'.join(basename.split('.')[:-1]) - obj = os.path.join(objdir, noext+".o") - moc = os.path.join(mocdir, "moc_"+basename) - if os.path.exists(obj): - print "deleting", obj - os.remove(obj) - if os.path.exists(moc): - print "deleting", moc - os.remove(moc) - - files = glob(directory+"/*.a") - for file in files: - print "deleting", file - os.remove(file) - - print directory, ": done." -print "all done."