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

#1363. Yield each tests updated to the current specification #1374

Merged
merged 3 commits into from
Jul 27, 2022

Conversation

sgrekhov
Copy link
Contributor

No description provided.

Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

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

LGTM, noting a few things.

The most delicate point is that the tests have a built-in assumption about the execution of asynchronous work (that is, a specific action is expected to have taken place because there was an await with a delay of 100ms, or something like that). I think this is safe in practice, and it might not be practical to express the constraint which is actually safe to assume (which would allow for a large number of different orderings of events), so I guess we'll have to have these tests where the outcome is something like [-1, 1, 'one', ...] even though there is no guarantee that things are actually going to happen in exactly that order.

Another thing to consider is that there are several cases where sc.close() is executed rather than await sc.close(). This may be fine as long as the close operation is performed after main has returned, but when it is not the last operation in main it looks like it might not establish the intended situation. So please take a look at all occurrences of sc.close(), and see if each of them is known to do the right thing.

@eernstg
Copy link
Member

eernstg commented Jul 26, 2022

@alexmarkov, it would be great if you could take a look, too!

Copy link

@alexmarkov alexmarkov left a comment

Choose a reason for hiding this comment

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

lgtm

});
await c.future;
sc.add(1);
await new Future.delayed(new Duration(milliseconds: 100));

Choose a reason for hiding this comment

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

Can we avoid these hardcoded delays? They may artificially increase execution time of the test, and at the same time these delays don't guarantee that anything will run during this time period if there is a high load on the bot, so we may end up with flaky failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, tests rewritten to not to use these delays

@sgrekhov
Copy link
Contributor Author

@eernstg @alexmarkov thank you for the review. I rewrote the tests so they don't rely on delays any longer but use Completer instead (or await null;). Test became much more safer and reliable now. Please rereview

Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

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

LGTM!

@eernstg eernstg merged commit 4f9a06e into dart-lang:master Jul 27, 2022
sgrekhov added a commit to sgrekhov/co19 that referenced this pull request Aug 4, 2022
…dart-lang#1374)

Authored by @sgrekhov.

Yield-each tests updated and new ones added; some delays replaced by `await null;`; do not to rely on delays, but use a completer (to avoid having flakiness during high loads, and in general to avoid depending on scheduling order and timing).
@sgrekhov sgrekhov deleted the co19-1363-2 branch August 9, 2022 10:20
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Aug 11, 2022
2022-08-04 sgrekhov22@gmail.com dart-lang/co19#993. FFI tests refactored and improved (dart-lang/co19#1387)
2022-08-04 sgrekhov22@gmail.com dart-lang/co19#993. [FFI] Missed tests added for some new types (dart-lang/co19#1386)
2022-08-03 sgrekhov22@gmail.com Fixes dart-lang/co19#1129. Don't expect any proxy routine in case of DIRECT connection (dart-lang/co19#1383)
2022-08-03 sgrekhov22@gmail.com dart-lang/co19#993. [FFI] Missed tests added for some new types (dart-lang/co19#1384)
2022-07-29 sgrekhov22@gmail.com dart-lang/co19#673. IFrame tests that don't actually test IFrame removed (dart-lang/co19#1382)
2022-07-29 sgrekhov22@gmail.com dart-lang/co19#1363. Some delays removed or reduced (dart-lang/co19#1380)
2022-07-29 sgrekhov22@gmail.com dart-lang/co19#1363 Async `for-in` test updated according to the current specification (dart-lang/co19#1379)
2022-07-27 sgrekhov22@gmail.com dart-lang/co19#1363. Yield each tests updated to the current specification (dart-lang/co19#1374)
2022-07-27 sgrekhov22@gmail.com Fixes dart-lang/co19#1375. Add test for final variable in a for-in loop (dart-lang/co19#1378)
2022-07-25 sgrekhov22@gmail.com dart-lang/co19#1363. Tests for yield updated to the current specification (dart-lang/co19#1370)

Change-Id: Ie92f4b2157284777177012320883247411e214fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254140
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
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

3 participants