Is it possible to run test code in JIT memory?

⚓ Rust    📅 2025-11-11    👤 surdeus    👁️ 2      

surdeus

I have a simple project and i will build it to dynamic library.

pub fn fib(n: u32) -> u32 {
    if n <= 1 {
        return n;
    }
    fib(n - 1) + fib(n - 2)
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_fib() {
        assert_eq!(fib(0), 0);
        assert_eq!(fib(1), 1);
        assert_eq!(fib(2), 1);
    }
}

Normally, we will use cargo test to run test code in host machine. But i need to run the test bin in target machine which does't have any execute permission(Belike SELinux).

But i can request the JIT permission in debug mode. So can we run the test bin with JIT memory?

2 posts - 2 participants

Read full topic

🏷️ Rust_feed