Files
moonwell-client-core/crates/benilla-lua/tests/oom.rs
T
sindoring d1961e79fc Sync upstream through b2473e60 and retain ruRU (#8)
Integrate 182 upstream commits through b2473e60 while retaining MoonWell packaging, branding and the community ruRU pack.

Upstream replaces the C Lua/mlua host with benilla-lua/benilla-mlua and the native glue screens with stock GlueXML. The update also includes the new locale/DBC/name rules, cache and interaction handling, rendering, quest log and chat behavior, including the latest quest completion and timed-quest failure fixes. Fork adaptations use the new APIs: stock Wow.ini locales remain intact, while the ruRU overlay reads column zero and retains its ruRU authentication tag and Lua identity. Russian names keep their twelve-letter policy and Unicode roster matching; fonts, spell costs, race/class labels and translated options retain real-pack regression coverage.

Windows regression fixes keep the locale-default test valid under instrumented window overrides and the shader assertion independent of checkout line endings. The original C Lua 5.1 host, rebuilt from c0630f3d in an isolated directory, reproduces the complete Windows cos-sweep answer byte for byte; cos now uses platform-specific goldens.

Validation on Windows: scripts/gates.sh passed all automatic gates, including real-data and no-install workspace tests, reference tables, documentation, message catalog, render-pass lint, player clippy/tests and engine boots with and without data. MoonWell player clippy also passed with -D warnings. The committed tree exactly matches the full green stamp; five vendored Kira files retain the tested checkout's line endings, with normalized contents unchanged. All three actual ruRU pack regressions passed in both builds. Fifteen test archives were restored read-only from the published client and SHA-256 checked.

Each real-data/player rung skipped 31 tests because the optional addon corpus is absent (24 general, 7 Quiver). Live smoke was not run: no declared probe account; no player-account login or character creation was performed. Linux/macOS changes were not locally built.
2026-10-17 21:10:31 +03:00

59 lines
1.8 KiB
Rust

//! Allocations the allocator refuses: under an address-space limit, a concatenation whose result
//! cannot be built raises `not enough memory` where Rust's allocator would abort the process.
//! Its own test binary: the limit is the whole process's.
#[cfg(target_os = "linux")]
#[test]
fn a_concatenation_the_allocator_refuses_is_not_enough_memory() {
#[repr(C)]
struct Rlimit {
cur: u64,
max: u64,
}
extern "C" {
fn setrlimit(resource: i32, rlim: *const Rlimit) -> i32;
}
/// `RLIMIT_AS` on Linux.
const RLIMIT_AS: i32 = 9;
let gib = 1u64 << 30;
// SAFETY: a plain libc call with a valid struct; it only lowers this process's limit.
assert_eq!(
unsafe {
setrlimit(
RLIMIT_AS,
&Rlimit {
cur: 3 * gib / 2,
max: u64::MAX,
},
)
},
0
);
let got = std::thread::Builder::new()
.stack_size(2 << 20)
.spawn(|| {
let mut vm = benilla_lua::new_state();
let src = br#"local s = string.rep("x", 268435456)
local ok1, e1 = pcall(function() return s .. s .. s .. s .. s .. s end)
local ok2, e2 = pcall(function() return s .. s .. s .. s end)
return ok1, e1, ok2, e2, string.len(s .. "y")"#;
match vm.exec(src, b"=t") {
Ok(vs) => Ok(vs.into_iter().map(|v| vm.display(v)).collect::<Vec<_>>()),
Err(e) => Err(vm.display(e)),
}
})
.unwrap()
.join()
.unwrap();
assert_eq!(
got,
Ok(vec![
"false".into(),
"not enough memory".into(),
"false".into(),
"not enough memory".into(),
"268435457".into()
])
);
}