build_tests and run_tests should work now

This commit is contained in:
Roman Bovsunivskiy
2010-02-22 17:38:03 +00:00
parent 4dc0dd399e
commit 360bc41d24
5 changed files with 24 additions and 110 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ SUBDIRS = src doc
DOLLAR = $
build_tests.commands = ./unit_tests.sh make
build_tests.commands = ./unit_tests.sh make build
build_tests.depends = all
run_tests.commands = ./unit_tests.sh make run
+3 -1
View File
@@ -59,6 +59,8 @@ run.commands = echo "Running tests..." && \
echo "OK" || { echo "FAILED"; exit 1; }
run.depends = all
QMAKE_EXTRA_TARGETS += run
build.depends = all
QMAKE_EXTRA_TARGETS += run build
-86
View File
@@ -1,86 +0,0 @@
/*
Firewall Builder
Copyright (C) 2003 NetCitadel, LLC
Author: Vadim Kurland vadim@fwbuilder.org
$Id$
This program is free software which we release under the GNU General Public
License. You may redistribute and/or modify this program under the terms
of that license as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To get a copy of the GNU General Public License, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../../../config.h"
#include "../global.h"
#include "../RCS.h"
#include <qapplication.h>
#include <qfile.h>
#include <qtextstream.h>
#include <iostream>
using namespace std;
using namespace libfwbuilder;
QApplication *app = NULL;
int fwbdebug = 0;
QString test_file = "zu.fwb";
QString rlog_unit_test_log_file = "rlog_unit_test.log";
int main( int argc, char ** argv )
{
app = new QApplication( argc, argv );
QWidget w;
app->setMainWidget(&w);
w.show();
RCS *rcs = new RCS(test_file);
QString reverse_engineered_rlog;
QValueList<Revision>::iterator i;
for (i=rcs->begin(); i!=rcs->end(); ++i)
{
reverse_engineered_rlog += "---------------------------------\n";
reverse_engineered_rlog += "revision: " + (*i).rev + "\n";
reverse_engineered_rlog += "date: " + (*i).date + "\n";
reverse_engineered_rlog += "author: " + (*i).author + "\n";
reverse_engineered_rlog += "locked by: " + (*i).locked_by + "\n";
reverse_engineered_rlog += "log: " + (*i).log + "\n";
}
QFile rlog_test_file(rlog_unit_test_log_file);
if (rlog_test_file.open( IO_ReadOnly ))
{
QTextStream strm( &rlog_test_file );
QString test_str = strm.read();
rlog_test_file.close();
if (test_str != reverse_engineered_rlog)
{
cout << reverse_engineered_rlog;
// cout << "################################################################" << endl;
// cout << test_str << endl;
}
}
}
+9 -22
View File
@@ -1,25 +1,12 @@
DOLLAR = $
run.commands = echo "Running tests..." && \
display=:1; \
Xvfb $${DOLLAR}$${DOLLAR}display & \
pid=$${DOLLAR}$${DOLLAR}!; \
for directory in `find . -maxdepth 1 -type d -regex \'\./[A-Za-z0-9\-\_]*\'`; \
do \
home=`pwd`; \
cd $${DOLLAR}$${DOLLAR}directory; \
qmake -spec $${DOLLAR}$${DOLLAR}QMAKESPEC; \
DISPLAY=$${DOLLAR}$${DOLLAR}display make run || { kill $${DOLLAR}$${DOLLAR}pid; exit 1; }; \
cd $${DOLLAR}$${DOLLAR}home; \
done; \
kill $${DOLLAR}$${DOLLAR}pid;
build.commands = echo "Building tests..."; \
./unit_tests.sh make
clean.commands = for directory in `find . -maxdepth 1 -type d -regex \'\./[A-Za-z0-9\-\_]*\'`; \
do \
cd $${DOLLAR}$${DOLLAR}directory; \
[ ! -e Makefile ] && qmake -spec $${DOLLAR}$${DOLLAR}QMAKESPEC; \
make clean; \
cd -; \
done
QMAKE_EXTRA_TARGETS += run clean
run.commands = echo "Running tests..."; \
./unit_tests.sh make run
clean.commands = echo "Cleaning tests..."; \
./unit_tests.sh make clean
QMAKE_EXTRA_TARGETS += run clean build
+11
View File
@@ -0,0 +1,11 @@
#!/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
cd -
done;