Skip to content
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

Added test and comments for poll_syscall #296

Merged
merged 5 commits into from
Jul 17, 2024
Merged

Added test and comments for poll_syscall #296

merged 5 commits into from
Jul 17, 2024

Conversation

qianxichen233
Copy link
Contributor

Description

This PR added several tests and comments for poll_syscall. The test being added is very simliar to select_syscall, as both syscalls serve a very similar purpose.

Fixes # (issue)

Several minor issues in poll_syscall are fixed in this PR:

  1. POLLPRI flag should be used for exception fds instead of POLLERR
  2. revents of all fds are cleared at the beginning of the syscall, in order to follow the standard
  3. negative fds should be ignored
  4. invalid fd should not raise the error directly, instead, it should just ignore it and set the corresponding flag in revent

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Test A - ut_lind_net_poll_bad_input
  • Test B - ut_lind_net_poll_timeout
  • Test C - ut_lind_net_poll (this test is marked as ignore since an unfixed bug will panick the test)

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been added to a pull request and/or merged in other modules (native-client, lind-glibc, lind-project)

Copy link
Contributor

@davidge20 davidge20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great tests! Left some minor comments for more context and typos

src/safeposix/syscalls/net_calls.rs Outdated Show resolved Hide resolved
src/safeposix/syscalls/net_calls.rs Show resolved Hide resolved
src/safeposix/syscalls/net_calls.rs Outdated Show resolved Hide resolved
src/safeposix/syscalls/net_calls.rs Show resolved Hide resolved
src/safeposix/syscalls/net_calls.rs Show resolved Hide resolved
src/tests/networking_tests.rs Outdated Show resolved Hide resolved
src/tests/networking_tests.rs Show resolved Hide resolved
src/tests/networking_tests.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@namanlalitnyu namanlalitnyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just two minor comments.
Very thorough tests!

src/safeposix/syscalls/net_calls.rs Show resolved Hide resolved
src/safeposix/syscalls/net_calls.rs Show resolved Hide resolved
@davidge20
Copy link
Contributor

LGTM!

@davidge20 davidge20 self-requested a review July 16, 2024 18:38
Copy link
Contributor

@yashaswi2000 yashaswi2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, really great job!

Copy link
Contributor

@rennergade rennergade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment but this is good to go. Great job!

@rennergade rennergade merged commit a5e5c9e into develop Jul 17, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants