summaryrefslogtreecommitdiffstats
path: root/js/src/tests/shell/os.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/tests/shell/os.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/shell/os.js')
-rw-r--r--js/src/tests/shell/os.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/js/src/tests/shell/os.js b/js/src/tests/shell/os.js
new file mode 100644
index 000000000..06e08f683
--- /dev/null
+++ b/js/src/tests/shell/os.js
@@ -0,0 +1,39 @@
+// |reftest| skip-if(!xulRuntime.shell||xulRuntime.OS=="WINNT")
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var pid = os.getpid();
+assertEq(pid > 0, true);
+
+var PATH = os.getenv("PATH");
+assertEq(PATH.indexOf("bin") > 0, true);
+assertEq(os.getenv("SQUAMMISH_HILLBILLY_GOAT_SQUEEZERS"), undefined);
+
+assertEq(os.system("true"), 0, "/bin/true should exit 0");
+assertEq(os.system("false") != 0, true, "/bin/false should exit nonzero");
+
+var kidpid = os.spawn("sleep 60");
+assertEq(kidpid > 0, true, "spawning sleep");
+var info = os.waitpid(kidpid, true);
+assertEq(info.hasOwnProperty("pid"), false);
+assertEq(info.hasOwnProperty("exitStatus"), false);
+
+os.kill(kidpid);
+
+info = os.waitpid(kidpid);
+assertEq(info.hasOwnProperty("pid"), true, "waiting on dead process should return pid");
+assertEq(info.pid, kidpid);
+assertEq(info.hasOwnProperty("exitStatus"), false, "killed process should not have exitStatus");
+
+kidpid = os.spawn("false");
+assertEq(kidpid > 0, true, "spawning /bin/false");
+info = os.waitpid(kidpid);
+assertEq(info.hasOwnProperty("pid"), true, "waiting on dead process should return pid");
+assertEq(info.pid, kidpid);
+assertEq(info.hasOwnProperty("exitStatus"), true, "process should have exitStatus");
+assertEq(info.exitStatus, 1, "/bin/false should exit 1");
+
+reportCompare(true, true);