aboutsummaryrefslogtreecommitdiff
path: root/test/js/node/process/process.test.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-09-21 07:25:18 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-21 07:25:18 -0700
commitd1e9b33cac65794632921045e7a851c58ef1863d (patch)
treeefca05827034d73b0481f37f7209940e266b46e6 /test/js/node/process/process.test.js
parentabfc10afeb73f9447e47929359d37f2b488c3c81 (diff)
downloadbun-d1e9b33cac65794632921045e7a851c58ef1863d.tar.gz
bun-d1e9b33cac65794632921045e7a851c58ef1863d.tar.zst
bun-d1e9b33cac65794632921045e7a851c58ef1863d.zip
On Linux, respect memory limit from cgroups (#5849)
* Implement `process.constrainedMemory()` * Add a comment * Handle max * Missing header * We can use WTF::ramSize now * Update WebKit * Update ZigGlobalObject.cpp * WebKit * :scissors: --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'test/js/node/process/process.test.js')
-rw-r--r--test/js/node/process/process.test.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/js/node/process/process.test.js b/test/js/node/process/process.test.js
index dc1081087..a4a8862a2 100644
--- a/test/js/node/process/process.test.js
+++ b/test/js/node/process/process.test.js
@@ -487,3 +487,13 @@ it("dlopen args parsing", () => {
expect(() => process.dlopen({ module: { exports: Symbol("123") } }, "/tmp/not-found.so")).toThrow();
expect(() => process.dlopen({ module: { exports: Symbol("123") } }, Symbol("badddd"))).toThrow();
});
+
+it("process.constrainedMemory()", () => {
+ if (process.platform === "linux") {
+ // On Linux, it returns 0 if the kernel doesn't support it
+ expect(process.constrainedMemory() >= 0).toBe(true);
+ } else {
+ // On unsupported platforms, it returns undefined
+ expect(process.constrainedMemory()).toBeUndefined();
+ }
+});