IJPL-442: add tests for CEF vmoptions

GitOrigin-RevId: 27e3304c08bb8e7517096c0157bec957f1f07f59
This commit is contained in:
Ivan Pashchenko
2024-03-27 16:23:43 +01:00
committed by intellij-monorepo-bot
parent 02a11ebaf8
commit 0249876623
2 changed files with 21 additions and 1 deletions

View File

@@ -10,6 +10,9 @@ mod tests {
use xplat_launcher::jvm_property;
use crate::utils::*;
#[cfg(target_os = "windows")]
use xplat_launcher::cef_generated::CEF_VERSION;
#[test]
fn correct_launcher_startup_test() {
run_launcher(LauncherRunSpec::standard().assert_status());
@@ -79,10 +82,27 @@ mod tests {
let path = PathBuf::from(vm_option.split_once('=').unwrap().1);
assert_eq!(vm_options_file.canonicalize().unwrap(), path.canonicalize().unwrap());
// hardcoded vmoptions
assert_vm_option_presence(&dump, "-Dide.native.launcher=true");
dump.vmOptions.iter().find(|s| s.starts_with("-XX:ErrorFile="))
.unwrap_or_else(|| panic!("'-XX:ErrorFile=' is not in {:?}", dump.vmOptions));
}
#[test]
#[cfg(target_os = "windows")]
fn cef_sandbox_vm_options_test() {
let test = prepare_test_env(LauncherLocation::Standard);
let vm_options_name = "xplat64.exe.vmoptions";
let vm_options_file = test.dist_root.join("bin").join(vm_options_name);
let dump = run_launcher_ext(&test, LauncherRunSpec::standard().with_dump().assert_status()).dump();
assert_vm_option_presence(&dump, format!("-Djcef.sandbox.cefVersion={CEF_VERSION}").as_ref());
dump.vmOptions.iter().find(|s| s.starts_with("-Djcef.sandbox.ptr="))
.unwrap_or_else(|| panic!("'-Djcef.sandbox.ptr=' is not in {:?}", dump.vmOptions));
}
#[test]
fn path_macro_expansion_test() {
let test = prepare_test_env(LauncherLocation::Standard);

View File

@@ -156,7 +156,7 @@ struct TestEnvironmentShared {
fn prepare_test_env_impl<'a>(launcher_location: LauncherLocation, with_jbr: bool) -> Result<TestEnvironment<'a>> {
INIT.call_once(|| {
let shared = init_test_environment_once().expect("Failed to init shared test environment");
let shared = init_test_environment_once().context("Failed to init shared test environment").unwrap();
unsafe {
SHARED = Some(shared)
}