-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(test/drivers): fix ENOSYS check and test skipping. #1737
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
* dealing with ENOSYS syscalls, ie: syscalls that are defined but unimplemented, | ||
* skipping the test. | ||
*/ | ||
#define assert_syscall_state(syscall_state, syscall_name, ...) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First 3 parameters are mandatory, thus we are sure that this macro always expands to the correct _assert_syscall_state
call, even if it is called with just 3 parameters, since the ...
will then expand to third(, fourth, fifth) parameter.
/hold |
e95f833
to
104cfe5
Compare
We cannot call GTEST_SKIP() in a sub-routine of a test, but only in the test body. Signed-off-by: Federico Di Pierro <[email protected]>
104cfe5
to
a78a15f
Compare
… tests. Signed-off-by: Federico Di Pierro <[email protected]>
int64_t errno_value = -errno; | ||
assert_syscall_state(SYSCALL_FAILURE, "dup3", res); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since assert_syscall_state
now resets errno
to 0, we must take errno
value before calling the macro.
Same below.
{ | ||
bool match = false; | ||
|
||
if (errno == ENOSYS) | ||
{ | ||
GTEST_SKIP() << "Syscall " << syscall_name << " not implemented" << std::endl; | ||
// it is managed upward by assert_syscall_state macro. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to short-circuit it here, because otherwise we would FAIL
the test below.
/unhold |
m_fd = syscall(__NR_openat, dirfd, filename, flags, 0); | ||
assert_syscall_state(SYSCALL_SUCCESS, "openat", m_fd, NOT_EQUAL, -1); | ||
// Using the macro that deals with ENOSYS produces a build issue since GTEST_SKIP returns value in a ctor. | ||
_assert_syscall_state(SYSCALL_SUCCESS, "openat", m_fd, NOT_EQUAL, -1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not clear who calls GTEST_SKIP()
here if we use the internal method and not the macro
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nobody :/ this is just a ctor unfortunately
AFAIK openat
should be implemented everywhere...hopefully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, we will notice immediately since it would break the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Andreagit97, FedeDP, LucaGuerra The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area tests
Does this PR require a change in the driver versions?
What this PR does / why we need it:
We cannot call GTEST_SKIP() in a sub-routine of a test, but only in the test body.
I kept the changes at the bare minumum to avoid touching all of the test cases...i had to introduce a simple macro though.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: