Skip to content

Commit f466778

Browse files
committed
Add a test for setup-ide + bsp import with JMH enabled
1 parent 41a90b5 commit f466778

File tree

1 file changed

+34
-0
lines changed
  • modules/integration/src/test/scala/scala/cli/integration

1 file changed

+34
-0
lines changed

modules/integration/src/test/scala/scala/cli/integration/JmhTests.scala

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,40 @@ class JmhTests extends ScalaCliSuite with JmhSuite with BspSuite {
7373
}
7474
}
7575

76+
test(s"setup-ide + bsp ($testMessage)") {
77+
val inputs = simpleBenchmarkingInputs(directiveString)
78+
inputs.fromRoot { root =>
79+
os.proc(TestUtil.cli, "setup-ide", "--power", extraOptions, ".", jmhOptions)
80+
.call(cwd = root)
81+
val ideOptionsPath = root / Constants.workspaceDirName / "ide-options-v2.json"
82+
expect(ideOptionsPath.toNIO.toFile.exists())
83+
val ideLauncherOptsPath = root / Constants.workspaceDirName / "ide-launcher-options.json"
84+
expect(ideLauncherOptsPath.toNIO.toFile.exists())
85+
val ideEnvsPath = root / Constants.workspaceDirName / "ide-envs.json"
86+
expect(ideEnvsPath.toNIO.toFile.exists())
87+
val jsonOptions = List(
88+
"--json-options",
89+
ideOptionsPath.toString,
90+
"--json-launcher-options",
91+
ideLauncherOptsPath.toString,
92+
"--envs-file",
93+
ideEnvsPath.toString
94+
)
95+
withBsp(inputs, Seq("."), bspOptions = jsonOptions, reuseRoot = Some(root)) {
96+
(_, _, remoteServer) =>
97+
async {
98+
val buildTargetsResp = await(remoteServer.workspaceBuildTargets().asScala)
99+
val targets = buildTargetsResp.getTargets.asScala.map(_.getId).toSeq
100+
expect(targets.length == 2)
101+
102+
val compileResult =
103+
await(remoteServer.buildTargetCompile(new b.CompileParams(targets.asJava)).asScala)
104+
expect(compileResult.getStatusCode == b.StatusCode.OK)
105+
}
106+
}
107+
}
108+
}
109+
76110
test(s"package ($testMessage)") {
77111
// TODO make package with --jmh build an artifact that actually runs benchmarks
78112
val expectedMessage = "Placeholder main method"

0 commit comments

Comments
 (0)