OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 assertThrows("os.mkdirp(TEST_DIR + '/file1');", "mkdir over file1"); | 89 assertThrows("os.mkdirp(TEST_DIR + '/file1');", "mkdir over file1"); |
90 assertThrows("os.mkdirp(TEST_DIR + '/file1/foo');", "mkdir over file2"); | 90 assertThrows("os.mkdirp(TEST_DIR + '/file1/foo');", "mkdir over file2"); |
91 assertThrows("os.mkdirp(TEST_DIR + '/file1/');", "mkdir over file3"); | 91 assertThrows("os.mkdirp(TEST_DIR + '/file1/');", "mkdir over file3"); |
92 assertThrows("os.mkdirp(TEST_DIR + '/file1/foo/');", "mkdir over file4"); | 92 assertThrows("os.mkdirp(TEST_DIR + '/file1/foo/');", "mkdir over file4"); |
93 // Create a dir we cannot read. | 93 // Create a dir we cannot read. |
94 os.mkdirp(TEST_DIR + "/dir4", 0); | 94 os.mkdirp(TEST_DIR + "/dir4", 0); |
95 // This test fails if you are root since root can read any dir. | 95 // This test fails if you are root since root can read any dir. |
96 assertThrows("os.chdir(TEST_DIR + '/dir4');", "chdir dir4 I"); | 96 assertThrows("os.chdir(TEST_DIR + '/dir4');", "chdir dir4 I"); |
97 os.rmdir(TEST_DIR + "/dir4"); | 97 os.rmdir(TEST_DIR + "/dir4"); |
98 assertThrows("os.chdir(TEST_DIR + '/dir4');", "chdir dir4 II"); | 98 assertThrows("os.chdir(TEST_DIR + '/dir4');", "chdir dir4 II"); |
99 // Set umask. | 99 |
| 100 // Set umask. This changes the umask for the whole process and is |
| 101 // the reason why the test cannot be run multi-threaded. |
100 var old_umask = os.umask(0777); | 102 var old_umask = os.umask(0777); |
101 // Create a dir we cannot read. | 103 // Create a dir we cannot read. |
102 os.mkdirp(TEST_DIR + "/dir5"); | 104 os.mkdirp(TEST_DIR + "/dir5"); |
103 // This test fails if you are root since root can read any dir. | 105 // This test fails if you are root since root can read any dir. |
104 assertThrows("os.chdir(TEST_DIR + '/dir5');", "cd dir5 I"); | 106 assertThrows("os.chdir(TEST_DIR + '/dir5');", "cd dir5 I"); |
105 os.rmdir(TEST_DIR + "/dir5"); | 107 os.rmdir(TEST_DIR + "/dir5"); |
106 assertThrows("os.chdir(TEST_DIR + '/dir5');", "chdir dir5 II"); | 108 assertThrows("os.chdir(TEST_DIR + '/dir5');", "chdir dir5 II"); |
107 os.umask(old_umask); | 109 os.umask(old_umask); |
108 | 110 |
109 os.mkdirp(TEST_DIR + "/hest/fisk/../fisk/ged"); | 111 os.mkdirp(TEST_DIR + "/hest/fisk/../fisk/ged"); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 str_error("os.mkdirp(e);"); | 179 str_error("os.mkdirp(e);"); |
178 str_error("os.setenv(e, 'goo');"); | 180 str_error("os.setenv(e, 'goo');"); |
179 str_error("os.setenv('goo', e);"); | 181 str_error("os.setenv('goo', e);"); |
180 str_error("os.chdir(e);"); | 182 str_error("os.chdir(e);"); |
181 str_error("os.rmdir(e);"); | 183 str_error("os.rmdir(e);"); |
182 | 184 |
183 } finally { | 185 } finally { |
184 os.system("rm", ["-r", TEST_DIR]); | 186 os.system("rm", ["-r", TEST_DIR]); |
185 } | 187 } |
186 } | 188 } |
OLD | NEW |