From 734d4af007075529556020a40afcb432723cb194 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Mon, 11 Jun 2012 15:59:33 +0300 Subject: [PATCH] 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) --- test/test.pro | 43 +++---------------------------------------- tools/dmake.cpp | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 40 deletions(-) diff --git a/test/test.pro b/test/test.pro index 345fd33c1..e779f03d1 100644 --- a/test/test.pro +++ b/test/test.pro @@ -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) { diff --git a/tools/dmake.cpp b/tools/dmake.cpp index 8834c25c7..b506bec17 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -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);