mirror of
https://github.com/denoland/deno.git
synced 2025-03-09 21:57:40 -04:00
chore(cli): Fix rename test for XFS (#21215)
Renaming a directory to a path where a non-empty directory already exists was asserted to always fail with `ENOTEMPTY` According to glibc manual the function may also fail with `EEXIST` on "some other systems". One such case is using XFS [^1]. This commit handles the EEXIST case. [^1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/xfs/xfs_inode.c?h=v4.18&id=94710cac0ef4ee177a63b5227664b38c95bbf703#n3082
This commit is contained in:
parent
9c39172f55
commit
0223ff36f1
2 changed files with 19 additions and 7 deletions
|
@ -2,6 +2,8 @@
|
||||||
import {
|
import {
|
||||||
assert,
|
assert,
|
||||||
assertEquals,
|
assertEquals,
|
||||||
|
AssertionError,
|
||||||
|
assertIsError,
|
||||||
assertThrows,
|
assertThrows,
|
||||||
pathToAbsoluteFileUrl,
|
pathToAbsoluteFileUrl,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
@ -149,6 +151,7 @@ Deno.test(
|
||||||
Error,
|
Error,
|
||||||
"Is a directory",
|
"Is a directory",
|
||||||
);
|
);
|
||||||
|
try {
|
||||||
assertThrows(
|
assertThrows(
|
||||||
() => {
|
() => {
|
||||||
Deno.renameSync(olddir, fulldir);
|
Deno.renameSync(olddir, fulldir);
|
||||||
|
@ -156,6 +159,14 @@ Deno.test(
|
||||||
Error,
|
Error,
|
||||||
"Directory not empty",
|
"Directory not empty",
|
||||||
);
|
);
|
||||||
|
} catch (e) {
|
||||||
|
// rename syscall may also return EEXIST, e.g. with XFS
|
||||||
|
assertIsError(
|
||||||
|
e,
|
||||||
|
AssertionError,
|
||||||
|
`Expected error message to include "Directory not empty", but got "File exists`,
|
||||||
|
);
|
||||||
|
}
|
||||||
assertThrows(
|
assertThrows(
|
||||||
() => {
|
() => {
|
||||||
Deno.renameSync(olddir, file);
|
Deno.renameSync(olddir, file);
|
||||||
|
|
|
@ -8,6 +8,7 @@ export {
|
||||||
assertEquals,
|
assertEquals,
|
||||||
assertFalse,
|
assertFalse,
|
||||||
AssertionError,
|
AssertionError,
|
||||||
|
assertIsError,
|
||||||
assertMatch,
|
assertMatch,
|
||||||
assertNotEquals,
|
assertNotEquals,
|
||||||
assertNotStrictEquals,
|
assertNotStrictEquals,
|
||||||
|
|
Loading…
Add table
Reference in a new issue