1
0
mirror of https://github.com/KarolS/millfork.git synced 2025-02-04 18:32:38 +00:00

Make tests toggleable by platform

This commit is contained in:
Karol Stasiak 2019-06-12 02:58:33 +02:00
parent 3b3fb24284
commit 4ec2fc2f62
3 changed files with 49 additions and 13 deletions

View File

@ -130,28 +130,31 @@ object EmuCrossPlatformBenchmarkRun {
if (platforms.isEmpty) {
throw new RuntimeException("Dude, test at least one platform")
}
if (platforms.contains(millfork.Cpu.Mos)) {
if (Settings.enable6502Tests && platforms.contains(millfork.Cpu.Mos)) {
EmuBenchmarkRun.apply(source)(verifier)
}
if (platforms.contains(millfork.Cpu.StrictMos)) {
if (Settings.enable6502Tests && platforms.contains(millfork.Cpu.StrictMos)) {
EmuBenchmarkRun.apply(source)(verifier)
}
if (platforms.contains(millfork.Cpu.Ricoh)) {
if (Settings.enableRicohTests && platforms.contains(millfork.Cpu.Ricoh)) {
verifier(EmuUndocumentedRun.apply(source))
}
if (platforms.contains(millfork.Cpu.Cmos)) {
if (Settings.enable65C02Tests && platforms.contains(millfork.Cpu.Cmos)) {
EmuCmosBenchmarkRun.apply(source)(verifier)
}
if (Settings.enableWdc85816Tests && platforms.contains(millfork.Cpu.Sixteen)) {
EmuNative65816BenchmarkRun.apply(source)(verifier)
}
if (platforms.contains(millfork.Cpu.Z80)) {
if (Settings.enableZ80Tests && platforms.contains(millfork.Cpu.Z80)) {
EmuZ80BenchmarkRun.apply(source)(verifier)
}
if (platforms.contains(millfork.Cpu.Intel8080)) {
if (Settings.enableGameboyTests && platforms.contains(millfork.Cpu.Intel8080)) {
EmuIntel8080BenchmarkRun.apply(source)(verifier)
}
if (platforms.contains(millfork.Cpu.Sharp)) {
if (Settings.enableUnemulatedTests && platforms.contains(millfork.Cpu.Intel8085)) {
EmuUnoptimizedIntel8085Run.apply(source)
}
if (Settings.enableGameboyTests && platforms.contains(millfork.Cpu.Sharp)) {
EmuSharpBenchmarkRun.apply(source)(verifier)
}
if (Settings.enableIntel8086Tests && platforms.contains(millfork.Cpu.Intel8086)) {

View File

@ -15,27 +15,27 @@ object EmuUnoptimizedCrossPlatformRun {
val (_, mi) = if (platforms.contains(Cpu.Intel8080)) EmuUnoptimizedIntel8080Run.apply2(source) else Timings(-1, -1) -> null
val (_, ms) = if (platforms.contains(Cpu.Sharp)) EmuUnoptimizedSharpRun.apply2(source) else Timings(-1, -1) -> null
val (_, mx) = if (Settings.enableIntel8086Tests && platforms.contains(Cpu.Intel8086)) EmuUnoptimizedIntel8086Run.apply2(source) else Timings(-1, -1) -> null
if (platforms.contains(Cpu.Mos)) {
if (Settings.enable6502Tests && platforms.contains(Cpu.Mos)) {
println(f"Running 6502")
verifier(mm)
}
if (platforms.contains(millfork.Cpu.Ricoh)) {
if (Settings.enableRicohTests && platforms.contains(millfork.Cpu.Ricoh)) {
println(f"Running Ricoh")
verifier(mn)
}
if (platforms.contains(Cpu.Cmos)) {
if (Settings.enable65C02Tests && platforms.contains(Cpu.Cmos)) {
println(f"Running 65C02")
verifier(mc)
}
if (platforms.contains(Cpu.Z80)) {
if (Settings.enableZ80Tests && platforms.contains(Cpu.Z80)) {
println(f"Running Z80")
verifier(mz)
}
if (platforms.contains(Cpu.Intel8080)) {
if (Settings.enableIntel8080Tests && platforms.contains(Cpu.Intel8080)) {
println(f"Running 8080")
verifier(mi)
}
if (platforms.contains(Cpu.Sharp)) {
if (Settings.enableGameboyTests && platforms.contains(Cpu.Sharp)) {
println(f"Running LR35902")
verifier(ms)
}

View File

@ -9,6 +9,7 @@ object Settings {
* Should the Intel 8086 tests be enabled?
* Intel 8086 tests:
* - are slow
* leak memory
* - don't work on headless JRE's
* open annoying windows on graphical JRE's
* test only the 8080-to-8086 translation
@ -27,4 +28,36 @@ object Settings {
*/
val enableWdc85816Tests: Boolean = false
/**
* Should the Ricoh tests be enabled?
* Ricoh tests:
* - don't differ from 6502 tests a lot
* are reasonably unfrequentE
* are fast
* so they are enabled by default
*/
val enableRicohTests: Boolean = true
/**
* Should tests that don't run emulated code be enabled?
* Unemulated tests:
* test only that code generation doesn't crash
* usually cover platforms similar to emulated ones
* are reasonably fast
* so they are enabled by default
*/
val enableUnemulatedTests: Boolean = true
// the following are the core platforms and they are all tested by default
val enable6502Tests: Boolean = true
val enable65C02Tests: Boolean = true
val enableIntel8080Tests: Boolean = true
val enableZ80Tests: Boolean = true
val enableGameboyTests: Boolean = true
}