Added build system support for installing tests.
Tests will install under $$[QT_INSTALL_TESTS]. TESTDATA may be used to install additional testdata required by the test. The default install rule may be disabled by CONFIG+=no_testcase_installs. Change-Id: I204de60c8e844775906ffd016ca50bffbb414142 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
parent
a25d0ef3c2
commit
9ffd7a339f
26
configure
vendored
26
configure
vendored
@ -848,6 +848,7 @@ QT_INSTALL_DATA=
|
||||
QT_INSTALL_TRANSLATIONS=
|
||||
QT_INSTALL_SETTINGS=
|
||||
QT_INSTALL_EXAMPLES=
|
||||
QT_INSTALL_TESTS=
|
||||
QT_HOST_PREFIX=
|
||||
|
||||
#flags for SQL drivers
|
||||
@ -1055,7 +1056,7 @@ while [ "$#" -gt 0 ]; do
|
||||
shift
|
||||
VAL=$1
|
||||
;;
|
||||
-prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-depths|-make|-nomake|-platform|-xplatform|-sdk|-arch|-host-arch|-mysql_config|-sysroot)
|
||||
-prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-sdk|-arch|-host-arch|-mysql_config|-sysroot)
|
||||
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
|
||||
shift
|
||||
VAL="$1"
|
||||
@ -1313,6 +1314,9 @@ while [ "$#" -gt 0 ]; do
|
||||
examplesdir)
|
||||
QT_INSTALL_EXAMPLES="$VAL"
|
||||
;;
|
||||
testsdir)
|
||||
QT_INSTALL_TESTS="$VAL"
|
||||
;;
|
||||
qconfig)
|
||||
CFG_QCONFIG="$VAL"
|
||||
;;
|
||||
@ -3617,6 +3621,17 @@ if [ -z "$QT_INSTALL_EXAMPLES" ]; then #default
|
||||
fi
|
||||
QT_INSTALL_EXAMPLES=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_EXAMPLES"`
|
||||
|
||||
#tests
|
||||
if [ -z "$QT_INSTALL_TESTS" ]; then #default
|
||||
if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
|
||||
if [ "$PLATFORM_MAC" = "yes" ]; then
|
||||
QT_INSTALL_TESTS="/Developer/Tests/Qt"
|
||||
fi
|
||||
fi
|
||||
[ -z "$QT_INSTALL_TESTS" ] && QT_INSTALL_TESTS="$QT_INSTALL_PREFIX/tests" #fallback
|
||||
fi
|
||||
QT_INSTALL_TESTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TESTS"`
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# help - interactive parts of the script _after_ this section please
|
||||
#-------------------------------------------------------------------------------
|
||||
@ -3693,7 +3708,7 @@ if [ "$OPT_HELP" = "yes" ]; then
|
||||
cat <<EOF
|
||||
Usage: $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
|
||||
[-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>]
|
||||
[-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>]
|
||||
[-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] [-testsdir <dir>]
|
||||
[-release] [-debug] [-debug-and-release]
|
||||
[-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
|
||||
[-largefile] [-no-exceptions] [-exceptions] [-no-accessibility]
|
||||
@ -3771,6 +3786,8 @@ cat <<EOF
|
||||
(default PREFIX/etc/settings)
|
||||
-examplesdir <dir> .... Examples will be installed to <dir>
|
||||
(default PREFIX/examples)
|
||||
-testsdir <dir> ....... Tests will be installed to <dir>
|
||||
(default PREFIX/tests)
|
||||
|
||||
Configure options:
|
||||
|
||||
@ -4616,6 +4633,7 @@ DATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_INSTA
|
||||
TRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_INSTALL_TRANSLATIONS"`
|
||||
SETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"`
|
||||
EXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES"`
|
||||
TESTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_tstspath=$QT_INSTALL_TESTS"`
|
||||
|
||||
TODAY=`date +%Y-%m-%d`
|
||||
cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
|
||||
@ -4640,6 +4658,7 @@ if [ ! -z "$QT_HOST_PREFIX" ]; then
|
||||
HOSTTRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_HOST_PREFIX/translations"`
|
||||
HOSTSETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"`
|
||||
HOSTEXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES"`
|
||||
HOSTTESTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_tstspath=$QT_INSTALL_TESTS"`
|
||||
|
||||
cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
|
||||
|
||||
@ -4656,6 +4675,7 @@ static const char qt_configure_data_path_str [256 + 12] = "$HOSTDATA_PAT
|
||||
static const char qt_configure_translations_path_str [256 + 12] = "$HOSTTRANSLATIONS_PATH_STR";
|
||||
static const char qt_configure_settings_path_str [256 + 12] = "$HOSTSETTINGS_PATH_STR";
|
||||
static const char qt_configure_examples_path_str [256 + 12] = "$HOSTEXAMPLES_PATH_STR";
|
||||
static const char qt_configure_tests_path_str [256 + 12] = "$HOSTTESTS_PATH_STR";
|
||||
#else // QT_BOOTSTRAPPED
|
||||
EOF
|
||||
fi
|
||||
@ -4673,6 +4693,7 @@ static const char qt_configure_data_path_str [256 + 12] = "$DATA_PATH_ST
|
||||
static const char qt_configure_translations_path_str [256 + 12] = "$TRANSLATIONS_PATH_STR";
|
||||
static const char qt_configure_settings_path_str [256 + 12] = "$SETTINGS_PATH_STR";
|
||||
static const char qt_configure_examples_path_str [256 + 12] = "$EXAMPLES_PATH_STR";
|
||||
static const char qt_configure_tests_path_str [256 + 12] = "$TESTS_PATH_STR";
|
||||
EOF
|
||||
|
||||
if [ ! -z "$QT_HOST_PREFIX" ]; then
|
||||
@ -4697,6 +4718,7 @@ cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
|
||||
#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;
|
||||
#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;
|
||||
#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;
|
||||
#define QT_CONFIGURE_TESTS_PATH qt_configure_tests_path_str + 12;
|
||||
EOF
|
||||
|
||||
# avoid unecessary rebuilds by copying only if qconfig.cpp has changed
|
||||
|
@ -65,5 +65,51 @@ QMAKE_EXTRA_TARGETS *= check
|
||||
}
|
||||
}
|
||||
|
||||
!no_testcase_installs:!contains(INSTALLS, target) {
|
||||
# Install tests unless no_testcase_installs is set, or there is already
|
||||
# a `target' in INSTALLS.
|
||||
#
|
||||
# Tests are installed under a directory named after the target so that each
|
||||
# test has its own directory for testdata etc.
|
||||
#
|
||||
load(resolve_target)
|
||||
TARGET_BASENAME = $$basename(QMAKE_RESOLVED_TARGET)
|
||||
target.path = $$[QT_INSTALL_TESTS]/$$TARGET_BASENAME
|
||||
INSTALLS += target
|
||||
}
|
||||
|
||||
contains(INSTALLS, target) {
|
||||
# Install testdata as well, but only if we're actually installing the test.
|
||||
#
|
||||
# Testdata is installed relative to the directory containing the testcase
|
||||
# binary itself, e.g. this:
|
||||
#
|
||||
# CONFIG += testcase
|
||||
# TARGET = tst_qxmlreader
|
||||
#
|
||||
# TESTDATA += testdata/test1.xml testdata/test2.xml
|
||||
#
|
||||
# ... will result in:
|
||||
#
|
||||
# /usr/lib/qt5/tests/tst_qxmlreader/tst_qxmlreader
|
||||
# /usr/lib/qt5/tests/tst_qxmlreader/testdata/test1.xml
|
||||
# /usr/lib/qt5/tests/tst_qxmlreader/testdata/test2.xml
|
||||
# ...
|
||||
#
|
||||
for(file, TESTDATA) {
|
||||
tdi = testdata_install_$${elem}
|
||||
tdif = $${tdi}.files
|
||||
tdip = $${tdi}.path
|
||||
|
||||
# TESTDATA consists of the files to install (source)...
|
||||
$$tdif = $$file
|
||||
|
||||
# ... and the destination preserves the relative path
|
||||
$$tdip = $${target.path}/$$dirname(file)
|
||||
|
||||
INSTALLS += $$tdi
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,8 @@ public:
|
||||
TranslationsPath,
|
||||
SettingsPath,
|
||||
ExamplesPath,
|
||||
ImportsPath
|
||||
ImportsPath,
|
||||
TestsPath
|
||||
};
|
||||
static QString location(LibraryLocation);
|
||||
};
|
||||
|
@ -93,6 +93,8 @@ QMakeProperty::value(QString v, bool just_check)
|
||||
return QLibraryInfo::location(QLibraryInfo::LibrariesPath);
|
||||
else if(v == "QT_INSTALL_BINS")
|
||||
return QLibraryInfo::location(QLibraryInfo::BinariesPath);
|
||||
else if(v == "QT_INSTALL_TESTS")
|
||||
return QLibraryInfo::location(QLibraryInfo::TestsPath);
|
||||
else if(v == "QT_INSTALL_PLUGINS")
|
||||
return QLibraryInfo::location(QLibraryInfo::PluginsPath);
|
||||
else if(v == "QT_INSTALL_IMPORTS")
|
||||
@ -199,6 +201,7 @@ QMakeProperty::exec()
|
||||
specialProps.append("QT_INSTALL_HEADERS");
|
||||
specialProps.append("QT_INSTALL_LIBS");
|
||||
specialProps.append("QT_INSTALL_BINS");
|
||||
specialProps.append("QT_INSTALL_TESTS");
|
||||
specialProps.append("QT_INSTALL_PLUGINS");
|
||||
specialProps.append("QT_INSTALL_IMPORTS");
|
||||
specialProps.append("QT_INSTALL_TRANSLATIONS");
|
||||
|
@ -280,6 +280,11 @@ QLibraryInfo::location(LibraryLocation loc)
|
||||
case ExamplesPath:
|
||||
path = QT_CONFIGURE_EXAMPLES_PATH;
|
||||
break;
|
||||
#endif
|
||||
#ifdef QT_CONFIGURE_TESTS_PATH
|
||||
case TestsPath:
|
||||
path = QT_CONFIGURE_TESTS_PATH;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
@ -331,6 +336,10 @@ QLibraryInfo::location(LibraryLocation loc)
|
||||
case ExamplesPath:
|
||||
key = QLatin1String("Examples");
|
||||
break;
|
||||
case TestsPath:
|
||||
key = QLatin1String("Tests");
|
||||
defaultValue = QLatin1String("tests");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -469,6 +478,7 @@ QLibraryInfo::location(LibraryLocation loc)
|
||||
\value TranslationsPath The location of translation information for Qt strings.
|
||||
\value SettingsPath The location for Qt settings.
|
||||
\value ExamplesPath The location for examples upon install.
|
||||
\value TestsPath The location of installed Qt testcases.
|
||||
|
||||
\sa location()
|
||||
*/
|
||||
|
@ -77,7 +77,8 @@ public:
|
||||
TranslationsPath,
|
||||
SettingsPath,
|
||||
ExamplesPath,
|
||||
ImportsPath
|
||||
ImportsPath,
|
||||
TestsPath
|
||||
};
|
||||
static QString location(LibraryLocation); // ### Qt 5: consider renaming it to path()
|
||||
|
||||
|
@ -11,7 +11,5 @@ wince* {
|
||||
} else {
|
||||
DEFINES += SRCDIR=\\\"$$PWD\\\"
|
||||
|
||||
test_data.files = baseline/*
|
||||
test_data.path = $${target.path}/baseline
|
||||
INSTALLS += test_data
|
||||
TESTDATA += baseline/*
|
||||
}
|
||||
|
@ -1119,6 +1119,13 @@ void Configure::parseCmdLine()
|
||||
dictionary[ "QT_INSTALL_EXAMPLES" ] = configCmdLine.at(i);
|
||||
}
|
||||
|
||||
else if (configCmdLine.at(i) == "-testsdir") {
|
||||
++i;
|
||||
if (i == argCount)
|
||||
break;
|
||||
dictionary[ "QT_INSTALL_TESTS" ] = configCmdLine.at(i);
|
||||
}
|
||||
|
||||
else if (configCmdLine.at(i) == "-hostprefix") {
|
||||
++i;
|
||||
if (i == argCount)
|
||||
@ -2602,6 +2609,8 @@ void Configure::generateOutputVars()
|
||||
dictionary[ "QT_INSTALL_TRANSLATIONS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/translations");
|
||||
if (!dictionary[ "QT_INSTALL_EXAMPLES" ].size())
|
||||
dictionary[ "QT_INSTALL_EXAMPLES" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/examples");
|
||||
if (!dictionary[ "QT_INSTALL_TESTS" ].size())
|
||||
dictionary[ "QT_INSTALL_TESTS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/tests");
|
||||
|
||||
if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
|
||||
dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ];
|
||||
@ -3103,6 +3112,7 @@ void Configure::generateConfigfiles()
|
||||
<< "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << escapeSeparators(dictionary["QT_INSTALL_DATA"]) << "\";" << endl
|
||||
<< "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << escapeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\";" << endl
|
||||
<< "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << escapeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << "\";" << endl
|
||||
<< "static const char qt_configure_tests_path_str [512 + 12] = \"qt_tstspath=" << escapeSeparators(dictionary["QT_INSTALL_TESTS"]) << "\";" << endl
|
||||
//<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << escapeSeparators(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl
|
||||
;
|
||||
if (!dictionary[ "QT_HOST_PREFIX" ].isNull()) {
|
||||
@ -3117,6 +3127,7 @@ void Configure::generateConfigfiles()
|
||||
<< "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ], true) <<"\";" << endl
|
||||
<< "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations", true) <<"\";" << endl
|
||||
<< "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example", true) <<"\";" << endl
|
||||
<< "static const char qt_configure_tests_path_str [512 + 12] = \"qt_tstspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/tests", true) <<"\";" << endl
|
||||
<< "#endif //QT_BOOTSTRAPPED" << endl;
|
||||
}
|
||||
tmpStream << "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl
|
||||
@ -3132,6 +3143,7 @@ void Configure::generateConfigfiles()
|
||||
<< "#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;" << endl
|
||||
<< "#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;" << endl
|
||||
<< "#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;" << endl
|
||||
<< "#define QT_CONFIGURE_TESTS_PATH qt_configure_tests_path_str + 12;" << endl
|
||||
//<< "#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;" << endl
|
||||
<< endl;
|
||||
|
||||
@ -3291,6 +3303,7 @@ void Configure::displayConfig()
|
||||
cout << "Data installed to..........." << dictionary[ "QT_INSTALL_DATA" ] << endl;
|
||||
cout << "Translations installed to..." << dictionary[ "QT_INSTALL_TRANSLATIONS" ] << endl;
|
||||
cout << "Examples installed to......." << dictionary[ "QT_INSTALL_EXAMPLES" ] << endl;
|
||||
cout << "Tests installed to.........." << dictionary[ "QT_INSTALL_TESTS" ] << endl;
|
||||
|
||||
if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("wince"))) {
|
||||
cout << "Using c runtime detection..." << dictionary[ "CE_CRT" ] << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user