Tests: Generate test file listing with dmake.

Use dmake to generate a test/testfiles.pri with all the files
containing tests. The testfiles.pri is included by the test/test.pro,
which compiles the test runner. This automates the test file listing
instead of former way to hand-edit the file list.

Fixes ticket #3885 (dmake needs to create a list of test files for qmake)
This commit is contained in:
Kimmo Varis 2012-06-11 15:59:33 +03:00
parent be21a44dd2
commit 734d4af007
2 changed files with 23 additions and 40 deletions

View File

@ -14,6 +14,8 @@ BASEPATH = ../externals/tinyxml/
include(../externals/tinyxml/tinyxml.pri)
BASEPATH = ../lib/
include(../lib/lib.pri)
BASEPATH = .
include($$PWD/testfiles.pri)
# cli/*
SOURCES += ../cli/cmdlineparser.cpp \
@ -31,46 +33,7 @@ HEADERS += ../cli/cmdlineparser.h \
# test/*
HEADERS += options.h redirect.h testsuite.h
SOURCES += options.cpp \
test64bit.cpp \
testassignif.cpp \
testautovariables.cpp \
testboost.cpp \
testbufferoverrun.cpp \
testcharvar.cpp \
testclass.cpp \
testcmdlineparser.cpp \
testconstructors.cpp \
testcppcheck.cpp \
testdivision.cpp \
testerrorlogger.cpp \
testexceptionsafety.cpp \
testfilelister.cpp \
testincompletestatement.cpp \
testmathlib.cpp \
testmemleak.cpp \
testnonreentrantfunctions.cpp \
testnullpointer.cpp \
testobsoletefunctions.cpp \
testoptions.cpp \
testother.cpp \
testpath.cpp \
testpathmatch.cpp \
testpostfixoperator.cpp \
testpreprocessor.cpp \
testrunner.cpp \
testsimplifytokens.cpp \
teststl.cpp \
testsuite.cpp \
testsuppressions.cpp \
testsymboldatabase.cpp \
testthreadexecutor.cpp \
testtoken.cpp \
testtokenize.cpp \
testuninitvar.cpp \
testunusedfunctions.cpp \
testunusedprivfunc.cpp \
testunusedvar.cpp
SOURCES += options.cpp
# Change Visual Studio compiler (CL) warning level to W4
contains(QMAKE_CXX, cl) {

View File

@ -190,6 +190,26 @@ int main(int argc, char **argv)
}
}
// QMAKE - test/testfiles.pri
{
std::ofstream fout1("test/testfiles.pri");
if (fout1.is_open()) {
fout1 << "# no manual edits - this file is autogenerated by dmake\n\n";
fout1 << "INCLUDEPATH += ../externals/tinyxml\n";
fout1 << "\n\nSOURCES += ";
for (unsigned int i = 0; i < testfiles.size(); ++i) {
const std::string filename(testfiles[i].substr(5));
// Include only files containing tests in this listing.
// I.e. filenames beginning with "test".
if (filename.compare(0, 4, "test") == 0) {
fout1 << "$${BASEPATH}/" << filename;
if (i + 1 < testfiles.size())
fout1 << " \\\n" << std::string(11, ' ');
}
}
fout1 << "\n";
}
}
static const char makefile[] = "Makefile";
std::ofstream fout(makefile, std::ios_base::trunc);