Avoid using an invalid working directory in mjsunit/d8-os.
This test deleted its working directory and then tried to run several shell commands which caused a failure on nfs. Changes: -TEST_DIR is only removed at the very end of the test -the working directory is changed to /tmp at the beginning so that every iteration (when running with --stress-opt) has a valid working directory BUG= TEST= Review URL: http://codereview.chromium.org/8936004 Patch from Daniel Kalmar <kalmard@homejinni.com>. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10240 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
517e192f3e
commit
94f9aa3a0d
@ -54,6 +54,8 @@ function str_error(str) {
|
||||
|
||||
|
||||
if (this.os && os.system) {
|
||||
// Ensure that we have a valid working directory.
|
||||
os.chdir("/tmp");
|
||||
try {
|
||||
// Delete the dir if it is lying around from last time.
|
||||
os.system("ls", [TEST_DIR]);
|
||||
@ -143,42 +145,43 @@ if (this.os && os.system) {
|
||||
assertEquals("baz\n", os.system("echo", ["baz"]));
|
||||
//}
|
||||
}
|
||||
|
||||
// Too few args.
|
||||
arg_error("os.umask();");
|
||||
arg_error("os.system();");
|
||||
arg_error("os.mkdirp();");
|
||||
arg_error("os.chdir();");
|
||||
arg_error("os.setenv();");
|
||||
arg_error("os.rmdir();");
|
||||
|
||||
// Too many args.
|
||||
arg_error("os.setenv('FOO=bar');");
|
||||
arg_error("os.umask(0, 0);");
|
||||
arg_error("os.system('ls', [], -1, -1, -1);");
|
||||
arg_error("os.mkdirp('foo', 0, 0)");
|
||||
arg_error("os.chdir('foo', 'bar')");
|
||||
arg_error("os.rmdir('foo', 'bar');");
|
||||
|
||||
// Wrong kind of args.
|
||||
arg_error("os.umask([]);");
|
||||
arg_error("os.system('ls', 'foo');");
|
||||
arg_error("os.system('ls', 123);");
|
||||
arg_error("os.system('ls', [], 'foo');");
|
||||
arg_error("os.system('ls', [], -1, 'foo');");
|
||||
arg_error("os.mkdirp('foo', 'bar');");
|
||||
|
||||
// Test broken toString().
|
||||
str_error("os.system(e);");
|
||||
str_error("os.system('ls', [e]);");
|
||||
str_error("os.system('ls', ['.', e]);");
|
||||
str_error("os.system('ls', [e, '.']);");
|
||||
str_error("os.mkdirp(e);");
|
||||
str_error("os.setenv(e, 'goo');");
|
||||
str_error("os.setenv('goo', e);");
|
||||
str_error("os.chdir(e);");
|
||||
str_error("os.rmdir(e);");
|
||||
|
||||
} finally {
|
||||
os.system("rm", ["-r", TEST_DIR]);
|
||||
}
|
||||
|
||||
// Too few args.
|
||||
arg_error("os.umask();");
|
||||
arg_error("os.system();");
|
||||
arg_error("os.mkdirp();");
|
||||
arg_error("os.chdir();");
|
||||
arg_error("os.setenv();");
|
||||
arg_error("os.rmdir();");
|
||||
|
||||
// Too many args.
|
||||
arg_error("os.setenv('FOO=bar');");
|
||||
arg_error("os.umask(0, 0);");
|
||||
arg_error("os.system('ls', [], -1, -1, -1);");
|
||||
arg_error("os.mkdirp('foo', 0, 0)");
|
||||
arg_error("os.chdir('foo', 'bar')");
|
||||
arg_error("os.rmdir('foo', 'bar');");
|
||||
|
||||
// Wrong kind of args.
|
||||
arg_error("os.umask([]);");
|
||||
arg_error("os.system('ls', 'foo');");
|
||||
arg_error("os.system('ls', 123);");
|
||||
arg_error("os.system('ls', [], 'foo');");
|
||||
arg_error("os.system('ls', [], -1, 'foo');");
|
||||
arg_error("os.mkdirp('foo', 'bar');");
|
||||
|
||||
// Test broken toString().
|
||||
str_error("os.system(e);");
|
||||
str_error("os.system('ls', [e]);");
|
||||
str_error("os.system('ls', ['.', e]);");
|
||||
str_error("os.system('ls', [e, '.']);");
|
||||
str_error("os.mkdirp(e);");
|
||||
str_error("os.setenv(e, 'goo');");
|
||||
str_error("os.setenv('goo', e);");
|
||||
str_error("os.chdir(e);");
|
||||
str_error("os.rmdir(e);");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user