-
Notifications
You must be signed in to change notification settings - Fork 63
Refactors partiql-tests-runner for multiple engines #1289
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
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5,827 changes: 5,827 additions & 0 deletions
5,827
test/partiql-tests-runner/conformance_test_results.ion
Large diffs are not rendered by default.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/ConformanceTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.partiql.runner | ||
|
||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.ArgumentsSource | ||
import org.partiql.runner.schema.TestCase | ||
import org.partiql.runner.skip.LANG_KOTLIN_EVAL_EQUIV_FAIL_LIST | ||
import org.partiql.runner.skip.LANG_KOTLIN_EVAL_FAIL_LIST | ||
import org.partiql.runner.test.TestProvider | ||
import org.partiql.runner.test.TestRunner | ||
import org.partiql.runner.test.executor.LegacyExecutor | ||
|
||
/** | ||
* Runs the conformance tests with an expected list of failing tests. Ensures that tests not in the failing list | ||
* succeed with the expected result. Ensures that tests included in the failing list fail. | ||
* | ||
* These tests are included in the normal test/building. | ||
* Update May 2023: Now excluded from the normal build, because the fail lists are out of date. | ||
* TODO: Come up with a low-burden method of maintaining fail / exclusion lists. | ||
*/ | ||
class ConformanceTest { | ||
|
||
private val factory = LegacyExecutor.Factory | ||
private val runner = TestRunner(factory) | ||
|
||
// Tests the eval tests with the Kotlin implementation | ||
@ParameterizedTest(name = "{arguments}") | ||
@ArgumentsSource(TestProvider.Eval::class) | ||
fun validatePartiQLEvalTestData(tc: TestCase) { | ||
when (tc) { | ||
is TestCase.Eval -> runner.test(tc, LANG_KOTLIN_EVAL_FAIL_LIST) | ||
else -> error("Unsupported test case category") | ||
} | ||
} | ||
|
||
// Tests the eval equivalence tests with the Kotlin implementation | ||
@ParameterizedTest(name = "{arguments}") | ||
@ArgumentsSource(TestProvider.Equiv::class) | ||
fun validatePartiQLEvalEquivTestData(tc: TestCase) { | ||
when (tc) { | ||
is TestCase.Equiv -> runner.test(tc, LANG_KOTLIN_EVAL_EQUIV_FAIL_LIST) | ||
else -> error("Unsupported test case category") | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/ConformanceTestReport.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.partiql.runner | ||
|
||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.ArgumentsSource | ||
import org.partiql.runner.report.ReportGenerator | ||
import org.partiql.runner.schema.TestCase | ||
import org.partiql.runner.test.TestProvider | ||
import org.partiql.runner.test.TestRunner | ||
import org.partiql.runner.test.executor.LegacyExecutor | ||
|
||
/** | ||
* Runs the conformance tests without a fail list, so we can document the passing/failing tests in the conformance | ||
* report. | ||
* | ||
* These tests are excluded from normal testing/building unless the `conformanceReport` gradle property is | ||
* specified (i.e. `gradle test ... -PconformanceReport`) | ||
*/ | ||
@ExtendWith(ReportGenerator::class) | ||
class ConformanceTestReport { | ||
|
||
private val factory = LegacyExecutor.Factory | ||
private val runner = TestRunner(factory) | ||
|
||
// Tests the eval tests with the Kotlin implementation without a fail list | ||
@ParameterizedTest(name = "{arguments}") | ||
@ArgumentsSource(TestProvider.Eval::class) | ||
fun validatePartiQLEvalTestData(tc: TestCase) { | ||
when (tc) { | ||
is TestCase.Eval -> runner.test(tc, emptyList()) | ||
else -> error("Unsupported test case category") | ||
} | ||
} | ||
|
||
// Tests the eval equivalence tests with the Kotlin implementation without a fail list | ||
@ParameterizedTest(name = "{arguments}") | ||
@ArgumentsSource(TestProvider.Equiv::class) | ||
fun validatePartiQLEvalEquivTestData(tc: TestCase) { | ||
when (tc) { | ||
is TestCase.Equiv -> runner.test(tc, emptyList()) | ||
else -> error("Unsupported test case category") | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/Ion.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.partiql.runner | ||
|
||
import com.amazon.ion.system.IonSystemBuilder | ||
|
||
/** | ||
* IonSystem for legacy pipelines and value comparison. | ||
*/ | ||
public val ION = IonSystemBuilder.standard().build() |
51 changes: 0 additions & 51 deletions
51
test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/Schema.kt
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/report/ReportGenerator.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.partiql.runner.report | ||
|
||
import com.amazon.ion.IonType | ||
import com.amazon.ion.system.IonTextWriterBuilder | ||
import org.junit.jupiter.api.extension.AfterAllCallback | ||
import org.junit.jupiter.api.extension.ExtensionContext | ||
import org.junit.jupiter.api.extension.TestWatcher | ||
import java.io.File | ||
|
||
class ReportGenerator : TestWatcher, AfterAllCallback { | ||
var failingTests = emptySet<String>() | ||
var passingTests = emptySet<String>() | ||
var ignoredTests = emptySet<String>() | ||
override fun testFailed(context: ExtensionContext?, cause: Throwable?) { | ||
failingTests += context?.displayName ?: "" | ||
super.testFailed(context, cause) | ||
} | ||
|
||
override fun testSuccessful(context: ExtensionContext?) { | ||
passingTests += context?.displayName ?: "" | ||
super.testSuccessful(context) | ||
} | ||
|
||
override fun afterAll(p0: ExtensionContext?) { | ||
val file = File("./conformance_test_results.ion") | ||
val outputStream = file.outputStream() | ||
val writer = IonTextWriterBuilder.pretty().build(outputStream) | ||
writer.stepIn(IonType.STRUCT) // in: outer struct | ||
|
||
// set struct field for passing | ||
writer.setFieldName("passing") | ||
writer.stepIn(IonType.LIST) | ||
passingTests.forEach { passingTest -> | ||
writer.writeString(passingTest) | ||
} | ||
writer.stepOut() | ||
// set struct field for failing | ||
writer.setFieldName("failing") | ||
writer.stepIn(IonType.LIST) | ||
failingTests.forEach { failingTest -> | ||
writer.writeString(failingTest) | ||
} | ||
writer.stepOut() | ||
|
||
// set struct field for ignored | ||
writer.setFieldName("ignored") | ||
writer.stepIn(IonType.LIST) | ||
ignoredTests.forEach { ignoredTest -> | ||
writer.writeString(ignoredTest) | ||
} | ||
writer.stepOut() | ||
|
||
writer.stepOut() // out: outer struct | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/schema/Assertion.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.partiql.runner.schema | ||
|
||
import com.amazon.ion.IonValue | ||
|
||
sealed class Assertion { | ||
data class EvaluationSuccess(val expectedResult: IonValue) : Assertion() | ||
object EvaluationFailure : Assertion() | ||
// TODO: other assertion and test categories: https://github.com/partiql/partiql-tests/issues/35 | ||
} |
6 changes: 6 additions & 0 deletions
6
test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/schema/EquivalenceClass.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.partiql.runner.schema | ||
|
||
data class EquivalenceClass( | ||
val id: String, | ||
val statements: List<String>, | ||
) |
10 changes: 10 additions & 0 deletions
10
test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/schema/Namespace.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.partiql.runner.schema | ||
|
||
import com.amazon.ion.IonStruct | ||
|
||
data class Namespace( | ||
var env: IonStruct, | ||
val namespaces: MutableList<Namespace>, | ||
val testCases: MutableList<TestCase>, | ||
val equivClasses: MutableMap<String, List<String>> | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/schema/TestCase.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.partiql.runner.schema | ||
|
||
import com.amazon.ion.IonStruct | ||
import org.partiql.lang.eval.CompileOptions | ||
|
||
sealed class TestCase { | ||
abstract val name: String | ||
abstract val env: IonStruct | ||
abstract val compileOptions: CompileOptions | ||
abstract val assertion: Assertion | ||
|
||
data class Equiv( | ||
override val name: String, | ||
val statements: List<String>, | ||
override val env: IonStruct, | ||
override val compileOptions: CompileOptions, | ||
override val assertion: Assertion | ||
) : TestCase() { | ||
override fun toString(): String { | ||
return name + ", compileOption: " + compileOptions.typingMode | ||
} | ||
} | ||
|
||
data class Eval( | ||
override val name: String, | ||
val statement: String, | ||
override val env: IonStruct, | ||
override val compileOptions: CompileOptions, | ||
override val assertion: Assertion | ||
) : TestCase() { | ||
override fun toString(): String { | ||
return name + ", compileOption: " + compileOptions.typingMode | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I believe this was an accidental addition. To mitigate this, these results should be placed in some ignored directory like
build
IMO. It doesn't need to be addressed with this PR, but this file should be removed.