Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
41b9dca0
Commit
41b9dca0
authored
5 years ago
by
haxxpop
Committed by
Nick Mathewson
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
test: Implement haproxy
parent
119004e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/test/include.am
+1
-0
1 addition, 0 deletions
src/test/include.am
src/test/test.c
+1
-0
1 addition, 0 deletions
src/test/test.c
src/test/test.h
+1
-0
1 addition, 0 deletions
src/test/test.h
src/test/test_proto_haproxy.c
+66
-0
66 additions, 0 deletions
src/test/test_proto_haproxy.c
with
69 additions
and
0 deletions
src/test/include.am
+
1
−
0
View file @
41b9dca0
...
...
@@ -182,6 +182,7 @@ src_test_test_SOURCES += \
src/test/test_process_descs.c \
src/test/test_prob_distr.c \
src/test/test_procmon.c \
src/test/test_proto_haproxy.c \
src/test/test_proto_http.c \
src/test/test_proto_misc.c \
src/test/test_protover.c \
...
...
This diff is collapsed.
Click to expand it.
src/test/test.c
+
1
−
0
View file @
41b9dca0
...
...
@@ -899,6 +899,7 @@ struct testgroup_t testgroups[] = {
{
"prob_distr/"
,
prob_distr_tests
},
{
"procmon/"
,
procmon_tests
},
{
"process/"
,
process_tests
},
{
"proto/haproxy/"
,
proto_haproxy_tests
},
{
"proto/http/"
,
proto_http_tests
},
{
"proto/misc/"
,
proto_misc_tests
},
{
"protover/"
,
protover_tests
},
...
...
This diff is collapsed.
Click to expand it.
src/test/test.h
+
1
−
0
View file @
41b9dca0
...
...
@@ -254,6 +254,7 @@ extern struct testcase_t slow_stochastic_prob_distr_tests[];
extern
struct
testcase_t
procmon_tests
[];
extern
struct
testcase_t
process_tests
[];
extern
struct
testcase_t
process_descs_tests
[];
extern
struct
testcase_t
proto_haproxy_tests
[];
extern
struct
testcase_t
proto_http_tests
[];
extern
struct
testcase_t
proto_misc_tests
[];
extern
struct
testcase_t
protover_tests
[];
...
...
This diff is collapsed.
Click to expand it.
src/test/test_proto_haproxy.c
0 → 100644
+
66
−
0
View file @
41b9dca0
/* Copyright (c) 2019, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
* \file test_proto_haproxy.c
* \brief Tests for our HAProxy protocol parser code
*/
#define PROTO_HAPROXY_PRIVATE
#include
"test/test.h"
#include
"core/proto/proto_haproxy.h"
#include
"test/log_test_helpers.h"
static
void
test_format_proxy_header_line
(
void
*
arg
)
{
tor_addr_t
addr
;
tor_addr_port_t
*
addr_port
=
NULL
;
char
*
output
=
NULL
;
(
void
)
arg
;
/* IPv4 address. */
tor_addr_parse
(
&
addr
,
"192.168.1.2"
);
addr_port
=
tor_addr_port_new
(
&
addr
,
8000
);
output
=
haproxy_format_proxy_header_line
(
addr_port
);
tt_str_op
(
output
,
OP_EQ
,
"PROXY TCP4 0.0.0.0 192.168.1.2 0 8000
\r\n
"
);
tor_free
(
addr_port
);
tor_free
(
output
);
/* IPv6 address. */
tor_addr_parse
(
&
addr
,
"123:45:6789::5005:11"
);
addr_port
=
tor_addr_port_new
(
&
addr
,
8000
);
output
=
haproxy_format_proxy_header_line
(
addr_port
);
tt_str_op
(
output
,
OP_EQ
,
"PROXY TCP6 :: 123:45:6789::5005:11 0 8000
\r\n
"
);
tor_free
(
addr_port
);
tor_free
(
output
);
/* UNIX socket address. */
memset
(
&
addr
,
0
,
sizeof
(
addr
));
addr
.
family
=
AF_UNIX
;
addr_port
=
tor_addr_port_new
(
&
addr
,
8000
);
output
=
haproxy_format_proxy_header_line
(
addr_port
);
/* If it's not an IPv4 or IPv6 address, haproxy_format_proxy_header_line
* must return NULL. */
tt_ptr_op
(
output
,
OP_EQ
,
NULL
);
tor_free
(
addr_port
);
tor_free
(
output
);
done:
tor_free
(
addr_port
);
tor_free
(
output
);
}
struct
testcase_t
proto_haproxy_tests
[]
=
{
{
"format_proxy_header_line"
,
test_format_proxy_header_line
,
0
,
NULL
,
NULL
},
END_OF_TESTCASES
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment