From f103fb385278bb7f7b56320068484ea86f514432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com> Date: Thu, 27 Jul 2023 18:48:55 +0200 Subject: [PATCH] Remove test for file creation in invalid path Actually, even setting files attributes to immutable, CI still succeeds at creating the file. This make the failure test to fail... --- tests/test_OFStream.cpp | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/tests/test_OFStream.cpp b/tests/test_OFStream.cpp index 1671a9cbe..6ca7d98df 100644 --- a/tests/test_OFStream.cpp +++ b/tests/test_OFStream.cpp @@ -7,12 +7,6 @@ #include <filesystem> -#ifdef __linux__ -#include <fcntl.h> -#include <linux/fs.h> -#include <sys/ioctl.h> -#endif // __linux__ - // clazy:excludeall=non-pod-global-static TEST_CASE("OFStream", "[language]") @@ -54,33 +48,4 @@ TEST_CASE("OFStream", "[language]") REQUIRE(not std::filesystem::exists(filename)); } - -#ifdef __linux__ - SECTION("invalid filename") - { - if (parallel::rank() == 0) { - const std::string filename = "tests/badpath/invalidpath/ofstream"; - std::filesystem::path directory = std::filesystem::path{filename}.parent_path(); - std::filesystem::create_directories(directory); - std::filesystem::permissions(directory, - std::filesystem::perms::owner_all | std::filesystem::perms::group_all | - std::filesystem::perms::others_all, - std::filesystem::perm_options::remove); - - int fd = open("tests/badpath/invalidpath", O_DIRECTORY); - int flags = FS_IMMUTABLE_FL; - ioctl(fd, FS_IOC_SETFLAGS, &flags); - REQUIRE_THROWS_WITH(std::make_shared<OFStream>(filename), "error: cannot create file " + filename); - - flags = 0; - ioctl(fd, FS_IOC_SETFLAGS, &flags); - - std::filesystem::permissions(directory, - std::filesystem::perms::owner_all | std::filesystem::perms::group_all | - std::filesystem::perms::others_all, - std::filesystem::perm_options::add); - std::filesystem::remove_all("tests/badpath"); - } - } -#endif // __linux__ } -- GitLab