Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 82 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -552,20 +552,86 @@ jobs:
- name: Run ts tests
run: make -C lib/nodets check

lib-cpp:
needs: compiler
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update -yq
sudo apt-get install -y --no-install-recommends g++ $BUILD_DEPS locales
sudo locale-gen en_US.UTF-8
sudo locale-gen de_DE.UTF-8
sudo update-locale

- name: Run bootstrap
run: ./bootstrap.sh

- name: Run configure
run: |
./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed -E 's/without-cpp/with-cpp/g')

- uses: actions/download-artifact@v4
with:
name: thrift-compiler
path: compiler/cpp

- name: Run thrift-compiler
run: |
chmod a+x compiler/cpp/thrift
compiler/cpp/thrift -version

- name: Run make for cpp
run: make -j$(nproc) -C lib/cpp

- name: Run make check for lib/cpp
run: make -j$(nproc) -C lib/cpp check

- name: Run make check for test/cpp
run: make -j$(nproc) -C test/cpp check

- name: Run make precross for cpp test
run: make -j$(nproc) -C test/cpp precross

- name: Upload cpp precross artifacts
uses: actions/upload-artifact@v4
with:
name: cpp-precross
if-no-files-found: error
include-hidden-files: true
path: |
test/cpp/TestClient
test/cpp/TestServer
test/cpp/.libs/TestClient
test/cpp/.libs/TestServer
lib/cpp/.libs/*.so
retention-days: 3

- name: Upload log files from failed test runs
uses: actions/upload-artifact@v4
if: failure()
with:
name: lib-cpp-test-log
path: lib/cpp/test/*.xml
retention-days: 3

cross-test:
needs:
- lib-java-kotlin
#- lib-swift # swift is currently broken and no maintainers around -> see THRIFT-5864
- lib-rust
- lib-go
- lib-python
- lib-cpp
runs-on: ubuntu-24.04
strategy:
matrix:
# swift is currently broken and no maintainers around -> see THRIFT-5864
server_lang: ['java', 'kotlin', 'go', 'rs'] # ['java', 'kotlin', 'go', 'rs', 'swift']
server_lang: ['java', 'kotlin', 'go', 'rs', 'cpp'] # ['java', 'kotlin', 'go', 'rs', 'swift']
# we always use comma join as many client langs as possible, to reduce the number of jobs
client_lang: ['java,kotlin', 'go,rs'] # ['java,kotlin', 'go,rs', 'swift']
client_lang: ['java,kotlin', 'go,rs,cpp'] # ['java,kotlin', 'go,rs', 'swift']
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand All @@ -584,7 +650,11 @@ jobs:
- name: Install openssl and certificates (for SSL tests)
run: |
sudo apt-get update -yq
sudo apt-get install -y --no-install-recommends openssl ca-certificates
sudo apt-get install -y --no-install-recommends \
openssl \
ca-certificates \
libboost-all-dev \
libevent-dev

- name: Download java precross artifacts
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -617,6 +687,12 @@ jobs:
name: go-precross
path: test/go/bin

- name: Download cpp precross artifacts
uses: actions/download-artifact@v4
with:
name: cpp-precross
path: .

- name: Set back executable flags
run: |
chmod a+x lib/java/build/run*
Expand All @@ -625,6 +701,9 @@ jobs:
# THRIFT-5864 chmod a+x test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/*
chmod a+x test/rs/bin/*
chmod a+x test/go/bin/*
chmod a+x test/cpp/*
chmod a+x test/cpp/.libs/*
chmod a+x lib/cpp/.libs/*.so

- name: Create tmp domain socket folder
run: mkdir /tmp/v0.16
Expand Down
8 changes: 8 additions & 0 deletions lib/cpp/src/thrift/protocol/THeaderProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ uint32_t THeaderProtocol::writeBinary(const std::string& str) {
return proto_->writeBinary(str);
}

uint32_t THeaderProtocol::writeUUID(const TUuid& uuid) {
return proto_->writeUUID(uuid);
}

/**
* Reading functions
*/
Expand Down Expand Up @@ -246,6 +250,10 @@ uint32_t THeaderProtocol::readString(std::string& str) {
uint32_t THeaderProtocol::readBinary(std::string& binary) {
return proto_->readBinary(binary);
}

uint32_t THeaderProtocol::readUUID(TUuid& uuid) {
return proto_->readUUID(uuid);
}
}
}
} // apache::thrift::protocol
Expand Down
4 changes: 4 additions & 0 deletions lib/cpp/src/thrift/protocol/THeaderProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ class THeaderProtocol : public TVirtualProtocol<THeaderProtocol> {

uint32_t writeBinary(const std::string& str);

uint32_t writeUUID(const TUuid& uuid);

/**
* Reading functions
*/
Expand Down Expand Up @@ -181,6 +183,8 @@ class THeaderProtocol : public TVirtualProtocol<THeaderProtocol> {

uint32_t readBinary(std::string& binary);

uint32_t readUUID(TUuid& uuid);

protected:
std::shared_ptr<THeaderTransport> trans_;

Expand Down
6 changes: 6 additions & 0 deletions lib/cpp/src/thrift/protocol/TProtocolTap.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ class TProtocolTap : public TVirtualProtocol<TProtocolTap> {
return rv;
}

uint32_t readUUID(TUuid& uuid) {
uint32_t rv = source_->readUUID(uuid);
sink_->writeUUid(uuid);
return rv;
}

private:
std::shared_ptr<TProtocol> source_;
std::shared_ptr<TProtocol> sink_;
Expand Down
2 changes: 1 addition & 1 deletion test/cpp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ StressTestNonBlocking_LDADD = \
#
# Common thrift code generation rules
#
gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/SecondService.cpp gen-cpp/SecondService.h gen-cpp/SecondService.tcc: $(top_srcdir)/test/v0.16/ThriftTest.thrift $(THRIFT)
gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/SecondService.cpp gen-cpp/SecondService.h gen-cpp/SecondService.tcc: $(top_srcdir)/test/ThriftTest.thrift $(THRIFT)
$(THRIFT) --gen cpp:templates,cob_style -r $<

gen-cpp/Service.cpp: $(top_srcdir)/test/StressTest.thrift $(THRIFT)
Expand Down
13 changes: 10 additions & 3 deletions test/cpp/src/TestClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <ios>
#include <iostream>
#include <sstream>
#include <fstream>
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/protocol/TCompactProtocol.h>
#include <thrift/protocol/THeaderProtocol.h>
Expand Down Expand Up @@ -321,9 +322,15 @@ int main(int argc, char** argv) {
std::shared_ptr<TProtocol> protocol2; // SecondService for multiplexed

if (ssl) {
cout << "Client Certificate File: " << certPath << '\n';
cout << "Client Key File: " << keyPath << '\n';
cout << "CA File: " << caPath << '\n';
auto fileExists = [](const std::string& path) {
std::ifstream f(path.c_str());
return f.good();
};

cout << "Client Path : " << testDir << '\n';
cout << "Client Certificate File: " << certPath << " (" << std::boolalpha << fileExists(certPath) << ")"<< '\n';
cout << "Client Key File: " << keyPath << " (" << std::boolalpha << fileExists(keyPath) << ")"<< '\n';
cout << "CA File: " << caPath << " (" << std::boolalpha << fileExists(caPath) << ")"<< '\n';

factory = std::shared_ptr<TSSLSocketFactory>(new TSSLSocketFactory());
factory->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
Expand Down
Loading
Loading