diff --git a/tests/auto/grpcgen/CMakeLists.txt b/tests/auto/grpcgen/CMakeLists.txt index 3e64abb2..5c5e4f9a 100644 --- a/tests/auto/grpcgen/CMakeLists.txt +++ b/tests/auto/grpcgen/CMakeLists.txt @@ -24,6 +24,13 @@ qt_internal_add_test(tst_qtgrpcgen BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}" ) +qt_internal_extend_target(tst_qtgrpcgen + CONDITION + CMAKE_CROSSCOMPILING + DEFINES + CROSSCOMPILING +) + qt_add_protobuf(tst_qtgrpcgen_protobuf_common OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${cmake_generated_dir}/protobuf_common" diff --git a/tests/auto/grpcgen/tst_qtgrpcgen.cpp b/tests/auto/grpcgen/tst_qtgrpcgen.cpp index ef1d24a8..1f279ed6 100644 --- a/tests/auto/grpcgen/tst_qtgrpcgen.cpp +++ b/tests/auto/grpcgen/tst_qtgrpcgen.cpp @@ -5,7 +5,14 @@ #include -#include +#if !QT_CONFIG(process) || defined(CROSSCOMPILING) +# define SKIP_COMMAND_LINE_TESTS +#endif + +#if !defined(SKIP_COMMAND_LINE_TESTS) +# include +#endif + #include #include "protocplugintestcommon.h" @@ -14,7 +21,7 @@ using namespace Qt::StringLiterals; using namespace ProtocPluginTest; namespace { -#if QT_CONFIG(process) +#if !defined(SKIP_COMMAND_LINE_TESTS) # ifndef PROTOC_EXECUTABLE # error PROTOC_EXECUTABLE definition must be set and point to the valid protoc executable # endif @@ -61,7 +68,7 @@ private Q_SLOTS: void cmakeGenerated_data(); void cmakeGenerated(); -#if QT_CONFIG(process) +#if !defined(SKIP_COMMAND_LINE_TESTS) //! Test command-line call of qtgrpcgen void cmdLineGenerated_data(); void cmdLineGenerated(); @@ -101,7 +108,7 @@ void qtgrpcgenTest::cmakeGenerated() cmakeGeneratedPath() + '/'_L1 + testName + '/'_L1 + filePath); } -#if QT_CONFIG(process) +#if !defined(SKIP_COMMAND_LINE_TESTS) void qtgrpcgenTest::cmdLineGenerated_data() { QTest::addColumn("directory"); diff --git a/tests/auto/protobufgen/CMakeLists.txt b/tests/auto/protobufgen/CMakeLists.txt index ccfd8537..cc7e8ab6 100644 --- a/tests/auto/protobufgen/CMakeLists.txt +++ b/tests/auto/protobufgen/CMakeLists.txt @@ -24,6 +24,14 @@ qt_internal_add_test(tst_qtprotobufgen CMAKE_GENERATED_DIR="${cmake_generated_dir}" BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}" ) + +qt_internal_extend_target(tst_qtprotobufgen + CONDITION + CMAKE_CROSSCOMPILING + DEFINES + CROSSCOMPILING +) + qt_autogen_tools_initial_setup(tst_qtprotobufgen) set(cmake_generator_tests "") diff --git a/tests/auto/protobufgen/tst_qtprotobufgen.cpp b/tests/auto/protobufgen/tst_qtprotobufgen.cpp index 6fce564e..fbbcf79d 100644 --- a/tests/auto/protobufgen/tst_qtprotobufgen.cpp +++ b/tests/auto/protobufgen/tst_qtprotobufgen.cpp @@ -6,7 +6,12 @@ #include #include -#if QT_CONFIG(process) + +#if !QT_CONFIG(process) || defined(CROSSCOMPILING) +# define SKIP_COMMAND_LINE_TESTS +#endif + +#if !defined(SKIP_COMMAND_LINE_TESTS) # include #endif #include @@ -17,7 +22,7 @@ using namespace Qt::StringLiterals; using namespace ProtocPluginTest; namespace { -#if QT_CONFIG(process) +#if !defined(SKIP_COMMAND_LINE_TESTS) # ifndef PROTOC_EXECUTABLE # error PROTOC_EXECUTABLE definition must be set and point to the valid protoc executable # endif @@ -40,7 +45,7 @@ constexpr QLatin1StringView allow_proto3_optional; constexpr QLatin1StringView CmdLineGeneratedDir("cmd_line_generated"); -#endif // QT_CONFIG(process) +#endif // !defined(SKIP_COMMAND_LINE_TESTS) # ifndef BINARY_DIR # error BINARY_DIR definition must be set @@ -68,7 +73,7 @@ private Q_SLOTS: void cmakeGenerated_data(); void cmakeGenerated(); -#if QT_CONFIG(process) +#if !defined(SKIP_COMMAND_LINE_TESTS) //! Test command-line call of qtprotobufgen void cmdLineGenerated_data(); void cmdLineGenerated(); @@ -85,7 +90,7 @@ void qtprotobufgenTest::initTestCase() { initPaths(BinaryDir, CMakeGeneratedDir, CmdLineGeneratedDir); QVERIFY(!cmakeGeneratedPath().isEmpty()); -#if QT_CONFIG(process) +#if !defined(SKIP_COMMAND_LINE_TESTS) QVERIFY(!cmdLineGeneratedPath().isEmpty()); #endif QVERIFY(protocolCompilerAvailableToRun(ProtocPath)); @@ -117,7 +122,7 @@ void qtprotobufgenTest::cmakeGenerated() cmakeGeneratedPath() + '/'_L1 + testName + '/'_L1 + filePath); } -#if QT_CONFIG(process) +#if !defined(SKIP_COMMAND_LINE_TESTS) void qtprotobufgenTest::cmdLineGenerated_data() { QTest::addColumn("directory"); @@ -293,7 +298,7 @@ void qtprotobufgenTest::cmdLineMutableGetterConflicts() QVERIFY2(process.exitCode() == 1, msgProcessFailed(process).constData()); } -#endif // QT_CONFIG(process) +#endif // !defined(SKIP_COMMAND_LINE_TESTS) void qtprotobufgenTest::cleanupTestCase() {