summaryrefslogtreecommitdiff
path: root/tests/thread.rs
diff options
context:
space:
mode:
authorAlex Orlenko <zxteam@protonmail.com>2019-10-16 10:56:44 +0100
committerAlex Orlenko <zxteam@protonmail.com>2019-11-04 22:23:15 +0000
commit6f42a6cca9798fc3effcd13e1b5423ab24e5ae04 (patch)
treee44266b4afd398abb22b4488b0758c8f9e639ae4 /tests/thread.rs
parent29aa25a48b04534ec71f072e7c9fe183d7c8bdf9 (diff)
downloadmlua-6f42a6cca9798fc3effcd13e1b5423ab24e5ae04.zip
Add LuaJIT support
Diffstat (limited to 'tests/thread.rs')
-rw-r--r--tests/thread.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/thread.rs b/tests/thread.rs
index 211e4eb..cd09002 100644
--- a/tests/thread.rs
+++ b/tests/thread.rs
@@ -1,3 +1,14 @@
+#![cfg_attr(
+ all(feature = "luajit", target_os = "macos", target_arch = "x86_64"),
+ feature(link_args)
+)]
+
+#[cfg_attr(
+ all(feature = "luajit", target_os = "macos", target_arch = "x86_64"),
+ link_args = "-pagezero_size 10000 -image_base 100000000"
+)]
+extern "system" {}
+
use std::panic::catch_unwind;
use mlua::{Error, Function, Lua, Result, Thread, ThreadStatus};
@@ -100,9 +111,9 @@ fn coroutine_from_closure() -> Result<()> {
let thrd_main = lua.create_function(|_, ()| Ok(()))?;
lua.globals().set("main", thrd_main)?;
- #[cfg(feature = "lua53")]
+ #[cfg(any(feature = "lua53", feature = "luajit"))]
let thrd: Thread = lua.load("coroutine.create(main)").eval()?;
- #[cfg(not(feature = "lua53"))]
+ #[cfg(all(not(feature = "lua53"), not(feature = "luajit")))]
let thrd: Thread = lua
.load("coroutine.create(function(...) return main(unpack(arg)) end)")
.eval()?;