MCPcopy Create free account
hub / github.com/Niko1221/Strata / test_words

Function test_words

engine/src/split/tools/memlock_test.cpp:164–185  ·  view source on GitHub ↗

the sentences in the owner's wording of 11-11, at the real sizes

Source from the content-addressed store, hash-verified

162
163// the sentences in the owner's wording of 11-11, at the real sizes
164void test_words() {
165 const uint64_t G = 1ull << 30;
166 std::vector<LockPart> none;
167 LockOutcome o;
168 o.want = (size_t) (27.5 * G);
169 o.env.limit = 8 * (1ull << 20);
170 o.locked = 0;
171 CHECK(lock_line(none, o) == "Split engine: its word tables (27.5 GiB) are not locked in RAM (this account may lock at most 8 MiB). It runs as usual. The tables are read into memory at the start; "
172 "only if the PC runs short of memory can long prompts slow down.");
173 o.locked = 8u << 20; // a sliver of a table of GiB counts as nothing locked
174 CHECK(lock_line(none, o).find("are not locked in RAM") != std::string::npos);
175 o.locked = (size_t) (14.0 * G);
176 o.env.limit = 14 * G;
177 CHECK(lock_line(none, o) == "Split engine: 14.0 of its 27.5 GiB of word tables are locked in RAM (this account may lock at most 14.0 GiB). It runs as usual. The rest is read into memory at the start; "
178 "only if the PC runs short of memory can long prompts slow down.");
179 o.env.limit = UINT64_MAX;
180 o.limited_by_ram = true;
181 o.env.reserve = (uint64_t) (6.3 * G);
182 CHECK(lock_line(none, o).find("(locking more would leave less than 6.3 GiB of RAM free)") != std::string::npos);
183 o.locked = o.want;
184 CHECK(lock_line(none, o).empty());
185}
186
187void test_real() {
188 // the soft AND hard limit are lowered to 256 KiB: the soft limit cannot be raised, the real mlock refuses most of 10 MiB (a process with CAP_IPC_LOCK is not limited: then all locks)

Callers 1

mainFunction · 0.85

Calls 3

lock_lineFunction · 0.85
findMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected