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
18 changes: 15 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ jobs:
run: cmake --build build

- name: Test
run: ctest --test-dir build --output-on-failure
run: ctest --test-dir build --output-on-failure -LE badssl

- name: Test with badssl.com
continue-on-error: true
run: ctest --test-dir build --output-on-failure -L badssl

macos:
name: ${{ matrix.os }} ${{ matrix.build_type }}
Expand Down Expand Up @@ -67,7 +71,11 @@ jobs:
run: cmake --build build

- name: Test
run: ctest --test-dir build --output-on-failure
run: ctest --test-dir build --output-on-failure -LE badssl

- name: Test with badssl.com
continue-on-error: true
run: ctest --test-dir build --output-on-failure -L badssl

windows:
name: ${{ matrix.os }} ${{ matrix.build_type }}
Expand Down Expand Up @@ -97,4 +105,8 @@ jobs:
run: cmake --build build --config ${{ matrix.build_type }}

- name: Test
run: ctest --test-dir build -C ${{ matrix.build_type }} --output-on-failure
run: ctest --test-dir build -C ${{ matrix.build_type }} --output-on-failure -LE badssl

- name: Test with badssl.com
continue-on-error: true
run: ctest --test-dir build -C ${{ matrix.build_type }} --output-on-failure -L badssl
7 changes: 7 additions & 0 deletions Release/tests/functional/http/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ set(SOURCES
)

add_casablanca_test(httpclient_test SOURCES)
if(BUILD_SHARED_LIBS)
add_test(NAME httpclient_test_badssl
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMAND test_runner /badssl /select:@Requires=badssl $<TARGET_FILE_NAME:httpclient_test>
)
set_tests_properties(httpclient_test_badssl PROPERTIES LABELS badssl)
endif()
if(TEST_LIBRARY_TARGET_TYPE STREQUAL "OBJECT")
target_include_directories(httpclient_test PRIVATE ../utilities/include)
else()
Expand Down
49 changes: 37 additions & 12 deletions Release/tests/functional/http/client/outside_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,19 @@ SUITE(outside_tests)
}
#endif // !defined(__cplusplus_winrt)

TEST(server_selfsigned_cert) { test_failed_ssl_cert(U("https://self-signed.badssl.com/")); }
TEST(server_selfsigned_cert, "Requires", "badssl") { test_failed_ssl_cert(U("https://self-signed.badssl.com/")); }

#if !defined(__cplusplus_winrt)
TEST(server_selfsigned_cert_ignored) { test_ignored_ssl_cert(U("https://self-signed.badssl.com/")); }
TEST(server_selfsigned_cert_ignored, "Requires", "badssl")
{
test_ignored_ssl_cert(U("https://self-signed.badssl.com/"));
}
#endif // !defined(__cplusplus_winrt)

TEST(server_hostname_mismatch) { test_failed_ssl_cert(U("https://wrong.host.badssl.com/")); }
TEST(server_hostname_mismatch, "Requires", "badssl") { test_failed_ssl_cert(U("https://wrong.host.badssl.com/")); }

#if !defined(__cplusplus_winrt) && !defined(CPPREST_FORCE_HTTP_CLIENT_WINHTTPPAL)
TEST(server_hostname_host_override)
TEST(server_hostname_host_override, "Requires", "badssl")
{
handle_timeout([] {
http_client client(U("https://wrong.host.badssl.com/"));
Expand All @@ -238,7 +241,10 @@ SUITE(outside_tests)
});
}

TEST(server_hostname_mismatch_ignored) { test_ignored_ssl_cert(U("https://wrong.host.badssl.com/")); }
TEST(server_hostname_mismatch_ignored, "Requires", "badssl")
{
test_ignored_ssl_cert(U("https://wrong.host.badssl.com/"));
}

// 198.35.26.96 no longer accepts connections for en.wikipedia.org
TEST(server_hostname_host_override_after_upgrade, "Ignore", "198.35.26.96")
Expand All @@ -251,29 +257,48 @@ SUITE(outside_tests)
}
#endif // !defined(__cplusplus_winrt) && !defined(CPPREST_FORCE_HTTP_CLIENT_WINHTTPPAL)

TEST(server_cert_expired) { test_failed_ssl_cert(U("https://expired.badssl.com/")); }
TEST(server_cert_expired, "Requires", "badssl") { test_failed_ssl_cert(U("https://expired.badssl.com/")); }

#if !defined(__cplusplus_winrt)
TEST(server_cert_expired_ignored) { test_ignored_ssl_cert(U("https://expired.badssl.com/")); }
TEST(server_cert_expired_ignored, "Requires", "badssl") { test_ignored_ssl_cert(U("https://expired.badssl.com/")); }
#endif // !defined(__cplusplus_winrt)

TEST(server_cert_revoked, "Ignore:Android", "229", "Ignore:Apple", "229", "Ignore:Linux", "229")
TEST(server_cert_revoked,
"Requires",
"badssl",
"Ignore:Android",
"229",
"Ignore:Apple",
"229",
"Ignore:Linux",
"229")
{
test_failed_ssl_cert(U("https://revoked.badssl.com/"));
}

#if !defined(__cplusplus_winrt)
TEST(server_cert_revoked_ignored) { test_ignored_ssl_cert(U("https://revoked.badssl.com/")); }
TEST(server_cert_revoked_ignored, "Requires", "badssl") { test_ignored_ssl_cert(U("https://revoked.badssl.com/")); }
#endif // !defined(__cplusplus_winrt)

TEST(server_cert_untrusted) { test_failed_ssl_cert(U("https://untrusted-root.badssl.com/")); }
TEST(server_cert_untrusted, "Requires", "badssl") { test_failed_ssl_cert(U("https://untrusted-root.badssl.com/")); }

#if !defined(__cplusplus_winrt)
TEST(server_cert_untrusted_ignored) { test_ignored_ssl_cert(U("https://untrusted-root.badssl.com/")); }
TEST(server_cert_untrusted_ignored, "Requires", "badssl")
{
test_ignored_ssl_cert(U("https://untrusted-root.badssl.com/"));
}
#endif // !defined(__cplusplus_winrt)

#if !defined(__cplusplus_winrt)
TEST(ignore_server_cert_invalid, "Ignore:Android", "229", "Ignore:Apple", "229", "Ignore:Linux", "229")
TEST(ignore_server_cert_invalid,
"Requires",
"badssl",
"Ignore:Android",
"229",
"Ignore:Apple",
"229",
"Ignore:Linux",
"229")
{
handle_timeout([] {
http_client_config config;
Expand Down
4 changes: 2 additions & 2 deletions Release/tests/functional/http/client/redirect_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ SUITE(redirect_tests)
}
}

TEST(does_not_follow_https_to_http_by_default)
TEST(does_not_follow_https_to_http_by_default, "Requires", "badssl")
{
handle_timeout([] {
http_client_config config;
Expand All @@ -171,7 +171,7 @@ SUITE(redirect_tests)
});
}

TEST(can_follow_https_to_http)
TEST(can_follow_https_to_http, "Requires", "badssl")
{
handle_timeout([] {
http_client_config config;
Expand Down
7 changes: 7 additions & 0 deletions Release/tests/functional/websockets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ if (NOT CPPREST_EXCLUDE_WEBSOCKETS)
)

add_casablanca_test(websocketsclient_test SOURCES)
if(BUILD_SHARED_LIBS)
add_test(NAME websocketsclient_test_badssl
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMAND test_runner /badssl /select:@Requires=badssl $<TARGET_FILE_NAME:websocketsclient_test>
)
set_tests_properties(websocketsclient_test_badssl PROPERTIES LABELS badssl)
endif()
if(NOT TEST_LIBRARY_TARGET_TYPE STREQUAL "OBJECT")
target_link_libraries(websocketsclient_test PRIVATE websockettest_utilities)
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ SUITE(authentication_tests)
}
}

TEST(self_signed_cert) { handshake_error_test_impl(U("wss://self-signed.badssl.com/")); }
TEST(self_signed_cert, "Requires", "badssl") { handshake_error_test_impl(U("wss://self-signed.badssl.com/")); }

TEST(hostname_mismatch) { handshake_error_test_impl(U("wss://wrong.host.badssl.com/")); }
TEST(hostname_mismatch, "Requires", "badssl") { handshake_error_test_impl(U("wss://wrong.host.badssl.com/")); }

TEST(cert_expired) { handshake_error_test_impl(U("wss://expired.badssl.com/")); }
TEST(cert_expired, "Requires", "badssl") { handshake_error_test_impl(U("wss://expired.badssl.com/")); }

} // SUITE(authentication_tests)

Expand Down
Loading