-
Notifications
You must be signed in to change notification settings - Fork 296
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
Unify Common Test Fixture Properties (Note Possible API Changes) #4038
Conversation
Two main groups of properties are commonly duplicated among test fixtures: * Dataflow processing with custom semantic definitions * Post processing passes This PR uses a combination of traits and new additions to `TestCpg` to improve the re-usability and consistency of these among frontend fixtures. I leave it up to the authors of the frontends to refactor these changes in each test suite.themselves. Misc: Added a fix for #4019
joern-cli/frontends/x2cpg/src/test/scala/io/joern/x2cpg/testfixtures/TestCpg.scala
Outdated
Show resolved
Hide resolved
@@ -1,6 +1,6 @@ | |||
name := "dataflowengineoss" | |||
|
|||
dependsOn(Projects.semanticcpg, Projects.x2cpg) | |||
dependsOn(Projects.semanticcpg, Projects.x2cpg % "compile->compile;test->test") |
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.
dependsOn(Projects.semanticcpg, Projects.x2cpg % "compile->compile;test->test") | |
dependsOn(Projects.semanticcpg, Projects.x2cpg, Projects.x2cpg % "test->test") |
The ;
separator led to problems with intellij in the past - splitting them up was the fix back then. Not sure if the problem still exists, but better play it safe.
Just noticed that this occurs in other places again - I'll send a PR for that after this is merged.
@@ -1,6 +1,6 @@ | |||
name := "c2cpg" | |||
|
|||
dependsOn(Projects.semanticcpg, Projects.dataflowengineoss % Test, Projects.x2cpg % "compile->compile;test->test") | |||
dependsOn(Projects.semanticcpg, Projects.dataflowengineoss % "compile->compile;test->test", Projects.x2cpg % "compile->compile;test->test") |
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.
same here, but feel free to keep as is, I'll clean this up after this PR is in
extraFlows: List[FlowSemantic] = List.empty, | ||
enableTypeRecovery: Boolean = false | ||
) extends Code2CpgFixture(() => | ||
new JavaSrcTestCpg(enableTypeRecovery).withOssDataflow(withOssDataflow).withExtraFlows(extraFlows) |
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.
interesting formatting... did scalafmt come up with that? in that case we need to update our config i guess... :)
|
||
implicit val resolver: ICallResolver = NoResolve | ||
implicit lazy val engineContext: EngineContext = EngineContext() | ||
new DefaultTestCpgWithRuby(packageTable, useDeprecatedFrontend) |
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.
again, strange indentation, no?
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.
Yeah it is pretty strange agreed
It seems in some frontends, post-processing and data-flow are not commutative, and thus the order of operations need to be specific. The result is that |
Two main groups of properties are commonly duplicated among test fixtures:
This PR uses a combination of traits and new additions to
TestCpg
to improve the re-usability and consistency of these among frontend fixtures.I leave it up to the authors of the frontends to refactor these changes in each test suite.themselves. The result is that all test fixtures include the options for
Misc: Added a fix for #4019