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

Add IR output verification to sample test #3

Merged
merged 5 commits into from
Oct 1, 2020

Conversation

rorbech
Copy link
Contributor

@rorbech rorbech commented Sep 15, 2020

Just a quick and dirty addition outlining a principle to allow IR output verification

@rorbech rorbech requested a review from nhachicha September 15, 2020 12:48
@rorbech
Copy link
Contributor Author

rorbech commented Sep 15, 2020

Hmm. IR output seems to hold machine specific paths.

val result = KotlinCompilation().apply {
sources = listOf(SourceFile.fromPath(resource))
sources = inputs.fileMap.values.map { SourceFile.fromPath(it)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it is just me, but when using it so far down a call chain, I'm not sure at all what it is? Some entries in a map, but the context is gone

@nhachicha
Copy link
Collaborator

nhachicha commented Sep 16, 2020

@rorbech
Copy link
Contributor Author

rorbech commented Sep 29, 2020

@rorbech there's also an AbstractIrGeneratorTestCase used for example in https://github.com/JetBrains/kotlin/blob/master/compiler/tests/org/jetbrains/kotlin/ir/IrJsTextTestCaseGenerated.java which validates the IR against a predefined file https://github.com/JetBrains/kotlin/blob/master/compiler/testData/ir/irJsText/dynamic/dynamicElvisOperator.txt
(corresponding Kotlin file
https://github.com/JetBrains/kotlin/blob/master/compiler/testData/ir/irJsText/dynamic/dynamicElvisOperator.kt)
We could use the same logic as JB for Ir testing ...

The kotlin infrastructure around this is quite massive and are not (as far as I can see) easily reusable in our context. My take would just be to merge the simple convention about having input, output and expected for each test case and add glue around as needed.

@rorbech rorbech requested a review from nhachicha September 29, 2020 11:36
@rorbech rorbech merged commit bbdb9be into master Oct 1, 2020
@rorbech rorbech deleted the cr/inspectable-ir-verification branch October 1, 2020 11:29
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants