Commit Graph

64 Commits

Author SHA1 Message Date
Alexey Edelev d8d39ce04b Fix enum serialization test
Test functions were not slots and never run. Also ajust the QCOMPARE
statements.

Change-Id: I0c6740e1a4a37f02d3460bed6254844e62268fe7
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
(cherry picked from commit e6bc158296)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit acf3d35287)
2023-12-11 02:18:14 +00:00
Alexey Edelev df52305b0f Add the file name output when checking if test data exists
Improves the error logging. If either expected or generated files
don't exists this will now display the full file path that is missing.

Change-Id: I502cc7592266c3e241aaedfbe14f02d67d5fc2b7
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
(cherry picked from commit 67932115f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8f81d0f78c)
2023-12-06 17:14:49 +00:00
Alexey Edelev 8d63f74364 Fix the names of nesting namespaces
Make sure that we use the capitalized messages names when generating
code that accesses the nested messages or enums.

Change-Id: I2f6d5f8f9a016c709bef0657b2cbce58a81cd8e8
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
(cherry picked from commit b0a4df9707)
(cherry picked from commit 3f11cd3e2c)
2023-10-02 10:15:19 +02:00
Alexey Edelev abb398cab1 Format the .proto files according to the clang-format rules
Change-Id: Iedc563ab8689779960dc6a2cc0b5817a874374e0
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
(cherry picked from commit 36a64710a9)
2023-09-21 15:07:15 +02:00
Alexey Edelev 2148464036 Avoid generating the client methods that require client-side streaming
Client-side streaming is not supported by QtGRPC. We shouldn't generate
methods that are nooperational.

Change-Id: I030717c105c87ceda724c449106d4b84ba57bf33
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
(cherry picked from commit d11ae3954d)
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-08-16 17:21:46 +02:00
Alexey Edelev 253657d84c Add 'checkThread' function to QAbstractGrpcChannelPrivate
Use generic 'checkThread' function across all QAbstractGrpcChannel
calls.

Change-Id: I8fdae06df112d5349441274b957ef6e0c8106cdc
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
(cherry picked from commit fa1a88fe8f)
2023-08-16 17:21:44 +02:00
Alexey Edelev d1524dafaa Add extra tests of nested enums
Change-Id: I53b33f72faf6a2e06e4c8e421a67c7d2341ecb2b
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
(cherry picked from commit 6011f8df40)
2023-08-10 13:57:51 +02:00
Tatiana Borisova 8f4fdf54aa QtProtobuf: Enum declaration error
Moved declaration of the nested messages after the top-level message,
since it's required for correct evaluation of parent internals.

Task-number: QTBUG-115180
Change-Id: Ie3c46076007fd46a946011607867526f17bb732f
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 05bafbc5c6)
2023-08-10 11:10:06 +02:00
Alexey Edelev 32e57bd1ae Fix detecting of unused nested messages
Previously if nested message was never used by the nesting class it
was ignored to be generated. It was the result if invalid filtering
of map messages as nested types.
Use the explicit map_key() based check instead of weird and tricky
one based on nesting class fields.

Keep the fallback solution that uses MessageOptions when building
with libprotoc versions less than 3.12.

Fixes: QTBUG-115175
Change-Id: I4aa238dac3375bdcdf85e41ba9daef74474ed0fb
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
(cherry picked from commit 03ccff3aa7)
2023-08-03 14:01:41 +02:00
Alexey Edelev 728f2ddbd1 Disable batch testing for qtgrpc repo
Tests are not designed for batch testing, so disabling them.

Change-Id: I2ed51dc971078e8bdf9e7b51372940374cc593f3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f77d778271)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-26 16:29:10 +00:00
Alexey Edelev ff954e39c7 Exclude native grpc channels from the Qt packaging configurations
Native gRPC channels rely on the reference gRPC implementation that
doesn't guarantee the ABI compatibility between different versions. We
shouldn't link libQt6GRPC to any 3rdparty libraries that are not
delivered as part of Qt when make packaging builds in CI.

Fixes: QTBUG-115055
Fixes: QTBUG-110107
Change-Id: I10081b4bd2477ee4f3a7edcd172066c08c6dd972
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 19588b81df)
2023-07-05 18:41:15 +02:00
Tatiana Borisova 869604dfde Delete useless "private:" block for grpcgen output
Change-Id: Ifdbecea989ca632ba840e0dba18aa1d07cc7ef32
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit f34a9bef52)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-04 15:51:04 +02:00
Tatiana Borisova 794a97154a Remove unused include from tst_protobuf_raw_serializers
The fieldindexrange.qpb.h file is not used in test.

Change-Id: I0e55cdf9bd9cdcd87eb8e3b750921960b4a77ae5
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 71fc45edf3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-05-31 15:01:58 +00:00
Alexey Edelev 79f57c7d0b Add recursive message test
Test for the recursive message support. Check that recurisve messages
can be compiled and serialized/deserialized correctly.

Change-Id: I34e8f60d6e64416a1665742b716356270f7ed085
(cherry picked from commit 35fb115ecb)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2023-05-05 11:09:34 +02:00
Alexey Edelev a6e9bfb0de Cleanup protobuf serializer
The actual protobuf serializer has multiple overheads and code
duplicaiton. Serialization functions use individual ways to
detect if field was initialized or not. This patch adds the
general functions that detect if field was initialized or not.

Also serializers previously juggled the protobuf field number to
conclude the need of field header. Now the header is added under
clear conditions.

For STRING and BYTES lists we should use the same way of
serializing/deserialing as for non-packed lists, since they are
non-packed lists.

Map elements should be serialized even if value is not initialized.
But non-initialized keys should still be present in serialization
stream. Avoid using serializeProperty when serializing the map key
and use integated type serilizers directly.

This change is backported from the dev branch, but is significantly
different of the original one, since the code base of dev branch
contains several features, like the support of the oneof fields,
that were not backported to the 6.5 branch.

Change-Id: I32b512acdaa9f355eea9c41f735bc9722bed0bba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 39e7773160)
2023-05-05 09:09:23 +00:00
Konrad Kujawa 7424b1fed1 Make IntTypes parameter a template parater in protobuf serialization data
Change-Id: Ifce791a41909b8737fffd457938ae34593bd4ad2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 6cd79d25d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-30 10:06:46 +02:00
Konrad Kujawa 9254d98002 Refactor tst_protobuf_deserialization_basictypes tests
Use common serialization data for serialization and deserialization
of basic types.

Task-number: QTBUG-111070
Change-Id: I2691e50d570a4a7b357f1e1eaea486f606b71bbe
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit d241085ef7)
2023-03-30 10:06:40 +02:00
Konrad Kujawa d6fdc8100d Refactor tst_protobuf_serialization_basictypes tests
Refactor tst_protobuf_serialization_basictypes tests to use _data()
methods and extract common data to free functions.

Change-Id: I5f42a4056e438501cc6c7bf93a0dc4097845f37c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit cd82ae8cff)
2023-03-30 10:06:33 +02:00
Tatiana Borisova 2b00df2a68 Test code is should be updated according the latest generator version
Add protobufgen output files to the grpcgen test for auto checking
them up to date

Change-Id: Ia7c3fcedfc9b3a4f0e66e748db8d5d818b4fb069
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fa202dd944)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-16 13:53:17 +00:00
Alexey Edelev 046910b115 Do not initialize the message fields when accessing the private getter
When accessing the message field using the private getter we do not
initialize the field. This will avoid serializing uninitialized messages
and unlock recursive message support.

Change-Id: I84805952835f071284a55b4f049dfcbb0e27c129
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 1c06cea7f4)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-11 12:13:23 +01:00
Alexey Edelev 900a5573bb Add the missing qRegisterProtobufTypes call to tests
qRegisterProtobufTypes needs to be called explicitly if test never
uses methods that call qRegisterProtobufTypes implicitly.

Change-Id: I98552ed6ca364a7620c69d4fdd3d84a635d318c0
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit c2eabf1726)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-10 23:24:18 +00:00
Alexey Edelev 2176663e58 Avoid serializing uninitialized fixed-size fields
All fixed-size fields should not be serialized to the wire if they
are uninitialized(the value is '0'-like).

Amends df8e7e1b8d

Change-Id: Iba6b4f742e08ccd204233fcc1fd1cd04a5394032
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 872f651b77)
2023-03-10 10:00:01 +01:00
Alexey Edelev 338e9a3b79 Add the missing copyright and license headers to the .proto files
Change-Id: Id3d75385f251e77aebe0b56a82549e19fd0fbf84
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 3b10bf74b2)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-10 06:21:46 +01:00
Konrad Kujawa c3b04ea59c Split tst_protobuf_serialization_maptypes tests
Split tst_protobuf_serialization_maptypes into
tst_protobuf_serialization_maptypes and
tst_protobuf_serialization_complex_maptypes.
Fix formatting in those tests.

Task-number: QTBUG-111070
Change-Id: I7add0a9eab4503fe87d746ceaddec062d8993603
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 4560309429)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-09 14:18:24 +00:00
Konrad Kujawa 9bb066b6d4 Split tst_protobuf_deserialization_maptypes tests
Split tst_protobuf_deserialization_maptypes into
tst_protobuf_deserialization_maptypes and
tst_protobuf_deserialization_complex_types.
Fix formatting in those tests.

Task-number: QTBUG-111070
Change-Id: I8cfddb985231891aeca3e6d2bc28d87261107397
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit b9471e21c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-03-09 14:18:18 +00:00
Konrad Kujawa e4c59cb569 Use _L1 and _ba string literals instead of QStringLiteral in tests
Change-Id: If30cb30c6f396de5c60dc134a8ce158e4142e4e0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 288c8cfcae)
2023-03-02 10:12:31 +01:00
Mårten Nordheim ebb58145bc Introduce QProtobufMessagePointer and un-virtualize QProtobufMessage
Changing our return types from QProtobufMessage* to use a smart-ptr lets
us quite nicely get rid of the only virtual left in QProtobufMessage:
The destructor. Since we create the subclass through the meta-type
system we can also delete it that way. This gets rid of the virtual
table, which we would've been unable to extend anyway given our ABI
promises.

Since users can no longer call `delete` on a QProtobufMessage directly
we instead provide a convenient alias for a unique_ptr with a Deleter
which takes care of the aforementioned meta-type part.

Done-with: Marc Mutz <marc.mutz@qt.io>
Change-Id: I3405f0a9121dc8325f2940a8ee719c3c462f2c01
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 613b3de08e)
2023-02-28 11:46:15 +00:00
Alexey Edelev 23cc552f3e Disable -fPIE for the qtgrpc/qtprotobuf executables
If libprotobuf is not built with -fPIE enabled we cannot link it
to qtprotobufgen. Disable the flag until provisioning got the proper
update.

Do the same trick for all executables and libraries that are linked
to the libgrpc* or libproto* libraries.

TODO: Re-enable PIE once QTBUG-111485 is fixed.

Task-number: QTBUG-111485
Change-Id: I8735069c0c0ab61ec5b118ee5c261f77627e3f8c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 272957831e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-24 13:51:57 +00:00
Tatiana Borisova 97ea301e39 Delete test blacklisting after arm macos update was done
Fixes: QTBUG-109130
Change-Id: Iafb1fe02c092312ac35cd3c9bdf70d3d1f30ea11
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit d9e2ba1add)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-22 08:28:38 +00:00
Konrad Kujawa bae7df8ce4 Rename QAbstractGrpcClient::stream() to startStream()
Task-number: QTBUG-108833
Change-Id: I3507f316bd857c2db36c887bf454a46dcf50d724
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
(cherry picked from commit 5bb03ba979)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-20 11:59:07 +00:00
Konrad Kujawa 7fd787af15 Blacklist tst_grpc_client due to aborts on RHEL CI build
Task-number: QTBUG-111098
Change-Id: Ic8d4d6a6398097b9f7d05f331dc8ea5dbf1ada5d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3a34eb1e86)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-10 17:33:09 +00:00
Alexey Edelev 43cea4b54c Fix the double-free issues related to QGrpcOperation primitives
In the recent implementation the std::shared_ptr takes the real
ownership over the Qt GRPC channel primitives such as QGrpcOperation,
QGrpcStream, and QGrpcReply. Meanwhile these primitives had the QObject
parent-children relationships with the classes derived of the
QAbstractGrpcClient. This led to the floating double free issue when
Qt GC removed the primitives before the std::shared_ptr did.

Break the parent-child linking between the Qt GRPC channel primitives
and QAbstractGrpcClient. Cleanup the code parts that suppressed the
issue - the use of deleteLater instead of calling destructor directly.

Change-Id: I9c6562335020e45ddb8e440311ec119fc90777f8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d98f418ebd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-09 13:47:15 +00:00
Konrad Kujawa a22d5a6f02 Remove QAbstractGrpcService and disable QtGrpc service generation
It's not in use for now, so there's no reason for it to exist in
the public API, even when we're in TP - and plans for future
releases are still unclear regarding server-side gRPC support,
so this feature may not be needed in the coming months.

Either way, it can easily be added again once we have all the
server functionality ready.

Split code generation of gRPC client and server to separate
functions and make GenerateServerService unused.

Task-number: QTBUG-108833
Change-Id: I65a2122ec5dba640614d97daec973567c57401f4
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3d16e50a4b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-02-08 09:49:43 +00:00
Alexey Edelev 39f2a1e64a Rearrange qtprotobufgen and qtgrpcgen features
These features should only be enabled when the corresponding tools
should be built. Currently features are enabled even if tools won't
be built. This leads to the following issues when crosscompiling and
the host Qt lacks the qtprotobufgen/qtgrpcgen targets:
  Failed to find the host tool "Qt6::qtprotobufgen".  It is part of the
  Qt6ProtobufTools package, but the package could not be found.

Instead of enabling features when crosscompiling by default, search for
the module host tool targets first in top-level CMakeLists.txt and
next check if respective tools can be found. Make the
qt_internal_add_tool calls dependent on either the
qtprotobufgen/qtgrpcgen features or the host tools lookup results.

This also adds the qtgrpcgen feature since it makes sense to skip
building the gRPC generator using separate feature.

Add the missing dependencies on qtgrpc to the qtgrpcgen and native_grpc
features. Both features now are disabled if the grpc feature is OFF.

Remove redundant feature checks and replace them with tool target check
where is necessary.

TODO: QT_FORCE_BUILD_TOOLS doesn't lead to the error if the
dependencies of the repo tools are not satisfied. See QTBUG-110849
for details.

Amends 326ebfaadb

Fixes: QTBUG-110704
Change-Id: Ib29c4b24bc3e8c5147bf40332909bd8d44664699
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 63b9cc81df)
2023-02-02 15:36:03 +01:00
Alexey Edelev f2754bc730 Remove redundant include of Qt6ProtobufToolsMacros
The include should be done by either the repository top-level
CMakeLists.txt or by find_package(Qt6 COMPONENTS Protobuf) for
standalone tests.

Amends 0d56724387

Change-Id: Ib8ff2ce10dfd88509cd0deb5461d7d61a8dd0b10
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 625ac3a8a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-30 19:11:51 +00:00
Konrad Kujawa 386e1e1f9e Use QLatin1String1View and QByteArrayView in QAbstractGrpcClient
Use QLatin1StringView in QAbstractGrpcClient and
whenever it is possible, because method and service names
are ASCII-only and may only contain characters allowed
by HTTP/2 text header values.

Use QByteArrayView in QAbstractGrpcClient, because it represents
arbitrary bytes sent to the server.

Task-number: QTBUG-108833
Change-Id: I1a9cf7df8cff9dbfe703f6a3bfcb01217df8c4cc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a4dff7c073)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-27 08:46:10 +00:00
Konrad Kujawa 1a8480b776 Update links to the QtGrpc documentation
Add QtGrpc index and classes documentation pages.
Fix missing links to QtGrpc documentation.
The modules are now consistently named 'Qt GRPC', 'Qt Protobuf'.

Change-Id: Iabd91336c871e43c97c49712a52f3aa82f7e75a5
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 79dc1b71ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-26 17:25:52 +00:00
Mårten Nordheim 1b946d0040 Fix QProtobufLazyMessagePointerBase double-free
Amends 78b649ea46

Change-Id: If6ecf9c59220b36b05e9fc3477d1e1810415ddaf
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c5a4b28963)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-26 16:53:58 +01:00
Marc Mutz a79003e86d tst_grpc_ssl_client: remove unused QSharedPointer include
Amends 92ad7b1579.

Task-number: QTBUG-108833
Change-Id: Ic291f3b510112b117d61f4aa528d44b470df44eb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
(cherry picked from commit f3a3771a68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-19 10:06:23 +00:00
Alexey Edelev 57443fa1fc Use initializer when copying fields in copy ctor
Use initializer instead of setters when copying fields in copy ctor

Change-Id: Ie069986fd0443c90c57621130a88151d685ed048
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit aeb2e8a1ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-12 13:18:15 +00:00
Tatiana Borisova 9e84ca1daa QtGrpc: Update code generator to generate gRPC structures
Split the .proto files generator into QtProtobuf and QtGrpc parts.

Task-number: QTBUG-105496
Change-Id: Ib43abe4c1fb849ecf68952b82af9d3988e88e02a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 326ebfaadb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-11 15:19:37 +00:00
Marc Mutz 047f28a4a1 tst_grpc_client: port from QSharedPointer to std::unique_ptr
The sharing capabilities of shared_ptr aren't used here, so use a
const unique_ptr, aka a scoped pointer.

Task-number: QTBUG-108833
Change-Id: I55977d18744627f56603d64816a6f13f254ab06f
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bdac28b542)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-06 13:55:58 +00:00
Konrad Kujawa d7d32e45cd Address minor suggestions for QtGrpc codebase
Add missing explicit, override, default, const keywords.
Omit pointless inline.
Remove empty () in lambdas.
Include mocs for QtGrpc module.
Use trailing , in enums.
Use underlying type for enums.

Task-number: QTBUG-108833
Change-Id: I34e73a7f2715f374303634f9ed0236601c094a84
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 9a1881718b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-05 07:54:48 +00:00
Konrad Kujawa 0b60efa23e Reflow and fix style issues in QtGrpc documentation and messages
Reflow QtGrpc documentation and messages.
Fix style and grammar issues in the QtGrpc.
Address minor code review suggestions from 'Introduce QtGrpc' patch.

Task-number: QTBUG-108833
Change-Id: I74b9725e82e23d0ad6ae9be19b6c5542e63fc487
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 176aa956eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-01-05 07:54:46 +00:00
Konrad Kujawa 9043a62833 Use std::shared_ptr instead of QSharedPointer
Task-number: QTBUG-108833
Change-Id: I51dcc024a3f4eb0d9a53f60a57c0a9621f8980c4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 92ad7b1579)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-12-22 14:50:10 +01:00
Alexey Edelev 9839b1dbdd grpc: Minor test updates
Minimize incrementing and check of the iterator variables. Replaces
hardcoded test values with constants.

Change-Id: I5ae4c5e1ab8db62b5744e62f62a5124536686342
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 7b565c1d13)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-12-22 13:50:08 +00:00
Alexey Edelev 70623068aa grpc: Make the latency between messages adjustable in tests
Reduce the base latency to 300ms since this should be good enough for
tests on localhost. Also replace all 'QT_TRY_<>' test calls with the
'QT_TRY_<>_WITH_TIMEOUT' calls to reduce the execution time.
Add signal spies for the 'finished' signal, to make sure that client
completed the communication with server, before checking messages
that were received from server and ensure that 'errorOccured' signal
is not called where it shouldn't.

Fixes: QTBUG-108212
Change-Id: I45338ad0495d77e461d96d2dd4193f1337dfbb3c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6ad57034be)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-12-22 09:15:47 +00:00
Konrad Kujawa f743141cea Fix case sensitive variable names in QtGrpc test_server CMake
Change-Id: Iea7030a330425afb7bc2b838ab4c49e3f75a4e19
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 858ab4abd4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-12-20 20:46:03 +00:00
Konrad Kujawa e5e48f5505 Check required dependencies for gRPC before adding WrapgRPC library
Check required dependencies for gRPC, which are linked as
INTERFACE_LINK_LIBRARIES which results in error when trying to use
gRPC library.

Fixes: QTBUG-109372
Change-Id: Ib1adb7f9aff3041c50fabaa47bf269081342a639
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit cb1bf672a1)
2022-12-14 16:30:04 +00:00
Alexey Edelev b5662a170f grpc: Add the missing call of the finished() signal
Add the missing call of the finished() signal to the native-based
implementation of gRPC stream. Emit both errorOccured and finished
when the stream is finished with error. This behavior is aligned
with the behavior of QNetworkReply.

Task-number: QTBUG-108212
Change-Id: I3f45e33c89aca1cd258066a9f7b3df846ceeccc2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-11 21:21:24 +01:00