-
Notifications
You must be signed in to change notification settings - Fork 348
test(bdd): add C++ SDK BDD tests for basic messaging #3554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
seokjin0414
wants to merge
3
commits into
apache:master
Choose a base branch
from
seokjin0414:2965-cpp-bdd-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| common --enable_bzlmod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 9.1.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| --- | ||
| BasedOnStyle: Chromium | ||
| IndentWidth: 4 | ||
| ColumnLimit: 120 | ||
| BreakBeforeBraces: Custom | ||
| IndentCaseLabels: true | ||
| PointerAlignment: Right | ||
| AlignOperands: true | ||
| AlignConsecutiveAssignments: true | ||
| AccessModifierOffset: -2 | ||
| AllowShortCaseLabelsOnASingleLine: false | ||
| KeepEmptyLinesAtTheStartOfBlocks: true | ||
| IndentPPDirectives: AfterHash | ||
| IncludeBlocks: Preserve |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| bazel-* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| load("@rules_cc//cc:defs.bzl", "cc_binary") | ||
|
|
||
| # BDD wire server: links the C++ step definitions with cucumber-cpp's main(), which starts a | ||
| # wire-protocol server on port 3902. A Ruby Cucumber runner drives the shared | ||
| # basic_messaging.feature over the wire (cucumber-cpp v0.8.0 is wire-only). main() comes from | ||
| # @cucumber-cpp//:cucumber-cpp via alwayslink, gtest provides the assertion macros, and | ||
| # @iggy_cpp//:iggy-cpp provides the SDK (built from the sibling foreign/cpp module). | ||
| cc_binary( | ||
| name = "bdd_wire_server", | ||
| srcs = glob([ | ||
| "features/step_definitions/*.cpp", | ||
| "features/step_definitions/*.hpp", | ||
| ]), | ||
| copts = [ | ||
| "-finput-charset=UTF-8", | ||
| "-fexec-charset=UTF-8", | ||
| "-Wall", | ||
| "-Wpedantic", | ||
| "-Werror", | ||
| "-Wextra", | ||
| "-g3", | ||
| "-O0", | ||
| "-fno-omit-frame-pointer", | ||
| "-DDEBUG", | ||
| ], | ||
| linkopts = ["-g"], | ||
| includes = [ | ||
| "features/step_definitions", | ||
| ], | ||
| testonly = True, | ||
| deps = [ | ||
| "@cucumber-cpp//:cucumber-cpp", | ||
| "@googletest//:gtest", | ||
| "@iggy_cpp//:iggy-cpp", | ||
| ], | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # C++ BDD harness. bdd/cpp is a self-contained Bazel module: it builds the step definitions | ||
| # into a cucumber-cpp wire server and pulls in the Iggy C++ SDK (foreign/cpp) via | ||
| # local_path_override. A Ruby Cucumber runner reads the shared feature files and drives the | ||
| # wire server over the wire protocol (cucumber-cpp v0.8.0 is wire-only). The image therefore | ||
| # needs the Rust + Bazel + C++ toolchain (to build the wire server) and Ruby (to run cucumber). | ||
|
|
||
| ARG RUST_VERSION=1.96 | ||
| FROM rust:${RUST_VERSION}-bookworm | ||
|
|
||
| RUN apt-get update && apt-get install --yes --no-install-recommends \ | ||
| build-essential \ | ||
| ca-certificates \ | ||
| curl \ | ||
| git \ | ||
| ruby-full \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Bazelisk resolves the Bazel version from bdd/cpp/.bazelversion. | ||
| RUN curl -fsSL "https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-$(dpkg --print-architecture)" \ | ||
| -o /usr/local/bin/bazel \ | ||
| && chmod +x /usr/local/bin/bazel | ||
|
|
||
| WORKDIR /workspace | ||
| COPY . . | ||
|
|
||
| # Build the cucumber-cpp wire server. bdd/cpp is its own Bazel module and links the Iggy C++ | ||
| # SDK pulled in from foreign/cpp via local_path_override. | ||
| RUN cd bdd/cpp \ | ||
| && bazel build //:bdd_wire_server \ | ||
| && cp bazel-bin/bdd_wire_server /usr/local/bin/bdd_wire_server | ||
|
|
||
| # Install the Cucumber runner (wire-protocol driver). | ||
| RUN gem install bundler --no-document \ | ||
| && cd bdd/cpp \ | ||
| && bundle install | ||
|
|
||
| RUN mkdir -p /workspace/bdd/cpp/features | ||
|
|
||
| # Entrypoint: copy the mounted shared feature files, start the wire server, then run cucumber. | ||
| COPY bdd/cpp/scripts/entrypoint.sh /entrypoint.sh | ||
| RUN chmod +x /entrypoint.sh | ||
|
|
||
| ENTRYPOINT ["/entrypoint.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # Cucumber runner that drives the C++ wire server (foreign/cpp/bdd) over the wire protocol. | ||
| # cucumber-cpp v0.8.0 only supports the wire protocol, and the wire protocol lives in the | ||
| # cucumber-wire gem; these versions match cucumber-cpp's own CI. | ||
| source "https://rubygems.org" | ||
|
|
||
| gem "cucumber", "7.1.0" | ||
| gem "cucumber-wire", "6.2.1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| GEM | ||
| remote: https://rubygems.org/ | ||
| specs: | ||
| builder (3.3.0) | ||
| cucumber (7.1.0) | ||
| builder (~> 3.2, >= 3.2.4) | ||
| cucumber-core (~> 10.1, >= 10.1.0) | ||
| cucumber-create-meta (~> 6.0, >= 6.0.1) | ||
| cucumber-cucumber-expressions (~> 14.0, >= 14.0.0) | ||
| cucumber-gherkin (~> 22.0, >= 22.0.0) | ||
| cucumber-html-formatter (~> 17.0, >= 17.0.0) | ||
| cucumber-messages (~> 17.1, >= 17.1.1) | ||
| cucumber-wire (~> 6.2, >= 6.2.0) | ||
| diff-lcs (~> 1.4, >= 1.4.4) | ||
| mime-types (~> 3.3, >= 3.3.1) | ||
| multi_test (~> 0.1, >= 0.1.2) | ||
| sys-uname (~> 1.2, >= 1.2.2) | ||
| cucumber-core (10.1.1) | ||
| cucumber-gherkin (~> 22.0, >= 22.0.0) | ||
| cucumber-messages (~> 17.1, >= 17.1.1) | ||
| cucumber-tag-expressions (~> 4.1, >= 4.1.0) | ||
| cucumber-create-meta (6.0.4) | ||
| cucumber-messages (~> 17.1, >= 17.1.1) | ||
| sys-uname (~> 1.2, >= 1.2.2) | ||
| cucumber-cucumber-expressions (14.0.0) | ||
| cucumber-gherkin (22.0.0) | ||
| cucumber-messages (~> 17.1, >= 17.1.1) | ||
| cucumber-html-formatter (17.0.0) | ||
| cucumber-messages (~> 17.1, >= 17.1.0) | ||
| cucumber-messages (17.1.1) | ||
| cucumber-tag-expressions (4.1.0) | ||
| cucumber-wire (6.2.1) | ||
| cucumber-core (~> 10.1, >= 10.1.0) | ||
| cucumber-cucumber-expressions (~> 14.0, >= 14.0.0) | ||
| diff-lcs (1.6.2) | ||
| ffi (1.17.4) | ||
| ffi (1.17.4-arm64-darwin) | ||
| ffi (1.17.4-x86_64-darwin) | ||
| logger (1.7.0) | ||
| memoist3 (1.0.0) | ||
| mime-types (3.7.0) | ||
| logger | ||
| mime-types-data (~> 3.2025, >= 3.2025.0507) | ||
| mime-types-data (3.2026.0414) | ||
| multi_test (0.1.2) | ||
| sys-uname (1.5.1) | ||
| ffi (~> 1.1) | ||
| memoist3 (~> 1.0.0) | ||
|
|
||
| PLATFORMS | ||
| aarch64-linux | ||
| arm64-darwin | ||
| ruby | ||
| x86_64-darwin | ||
|
|
||
| DEPENDENCIES | ||
| cucumber (= 7.1.0) | ||
| cucumber-wire (= 6.2.1) | ||
|
|
||
| BUNDLED WITH | ||
| 2.6.9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| module( | ||
| name = "iggy_cpp_bdd", | ||
| ) | ||
|
|
||
| bazel_dep(name = "rules_cc", version = "0.2.19") | ||
| bazel_dep(name = "googletest", version = "1.17.0.bcr.2") | ||
| bazel_dep(name = "cucumber-cpp", version = "0.8.0.bcr.1") | ||
|
|
||
| # The Iggy C++ SDK lives in the sibling foreign/cpp Bazel module. Pull it in locally so the | ||
| # wire server links against the same cxx staticlib the SDK ships, without duplicating its | ||
| # build rules here. | ||
| bazel_dep(name = "iggy_cpp", version = "0.1.0") | ||
| local_path_override( | ||
| module_name = "iggy_cpp", | ||
| path = "../../foreign/cpp", | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add the following flags: -Wall, -Wpedantic, -Werror, -Wextra, -g3, -O0, -fno-omit-frame-pointer, -DDEBUG
Also
linkopts = ["-g"]There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added all of those to the cc_binary copts, plus linkopts = ["-g"]. compiles clean under -Werror -Wpedantic.