CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
100 lines
3.0 KiB
C++
100 lines
3.0 KiB
C++
#include "lldb/Utility/UriParser.h"
|
|
#include "gtest/gtest.h"
|
|
|
|
using namespace lldb_private;
|
|
|
|
TEST(UriParserTest, Minimal) {
|
|
EXPECT_EQ((URI{"x", "y", std::nullopt, "/"}), URI::Parse("x://y"));
|
|
}
|
|
|
|
TEST(UriParserTest, MinimalPort) {
|
|
EXPECT_EQ((URI{"x", "y", 1, "/"}), URI::Parse("x://y:1"));
|
|
}
|
|
|
|
TEST(UriParserTest, MinimalPath) {
|
|
EXPECT_EQ((URI{"x", "y", std::nullopt, "/"}), URI::Parse("x://y/"));
|
|
}
|
|
|
|
TEST(UriParserTest, MinimalPortPath) {
|
|
EXPECT_EQ((URI{"x", "y", 1, "/"}), URI::Parse("x://y:1/"));
|
|
}
|
|
|
|
TEST(UriParserTest, LongPath) {
|
|
EXPECT_EQ((URI{"x", "y", std::nullopt, "/abc/def/xyz"}),
|
|
URI::Parse("x://y/abc/def/xyz"));
|
|
}
|
|
|
|
TEST(UriParserTest, TypicalPortPathIPv4) {
|
|
EXPECT_EQ((URI{"connect", "192.168.100.132", 5432, "/"}),
|
|
URI::Parse("connect://192.168.100.132:5432/"));
|
|
}
|
|
|
|
TEST(UriParserTest, TypicalPortPathIPv6) {
|
|
EXPECT_EQ(
|
|
(URI{"connect", "2601:600:107f:db64:a42b:4faa:284:3082", 5432, "/"}),
|
|
URI::Parse("connect://[2601:600:107f:db64:a42b:4faa:284:3082]:5432/"));
|
|
}
|
|
|
|
TEST(UriParserTest, BracketedHostnamePort) {
|
|
EXPECT_EQ((URI{"connect", "192.168.100.132", 5432, "/"}),
|
|
URI::Parse("connect://[192.168.100.132]:5432/"));
|
|
}
|
|
|
|
TEST(UriParserTest, BracketedHostname) {
|
|
EXPECT_EQ((URI{"connect", "192.168.100.132", std::nullopt, "/"}),
|
|
URI::Parse("connect://[192.168.100.132]"));
|
|
}
|
|
|
|
TEST(UriParserTest, BracketedHostnameWithPortIPv4) {
|
|
// Android device over IPv4: port is a part of the hostname.
|
|
EXPECT_EQ((URI{"connect", "192.168.100.132:1234", std::nullopt, "/"}),
|
|
URI::Parse("connect://[192.168.100.132:1234]"));
|
|
}
|
|
|
|
TEST(UriParserTest, BracketedHostnameWithPortIPv6) {
|
|
// Android device over IPv6: port is a part of the hostname.
|
|
EXPECT_EQ((URI{"connect", "[2601:600:107f:db64:a42b:4faa:284]:1234",
|
|
std::nullopt, "/"}),
|
|
URI::Parse("connect://[[2601:600:107f:db64:a42b:4faa:284]:1234]"));
|
|
}
|
|
|
|
TEST(UriParserTest, BracketedHostnameWithColon) {
|
|
EXPECT_EQ((URI{"connect", "192.168.100.132:5555", 1234, "/"}),
|
|
URI::Parse("connect://[192.168.100.132:5555]:1234"));
|
|
}
|
|
|
|
TEST(UriParserTest, SchemeHostSeparator) {
|
|
EXPECT_EQ(std::nullopt, URI::Parse("x:/y"));
|
|
}
|
|
|
|
TEST(UriParserTest, SchemeHostSeparator2) {
|
|
EXPECT_EQ(std::nullopt, URI::Parse("x:y"));
|
|
}
|
|
|
|
TEST(UriParserTest, SchemeHostSeparator3) {
|
|
EXPECT_EQ(std::nullopt, URI::Parse("x//y"));
|
|
}
|
|
|
|
TEST(UriParserTest, SchemeHostSeparator4) {
|
|
EXPECT_EQ(std::nullopt, URI::Parse("x/y"));
|
|
}
|
|
|
|
TEST(UriParserTest, BadPort) {
|
|
EXPECT_EQ(std::nullopt, URI::Parse("x://y:a/"));
|
|
}
|
|
|
|
TEST(UriParserTest, BadPort2) {
|
|
EXPECT_EQ(std::nullopt, URI::Parse("x://y:5432a/"));
|
|
}
|
|
|
|
TEST(UriParserTest, Empty) { EXPECT_EQ(std::nullopt, URI::Parse("")); }
|
|
|
|
TEST(UriParserTest, PortOverflow) {
|
|
EXPECT_EQ(std::nullopt,
|
|
URI::Parse("x://"
|
|
"y:"
|
|
"0123456789012345678901234567890123456789012345678"
|
|
"9012345678901234567890123456789012345678901234567"
|
|
"89/"));
|
|
}
|