Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Packetdrill_tarr_ext
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Stefan Gense
Packetdrill_tarr_ext
Commits
b5cddb04
Commit
b5cddb04
authored
9 years ago
by
Aomx
Browse files
Options
Downloads
Patches
Plain Diff
refined if statements for desired behaviour at accept syscalls
parent
ff14fdb6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gtests/net/packetdrill/run_system_call.c
+16
-4
16 additions, 4 deletions
gtests/net/packetdrill/run_system_call.c
with
16 additions
and
4 deletions
gtests/net/packetdrill/run_system_call.c
+
16
−
4
View file @
b5cddb04
...
@@ -514,7 +514,7 @@ static void begin_syscall(struct state *state, struct syscall_spec *syscall)
...
@@ -514,7 +514,7 @@ static void begin_syscall(struct state *state, struct syscall_spec *syscall)
enum
result_check_t
{
enum
result_check_t
{
CHECK_EXACT
,
/* check that result matches exactly */
CHECK_EXACT
,
/* check that result matches exactly */
CHECK_NON_NEGATIVE
,
/* check that result is non-negative */
CHECK_NON_NEGATIVE
,
/* check that result is non-negative */
CHECK_A
NY
,
/*
accept any result
*/
CHECK_A
CCEPT
,
/*
checks for results after accept-syscall
*/
};
};
static
int
end_syscall
(
struct
state
*
state
,
struct
syscall_spec
*
syscall
,
static
int
end_syscall
(
struct
state
*
state
,
struct
syscall_spec
*
syscall
,
enum
result_check_t
mode
,
int
actual
,
char
**
error
)
enum
result_check_t
mode
,
int
actual
,
char
**
error
)
...
@@ -558,8 +558,20 @@ static int end_syscall(struct state *state, struct syscall_spec *syscall,
...
@@ -558,8 +558,20 @@ static int end_syscall(struct state *state, struct syscall_spec *syscall,
expected
,
actual
);
expected
,
actual
);
return
STATUS_ERR
;
return
STATUS_ERR
;
}
}
}
else
if
(
mode
==
CHECK_ANY
)
{
}
else
if
(
mode
==
CHECK_ACCEPT
)
{
return
STATUS_OK
;
if
(
expected
>=
0
&&
actual
<
0
)
{
asprintf
(
error
,
"Expected non-negative result but got %d "
"with errno %d (%s)"
,
actual
,
actual_errno
,
strerror
(
actual_errno
));
return
STATUS_ERR
;
}
else
if
(
expected
<
0
&&
actual
!=
expected
)
{
asprintf
(
error
,
"Expected result %d but got %d"
,
expected
,
actual
);
return
STATUS_ERR
;
}
}
else
{
}
else
{
assert
(
!
"bad mode"
);
assert
(
!
"bad mode"
);
}
}
...
@@ -997,7 +1009,7 @@ static int syscall_accept(struct state *state, struct syscall_spec *syscall,
...
@@ -997,7 +1009,7 @@ static int syscall_accept(struct state *state, struct syscall_spec *syscall,
result
=
accept
(
live_fd
,
(
struct
sockaddr
*
)
&
live_addr
,
&
live_addrlen
);
result
=
accept
(
live_fd
,
(
struct
sockaddr
*
)
&
live_addr
,
&
live_addrlen
);
if
(
end_syscall
(
state
,
syscall
,
CHECK_A
NY
,
result
,
error
))
if
(
end_syscall
(
state
,
syscall
,
CHECK_A
CCEPT
,
result
,
error
))
return
STATUS_ERR
;
return
STATUS_ERR
;
if
(
result
>=
0
)
{
if
(
result
>=
0
)
{
...
...
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