Commit 698144e3 authored by Christian Kandeler's avatar Christian Kandeler

Add qbs project files for autotests.

Note: Since not all autotests are able to run from an installed location,
we need to be able to start them from the build directory, which
in turn forces us to set a destination directory for libraries and plugins,
so they will be found at run-time.

Change-Id: Idcf7e1333dfa6e9dbf745391b78c035f842ccc5a
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@digia.com>
parent fbda0ef5
import qbs.base 1.0
Project {
property bool withAutotests: qbs.buildVariant === "debug"
property string ide_version_major: '2'
property string ide_version_minor: '8'
property string ide_version_release: '81'
......@@ -55,5 +56,6 @@ Project {
"lib/qtcreator/qtcomponents/qtcomponents.qbs",
"share/share.qbs",
"share/qtcreator/translations/translations.qbs",
"tests/tests.qbs"
]
}
......@@ -9,6 +9,7 @@ DynamicLibrary {
}
targetName: Defaults.qtLibraryName(qbs, name)
destinationDirectory: project.ide_library_path
cpp.defines: project.generalDefines
cpp.linkerFlags: {
......
......@@ -9,6 +9,7 @@ Product {
property var pluginRecommends: []
targetName: Defaults.qtLibraryName(qbs, name)
destinationDirectory: project.ide_plugin_path + '/' + provider
Depends { name: "ExtensionSystem" }
Depends { name: "pluginspec" }
......
import qbs
import "../autotest.qbs" as Autotest
Autotest {
name: "Aggregation autotest"
Depends { name: "Aggregation" }
files: "tst_aggregate.cpp"
}
import qbs
Project {
name: "Autotests"
condition: project.withAutotests
references: [
"aggregation/aggregation.qbs",
"changeset/changeset.qbs",
"cplusplus/cplusplus.qbs",
"debugger/debugger.qbs",
"diff/diff.qbs",
"environment/environment.qbs",
"extensionsystem/extensionsystem.qbs",
"externaltool/externaltool.qbs",
"filesearch/filesearch.qbs",
"generichighlighter/generichighlighter.qbs",
"ioutils/ioutils.qbs",
"profilewriter/profilewriter.qbs",
"qml/qml.qbs",
"qtcprocess/qtcprocess.qbs",
"treeviewfind/treeviewfind.qbs",
"utils/utils.qbs",
"utils_stringutils/utils_stringutils.qbs",
"valgrind/valgrind.qbs"
]
}
import qbs
import qbs.FileInfo
CppApplication {
type: "application"
Depends { name: "Qt.test" }
targetName: "tst_" + name.split(' ').join("")
// This needs to be absolute, because it is passed to one of the source files.
destinationDirectory: buildDirectory + '/'
+ FileInfo.relativePath(project.ide_source_tree, sourceDirectory)
cpp.rpaths: [
buildDirectory + '/' + project.ide_library_path,
buildDirectory + '/' + project.ide_library_path + "/..", // OSX
buildDirectory + '/' + project.ide_plugin_path + "/QtProject"
]
// The following would be conceptually right, but does not work currently as some autotests
// (e.g. extensionsystem) do not work when installed, because they want hardcoded
// absolute paths to resources in the build directory.
// cpp.rpaths: qbs.targetOS.contains("osx")
// ? ["@executable_path/.."]
// : ["$ORIGIN/../lib/qtcreator", "$ORIGIN/../lib/qtcreator/plugins/QtProject"]
// Group {
// fileTagsFilter: product.type
// qbs.install: true
// qbs.installDir: project.ide_bin_path
// }
}
import qbs
import "../autotest.qbs" as Autotest
Autotest {
name: "ChangeSet autotest"
Depends { name: "Utils" }
Depends { name: "Qt.gui" } // TODO: Remove once qbs bug is fixed.
files: "tst_changeset.cpp"
}
import qbs
import "../cplusplusautotest.qbs" as CPlusPlusAutotest
CPlusPlusAutotest {
name: "CPlusPlus AST autotest"
files: "tst_ast.cpp"
}
import qbs
import "../cplusplusautotest.qbs" as CPlusPlusAutotest
CPlusPlusAutotest {
name: "CPlusPlus check symbols autotest"
files: "tst_checksymbols.cpp"
}
import qbs
import "../cplusplusautotest.qbs" as CPlusPlusAutotest
CPlusPlusAutotest {
name: "CPlusPlus code formatter autotest"
files: "tst_codeformatter.cpp"
}
import qbs
Project {
name: "CPlusPlus autotests"
references: [
"ast/ast.qbs",
"checksymbols/checksymbols.qbs",
"codeformatter/codeformatter.qbs",
"cxx11/cxx11.qbs",
"findusages/findusages.qbs",
"lexer/lexer.qbs",
"lookup/lookup.qbs",
"misc/misc.qbs",
"preprocessor/preprocessor.qbs",
"semantic/semantic.qbs",
"simplifytypes/simplifytypes.qbs",
"typeprettyprinter/typeprettyprinter.qbs"
]
}
import qbs
import "../autotest.qbs" as Autotest
Autotest {
Depends { name: "CppTools" }
Depends { name: "TextEditor" }
Depends { name: "Utils" }
Depends { name: "Qt.widgets" } // For QTextDocument & friends
}
import qbs
import "../cplusplusautotest.qbs" as CPlusPlusAutotest
CPlusPlusAutotest {
name: "Cxx11 autotest"
Group {
name: "Source Files"
files: "tst_cxx11.cpp"
}
Group {
name: "Data Files"
prefix: "data/"
fileTags: ["data"]
files: [
"inlineNamespace.1.cpp",
"inlineNamespace.1.errors.txt",
"staticAssert.1.cpp",
"staticAssert.1.errors.txt",
"noExcept.1.cpp",
"noExcept.1.errors.txt"
]
}
cpp.defines: base.concat(['SRCDIR="' + path + '"'])
}
import qbs
import "../cplusplusautotest.qbs" as CPlusPlusAutotest
CPlusPlusAutotest {
name: "CPlusPlus find usages autotest"
files: "tst_findusages.cpp"
}
import qbs
import "../cplusplusautotest.qbs" as CPlusPlusAutotest
CPlusPlusAutotest {
name: "CPlusPlus lexer autotest"
files: "tst_lexer.cpp"
}
import qbs
import "../cplusplusautotest.qbs" as CPlusPlusAutotest
CPlusPlusAutotest {
name: "CPlusPlus lookup autotest"
files: "tst_lookup.cpp"
}
import qbs
import "../cplusplusautotest.qbs" as CPlusPlusAutotest
CPlusPlusAutotest {
name: "CPlusPlus miscellaneous autotest"
files: "tst_misc.cpp"
}
import qbs
import "../cplusplusautotest.qbs" as CPlusPlusAutotest
CPlusPlusAutotest {
name: "CPlusPlus preprocessor autotest"
Group {
name: "Source Files"
files: "tst_preprocessor.cpp"
}
Group {
name: "Data files"
prefix: "data/"
fileTags: ["data"]
files: [
"empty-macro.cpp", "empty-macro.out.cpp",
"empty-macro.2.cpp", "empty-macro.2.out.cpp",
"identifier-expansion.1.cpp", "identifier-expansion.1.out.cpp",
"identifier-expansion.2.cpp", "identifier-expansion.2.out.cpp",
"identifier-expansion.3.cpp", "identifier-expansion.3.out.cpp",
"identifier-expansion.4.cpp", "identifier-expansion.4.out.cpp",
"identifier-expansion.5.cpp", "identifier-expansion.5.out.cpp",
"macro_expand.c", "macro_expand.out.c",
"macro_expand_1.cpp", "macro_expand_1.out.cpp",
"macro-test.cpp", "macro-test.out.cpp",
"macro_pounder_fn.c",
"noPP.1.cpp",
"noPP.2.cpp",
"poundpound.1.cpp", "poundpound.1.out.cpp",
"recursive.1.cpp", "recursive.1.out.cpp",
"reserved.1.cpp", "reserved.1.out.cpp",
]
}
cpp.defines: base.concat(['SRCDIR="' + path + '"'])
}
import qbs
import "../cplusplusautotest.qbs" as CPlusPlusAutotest
CPlusPlusAutotest {
name: "CPlusPlus semantic autotest"
files: "tst_semantic.cpp"
}
import qbs
import "../cplusplusautotest.qbs" as CPlusPlusAutotest
CPlusPlusAutotest {
name: "CPlusPlus simplify types autotest"
files: "tst_simplifytypestest.cpp"
}
import qbs
import "../cplusplusautotest.qbs" as CPlusPlusAutotest
CPlusPlusAutotest {
name: "CPlusPlus pretty printer autotest"
files: "tst_typeprettyprinter.cpp"
}
import qbs
Project {
name: "Debugger autotests"
property path debuggerDir: project.ide_source_tree + "/src/plugins/debugger/"
references: [
"dumpers.qbs",
"gdb.qbs",
"namedemangler.qbs"
]
}
import qbs
import "../autotest.qbs" as Autotest
Autotest {
name: "Debugger dumpers autotest"
Depends { name: "CPlusPlus" }
Depends { name: "Utils" }
Depends { name: "Qt.widgets" } // For QTextDocument
Depends { name: "Qt.network" } // For QHostAddress
Group {
name: "Sources from Debugger plugin"
prefix: project.debuggerDir
files: [
"debuggerprotocol.h", "debuggerprotocol.cpp",
"watchdata.h", "watchdata.cpp",
"watchutils.h", "watchutils.cpp"
]
}
Group {
name: "Test sources"
files: [
"temporarydir.h",
"tst_dumpers.cpp"
]
}
cpp.defines: base.concat([
'CDBEXT_PATH="' + buildDirectory + '\\\\lib"',
'DUMPERDIR="' + path + '/../../../share/qtcreator/dumper"',
'QT_NO_CAST_FROM_ASCII',
'QT_DISABLE_DEPRECATED_BEFORE=0x040900'
])
cpp.includePaths: base.concat([project.debuggerDir])
}
import qbs
import "../autotest.qbs" as Autotest
Autotest {
name: "gdb autotest"
Depends { name: "Qt.network" } // For QHostAddress
Group {
name: "Sources from Debugger plugin"
prefix: project.debuggerDir
files: "debuggerprotocol.cpp"
}
Group {
name: "Test sources"
files: "tst_gdb.cpp"
}
cpp.includePaths: base.concat([project.debuggerDir])
}
import qbs
import "../autotest.qbs" as Autotest
Autotest {
name: "Name demangler autotest"
Group {
name: "Sources from Debugger plugin"
prefix: project.debuggerDir + "namedemangler/"
files: ["*.h", "*.cpp"]
}
Group {
name: "Test sources"
files: "tst_namedemangler.cpp"
}
cpp.includePaths: base.concat([project.debuggerDir])
}
import qbs
Project {
name: "Diff autotests"
references: ["differ/differ.qbs"]
}
import qbs
import "../../autotest.qbs" as Autotest
Autotest {
name: "Differ autotest"
Depends { name: "DiffEditor" }
Depends { name: "Qt.widgets" } // For QTextDocument
files: "tst_differ.cpp"
}
import qbs
import "../autotest.qbs" as Autotest
Autotest {
name: "Environment autotest"
Depends { name: "Utils" }
Depends { name: "Qt.widgets" } // TODO: qbs bug, remove when fixed
files: "tst_environment.cpp"
}
import qbs
import qbs.File
import qbs.FileInfo
Transformer {
property pathList sourceFiles
property path targetDirectory
inputs: sourceFiles
Artifact { fileName: targetDirectory }
prepare: {
var commands = []
for (var tag in inputs) {
for (var index in inputs[tag]) {
var artifact = inputs[tag][index];
var cmd = new JavaScriptCommand();
cmd.sourceFile = artifact.fileName;
cmd.description = "Copying '" + cmd.sourceFile + "' to '" + output.fileName + "/'.";
cmd.highlight = "codegen";
cmd.targetFilePath = output.fileName + '/' + FileInfo.fileName(cmd.sourceFile);
cmd.sourceCode = function() { File.copy(sourceFile, targetFilePath); }
commands.push(cmd);
}
}
return commands;
}
}
import qbs
Project {
name: "ExtensionSystem autotests"
references: [
"pluginmanager/pluginmanager.qbs",
"pluginspec/pluginspec.qbs"
]
}
import qbs
import qbs.File
import qbs.FileInfo
import "./copytransformer.qbs" as CopyTransformer
import "../../../qbs/defaults.js" as Defaults
DynamicLibrary {
Depends { name: "Aggregation" }
Depends { name: "ExtensionSystem" }
Depends { name: "cpp" }
Depends { name: "Qt.core" }
targetName: Defaults.qtLibraryName(qbs, name.split('_')[1])
destinationDirectory: FileInfo.relativePath(project.ide_source_tree, sourceDirectory)
cpp.rpaths: [
buildDirectory + "/lib/qtcreator",
buildDirectory + "/lib/qtcreator/plugins/QtProject"
].concat(additionalRPaths)
property pathList filesToCopy
property pathList additionalRPaths: []
CopyTransformer {
sourceFiles: product.filesToCopy
targetDirectory: product.destinationDirectory
}
}
import qbs
Project {
name: "ExtensionSystem cirular plugins autotests"
references: [
"plugin1/plugin1.qbs",
"plugin2/plugin2.qbs",
"plugin3/plugin3.qbs"
]
}
import qbs
import "../../../plugin.qbs" as Plugin
Plugin {
name: "circular_plugin1"
filesToCopy: "plugin.xml"
files: ["plugin1.h", "plugin1.cpp"].concat(filesToCopy)
cpp.defines: base.concat(["PLUGIN1_LIBRARY"])
}
import qbs
import "../../../plugin.qbs" as Plugin
Plugin {
name: "circular_plugin2"
filesToCopy: "plugin.xml"
files: ["plugin2.h", "plugin2.cpp"].concat(filesToCopy)
cpp.defines: base.concat(["PLUGIN2_LIBRARY"])
}
import qbs
import "../../../plugin.qbs" as Plugin
Plugin {
name: "circular_plugin3"
filesToCopy: "plugin.xml"
files: ["plugin3.h", "plugin3.cpp"].concat(filesToCopy)
cpp.defines: base.concat(["PLUGIN3_LIBRARY"])
}
import qbs
Project {
name: "ExtensionSystem correct plugins autotests"
references: [
"plugin1/plugin1.qbs",
"plugin2/plugin2.qbs",
"plugin3/plugin3.qbs"
]
}
import qbs
import "../../../plugin.qbs" as Plugin
Plugin {
name: "correct_plugin1"
Depends { name: "correct_plugin2" }
Depends { name: "correct_plugin3" }
filesToCopy: "plugin.spec"
additionalRPaths: [
destinationDirectory + "/../plugin2",
destinationDirectory + "/../plugin3"
]
files: ["plugin1.h", "plugin1.cpp"].concat(filesToCopy)
cpp.defines: base.concat(["PLUGIN1_LIBRARY"])
}
import qbs
import "../../../plugin.qbs" as Plugin
Plugin {
name: "correct_plugin2"
filesToCopy: "plugin.spec"
files: ["plugin2.h", "plugin2.cpp"].concat(filesToCopy)
cpp.defines: base.concat(["PLUGIN2_LIBRARY"])
}
import qbs
import "../../../plugin.qbs" as Plugin
Plugin {
name: "correct_plugin3"
Depends { name: "correct_plugin2" }
filesToCopy: "plugin.spec"
additionalRPaths: [destinationDirectory + "/../plugin2"]
files: ["plugin3.h", "plugin3.cpp"].concat(filesToCopy)
cpp.defines: base.concat(["PLUGIN3_LIBRARY"])
}
import qbs
Project {
name: "PluginManager autotests"
references: [
"circularplugins/circularplugins.qbs",
"correctplugins1/correctplugins1.qbs",
"test.qbs"
]
}
import qbs
import qbs.File
import qbs.FileInfo
import "../../autotest.qbs" as Autotest
import "../copytransformer.qbs" as CopyTransformer
Autotest {
name: "PluginManager autotest"
Depends { name: "Aggregation" }
Depends { name: "ExtensionSystem" }
Depends { name: "circular_plugin1" }
Depends { name: "circular_plugin2" }
Depends { name: "circular_plugin3" }
Depends { name: "correct_plugin1" }
Depends { name: "correct_plugin2" }
Depends { name: "correct_plugin3" }
Group {
id: pluginGroup
name: "plugins"
files: [
"plugins/otherplugin.xml",
"plugins/plugin1.xml",
"plugins/myplug/myplug.xml"
]
}
CopyTransformer {
sourceFiles: pluginGroup.files
targetDirectory: product.destinationDirectory + "/plugins"
}
files: "tst_pluginmanager.cpp"
cpp.defines: base.concat(['PLUGINMANAGER_TESTS_DIR="' + destinationDirectory + '"'])
}
import qbs
Project {
name: "ExtensionSystem pluginspec autotests"
references: ["testplugin/testplugin.qbs", "test.qbs"]
}
import qbs
// TODO: Remove when import bug is fixed
import qbs.File
import qbs.FileInfo
import "../../autotest.qbs" as Autotest
import "../copytransformer.qbs" as CopyTransformer
Autotest {
name: "ExtensionSystem pluginspec autotest"
Depends { name: "Aggregation" }
Depends { name: "ExtensionSystem" }
Depends { name: "pluginspec_test" }
cpp.defines: base.concat(['PLUGINSPEC_DIR="' + destinationDirectory + '"'])