-
Notifications
You must be signed in to change notification settings - Fork 284
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
tests for Unix.select and introduce select-as-epoll #5910
Merged
edwintorok
merged 13 commits into
xapi-project:master
from
edwintorok:private/edvint/epoll-tests
Aug 27, 2024
Merged
tests for Unix.select and introduce select-as-epoll #5910
edwintorok
merged 13 commits into
xapi-project:master
from
edwintorok:private/edvint/epoll-tests
Aug 27, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ah Unixext_test is not part of quicktest.ml, let me fix that. |
edwintorok
force-pushed
the
private/edvint/epoll-tests
branch
2 times, most recently
from
August 5, 2024 09:51
6913a42
to
500f633
Compare
Added, and it passes now:
|
Merged
edwintorok
force-pushed
the
private/edvint/epoll-tests
branch
2 times, most recently
from
August 5, 2024 15:07
6354eca
to
ef8864f
Compare
The tests are now run by 'quicktest' in Dom0 too:
Also included #5912 to fix the CI |
Vincent-lau
approved these changes
Aug 14, 2024
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.
Looks good to me. Most of these are unit tests so should be relatively low risk
minglumlu
reviewed
Aug 15, 2024
minglumlu
reviewed
Aug 15, 2024
minglumlu
reviewed
Aug 15, 2024
lindig
approved these changes
Aug 15, 2024
Parenthesis were in the wrong place, so when you ran just the non-XAPI tests by hand it worked, but when running all tests automatically it skipped the qcheck tests. I'm fairly sure I fixed this bug previously, but must've gotten lost during a rebase. Signed-off-by: Edwin Török <[email protected]>
The version we have in Dom0 is too old and doesn't support these flags. We can only test 512 block size. Signed-off-by: Edwin Török <[email protected]>
These only run when root. However certain combinations are not valid: we cannot insert delays when reading/writing, because the other side won't get any completion notifications, so we cannot check the usual way whether time_limited_{read,write} has completed. Skip BLK tests with delays. Signed-off-by: Edwin Török <[email protected]>
The file descriptor gets closed when the channel is closed, so we need to use Unix.dup here to avoid a double close and avoid an EBADF. Signed-off-by: Edwin Török <[email protected]>
And increase ulimit when running quicktest, to cope with open-1024 on startup. Signed-off-by: Edwin Török <[email protected]>
Like file_kind, but exclude file kinds that the current program cannot generate, e.g. exclude block devices when not root. Signed-off-by: Edwin Török <[email protected]>
Generate a list of file descriptors, with nested try/finally closing. Signed-off-by: Edwin Török <[email protected]>
Signed-off-by: Edwin Török <[email protected]>
Generate 3 sets of file descriptors and a timeout. Try to generate interesting combinations: * empty lists * lists with the same file kinds * lists with mixed file kinds * lists with common elements * bias towards generating very short lists Signed-off-by: Edwin Török <[email protected]>
Test Unix.select. This can be easily switched to test Unixext.select based on epoll. We disable the 'open 1024' fds on startup because we are testing regular select here. Signed-off-by: Edwin Török <[email protected]>
A drop-in replacement for select that doesn't fail when a file descriptor number is >1024. This is bad for performance (it makes a lot more syscalls than select), and performance sensitive callers should instead use `SO_RCVTIMEO/SO_SNDTIMEO` on sockets, or move the polly instance creation out of loops. This will also use one additional file descriptor compared to 'select', so it will reach EMFILE sooner. When replacing `Unix.select` with `Unixext.select` you must also increase resource limits! Signed-off-by: Edwin Török <[email protected]>
Signed-off-by: Edwin Török <[email protected]>
Signed-off-by: Edwin Török <[email protected]>
edwintorok
force-pushed
the
private/edvint/epoll-tests
branch
from
August 15, 2024 12:43
ef8864f
to
9208739
Compare
I've added 2 comments: @@ -684,6 +684,8 @@ let pollerr_set = Polly.Events.pri
let to_milliseconds ms = ms *. 1e3 |> ceil |> int_of_float
+(* we could change lists to proper Sets once the Unix.select to Unixext.select conversion is done *)
+
let readable fd (rd, wr, ex) = (fd :: rd, wr, ex)
let writable fd (rd, wr, ex) = (rd, fd :: wr, ex)
@@ -723,6 +723,7 @@ let select ins outs errs timeout =
Unix.sleepf timeout ; no_events
| _ -> (
with_polly @@ fun polly ->
+ (* file descriptors that cannot be watched by epoll *)
let immediate =
no_events
|> polly_fold polly pollin_set ins readable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First write tests for the semantics of Unix.select.
Then introduce a Unixext.select implemented using epoll, and switch the tests to test this function: now we know that Unixext.select semantics matches Unix.select.
(we don't test error semantics, because XAPI only calls Unix.select with an empty list as the error list).
This doesn't yet switch the code to use Unixext.select, that will be done on feature/perf as it needs more testing.
Draft, needs testing in koji and some ticket numbers.
Also I don't know why the BLK tests haven't failed before on master, maybe they are not being run correctly, they were supposed to run as part of the Quicktests...