-// Copyright (C) 2017-2019 Free Software Foundation, Inc.
+// Copyright (C) 2017-2024 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-options "-std=gnu++17" }
// { dg-do run { target c++17 } }
// { dg-require-filesystem-ts "" }
-// { dg-xfail-if "symlinks not supported" { *-*-mingw* } }
#include <filesystem>
#include <testsuite_hooks.h>
fs::file_status st2 = fs::symlink_status(dot);
VERIFY( st2.type() == fs::file_type::directory );
+#ifndef NO_SYMLINKS
fs::path link = __gnu_test::nonexistent_path();
create_directory_symlink(dot, link);
__gnu_test::scoped_file l(link, __gnu_test::scoped_file::adopt_file);
st2 = fs::symlink_status(link, ec);
VERIFY( !ec );
VERIFY( st2.type() == fs::file_type::symlink );
+#endif
}
void
void
test03()
{
+#ifndef NO_SYMLINKS
+ if (!__gnu_test::permissions_are_testable())
+ return;
+
fs::path dir = __gnu_test::nonexistent_path();
fs::create_directory(dir);
__gnu_test::scoped_file d(dir, __gnu_test::scoped_file::adopt_file);
std::error_code ec2;
fs::path p, p2;
try {
- fs::symlink_status(f.path);
+ (void) fs::symlink_status(f.path);
} catch (const fs::filesystem_error& e) {
caught = true;
p = e.path1();
VERIFY( st2.type() == fs::file_type::symlink );
fs::permissions(dir, fs::perms::owner_all, ec);
+#endif
+}
+
+void
+test04()
+{
+ // PR libstdc++/88881
+ fs::path p = "./";
+ auto st = symlink_status(p);
+ VERIFY( is_directory(st) );
}
int
test01();
test02();
test03();
+ test04();
}