From aed64aae6084b40bb12cc137568b46798802d1a9 Mon Sep 17 00:00:00 2001 From: zhongwencool Date: Sun, 11 Jun 2023 09:12:41 +0800 Subject: [PATCH] chore: delete emqx_utils_fs_SUITE_data dir --- apps/emqx_utils/test/emqx_utils_fs_SUITE.erl | 35 +++++++++++++++++++ .../emqx_utils_fs_SUITE_data/nonempty/d1/1 | 0 .../emqx_utils_fs_SUITE_data/nonempty/d1/2 | 0 .../nonempty/d1/mutrec | 1 - .../nonempty/d2/deep/down/here | 0 .../nonempty/d2/deep/mutrec | 1 - 6 files changed, 35 insertions(+), 2 deletions(-) delete mode 100644 apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d1/1 delete mode 100644 apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d1/2 delete mode 120000 apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d1/mutrec delete mode 100644 apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d2/deep/down/here delete mode 120000 apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d2/deep/mutrec diff --git a/apps/emqx_utils/test/emqx_utils_fs_SUITE.erl b/apps/emqx_utils/test/emqx_utils_fs_SUITE.erl index 243db98cd..750a91073 100644 --- a/apps/emqx_utils/test/emqx_utils_fs_SUITE.erl +++ b/apps/emqx_utils/test/emqx_utils_fs_SUITE.erl @@ -26,6 +26,41 @@ all() -> emqx_common_test_helpers:all(?MODULE). +init_per_suite(Config) -> + Root = ?config(data_dir, Config), + D1 = filename:join([Root, "nonempty", "d1/"]), + D2 = filename:join([Root, "nonempty", "d2/"]), + F1 = filename:join([D1, "1"]), + F2 = filename:join([D1, "2"]), + DeepDir = filename:join([Root, "nonempty", "d2", "deep", "down/"]), + DeepFile = filename:join([DeepDir, "here"]), + ok = filelib:ensure_dir(F1), + ok = filelib:ensure_dir(F2), + ok = filelib:ensure_dir(DeepFile), + D1Mutrec = filename:join([D1, "mutrec"]), + D2Mutrec = filename:join([D2, "deep", "mutrec"]), + ok = file:write_file(F1, <<"">>, [write]), + ok = file:write_file(F2, <<"">>, [write]), + ok = file:write_file(DeepFile, <<"">>, [write]), + {ok, D1FileInfo} = file:read_file_info(D1), + ok = file:write_file_info(D1, D1FileInfo#file_info{mode = 8#00777}), + _ = file:delete(D1Mutrec), + _ = file:delete(D2Mutrec), + ok = file:make_symlink(DeepDir, D1Mutrec), + %% can't file:make_link("../../d1", D2Mutrec) on mac, it return {error, eperm} + ok = file:make_symlink("../../d1", D2Mutrec), + {ok, DeepFileInfo} = file:read_file_info(DeepFile), + ok = file:write_file_info(DeepFile, DeepFileInfo#file_info{mode = 8#00600}), + {ok, D2MutrecInfo} = file:read_link_info(D2Mutrec), + ct:pal("~p~n", [D2MutrecInfo]), + %ok = file:write_link_info(D2Mutrec, D2MutrecInfo#file_info{mode = 8#00777}), + Config. + +end_per_suite(Config) -> + Root = ?config(data_dir, Config), + %ok = file:del_dir_r(filename:join([Root, "nonempty"])), + ok. + %% t_traverse_dir(Config) -> diff --git a/apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d1/1 b/apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d1/1 deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d1/2 b/apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d1/2 deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d1/mutrec b/apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d1/mutrec deleted file mode 120000 index d378eb1b6..000000000 --- a/apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d1/mutrec +++ /dev/null @@ -1 +0,0 @@ -../d2/deep/down \ No newline at end of file diff --git a/apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d2/deep/down/here b/apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d2/deep/down/here deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d2/deep/mutrec b/apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d2/deep/mutrec deleted file mode 120000 index 354c7c5c3..000000000 --- a/apps/emqx_utils/test/emqx_utils_fs_SUITE_data/nonempty/d2/deep/mutrec +++ /dev/null @@ -1 +0,0 @@ -../../d1 \ No newline at end of file