Commit 85259936 authored by Carsten Heinz's avatar Carsten Heinz Committed by Lukas Sommer

Remove power report from scala tests

parent 331d0f50
Pipeline #1312 passed with stages
in 193 minutes and 19 seconds
......@@ -46,24 +46,20 @@ class ReportManagerSpec extends FlatSpec with Matchers {
Files.walkFileTree(p, visitor)
}
private def setupStructure(p: Path): (Path, Path, Path, Path) = {
private def setupStructure(p: Path): (Path, Path, Path) = {
val cosimPath = p.resolve("arraysum").resolve("axi4mm").resolve("vc709").resolve("ipcore")
val powerPath = p.resolve("arrayinit").resolve("blueline").resolve("zedboard").resolve("ipcore")
val synthPath = p.resolve("aes").resolve("blackline").resolve("zc706").resolve("ipcore")
val timingPath = p.resolve("test").resolve("axi4mm").resolve("zc706").resolve("ipcore")
Files.createDirectories(cosimPath)
Files.createDirectories(powerPath)
Files.createDirectories(synthPath)
Files.createDirectories(timingPath)
Files.copy(TAPASCO_HOME.resolve("report-examples").resolve("correct-cosim1.rpt"),
cosimPath.resolve("arraysum_cosim.rpt"))
Files.copy(TAPASCO_HOME.resolve("report-examples").resolve("correct-power1.rpt"),
powerPath.resolve("power.rpt"))
Files.copy(TAPASCO_HOME.resolve("report-examples").resolve("correct-synth1.rpt"),
synthPath.resolve("aes_export.xml"))
Files.copy(TAPASCO_HOME.resolve("report-examples").resolve("correct-timing.rpt"),
timingPath.resolve("timing.rpt"))
(cosimPath, powerPath, synthPath, timingPath)
(cosimPath, synthPath, timingPath)
}
"All reports in existing directory structure" should "be found and built correctly" in {
......@@ -76,17 +72,12 @@ class ReportManagerSpec extends FlatSpec with Matchers {
bpm += rc.basePathListener
assert(rc.timingReports.size == 1)
assert(rc.synthReports.size == 1)
assert(rc.powerReports.size == 1)
assert(rc.timingReports.size == 1)
val r1 = rc.cosimReport("arraysum", "axi4mm", "vc709")
assert(r1.nonEmpty)
assert(r1.get.latency.avg == 280)
val r2 = rc.powerReport("arrayinit", "blueline", "zedboard")
assert(r2.nonEmpty)
assert(r2.get.totalOnChipPower map (_ == 0.33) getOrElse false)
val r3 = rc.synthReport("aes", "blackline", "zc706")
assert(r3.nonEmpty)
assert(r3.get.area.nonEmpty)
......@@ -103,7 +94,7 @@ class ReportManagerSpec extends FlatSpec with Matchers {
import Entities._
val p = Files.createTempDirectory("tapasco-reportcache-").resolve("core")
val dw = DirectoryWatcher(p)
val (p1, p2, p3, p4) = setupStructure(p)
val (p1, p2, p3) = setupStructure(p)
val bpm = new BasePathManager
bpm.basepath(Cores).set(p)
val rc = new ReportManager(bpm.basepath(Cores))
......@@ -113,7 +104,6 @@ class ReportManagerSpec extends FlatSpec with Matchers {
assert(rc.timingReports.size == 1)
assert(rc.synthReports.size == 1)
assert(rc.powerReports.size == 1)
assert(rc.timingReports.size == 1)
val r1 = rc.cosimReport("arraysum", "axi4mm", "vc709")
......@@ -129,14 +119,6 @@ class ReportManagerSpec extends FlatSpec with Matchers {
assert(r2.nonEmpty)
assert(r2.get.latency.avg == 2279)
val r3 = rc.powerReport("arrayinit", "blueline", "zedboard")
assert(r3.nonEmpty)
Files.delete(r3.get.file)
Thread.sleep(FS_SLEEP)
assert(rc.powerReports.size == 0)
dw.stop()
markForDeletion(p)
}
......@@ -153,14 +135,12 @@ class ReportManagerSpec extends FlatSpec with Matchers {
assert(rc.timingReports.size == 1)
assert(rc.synthReports.size == 1)
assert(rc.powerReports.size == 1)
assert(rc.timingReports.size == 1)
bpm.basepath(Cores).set(p2)
assert(rc.timingReports.size == 0)
assert(rc.synthReports.size == 0)
assert(rc.powerReports.size == 0)
assert(rc.timingReports.size == 0)
markForDeletion(p1)
......
//
// Copyright (C) 2017 Jens Korinth, TU Darmstadt
//
// This file is part of Tapasco (TPC).
//
// Tapasco is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tapasco is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
//
/**
* @file PowerReportTest.scala
* @brief Unit tests for PowerReport model.
* @authors J. Korinth, TU Darmstadt (jk@esa.cs.tu-darmstadt.de)
**/
package de.tu_darmstadt.cs.esa.tapasco.reports
import org.scalatest._
import java.nio.file._
class PowerReportSpec extends FlatSpec with Matchers {
val reportPath = Paths.get("report-examples").toAbsolutePath
"A missing PowerReport file" should "result in None" in {
PowerReport(reportPath.resolve("missing.rpt")) shouldBe empty
}
"An invalid PowerReport file" should "result in None" in {
PowerReport(reportPath.resolve("correct-timing.rpt")) shouldBe empty
}
"A correct PowerReport file" should "be parsed correctly" in {
val oc = PowerReport(reportPath.resolve("correct-power1.rpt"))
lazy val r = oc.get
oc should not be empty
r.totalOnChipPower should be (Some(0.33))
r.dynamicPower should be (Some(0.006))
r.staticPower should be (Some(0.324))
r.confidenceLevel should be (Some("Low"))
val oc2 = PowerReport(reportPath.resolve("correct-power2.rpt"))
lazy val r2 = oc2.get
oc2 should not be empty
r2.totalOnChipPower should be (Some(0.231))
r2.dynamicPower should be (Some(0.007))
r2.staticPower should be (Some(0.224))
r2.confidenceLevel should be (Some("Low"))
val oc3 = PowerReport(reportPath.resolve("correct-power3.rpt"))
lazy val r3 = oc3.get
oc3 should not be empty
r3.totalOnChipPower should be (Some(0.123))
r3.dynamicPower should be (Some(0.005))
r3.staticPower should be (Some(0.118))
r3.confidenceLevel should be (Some("Low"))
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment