Skip to content

Added test and comments for poll_syscall#296

Merged
rennergade merged 5 commits intodevelopfrom
qianxi_poll
Jul 17, 2024
Merged

Added test and comments for poll_syscall#296
rennergade merged 5 commits intodevelopfrom
qianxi_poll

Conversation

@qianxichen233
Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread src/safeposix/syscalls/net_calls.rs Outdated
Comment thread src/safeposix/syscalls/net_calls.rs
Comment thread src/safeposix/syscalls/net_calls.rs Outdated
Comment thread src/safeposix/syscalls/net_calls.rs
Comment thread src/safeposix/syscalls/net_calls.rs
Comment thread src/tests/networking_tests.rs Outdated
Comment thread src/tests/networking_tests.rs
Comment thread src/tests/networking_tests.rs Outdated
Copy link
Copy Markdown
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!

Comment thread src/safeposix/syscalls/net_calls.rs
Comment thread src/safeposix/syscalls/net_calls.rs
@davidge20
Copy link
Copy Markdown
Contributor

LGTM!

@davidge20 davidge20 self-requested a review July 16, 2024 18:38
@rennergade rennergade requested a review from yashaswi2000 July 17, 2024 01:41
Copy link
Copy Markdown
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!

Comment thread src/safeposix/syscalls/net_calls.rs Outdated
Copy link
Copy Markdown
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!

@qianxichen233 qianxichen233 requested a review from rennergade July 17, 2024 03:15
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.

5 participants