Skip to content

Commit

Permalink
structure refactoring; output of 64spec test framework
Browse files Browse the repository at this point in the history
* structure refactoring; output of 64spec test framework
* update doc
  • Loading branch information
maciejmalecki authored Apr 9, 2022
1 parent d9d6676 commit fee5ee8
Show file tree
Hide file tree
Showing 31 changed files with 157 additions and 36 deletions.
3 changes: 3 additions & 0 deletions CHANGES.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
= Change log

1.5.3::
* `64spec`: Dumping output of the 64spec to the build output - exact test results are visible now.

1.5.2::
* `Charpad`: Adding CTM8 prototype compatibility flag; support for CTM 8/CTM 8.2 as handled by Charpad Pro 3.10.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SOFTWARE.
package com.github.c64lib.retroassembler.binary_interleaver

import com.github.c64lib.processor.commons.BinaryOutput
import com.github.c64lib.retroassembler.domain.shared.IllegalInputException
import com.github.c64lib.rbt.domain.shared.IllegalInputException
import io.vavr.collection.Seq

class BinaryInterleaver(private val outputs: Seq<BinaryOutput>) : BinaryOutput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ SOFTWARE.
*/
package com.github.c64lib.retroassembler.binary_interleaver

import com.github.c64lib.rbt.domain.shared.IllegalInputException
import com.github.c64lib.retroassembler.binutils.BinaryOutputMock
import com.github.c64lib.retroassembler.domain.shared.IllegalInputException
import io.vavr.collection.List
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Assertions.fail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ package com.github.c64lib.retroassembler.charpad_processor.producer

import com.github.c64lib.processor.commons.Output
import com.github.c64lib.processor.commons.OutputProducer
import com.github.c64lib.rbt.domain.shared.IllegalInputException
import com.github.c64lib.retroassembler.charpad_processor.model.MapCoord
import com.github.c64lib.retroassembler.domain.shared.IllegalInputException

class MapProducer(
private val leftTop: MapCoord,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ SOFTWARE.
*/
package com.github.c64lib.processor.commons

import com.github.c64lib.retroassembler.domain.shared.OutOfDataException
import com.github.c64lib.rbt.domain.shared.OutOfDataException

/**
* Produces binary output from binary input.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ package com.github.c64lib.retroassembler.spritepad_processor

import com.github.c64lib.processor.commons.BinaryProducer
import com.github.c64lib.processor.commons.Output
import com.github.c64lib.retroassembler.domain.shared.OutOfDataException
import com.github.c64lib.rbt.domain.shared.OutOfDataException

class SpriteProducer(val start: Int = 0, private val end: Int = 65536, output: Output<ByteArray>) :
BinaryProducer(output) {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ java {
allprojects {

group = "com.github.c64lib"
version = "1.5.2"
version = "1.5.3"

if (project.hasProperty(tagPropertyName)) {
version = project.property(tagPropertyName) ?: version
Expand Down
Binary file added doc/img/pipelines.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions doc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
:stem: latexmath
:docinfo:
:actualKickAssVersion: 5.23
:actualDockerVersion: 0.1.5
:actualPluginVersion: 1.5.1
:actualDockerVersion: 0.1.6
:actualPluginVersion: 1.5.3

Retro Build Tool brings automation to the C64 software building process.
It is implemented as a Gradle plugin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.c64lib.retroassembler.domain
package com.github.c64lib.rbt.domain

enum class AssemblerType {
KickAssembler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.c64lib.retroassembler.domain
package com.github.c64lib.rbt.domain.dependency

data class Dependency(
val type: DependencyType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.c64lib.retroassembler.domain
package com.github.c64lib.rbt.domain.dependency

enum class DependencyType {
GitHub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.c64lib.retroassembler.domain
package com.github.c64lib.rbt.domain.dependency

data class DependencyVersion(val version: String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
MIT License
Copyright (c) 2018-2022 c64lib: The Ultimate Commodore 64 Library
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.c64lib.rbt.domain.pipeline

class ElementNotFoundException(elementId: String) :
RuntimeException("Element identified by $elementId not found")
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
MIT License
Copyright (c) 2018-2022 c64lib: The Ultimate Commodore 64 Library
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.c64lib.rbt.domain.pipeline

class Entries(val values: List<Entry>) {

private val indexedValues = values.associateBy { it.id }

fun get(id: String) = indexedValues[id] ?: throw ElementNotFoundException(id)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
MIT License
Copyright (c) 2018-2022 c64lib: The Ultimate Commodore 64 Library
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.c64lib.rbt.domain.pipeline

interface Entry {
val id: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
MIT License
Copyright (c) 2018-2022 c64lib: The Ultimate Commodore 64 Library
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.c64lib.rbt.domain.pipeline

interface Step {

val inputs: Entries

val outputs: Entries
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.c64lib.retroassembler.domain.shared
package com.github.c64lib.rbt.domain.shared

/** Error that indicates wrong general configuration of the plugin. */
class IllegalConfigurationException(msg: String) : RuntimeException(msg)
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.c64lib.retroassembler.domain.shared
package com.github.c64lib.rbt.domain.shared

/** Error that indicates wrong arrangement of input configuration / parameters. */
class IllegalInputException(msg: String) : RuntimeException(msg)
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.c64lib.retroassembler.domain.shared
package com.github.c64lib.rbt.domain.shared

class OutOfDataException(message: String) : RuntimeException(message)
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ SOFTWARE.
*/
package com.github.c64lib.gradle

import com.github.c64lib.retroassembler.domain.AssemblerType
import com.github.c64lib.retroassembler.domain.Dependency
import com.github.c64lib.retroassembler.domain.DependencyType
import com.github.c64lib.retroassembler.domain.DependencyVersion
import com.github.c64lib.rbt.domain.AssemblerType
import com.github.c64lib.rbt.domain.dependency.Dependency
import com.github.c64lib.rbt.domain.dependency.DependencyType
import com.github.c64lib.rbt.domain.dependency.DependencyVersion

const val EXTENSION_DSL_NAME = "retroProject"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ package com.github.c64lib.gradle.asms

import com.github.c64lib.gradle.RetroAssemblerPluginExtension
import com.github.c64lib.gradle.asms.kickassembler.KickAssemblerFacade
import com.github.c64lib.retroassembler.domain.AssemblerType
import com.github.c64lib.rbt.domain.AssemblerType
import java.io.File
import org.gradle.api.GradleException
import org.gradle.api.Project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ package com.github.c64lib.gradle.asms

import com.github.c64lib.gradle.asms.kickassembler.KickAssemblerSrcWriter
import com.github.c64lib.gradle.preprocess.TextOutputBuffer
import com.github.c64lib.retroassembler.domain.AssemblerType
import com.github.c64lib.rbt.domain.AssemblerType
import org.gradle.api.GradleException

interface AssemblySrcWriter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ package com.github.c64lib.gradle.deps

import com.github.c64lib.gradle.GROUP_BUILD
import com.github.c64lib.gradle.RetroAssemblerPluginExtension
import com.github.c64lib.retroassembler.domain.Dependency
import com.github.c64lib.retroassembler.domain.DependencyType
import com.github.c64lib.rbt.domain.dependency.Dependency
import com.github.c64lib.rbt.domain.dependency.DependencyType
import de.undercouch.gradle.tasks.download.Download
import java.io.File
import org.gradle.api.DefaultTask
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ SOFTWARE.
package com.github.c64lib.gradle.preprocess

import com.github.c64lib.processor.commons.BinaryOutput
import com.github.c64lib.rbt.domain.shared.IllegalConfigurationException
import com.github.c64lib.retroassembler.binary_interleaver.BinaryInterleaver
import com.github.c64lib.retroassembler.domain.shared.IllegalConfigurationException
import com.github.c64lib.retroassembler.nybbler.Nybbler
import io.vavr.collection.List
import java.io.File
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ SOFTWARE.
*/
package com.github.c64lib.gradle.preprocess

import com.github.c64lib.retroassembler.domain.shared.IllegalConfigurationException
import com.github.c64lib.rbt.domain.shared.IllegalConfigurationException
import java.io.File
import javax.inject.Inject
import org.gradle.api.file.ProjectLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ package com.github.c64lib.gradle.preprocess.charpad
import com.github.c64lib.gradle.preprocess.FileTextOutputBuffer
import com.github.c64lib.gradle.preprocess.OutputExtension
import com.github.c64lib.gradle.preprocess.TextOutputBuffer
import com.github.c64lib.retroassembler.domain.AssemblerType
import com.github.c64lib.rbt.domain.AssemblerType
import java.io.File
import javax.inject.Inject
import org.gradle.api.file.ProjectLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ open class AssembleSpec : DefaultTask() {
"-vicesymbols",
":on_exit=jam",
":write_final_results_to_file=true",
":change_character_set=true",
":result_file_name=" + resultFileName(file))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.github.c64lib.gradle.RetroAssemblerPluginExtension
import com.github.c64lib.gradle.emu.vice.AutostartPrgMode
import com.github.c64lib.gradle.emu.vice.JamAction
import com.github.c64lib.gradle.emu.vice.Vice
import com.github.c64lib.retroassembler.domain.AssemblerType
import com.github.c64lib.rbt.domain.AssemblerType
import java.io.File
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ package com.github.c64lib.gradle.spec
import java.io.File

class TestReport(private val testFiles: List<File>) {
private class ResultCounters(val success: Int = 0, val total: Int = 0) {
private class Result(val outputText: String, val success: Int = 0, val total: Int = 0) {

val isPositive: Boolean
get() = success == total
Expand All @@ -38,30 +38,30 @@ class TestReport(private val testFiles: List<File>) {
"FAILED"
}

override fun toString(): String = "($success/$total) " + tag()
override fun toString(): String = "($success/$total) ${tag()}"
}

fun generateTestReport(outputFn: (value: String) -> Unit): Boolean {
val result =
testFiles.map { file -> resultFile(file) }.fold(ResultCounters()) { result, fileName ->
testFiles.map { file -> resultFile(file) }.fold(Result("")) { result, fileName ->
val file = File(fileName)
outputFn(file.name)
val testOutput = fromPetscii(file.readBytes())
val counts = parseTestOutput(testOutput)
outputFn("Tests execution $counts")
ResultCounters(result.success + counts.success, result.total + counts.total)
outputFn("Tests execution ${counts.outputText}")
Result("", result.success + counts.success, result.total + counts.total)
}
outputFn("Overall test report $result")
return result.isPositive
}

private fun parseTestOutput(outputText: String): ResultCounters {
private fun parseTestOutput(outputText: String): Result {
val regex = Regex("\\((\\d+)/(\\d+)\\)")
val matchResult: MatchResult? = regex.find(outputText)
return if (matchResult != null) {
ResultCounters(matchResult.groupValues[1].toInt(), matchResult.groupValues[2].toInt())
Result(outputText, matchResult.groupValues[1].toInt(), matchResult.groupValues[2].toInt())
} else {
ResultCounters()
Result(outputText)
}
}

Expand Down
Loading

0 comments on commit fee5ee8

Please sign in to comment.