iPXE
|
URI self-tests. More...
#include <string.h>
#include <byteswap.h>
#include <ipxe/uri.h>
#include <ipxe/tcpip.h>
#include <ipxe/params.h>
#include <ipxe/test.h>
Go to the source code of this file.
Data Structures | |
struct | uri_test |
A URI parsing/formatting test. More... | |
struct | uri_port_test |
A URI port number test. More... | |
struct | uri_resolve_test |
A URI or path resolution test. More... | |
struct | uri_pxe_test |
A PXE URI test. More... | |
struct | uri_churi_test |
A current working URI test. More... | |
struct | uri_params_test_list |
A request parameter URI test list. More... | |
struct | uri_params_test |
A request parameter URI test. More... | |
Macros | |
#define | uri_ok(uri, expected) uri_okx ( uri, expected, __FILE__, __LINE__ ) |
#define | uri_parse_ok(test) uri_parse_okx ( test, __FILE__, __LINE__ ) |
#define | uri_format_ok(test) uri_format_okx ( test, __FILE__, __LINE__ ) |
#define | uri_dup_ok(test) uri_dup_okx ( test, __FILE__, __LINE__ ) |
#define | uri_parse_format_dup_ok(test) uri_parse_format_dup_okx ( test, __FILE__, __LINE__ ) |
#define | uri_port_ok(test) uri_port_okx ( test, __FILE__, __LINE__ ) |
#define | uri_resolve_ok(test) uri_resolve_okx ( test, __FILE__, __LINE__ ) |
#define | uri_resolve_path_ok(test) uri_resolve_path_okx ( test, __FILE__, __LINE__ ) |
#define | uri_pxe_ok(test) uri_pxe_okx ( test, __FILE__, __LINE__ ) |
#define | uri_churi_ok(test) uri_churi_okx ( test, __FILE__, __LINE__ ) |
#define | uri_params_list_ok(test) uri_params_list_okx ( test, __FILE__, __LINE__ ) |
#define | uri_params_ok(test) uri_params_okx ( test, __FILE__, __LINE__ ) |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static int | uristrcmp (const char *first, const char *second) |
Compare two URI component strings. More... | |
static void | uri_okx (struct uri *uri, struct uri *expected, const char *file, unsigned int line) |
Report URI equality test result. More... | |
static void | uri_parse_okx (struct uri_test *test, const char *file, unsigned int line) |
Report URI parsing test result. More... | |
static void | uri_format_okx (struct uri_test *test, const char *file, unsigned int line) |
Report URI formatting test result. More... | |
static void | uri_dup_okx (struct uri *uri, const char *file, unsigned int line) |
Report URI duplication test result. More... | |
static void | uri_parse_format_dup_okx (struct uri_test *test, const char *file, unsigned int line) |
Report URI combined parsing and formatting test result. More... | |
static void | uri_port_okx (struct uri_port_test *test, const char *file, unsigned int line) |
Report URI port number test result. More... | |
static void | uri_resolve_okx (struct uri_resolve_test *test, const char *file, unsigned int line) |
Report URI resolution test result. More... | |
static void | uri_resolve_path_okx (struct uri_resolve_test *test, const char *file, unsigned int line) |
Report path resolution test result. More... | |
static void | uri_pxe_okx (struct uri_pxe_test *test, const char *file, unsigned int line) |
Report URI PXE test result. More... | |
static void | uri_churi_okx (struct uri_churi_test *test, const char *file, unsigned int line) |
Report current working URI test result. More... | |
static void | uri_params_list_okx (struct uri_params_test *test, struct uri *uri, const char *file, unsigned int line) |
Report request parameter URI test list result. More... | |
static void | uri_params_okx (struct uri_params_test *test, const char *file, unsigned int line) |
Report request parameter URI test result. More... | |
static void | uri_test_exec (void) |
Perform URI self-test. More... | |
Variables | |
static struct uri_test | uri_empty |
Empty URI. More... | |
static struct uri_test | uri_boot_ipxe_org |
Basic HTTP URI. More... | |
static struct uri_test | uri_mailto |
Basic opaque URI. More... | |
static struct uri_test | uri_host |
Basic host-only URI. More... | |
static struct uri_test | uri_path |
Basic path-only URI. More... | |
static struct uri_test | uri_path_escaped |
Path-only URI with escaped characters. More... | |
static struct uri_test | uri_http_all |
HTTP URI with all the trimmings. More... | |
static struct uri_test | uri_http_escaped |
HTTP URI with escaped characters. More... | |
static struct uri_test | uri_http_escaped_improper |
HTTP URI with improperly escaped characters. More... | |
static struct uri_test | uri_ipv6 |
IPv6 URI. More... | |
static struct uri_test | uri_ipv6_port |
IPv6 URI with port. More... | |
static struct uri_test | uri_ipv6_local |
IPv6 URI with link-local address. More... | |
static struct uri_test | uri_ipv6_local_non_conforming |
IPv6 URI with link-local address not conforming to RFC 6874. More... | |
static struct uri_test | uri_iscsi |
iSCSI URI More... | |
static struct uri_test | uri_file_relative |
File URI with relative (opaque) path. More... | |
static struct uri_test | uri_file_absolute |
File URI with absolute path. More... | |
static struct uri_test | uri_file_volume |
File URI with volume name. More... | |
static struct uri_test | uri_colons |
Relative URI with colons in path. More... | |
static struct uri_port_test | uri_explicit_port |
URI with port number. More... | |
static struct uri_port_test | uri_default_port |
URI without port number. More... | |
static struct uri_resolve_test | uri_simple_path |
Simple path resolution test. More... | |
static struct uri_resolve_test | uri_relative_path |
Path resolution test with "." and ".." elements. More... | |
static struct uri_resolve_test | uri_directory_path |
Path resolution test terminating with directory. More... | |
static struct uri_resolve_test | uri_excessive_path |
Path resolution test with excessive ".." elements. More... | |
static struct uri_resolve_test | uri_absolute_path |
Path resolution test with absolute path. More... | |
static struct uri_resolve_test | uri_relative |
Relative URI resolution test. More... | |
static struct uri_resolve_test | uri_absolute |
Absolute URI resolution test. More... | |
static struct uri_resolve_test | uri_absolute_uri_path |
Absolute path URI resolution test. More... | |
static struct uri_resolve_test | uri_query |
Query URI resolution test. More... | |
static struct uri_resolve_test | uri_fragment |
Fragment URI resolution test. More... | |
static struct uri_resolve_test | uri_self |
Empty relative URI resolution test. More... | |
static struct uri_resolve_test | uri_cwd |
Current directory URI resolution test. More... | |
static struct uri_pxe_test | uri_pxe_absolute |
PXE URI with absolute URI. More... | |
static struct uri_pxe_test | uri_pxe_absolute_path |
PXE URI with absolute path. More... | |
static struct uri_pxe_test | uri_pxe_relative_path |
PXE URI with relative path. More... | |
static struct uri_pxe_test | uri_pxe_icky |
PXE URI with path containing special characters. More... | |
static struct uri_pxe_test | uri_pxe_port |
PXE URI with custom port. More... | |
static struct uri_churi_test | uri_churi [] |
Current working URI test. More... | |
static struct uri_params_test_list | uri_params_list [] |
Request parameter URI test list. More... | |
static struct uri_params_test | uri_params |
Request parameter URI test. More... | |
static struct uri_params_test_list | uri_named_params_list [] |
Named request parameter URI test list. More... | |
static struct uri_params_test | uri_named_params |
Named request parameter URI test. More... | |
struct self_test uri_test | __self_test |
URI self-test. More... | |
URI self-tests.
Definition in file uri_test.c.
Definition at line 160 of file uri_test.c.
#define uri_parse_ok | ( | test | ) | uri_parse_okx ( test, __FILE__, __LINE__ ) |
Definition at line 180 of file uri_test.c.
#define uri_format_ok | ( | test | ) | uri_format_okx ( test, __FILE__, __LINE__ ) |
Definition at line 207 of file uri_test.c.
#define uri_dup_ok | ( | test | ) | uri_dup_okx ( test, __FILE__, __LINE__ ) |
Definition at line 226 of file uri_test.c.
#define uri_parse_format_dup_ok | ( | test | ) | uri_parse_format_dup_okx ( test, __FILE__, __LINE__ ) |
Definition at line 242 of file uri_test.c.
#define uri_port_ok | ( | test | ) | uri_port_okx ( test, __FILE__, __LINE__ ) |
Definition at line 266 of file uri_test.c.
#define uri_resolve_ok | ( | test | ) | uri_resolve_okx ( test, __FILE__, __LINE__ ) |
Definition at line 307 of file uri_test.c.
#define uri_resolve_path_ok | ( | test | ) | uri_resolve_path_okx ( test, __FILE__, __LINE__ ) |
Definition at line 330 of file uri_test.c.
#define uri_pxe_ok | ( | test | ) | uri_pxe_okx ( test, __FILE__, __LINE__ ) |
Definition at line 357 of file uri_test.c.
#define uri_churi_ok | ( | test | ) | uri_churi_okx ( test, __FILE__, __LINE__ ) |
Definition at line 405 of file uri_test.c.
#define uri_params_list_ok | ( | test | ) | uri_params_list_okx ( test, __FILE__, __LINE__ ) |
Definition at line 439 of file uri_test.c.
#define uri_params_ok | ( | test | ) | uri_params_okx ( test, __FILE__, __LINE__ ) |
Definition at line 489 of file uri_test.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
|
static |
Report URI equality test result.
uri | URI |
expected | Expected URI |
file | Test code file |
line | Test code line |
Definition at line 144 of file uri_test.c.
References uri::efragment, uri::epath, uri::equery, uri::host, okx, uri::opaque, uri::params, uri::password, uri::path, uri::port, uri::scheme, uristrcmp(), and uri::user.
Referenced by uri_dup_okx(), uri_params_list_okx(), uri_parse_okx(), and uri_pxe_okx().
|
static |
Report URI parsing test result.
test | URI test |
file | Test code file |
line | Test code line |
Definition at line 169 of file uri_test.c.
References NULL, okx, parse_uri(), test, uri_okx(), and uri_put().
Referenced by uri_parse_format_dup_okx().
|
static |
Report URI formatting test result.
test | URI test |
file | Test code file |
line | Test code line |
Definition at line 189 of file uri_test.c.
References format_uri(), format_uri_alloc(), free, len, NULL, okx, strcmp(), strlen(), test, and tmp.
Referenced by uri_parse_format_dup_okx().
|
static |
Report URI duplication test result.
test | URI |
file | Test code file |
line | Test code line |
Definition at line 216 of file uri_test.c.
References NULL, okx, uri_dup(), uri_okx(), and uri_put().
Referenced by uri_parse_format_dup_okx().
|
static |
Report URI combined parsing and formatting test result.
test | URI test |
file | Test code file |
line | Test code line |
Definition at line 235 of file uri_test.c.
References test, uri_dup_okx(), uri_format_okx(), and uri_parse_okx().
|
static |
Report URI port number test result.
test | URI port number test |
file | Test code file |
line | Test code line |
Definition at line 252 of file uri_test.c.
References NULL, okx, parse_uri(), port, test, uri_port(), and uri_put().
|
static |
Report URI resolution test result.
test | Path resolution test |
file | Test code file |
line | Test code line |
Definition at line 275 of file uri_test.c.
References base, format_uri_alloc(), formatted, free, NULL, okx, parse_uri(), resolve_uri(), strcmp(), test, and uri_put().
Referenced by uri_resolve_path_okx().
|
static |
Report path resolution test result.
test | Path resolution test |
file | Test code file |
line | Test code line |
Definition at line 316 of file uri_test.c.
References free, NULL, okx, resolve_path(), strcmp(), test, and uri_resolve_okx().
|
static |
Report URI PXE test result.
test | URI PXE test |
file | Test code file |
line | Test code line |
Definition at line 340 of file uri_test.c.
References format_uri(), len, NULL, okx, pxe_uri(), strcmp(), strlen(), test, uri_okx(), and uri_put().
|
static |
Report current working URI test result.
tests | List of current working URI tests |
file | Test code file |
line | Test code line |
Definition at line 366 of file uri_test.c.
References churi(), cwuri, format_uri_alloc(), formatted, free, NULL, okx, parse_uri(), strcmp(), test, uri_get(), and uri_put().
|
static |
Report request parameter URI test list result.
test | Request parameter URI test |
uri | URI |
file | Test code file |
line | Test code line |
Definition at line 415 of file uri_test.c.
References for_each_param, parameter::list, NULL, okx, param, uri::params, strcmp(), test, and uri_okx().
Referenced by uri_params_okx().
|
static |
Report request parameter URI test result.
test | Request parameter URI test |
file | Test code file |
line | Test code line |
Definition at line 449 of file uri_test.c.
References add_parameter(), create_parameters(), uri_params_test_list::flags, uri_params_test_list::key, NULL, okx, param, uri::params, parse_uri(), test, uri_dup(), uri_params_list_okx(), uri_put(), and uri_params_test_list::value.
|
static |
Perform URI self-test.
URI port number tests
Path resolution tests
URI resolution tests
Definition at line 974 of file uri_test.c.
References uri_absolute, uri_absolute_path, uri_absolute_uri_path, uri_boot_ipxe_org, uri_churi, uri_churi_ok, uri_colons, uri_cwd, uri_default_port, uri_directory_path, uri_empty, uri_excessive_path, uri_explicit_port, uri_file_absolute, uri_file_relative, uri_file_volume, uri_fragment, uri_host, uri_http_all, uri_http_escaped, uri_http_escaped_improper, uri_ipv6, uri_ipv6_local, uri_ipv6_local_non_conforming, uri_ipv6_port, uri_iscsi, uri_mailto, uri_named_params, uri_params, uri_params_ok, uri_parse_format_dup_ok, uri_parse_ok, uri_path, uri_path_escaped, uri_port_ok, uri_pxe_absolute, uri_pxe_absolute_path, uri_pxe_icky, uri_pxe_ok, uri_pxe_port, uri_pxe_relative_path, uri_query, uri_relative, uri_relative_path, uri_resolve_ok, uri_resolve_path_ok, uri_self, and uri_simple_path.
|
static |
Empty URI.
Definition at line 492 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Basic HTTP URI.
Definition at line 497 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Basic opaque URI.
Definition at line 504 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Basic host-only URI.
Definition at line 510 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Basic path-only URI.
Definition at line 516 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Path-only URI with escaped characters.
Definition at line 523 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
HTTP URI with all the trimmings.
Definition at line 529 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
HTTP URI with escaped characters.
Definition at line 545 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
HTTP URI with improperly escaped characters.
Definition at line 558 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
IPv6 URI.
Definition at line 576 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
IPv6 URI with port.
Definition at line 587 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
IPv6 URI with link-local address.
Definition at line 599 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
IPv6 URI with link-local address not conforming to RFC 6874.
Definition at line 610 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
iSCSI URI
Definition at line 626 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
File URI with relative (opaque) path.
Definition at line 635 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
File URI with absolute path.
Definition at line 644 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
File URI with volume name.
Definition at line 654 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Relative URI with colons in path.
Definition at line 665 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
URI with port number.
Definition at line 674 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
URI without port number.
Definition at line 681 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Simple path resolution test.
Definition at line 688 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Path resolution test with "." and ".." elements.
Definition at line 695 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Path resolution test terminating with directory.
Definition at line 702 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Path resolution test with excessive ".." elements.
Definition at line 709 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Path resolution test with absolute path.
Definition at line 716 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Relative URI resolution test.
Definition at line 723 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Absolute URI resolution test.
Definition at line 730 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Absolute path URI resolution test.
Definition at line 737 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Query URI resolution test.
Definition at line 744 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Fragment URI resolution test.
Definition at line 751 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Empty relative URI resolution test.
Definition at line 758 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Current directory URI resolution test.
Definition at line 765 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
PXE URI with absolute URI.
Definition at line 772 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
PXE URI with absolute path.
Definition at line 791 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
PXE URI with relative path.
Definition at line 810 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
PXE URI with path containing special characters.
Definition at line 829 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
PXE URI with custom port.
Definition at line 848 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Current working URI test.
Definition at line 869 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Request parameter URI test list.
Definition at line 901 of file uri_test.c.
|
static |
Request parameter URI test.
Definition at line 925 of file uri_test.c.
Referenced by uri_test_exec().
|
static |
Named request parameter URI test list.
Definition at line 938 of file uri_test.c.
|
static |
Named request parameter URI test.
Definition at line 957 of file uri_test.c.
Referenced by uri_test_exec().
URI self-test.
Definition at line 1032 of file uri_test.c.