Skip to content

Commit

Permalink
Add bazel.noexcept to CI. (gabime#41)
Browse files Browse the repository at this point in the history
This is to ensure OpenTelemetry works without exception handling.
  • Loading branch information
g-easy committed Mar 3, 2020
1 parent a76df41 commit 928080e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ jobs:
- run: ./ci/install_bazelisk.sh
- run: ./ci/do_ci.sh bazel.test

bazel_noexcept:
resource_class: xlarge
docker:
- image: ubuntu:18.04
steps:
- checkout
- run: ./ci/setup_ci_environment.sh
- run: ./ci/install_bazelisk.sh
- run: ./ci/do_ci.sh bazel.noexcept

bazel_asan:
resource_class: xlarge
docker:
Expand Down Expand Up @@ -119,6 +129,7 @@ workflows:
- plugin_test
- gcc_48_test
- bazel_test
- bazel_noexcept
- bazel_asan
- format
- benchmark
Expand Down
4 changes: 4 additions & 0 deletions api/include/opentelemetry/plugin/detail/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@ namespace plugin
namespace detail
{
inline void CopyErrorMessage(const char *source, std::string &destination) noexcept
#if __EXCEPTIONS
try
#endif
{
if (source == nullptr)
{
return;
}
destination.assign(source);
}
#if __EXCEPTIONS
catch (const std::bad_alloc &)
{}
#endif
} // namespace detail
} // namespace plugin
} // namespace opentelemetry
1 change: 1 addition & 0 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CI tests can be run on docker by invoking the script `./ci/run_docker.sh ./ci/do
* `cmake.test`: build cmake targets and run tests.
* `cmake.test_example_plugin`: build and test an example OpenTelemetry plugin.
* `bazel.test`: build bazel targets and run tests.
* `bazel.noexcept`: build bazel targets and run tests with exceptions disabled.
* `bazel.asan`: build bazel targets and run tests with AddressSanitizer.
* `benchmark`: run all benchmarks.
* `format`: use `tools/format.sh` to enforce text formatting.
Expand Down
6 changes: 5 additions & 1 deletion ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ EOF
examples/plugin/load/load_plugin_example ${PLUGIN_DIR}/libexample_plugin.so /dev/null
exit 0
elif [[ "$1" == "bazel.test" ]]; then
bazel build $BAZEL_OPTIONS -- //...
bazel build $BAZEL_OPTIONS //...
bazel test $BAZEL_TEST_OPTIONS //...
exit 0
elif [[ "$1" == "bazel.noexcept" ]]; then
bazel build --copt=-fno-exceptions $BAZEL_OPTIONS //...
bazel test --copt=-fno-exceptions $BAZEL_TEST_OPTIONS //...
exit 0
elif [[ "$1" == "bazel.asan" ]]; then
bazel test --config=asan $BAZEL_TEST_OPTIONS //...
exit 0
Expand Down

0 comments on commit 928080e

Please sign in to comment.