Skip to content

Conversation

@jketema
Copy link
Contributor

@jketema jketema commented Jun 19, 2023

Follow up to #12789, #13346, and #13426. This PR introduces three additional merge modules to merge 3, 4, and 5 inline expectation tests, as Go and Python have a few instances where that many inline expectation tests occur in a single file. This solution seemed cleaner than having nested merged test in the test ql files, although in one case that is still necessary (see comment below).

Other than the above, there's one commit per language. The Go and Ruby ones deal with the last remaining cases for those languages where the parameterized module was not used. In the case of Python there are two remaining instances that still use the inline expectations test class.

Comment on lines +544 to +553
import MakeTest<MergeTests5<MergeTests5<SystemCommandExecutionTest, DecodingTest, EncodingTest, LoggingTest,
CodeExecutionTest>,
MergeTests5<SqlConstructionTest, SqlExecutionTest, XPathConstructionTest, XPathExecutionTest,
EscapingTest>,
MergeTests4<HttpServerRouteSetupTest, HttpServerRequestHandlerTest,
HttpServerHttpRedirectResponseTest, HttpServerCookieWriteTest>,
MergeTests5<FileSystemAccessTest, FileSystemWriteAccessTest, PathNormalizationTest,
SafeAccessCheckTest, PublicKeyGenerationTest>,
MergeTests5<CryptographicOperationTest, HttpClientRequestTest, CsrfProtectionSettingTest,
CsrfLocalProtectionSettingTest, XmlParsingTest>>>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not particularly proud of this, but I don't see a better way of doing this with 25 inline expectation tests in a single file.

Note that HttpServerHttpResponseTest is still missing here. That remains one of the inline expectation tests that still needs to be reworked.

@jketema jketema marked this pull request as ready for review June 20, 2023 08:36
@jketema jketema requested review from a team as code owners June 20, 2023 08:36
Copy link
Contributor

@owen-mc owen-mc left a comment

Choose a reason for hiding this comment

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

Go 👍🏻

Comment on lines 1 to +2
import experimental.meta.InlineTaintTest
import MakeInlineTaintTest<TestTaintTrackingConfig>
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this could be put into a file, say DefaultInlineTaintTest.qll that is then imported. Just since this is the way we always use it...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I generally did that when the config and the Make.... were in the same file and when it was clear to me that it would not be sensible to use any other configuration. If you think that the latter applies here (i.e., no other sensible configuration), then I happily move this.

Copy link
Contributor

Choose a reason for hiding this comment

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

It might be sensible we just do not really do it. That is why I suggested a convenience file so a single import would be enough in most cases. It could even be named InlineTaintTest to remove the common case form the diff of this PR; then we just have to come up with a different name for the unspecialised one...

Copy link
Contributor

Choose a reason for hiding this comment

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

I do not think such an ergonomic improvement has to be part of this PR, though. The common workflow is to just copy an existing version of the file into a new test folder, so the number of lines in the file does not really matter inthat case...

Copy link
Contributor Author

@jketema jketema Jun 20, 2023

Choose a reason for hiding this comment

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

Then I'll leave that improvement to the Python team.

Copy link
Contributor

@yoff yoff left a comment

Choose a reason for hiding this comment

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

Thanks for this enormous effort 💪

Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

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

Ruby 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants