Skip to content

Commit f342c56

Browse files
tweak tests
1 parent 5f65669 commit f342c56

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

src/test/scala/genwasym/TestStagedConcolicEval.scala

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,17 @@ class TestStagedConcolicEval extends FunSuite {
7373
println(result)
7474

7575
expect.map(vs => {
76-
val stackValues = result
77-
.split("Stack contents: \n")(1)
78-
.split("\n")
79-
.map(_.toFloat)
80-
.toList
76+
val stackValues = {
77+
val startMarker = "Stack contents: \n"
78+
val endMarker = "End of Stack contents"
79+
val start = result.indexOf(startMarker)
80+
val end = if (start >= 0) result.indexOf(endMarker, start + startMarker.length) else -1
81+
require(start >= 0 && end >= 0, s"Could not find markers '$startMarker' and '$endMarker' in output")
82+
result.substring(start + startMarker.length, end).trim
83+
.split("\n")
84+
.map(_.toFloat)
85+
.toList
86+
}
8187
assert(vs == stackValues)
8288
})
8389
}
@@ -113,10 +119,11 @@ class TestStagedConcolicEval extends FunSuite {
113119
}
114120
test("btree-bug-finding-concolic") { testFileConcolicCpp("./benchmarks/wasm/btree/2o1u-unlabeled.wat", exitByCoverage = true) }
115121

116-
test("long-trivial-execution-concrete") {
117-
// This is a example to show how much performance improvement we can get by immutable data structure
118-
testFileConcreteCpp("./benchmarks/wasm/staged/long-trivial-execution.wat", None)
119-
}
122+
// Don't run this test by default since it takes too long and is only for performance comparison
123+
// test("long-trivial-execution-concrete") {
124+
// // This is a example to show how much performance improvement we can get by immutable data structure
125+
// testFileConcreteCpp("./benchmarks/wasm/staged/long-trivial-execution.wat", None)
126+
// }
120127

121128
test("return-poly - concrete") {
122129
testFileConcreteCpp("./benchmarks/wasm/staged/return_poly.wat", Some("$real_main"), expect=Some(List(42)))

src/test/scala/genwasym/TestStagedEval.scala

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ class TestStagedEval extends FunSuite {
3636
println(result)
3737

3838
expect.map(vs => {
39-
val stackValues = result
40-
.split("Stack contents: \n")(1)
41-
.split("\n")
42-
.map(_.toFloat)
43-
.toList
39+
val stackValues = {
40+
val startMarker = "Stack contents: \n"
41+
val endMarker = "End of Stack contents"
42+
val start = result.indexOf(startMarker)
43+
val end = if (start >= 0) result.indexOf(endMarker, start + startMarker.length) else -1
44+
require(start >= 0 && end >= 0, s"Could not find markers '$startMarker' and '$endMarker' in output")
45+
result.substring(start + startMarker.length, end).trim
46+
.split("\n")
47+
.map(_.toFloat)
48+
.toList
49+
}
4450
assert(vs == stackValues)
4551
})
4652
}

0 commit comments

Comments
 (0)