aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/dir-iterator/testscript13
-rw-r--r--tests/link/driver.cxx48
2 files changed, 58 insertions, 3 deletions
diff --git a/tests/dir-iterator/testscript b/tests/dir-iterator/testscript
index 956eacb..370fd2f 100644
--- a/tests/dir-iterator/testscript
+++ b/tests/dir-iterator/testscript
@@ -36,14 +36,21 @@ else
{
+mkdir a
+mkdir --no-cleanup a/b
- +ln -s a/b a/l
+ +ln -s a/b a/bl
+rmdir a/b
+touch a/c
+ +mkdir a/d
+ +ln -s a/d a/dl
+
# On Wine dangling symlinks are not visible (see mksymlink() for details).
#
- #$* ../a >! 2>! != 0 : keep
+ #$* ../a >! 2>! != 0 : keep
- $* -i ../a >'reg c' : skip
+ : skip
+ :
+ $* -i ../a >>~%EOO%
+ %(reg c|dir d|sym dir dl)%{3}
+ EOO
}
diff --git a/tests/link/driver.cxx b/tests/link/driver.cxx
index 76cdbfc..6489d8d 100644
--- a/tests/link/driver.cxx
+++ b/tests/link/driver.cxx
@@ -179,12 +179,22 @@ main ()
dir_path ld (td / dir_path ("dslink"));
assert (link_dir (dp, ld, false /* hard */, true /* check_content */));
+ // Create the symlink to a directory symlink using an absolute path.
+ //
+ dir_path lld (td / dir_path ("dslinkslink"));
+ assert (link_dir (ld, lld, false /* hard */, true /* check_content */));
+
{
pair<bool, entry_stat> pe (path_entry (ld / "f"));
assert (pe.first && pe.second.type == entry_type::regular);
}
{
+ pair<bool, entry_stat> pe (path_entry (lld / "f"));
+ assert (pe.first && pe.second.type == entry_type::regular);
+ }
+
+ {
pair<bool, entry_stat> pe (path_entry (ld));
assert (pe.first && pe.second.type == entry_type::symlink);
}
@@ -194,16 +204,31 @@ main ()
assert (pe.first && pe.second.type == entry_type::directory);
}
+ {
+ pair<bool, entry_stat> pe (path_entry (lld));
+ assert (pe.first && pe.second.type == entry_type::symlink);
+ }
+
+ {
+ pair<bool, entry_stat> pe (path_entry (lld, true /* follow_symlinks */));
+ assert (pe.first && pe.second.type == entry_type::directory);
+ }
+
for (const dir_entry& de: dir_iterator (td, false /* ignore_dangling */))
{
assert (de.path () != path ("dslink") ||
(de.type () == entry_type::directory &&
de.ltype () == entry_type::symlink));
+
+ assert (de.path () != path ("dslinkslink") ||
+ (de.type () == entry_type::directory &&
+ de.ltype () == entry_type::symlink));
}
// Remove the directory symlink and make sure the target's content still
// exists.
//
+ assert (try_rmsymlink (lld) == rmfile_status::success);
assert (try_rmsymlink (ld) == rmfile_status::success);
{
@@ -221,6 +246,29 @@ main ()
assert (link_dir (dn, td / dir_path ("rdslink"), false, true));
#endif
+ // Delete the junction target and verify the junction entry status.
+ //
+ assert (link_dir (dp, ld, false /* hard */, true /* check_content */));
+ rmdir_r (dp);
+
+ // On Wine dangling junctions are not visible. That's why we also re-create
+ // the target before the junction removal.
+ //
+#if 0
+ {
+ pair<bool, entry_stat> pe (path_entry (ld));
+ assert (pe.first && pe.second.type == entry_type::symlink);
+ }
+#endif
+
+ {
+ pair<bool, entry_stat> pe (path_entry (ld, true /* follow_symlinks */));
+ assert (!pe.first);
+ }
+
+ assert (try_mkdir (dp) == mkdir_status::success);
+ assert (try_rmsymlink (ld) == rmfile_status::success);
+
try
{
rmdir_r (td);