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
46ff91b6
Commit
46ff91b6
authored
11 years ago
by
Andrea Shepard
Browse files
Options
Downloads
Patches
Plain Diff
Add scheduler_channel_has_waiting_cells_mock() and some mock counter queries
parent
2ee69bd5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/fakechans.h
+6
-0
6 additions, 0 deletions
src/test/fakechans.h
src/test/test_channel.c
+40
-0
40 additions, 0 deletions
src/test/test_channel.c
with
46 additions
and
0 deletions
src/test/fakechans.h
+
6
−
0
View file @
46ff91b6
...
...
@@ -14,6 +14,12 @@ void make_fake_var_cell(var_cell_t *c);
channel_t
*
new_fake_channel
(
void
);
/* Also exposes some a mock used by both test_channel.c and test_relay.c */
void
scheduler_channel_has_waiting_cells_mock
(
channel_t
*
ch
);
void
scheduler_release_channel_mock
(
channel_t
*
ch
);
/* Query some counters used by the exposed mocks */
int
get_mock_scheduler_has_waiting_cells_count
(
void
);
int
get_mock_scheduler_release_channel_count
(
void
);
#endif
/* !defined(TOR_FAKECHANS_H) */
This diff is collapsed.
Click to expand it.
src/test/test_channel.c
+
40
−
0
View file @
46ff91b6
...
...
@@ -22,6 +22,7 @@ static int test_chan_accept_cells = 0;
static
int
test_cells_written
=
0
;
static
int
test_destroy_not_pending_calls
=
0
;
static
int
test_doesnt_want_writes_count
=
0
;
static
int
test_has_waiting_cells_count
=
0
;
static
double
test_overhead_estimate
=
1
.
0
f
;
static
int
test_releases_count
=
0
;
...
...
@@ -206,6 +207,31 @@ new_fake_channel(void)
return
chan
;
}
/**
* Counter query for scheduler_channel_has_waiting_cells_mock()
*/
int
get_mock_scheduler_has_waiting_cells_count
(
void
)
{
return
test_has_waiting_cells_count
;
}
/**
* Mock for scheduler_channel_has_waiting_cells()
*/
void
scheduler_channel_has_waiting_cells_mock
(
channel_t
*
ch
)
{
(
void
)
ch
;
/* Increment counter */
++
test_has_waiting_cells_count
;
return
;
}
static
void
scheduler_channel_doesnt_want_writes_mock
(
channel_t
*
ch
)
{
...
...
@@ -217,6 +243,20 @@ scheduler_channel_doesnt_want_writes_mock(channel_t *ch)
return
;
}
/**
* Counter query for scheduler_release_channel_mock()
*/
int
get_mock_scheduler_release_channel_count
(
void
)
{
return
test_releases_count
;
}
/**
* Mock for scheduler_release_channel()
*/
void
scheduler_release_channel_mock
(
channel_t
*
ch
)
{
...
...
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