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
122 changes: 110 additions & 12 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,125 @@
# For Drone CI we use the Starlark scripting language to reduce duplication.
# As the yaml syntax for Drone CI is rather limited.
#
#

globalenv = {
'B2_CI_VERSION': '1',
'B2_VARIANT': 'debug,release',
'B2_FLAGS': 'warnings=extra warnings-as-errors=on',
}

def main(ctx):
return generate(
# Compilers
# generate() provides: main compiler matrix, asan, ubsan, coverage,
# and cmake-superproject (linux/latest gcc) by default
jobs = generate(
[
'gcc >=10.0',
'clang >=10.0',
'gcc >=13.0',
'clang >=17.0',
'msvc >=14.1',
'arm64-gcc latest',
's390x-gcc latest',
# 'freebsd-gcc latest',
'apple-clang *',
'arm64-clang latest',
's390x-clang latest',
'freebsd-clang latest',
'x86-msvc latest'
],
# Standards
'>=20',
packages=['zlib1g', 'zlib1g-dev', 'libbrotli-dev', 'libssl-dev'])
docs=False,
coverage=False,
cache_dir='cache')
# Note: liburing-dev is not added to generate()'s package list.
# generate() emits jobs on Ubuntu focal (which has no liburing-dev
# package at all) and jammy (liburing 2.1, which our probe rejects
# for being too old). Either way io_uring stays disabled, so the
# install would just fail focal. The manual jobs below that target
# noble (24.04) explicitly install liburing-dev where it works.

# macOS: generate() skips apple-clang when cxx_range='>=20' because
# ci-automation's compiler_supports() doesn't list C++20 for apple-clang
jobs += [
osx_cxx("macOS: Clang 16.2.0", "clang++", packages="",
buildscript="drone", buildtype="boost",
xcode_version="16.2.0",
environment={
'B2_TOOLSET': 'clang',
'B2_CXXSTD': '20',
},
globalenv=globalenv),

osx_cxx("macOS: Clang 26.2.0", "clang++", packages="",
buildscript="drone", buildtype="boost",
xcode_version="26.2.0",
environment={
'B2_TOOLSET': 'clang',
'B2_CXXSTD': '20',
},
globalenv=globalenv),
]

jobs += [
freebsd_cxx("clang-22", "clang++-22",
buildscript="drone", buildtype="boost",
freebsd_version="15.0",
environment={
'B2_TOOLSET': 'clang-22',
'B2_CXXSTD': '20',
},
globalenv=globalenv),
]

# Jobs not covered by generate()
jobs += [
linux_cxx("Valgrind", "clang++-17", packages="clang-17 libc6-dbg libstdc++-12-dev liburing-dev",
llvm_os="jammy", llvm_ver="17",
buildscript="drone", buildtype="valgrind",
image="cppalliance/droneubuntu2204:1",
environment={
'COMMENT': 'valgrind',
'B2_TOOLSET': 'clang-17',
'B2_CXXSTD': '20',
'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1',
'B2_VARIANT': 'debug',
'B2_TESTFLAGS': 'testing.launcher=valgrind',
'VALGRIND_OPTS': '--error-exitcode=1',
},
globalenv=globalenv),

# Note: no liburing-dev on the Drone cmake jobs even though the
# noble image has 2.5+. Docker's default seccomp profile blocks
# the io_uring_setup syscall (post-CVE hardening), so io_uring
# tests would compile in but abort at runtime with EPERM
# ('io_uring_queue_init_params: Operation not permitted').
# Without liburing-dev the CMake probe disables the backend and
# the cmake-mainproject/subdirectory jobs exercise epoll only.
# io_uring runtime coverage is provided by the GitHub Actions
# Linux jobs, which run on unrestricted GitHub-hosted runners.
linux_cxx("cmake-mainproject", "g++-13", packages="g++-13",
image="cppalliance/droneubuntu2404:1",
buildtype="cmake-mainproject", buildscript="drone",
environment={
'COMMENT': 'cmake-mainproject',
'CXX': 'g++-13',
},
globalenv=globalenv),

linux_cxx("cmake-subdirectory", "g++-13", packages="g++-13",
image="cppalliance/droneubuntu2404:1",
buildtype="cmake-subdirectory", buildscript="drone",
environment={
'COMMENT': 'cmake-subdirectory',
'CXX': 'g++-13',
},
globalenv=globalenv),

windows_cxx("msvc-14.3 cmake-superproject", "",
image="cppalliance/dronevs2022:1",
buildtype="cmake-superproject", buildscript="drone",
environment={
'B2_TOOLSET': 'msvc-14.3',
'B2_CXXSTD': '20',
},
globalenv=globalenv),
]

return jobs


# from https://github.com/cppalliance/ci-automation
load("@ci_automation//ci/drone/:functions.star", "linux_cxx", "windows_cxx", "osx_cxx", "freebsd_cxx", "generate")
35 changes: 21 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ jobs:
ccflags: "--coverage -fprofile-arcs -ftest-coverage"
install: "lcov wget unzip"

# Linux Clang (5 configurations)

- compiler: "clang"
version: "20"
cxxstd: "20,23"
Expand Down Expand Up @@ -485,29 +483,38 @@ jobs:
ref-source-dir: boost-root
toolchain: ${{ (startsWith(matrix.runs-on, 'windows') && steps.patch-user-config.outputs.toolchain) || '' }}

- name: Codecov
- name: Generate Coverage Report
if: ${{ matrix.coverage }}
run: |
set -x

# Generate report
gcov_tool="gcov"
if command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}.${{ steps.setup-cpp.outputs.version-minor }}" &> /dev/null; then
gcov_tool="gcov"
elif command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}" &> /dev/null; then
if command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}" &> /dev/null; then
gcov_tool="gcov-${{ steps.setup-cpp.outputs.version-major }}"
fi
lcov -c -q -o "boost-root/__build_cmake_test__/coverage.info" -d "boost-root/__build_cmake_test__" --include "$(pwd)/boost-root/libs/${{steps.patch.outputs.module}}/*" --gcov-tool "$gcov_tool"
lcov -c -q -o "boost-root/__build_cmake_test__/coverage.info" -d "boost-root/__build_cmake_test__" \
--include "$(pwd)/boost-root/libs/${{ steps.patch.outputs.module }}/include/*" \
--include "$(pwd)/boost-root/libs/${{ steps.patch.outputs.module }}/src/*" \
--gcov-tool "$gcov_tool"

# Upload to codecov
bash <(curl -s https://codecov.io/bash) -f "boost-root/__build_cmake_test__/coverage.info"

# Summary
- name: Upload to Codecov
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@v5
with:
files: boost-root/__build_cmake_test__/coverage.info
flags: linux
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
disable_search: true
plugins: noop

- name: Coverage Summary
if: ${{ matrix.coverage }}
run: |
echo "# Coverage" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "[![codecov](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA/graphs/sunburst.svg)](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Commit: [![codecov](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA/graph/badge.svg)](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Branch: [![codecov](https://codecov.io/github/$GITHUB_REPOSITORY/branch/$GITHUB_REF_NAME/graph/badge.svg)](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY
Expand Down
4 changes: 2 additions & 2 deletions src/detail/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace burl
{
namespace detail
{

#if 0
namespace grammar = boost::urls::grammar;
namespace variant2 = boost::variant2;
namespace fs = std::filesystem;
Expand Down Expand Up @@ -169,7 +169,7 @@ resolve_dest(response& resp, fs::path dest)

return dest / "index.html";
}

#endif
} // namespace detail
} // namespace burl
} // namespace boost
3 changes: 3 additions & 0 deletions src/detail/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ clamp(
return static_cast<std::size_t>(x);
}

#if 0

std::optional<std::string>
extract_filename_form_content_disposition(std::string_view sv);

Expand All @@ -47,6 +49,7 @@ extract_filename_form_content_disposition(std::string_view sv);
std::filesystem::path
resolve_dest(response& resp, std::filesystem::path dest);

#endif
} // namespace detail
} // namespace burl
} // namespace boost
Expand Down
28 changes: 28 additions & 0 deletions test/unit/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,32 @@ class client_test
http::method::options);
}

void
testBasicAuth()
{
client c(
capy::get_system_context().get_executor(),
corosio::tls_context());

c.basic_auth("user", "pass");
BOOST_TEST_EQ(
c.headers().at(http::field::authorization),
"Basic dXNlcjpwYXNz");
}

void
testBearerAuth()
{
client c(
capy::get_system_context().get_executor(),
corosio::tls_context());

c.bearer_auth("sekrit");
BOOST_TEST_EQ(
c.headers().at(http::field::authorization),
"Bearer sekrit");
}

void
run()
{
Expand Down Expand Up @@ -999,6 +1025,8 @@ class client_test
testStatusErrorThenTransportErrorOnBody();
testTransportErrorInjection();
testVerbs();
testBasicAuth();
testBearerAuth();
}
};

Expand Down
27 changes: 7 additions & 20 deletions test/unit/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,21 @@ struct error_test
void
testCategoryNames()
{
BOOST_TEST(std::string(burl_category().name()) == "boost.burl");
BOOST_TEST(
std::string(burl_condition_category().name()) ==
BOOST_TEST_EQ(
std::string_view{ burl_category().name() },
"boost.burl");
BOOST_TEST_EQ(
std::string_view{ burl_condition_category().name() },
"boost.burl.condition");
}

void
testMessages()
{
BOOST_TEST_EQ(
make_error_code(error::unsupported_url_scheme).message(),
"unsupported URL scheme");
BOOST_TEST_EQ(
make_error_code(error::too_many_redirects).message(),
"too many redirects");
BOOST_TEST_EQ(
make_error_code(error::bad_redirect_response).message(),
"bad redirect response");
BOOST_TEST_EQ(
make_error_code(error::file_changed).message(),
"file size changed during read");
BOOST_TEST_EQ(
make_error_code(error::proxy_auth_failed).message(),
"proxy authentication failed");

// The code carries the burl category.
BOOST_TEST_EQ(
&make_error_code(error::file_changed).category(), &burl_category());
&make_error_code(error::file_changed).category(),
&burl_category());
}

void
Expand Down
Loading