aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Richardson <arichardson.kde@gmail.com>2014-05-07 15:59:57 +0200
committerAlex Richardson <arichardson.kde@gmail.com>2014-05-07 15:59:57 +0200
commit69000672e974ad5444b5d6df5187db13eab279de (patch)
treea7f94274048b1c6191766f2dfcf561ce5e04d762
parenta1dcaf788ee48b70e6937962e6fc00a148d89bc5 (diff)
downloadkconfig-69000672e974ad5444b5d6df5187db13eab279de.tar.gz
kconfig-69000672e974ad5444b5d6df5187db13eab279de.tar.bz2
fix kconfig_compiler test on windows
We have to generate the files in the same directory as the test executables otherwise QFINDTESTDATA will fail
-rw-r--r--autotests/kconfig_compiler/CMakeLists.txt22
-rw-r--r--autotests/kconfig_compiler/kconfigcompiler_test.cpp4
-rw-r--r--autotests/kconfig_compiler/test4main.cpp2
3 files changed, 18 insertions, 10 deletions
diff --git a/autotests/kconfig_compiler/CMakeLists.txt b/autotests/kconfig_compiler/CMakeLists.txt
index cca468f9..b2049dc1 100644
--- a/autotests/kconfig_compiler/CMakeLists.txt
+++ b/autotests/kconfig_compiler/CMakeLists.txt
@@ -1,4 +1,15 @@
+# On Windows we have to generate the .h and .cpp inside ${CMAKE_BINARY_DIR}/bin because
+# otherwise QFINDTESTDATA will not be able to locate them.
+if(WIN32)
+ set(KCFG_OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin")
+else()
+ set(KCFG_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+endif()
+
+# make sure the generated headers can be found
+include_directories(${KCFG_OUTPUT_DIR})
+
macro(GEN_KCFG_TEST_SOURCE _testName _srcs)
cmake_parse_arguments(ARG "" "KCFG" "" ${ARGN} )
set(_kcfgFile ${ARG_KCFG})
@@ -6,17 +17,14 @@ macro(GEN_KCFG_TEST_SOURCE _testName _srcs)
set(_kcfgFile "${_testName}.kcfg")
endif()
add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h
+ OUTPUT ${KCFG_OUTPUT_DIR}/${_testName}.cpp ${KCFG_OUTPUT_DIR}/${_testName}.h
COMMAND KF5::kconfig_compiler ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfgFile} ${CMAKE_CURRENT_SOURCE_DIR}/${_testName}.kcfgc
+ WORKING_DIRECTORY ${KCFG_OUTPUT_DIR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfgFile} ${CMAKE_CURRENT_SOURCE_DIR}/${_testName}.kcfgc KF5::kconfig_compiler)
# set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h PROPERTIES GENERATED TRUE)
- qt5_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.moc )
- # do not run automoc on the generated file
- set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_testName}.cpp PROPERTIES SKIP_AUTOMOC TRUE)
- set( ${_srcs} ${${_srcs}} ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h )
-
- set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.moc )
+ set( ${_srcs} ${${_srcs}} ${KCFG_OUTPUT_DIR}/${_testName}.cpp)
+ set_property(SOURCE ${KCFG_OUTPUT_DIR}/${_testName}.cpp APPEND PROPERTY OBJECT_DEPENDS ${KCFG_OUTPUT_DIR}/${_testName}.moc )
endmacro(GEN_KCFG_TEST_SOURCE)
include(ECMMarkAsTest)
diff --git a/autotests/kconfig_compiler/kconfigcompiler_test.cpp b/autotests/kconfig_compiler/kconfigcompiler_test.cpp
index fcefcb68..40173ee7 100644
--- a/autotests/kconfig_compiler/kconfigcompiler_test.cpp
+++ b/autotests/kconfig_compiler/kconfigcompiler_test.cpp
@@ -100,11 +100,11 @@ void KConfigCompiler_Test::testBaselineComparison()
QFile fileRef(QFINDTESTDATA(testName + QLatin1String(".ref")));
if (!file.open(QIODevice::ReadOnly)) {
- qWarning() << "Failed to open" << file.fileName();
+ qWarning() << "Failed to open" << file.fileName() << "(" << testName << ")";
QFAIL("Can't open file for comparison");
}
if (!fileRef.open(QIODevice::ReadOnly)) {
- qWarning() << "Failed to open" << fileRef.fileName();
+ qWarning() << "Failed to open" << fileRef.fileName() << "(" << testName << ".ref )";
QFAIL("Can't open file for comparison");
}
QString content = file.readAll();
diff --git a/autotests/kconfig_compiler/test4main.cpp b/autotests/kconfig_compiler/test4main.cpp
index 1df7cc5e..b4569ba9 100644
--- a/autotests/kconfig_compiler/test4main.cpp
+++ b/autotests/kconfig_compiler/test4main.cpp
@@ -34,7 +34,7 @@ int main(int argc, char **argv)
group.writeEntry(QLatin1String("foo bar"), QStringLiteral("Value"));
}
Test4 *t = Test4::self();
- bool ok = QFile::exists(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/test4rc");
+ bool ok = QFile::exists(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/test4rc");
if (!ok) {
qWarning() << "config file was not created!";
}