Kaynağa Gözat

Fix build configurations

- Make all the CI checks for opensuse 'Release'.
- Make all the CI checks for ubuntu 'Debug'.
- Make the CI check for windows 'Debug'.
- Add the threadsafe flag for gRPC test. 'Release' build tests
  fail if are running without this flag is set.
Alexey Edelev 3 yıl önce
ebeveyn
işleme
bcfb457794

+ 2 - 2
.ci/Dockerfile.opensuse

@@ -3,7 +3,7 @@ ADD . /sources
 RUN mkdir -p /build
 WORKDIR /build
 ENV PATH=/qt/5.15.2/gcc_64/bin:$PATH
-RUN cmake ../sources -DCMAKE_PREFIX_PATH="/qt/5.15.2/gcc_64/lib/cmake" -DBUILD_SHARED_LIBS=ON
-RUN cmake --build . --config RELEASE
+RUN cmake ../sources -DCMAKE_PREFIX_PATH="/qt/5.15.2/gcc_64/lib/cmake" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release
+RUN cmake --build .
 ENV QT_PLUGIN_PATH=/qt/5.15.2/gcc_64/plugins
 ENV QT_QPA_PLATFORM=minimal

+ 2 - 2
.ci/Dockerfile.opensuse_static

@@ -3,7 +3,7 @@ ADD . /sources
 RUN mkdir -p /build
 WORKDIR /build
 ENV PATH=/qt/5.15.2/gcc_64/bin:$PATH
-RUN cmake ../sources -DCMAKE_PREFIX_PATH="/qt/5.15.2/gcc_64/lib/cmake" -DBUILD_SHARED_LIBS=OFF
-RUN cmake --build . --config RELEASE
+RUN cmake ../sources -DCMAKE_PREFIX_PATH="/qt/5.15.2/gcc_64/lib/cmake" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release
+RUN cmake --build .
 ENV QT_PLUGIN_PATH=/qt/5.15.2/gcc_64/plugins
 ENV QT_QPA_PLATFORM=minimal

+ 2 - 2
.ci/Dockerfile.ubuntu

@@ -3,7 +3,7 @@ ADD . /sources
 RUN mkdir -p /build
 WORKDIR /build
 ENV PATH=/qt/5.15.2/gcc_64/bin:$PATH
-RUN cmake ../sources -DCMAKE_PREFIX_PATH="/qt/5.15.2/gcc_64/lib/cmake" -DBUILD_SHARED_LIBS=ON
-RUN cmake --build . --config RELEASE
+RUN cmake ../sources -DCMAKE_PREFIX_PATH="/qt/5.15.2/gcc_64/lib/cmake" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug
+RUN cmake --build .
 ENV QT_PLUGIN_PATH=/qt/5.15.2/gcc_64/plugins
 ENV QT_QPA_PLATFORM=minimal

+ 2 - 2
.ci/Dockerfile.ubuntu_static

@@ -3,7 +3,7 @@ ADD . /sources
 RUN mkdir -p /build
 WORKDIR /build
 ENV PATH=/qt/5.15.2/gcc_64/bin:$PATH
-RUN cmake ../sources -DCMAKE_PREFIX_PATH="/qt/5.15.2/gcc_64/lib/cmake" -DBUILD_SHARED_LIBS=OFF
-RUN cmake --build . --config RELEASE
+RUN cmake ../sources -DCMAKE_PREFIX_PATH="/qt/5.15.2/gcc_64/lib/cmake" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug
+RUN cmake --build .
 ENV QT_PLUGIN_PATH=/qt/5.15.2/gcc_64/plugins
 ENV QT_QPA_PLATFORM=minimal

+ 1 - 1
.github/workflows/branchpush.yml

@@ -86,7 +86,7 @@ jobs:
         setx path "%path%;C:\Qt\5.15.2\msvc2019_64\bin;C:\Go\bin;C:\yasm"
         set GOROOT="c:\Go"
         set PATH="%PATH%;C:\Qt\5.15.2\msvc2019_64\bin;C:\Go\bin;C:\yasm"
-        cmake -DCMAKE_PREFIX_PATH="C:\Qt\5.15.2\msvc2019_64;C:\Go\bin;C:\yasm" -DBUILD_SHARED_LIBS=OFF ..
+        cmake -DCMAKE_PREFIX_PATH="C:\Qt\5.15.2\msvc2019_64;C:\Go\bin;C:\yasm" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug ..
         cmake --build . --config Debug
     - name: Run tests
       run: |

+ 1 - 1
src/grpc/qabstractgrpcclient.cpp

@@ -64,7 +64,7 @@ void QAbstractGrpcClient::attachChannel(const std::shared_ptr<QAbstractGrpcChann
         qProtoCritical() << "QAbstractGrpcClient::attachChannel is called from different thread.\n"
                            "QtGrpc doesn't guarantie thread safety on channel level.\n"
                            "You have to be confident that channel routines are working in the same thread as QAbstractGrpcClient";
-        assert(channel->thread() == QThread::currentThread());
+        throw std::runtime_error("Call from another thread");
     }
     dPtr->channel = channel;
     dPtr->serializer = channel->serializer();

+ 2 - 3
tests/test_grpc/clienttest.cpp

@@ -775,6 +775,7 @@ TEST_P(ClientTest, StringEchoStreamThreadTest)
 
 TEST_F(ClientTest, AttachChannelThreadTest)
 {
+    ::testing::FLAGS_gtest_death_test_style = "threadsafe";
     std::shared_ptr<QGrpcHttp2Channel> channel;
     std::shared_ptr<QThread> thread(QThread::create([&](){
         channel = std::make_shared<QGrpcHttp2Channel>(m_echoServerAddress, QGrpcInsecureCallCredentials() | QGrpcInsecureChannelCredentials());
@@ -782,9 +783,7 @@ TEST_F(ClientTest, AttachChannelThreadTest)
     thread->start();
     QThread::msleep(1000);
     TestServiceClient testClient;
-    EXPECT_DEATH({
-                     testClient.attachChannel(channel);
-                 }, ".*");
+    EXPECT_THROW(testClient.attachChannel(channel), std::runtime_error);
 }
 
 TEST_P(ClientTest, StreamCancelWhileErrorTimeoutTest)