From e897b0f403bd3dcf014364c4ea631937e5da13cd Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Wed, 10 Jan 2024 11:06:25 +0100 Subject: [PATCH] Require the PROTOC_EXECUTABLE definition in tests Require the PROTOC_EXECUTABLE definition when compiling qtprotobufgen/qtgrpcgen tests. Pick-to: 6.5 Change-Id: I5e207c8402dbccd5254d6a9687303e56ff7a4bbb Reviewed-by: Tatiana Borisova (cherry picked from commit f15db878a193f3ac4557255b70a32e9e948e3fec) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 2be1d6fa8cadf1f3383b6a06de363b1adf586d6c) --- tests/auto/grpcgen/tst_qtgrpcgen.cpp | 11 +++-------- tests/auto/protobufgen/tst_qtprotobufgen.cpp | 11 +++-------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/tests/auto/grpcgen/tst_qtgrpcgen.cpp b/tests/auto/grpcgen/tst_qtgrpcgen.cpp index d8da2e9f..5fe319cc 100644 --- a/tests/auto/grpcgen/tst_qtgrpcgen.cpp +++ b/tests/auto/grpcgen/tst_qtgrpcgen.cpp @@ -20,15 +20,10 @@ const QLatin1StringView grpcGenQtprotobufKey(" --plugin=protoc-gen-qtgrpc="); const QLatin1StringView optKey(" --qtgrpc_opt="); const QLatin1StringView outputKey(" --qtgrpc_out="); const QLatin1StringView includeKey(" -I"); -#if defined(PROTOC_EXECUTABLE) +#ifndef PROTOC_EXECUTABLE +# error PROTOC_EXECUTABLE definition must be set and point to the valid protoc executable +#endif const QLatin1StringView protocolBufferCompiler(XSTR(PROTOC_EXECUTABLE)); -#else -#if defined(Q_OS_WIN) -const QLatin1StringView protocolBufferCompiler("protoc.exe"); -#else -const QLatin1StringView protocolBufferCompiler("protoc"); -#endif -#endif #if defined(Q_OS_WIN) const QLatin1StringView qtgrpcgen("/qtgrpcgen.exe"); #else diff --git a/tests/auto/protobufgen/tst_qtprotobufgen.cpp b/tests/auto/protobufgen/tst_qtprotobufgen.cpp index 42e3aaa0..be7a6525 100644 --- a/tests/auto/protobufgen/tst_qtprotobufgen.cpp +++ b/tests/auto/protobufgen/tst_qtprotobufgen.cpp @@ -21,15 +21,10 @@ const QLatin1StringView protocGenQtprotobufKey(" --plugin=protoc-gen-qtprotobuf= const QLatin1StringView optKey(" --qtprotobuf_opt="); const QLatin1StringView outputKey(" --qtprotobuf_out="); const QLatin1StringView includeKey(" -I"); -#if defined(PROTOC_EXECUTABLE) +#ifndef PROTOC_EXECUTABLE +# error PROTOC_EXECUTABLE definition must be set and point to the valid protoc executable +#endif const QLatin1StringView protocolBufferCompiler(XSTR(PROTOC_EXECUTABLE)); -#else -#if defined(Q_OS_WIN) -const QLatin1StringView protocolBufferCompiler("protoc.exe"); -#else -const QLatin1StringView protocolBufferCompiler("protoc"); -#endif -#endif #if defined(Q_OS_WIN) const QLatin1StringView qtprotobufgen("/qtprotobufgen.exe"); #else