Commit caf493af authored by vitalyr@chromium.org's avatar vitalyr@chromium.org

Make d8-os test less flaky.

Because of stress testing there may be parallel instances of the test
running, which makes it fail when using a hardcoded test dir
name. Adding a random suffix helps. It'd be nicer to add something
like pid, but there doesn't seem to be an easy way of getting it.

R=yangguo@chromium.org

Review URL: http://codereview.chromium.org/7491057

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8848 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e9bc76c4
......@@ -30,6 +30,9 @@
// implemented on Windows, and even if it were then many of the things
// we are calling would not be available.
var TEST_DIR = "d8-os-test-directory-" + ((Math.random() * (1<<30)) | 0);
function arg_error(str) {
try {
eval(str);
......@@ -53,14 +56,15 @@ function str_error(str) {
if (this.os && os.system) {
try {
// Delete the dir if it is lying around from last time.
os.system("ls", ["d8-os-test-directory"]);
os.system("rm", ["-r", "d8-os-test-directory"]);
os.system("ls", [TEST_DIR]);
os.system("rm", ["-r", TEST_DIR]);
} catch (e) {
}
os.mkdirp("d8-os-test-directory");
os.chdir("d8-os-test-directory");
os.mkdirp(TEST_DIR);
os.chdir(TEST_DIR);
try {
// Check the chdir worked.
os.system('ls', ['../d8-os-test-directory']);
os.system('ls', ['../' + TEST_DIR]);
// Simple create dir.
os.mkdirp("dir");
// Create dir in dir.
......@@ -139,9 +143,10 @@ if (this.os && os.system) {
assertEquals("baz\n", os.system("echo", ["baz"]));
//}
}
} finally {
os.chdir("..");
os.system("rm", ["-r", "d8-os-test-directory"]);
os.system("rm", ["-r", TEST_DIR]);
}
// Too few args.
arg_error("os.umask();");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment