From d8bfb02fa54c664cf13189968b3ee9dce28e71e1 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Tue, 28 Nov 2017 17:19:06 +0300 Subject: [PATCH] fix env_native_export_entry_type_check Also ignore "import_env_mutable_global". --- src/interpreter/tests/basics.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/interpreter/tests/basics.rs b/src/interpreter/tests/basics.rs index 637e9f7..1de0e9d 100644 --- a/src/interpreter/tests/basics.rs +++ b/src/interpreter/tests/basics.rs @@ -432,6 +432,8 @@ fn native_custom_error() { assert_eq!(user_error2.downcast_ref::().unwrap(), &UserErrorWithCode { error_code: 777 }); } +// TODO: Move into pwasm-emscripten +#[ignore] #[test] fn import_env_mutable_global() { let program = ProgramInstance::with_emscripten_env(Default::default()).unwrap(); @@ -445,12 +447,20 @@ fn import_env_mutable_global() { #[test] fn env_native_export_entry_type_check() { - let program = ProgramInstance::with_emscripten_env(Default::default()).unwrap(); + let program = ProgramInstance::new(); + let env_module = module() + .memory() + .with_min(1) + .build() + .with_export(ExportEntry::new("memory".into(), Internal::Memory(0))) + .build(); + let env_instance = program.add_module("env", env_module, None).unwrap(); + let env_memory = env_instance.memory(ItemIndex::Internal(0)).unwrap(); let mut function_executor = FunctionExecutor { - memory: program.module("env").unwrap().memory(ItemIndex::Internal(0)).unwrap(), + memory: env_memory, values: Vec::new(), }; - let native_env_instance = native_module(program.module("env").unwrap(), UserDefinedElements { + let native_env_instance = native_module(env_instance, UserDefinedElements { executor: Some(&mut function_executor), globals: vec![("ext_global".into(), Arc::new(VariableInstance::new(false, VariableType::I32, RuntimeValue::I32(1312)).unwrap()))].into_iter().collect(), functions: ::std::borrow::Cow::from(SIGNATURES),