sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Some analysis_server tests produce invalid analysis_options.yaml files due to passing an empty list for experiments instead of null.

Open osaxma opened this issue 1 year ago • 5 comments

While working on 352220, I came a cross a case where an invalid analysis_options.yaml was produced from some tests (namely: remove_break_test.dart).

It seems that the setUp function is passing an empty list for experiments instead of null to createAnalysisOptionsFile producing an invalid format for the analysis_options.yaml (i.e. a label without value):

https://github.com/dart-lang/sdk/blob/c3a626f729524ac8859ef8f7f06ebf4e98a43719/pkg/analysis_server/test/abstract_context.dart#L121-L138

Maybe the method above should check for both null and isNotEmpty for all the arguments if that wasn't intentional.

osaxma avatar Feb 15 '24 05:02 osaxma

Great catch!

Maybe the method above should check for both null and isNotEmpty for all the arguments if that wasn't intentional.

Seems reasonable to me.

@scheglov?

pq avatar Feb 16 '24 16:02 pq

It seems to me that it would be cleaner to give default const [], and check for .isNotEmpty instead of != null.

scheglov avatar Feb 16 '24 17:02 scheglov

👍 I like that.

pq avatar Feb 16 '24 20:02 pq

Hi @pq

I pushed a quick fix for this one as suggested by @scheglov at:

  • https://dart-review.googlesource.com/c/sdk/+/352866

Side questions:

  • what does the yellow color mean for those 9 tests?

Screen Shot 2024-02-17 at 1 03 38 PM

  • Also, I've been running the tests using dart run test/test_all.dart -- is that sufficient for local testing?

osaxma avatar Feb 17 '24 10:02 osaxma

These are @SkippedTest that we were not able to make reliable.

scheglov avatar Feb 17 '24 17:02 scheglov

Thank you!

Also, I've been running the tests using dart run test/test_all.dart -- is that sufficient for local testing?

Should be, yes.

pq avatar Feb 20 '24 16:02 pq