summaryrefslogtreecommitdiff
path: root/opendc-experiments/opendc-experiments-m3sa/src/test/kotlin
diff options
context:
space:
mode:
authorRadu Nicolae <rnicolae04@gmail.com>2025-06-16 18:01:07 +0200
committerGitHub <noreply@github.com>2025-06-16 18:01:07 +0200
commit0df3d9ced743ac3385dd710c7133a6cf369b051c (patch)
treeeff5d6d67c275643e229731ba08c5fe7dc4ccd0a /opendc-experiments/opendc-experiments-m3sa/src/test/kotlin
parentc7e303ad1b5217e2ff24cee9538ac841d6149706 (diff)
integrated M3SA, updated with tests and CpuPowerModels
Diffstat (limited to 'opendc-experiments/opendc-experiments-m3sa/src/test/kotlin')
-rw-r--r--opendc-experiments/opendc-experiments-m3sa/src/test/kotlin/org/opendc/experiments/m3sa/M3SARunnerTest.kt50
1 files changed, 50 insertions, 0 deletions
diff --git a/opendc-experiments/opendc-experiments-m3sa/src/test/kotlin/org/opendc/experiments/m3sa/M3SARunnerTest.kt b/opendc-experiments/opendc-experiments-m3sa/src/test/kotlin/org/opendc/experiments/m3sa/M3SARunnerTest.kt
new file mode 100644
index 00000000..8d8bae5f
--- /dev/null
+++ b/opendc-experiments/opendc-experiments-m3sa/src/test/kotlin/org/opendc/experiments/m3sa/M3SARunnerTest.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2025 AtLarge Research
+ *
+ * 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 org.opendc.experiments.m3sa
+
+import org.junit.jupiter.api.Assertions.assertDoesNotThrow
+import org.junit.jupiter.api.Assertions.assertTrue
+import org.junit.jupiter.api.Test
+import org.opendc.experiments.m3sa.runner.main
+import java.io.File
+
+class M3SARunnerTest {
+ @Test
+ fun `Run M3SA-OpenDC full integration 1`() {
+ val scenarioJson = "src/test/resources/scenarios/experiment1/scenario_metamodel.json"
+ val outDir = "src/test/resources/outputs/"
+ val m3saPath = "src/test/resources/m3saSetups/experiment1/m3saSetup.json"
+ val m3saExecPath = "src/main/python"
+ File(outDir).deleteRecursively()
+
+ assertDoesNotThrow {
+ main(
+ arrayOf("--experiment-path", scenarioJson, "--m3sa-setup-path", m3saPath, "--m3sa-exec-path", m3saExecPath),
+ )
+ }
+
+ assertTrue(File(outDir).exists(), "Expected simulation to create $outDir")
+ assertTrue(File("$outDir/trackr.json").exists(), "Expected trackr.json to be created in $outDir")
+ assertTrue(File("$outDir/trackr.json").readText().isNotEmpty(), "Expected trackr.json to contain data")
+ }
+}