Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Unified Diff: test/mjsunit/d8-os.js

Issue 8936004: Avoid using an invalid working directory in mjsunit/d8-os. (Closed)
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/d8-os.js
diff --git a/test/mjsunit/d8-os.js b/test/mjsunit/d8-os.js
index 5640326856b9a11562078db3cd80f92203a4a988..8292ab92612686873d3a9ce6a6debe2db0b1da07 100644
--- a/test/mjsunit/d8-os.js
+++ b/test/mjsunit/d8-os.js
@@ -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);");
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698