summaryrefslogtreecommitdiffstats
path: root/tests/lib/vfs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:44:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:44:12 +0000
commit8ccb487c21368a7fdc8c7c72315325bf0aa06147 (patch)
treeb2056fae01d325924508a41731edfbd4c3cddd23 /tests/lib/vfs
parentInitial commit. (diff)
downloadmc-8ccb487c21368a7fdc8c7c72315325bf0aa06147.tar.xz
mc-8ccb487c21368a7fdc8c7c72315325bf0aa06147.zip
Adding upstream version 3:4.8.29.upstream/3%4.8.29upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/lib/vfs')
-rw-r--r--tests/lib/vfs/Makefile.am98
-rw-r--r--tests/lib/vfs/Makefile.in1508
-rw-r--r--tests/lib/vfs/canonicalize_pathname.c203
-rw-r--r--tests/lib/vfs/current_dir.c207
-rw-r--r--tests/lib/vfs/mc.charsets5
-rw-r--r--tests/lib/vfs/path_cmp.c254
-rw-r--r--tests/lib/vfs/path_len.c142
-rw-r--r--tests/lib/vfs/path_manipulations.c458
-rw-r--r--tests/lib/vfs/path_recode.c285
-rw-r--r--tests/lib/vfs/path_serialize.c203
-rw-r--r--tests/lib/vfs/relative_cd.c221
-rw-r--r--tests/lib/vfs/tempdir.c140
-rw-r--r--tests/lib/vfs/vfs_adjust_stat.c205
-rw-r--r--tests/lib/vfs/vfs_get_encoding.c159
-rw-r--r--tests/lib/vfs/vfs_parse_ls_lga.c426
-rw-r--r--tests/lib/vfs/vfs_path_from_str_flags.c125
-rw-r--r--tests/lib/vfs/vfs_path_string_convert.c335
-rw-r--r--tests/lib/vfs/vfs_prefix_to_class.c170
-rw-r--r--tests/lib/vfs/vfs_s_get_path.c168
-rw-r--r--tests/lib/vfs/vfs_setup_cwd.c157
-rw-r--r--tests/lib/vfs/vfs_split.c207
21 files changed, 5676 insertions, 0 deletions
diff --git a/tests/lib/vfs/Makefile.am b/tests/lib/vfs/Makefile.am
new file mode 100644
index 0000000..62ebe9f
--- /dev/null
+++ b/tests/lib/vfs/Makefile.am
@@ -0,0 +1,98 @@
+PACKAGE_STRING = "/lib/vfs"
+
+AM_CPPFLAGS = \
+ -DTEST_SHARE_DIR=\"$(abs_srcdir)\" \
+ $(GLIB_CFLAGS) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/lib/vfs \
+ @CHECK_CFLAGS@
+
+AM_LDFLAGS = @TESTS_LDFLAGS@
+
+EXTRA_DIST = mc.charsets
+
+LIBS = @CHECK_LIBS@ \
+ $(top_builddir)/lib/libmc.la
+
+if ENABLE_MCLIB
+LIBS += $(GLIB_LIBS)
+endif
+
+TESTS = \
+ canonicalize_pathname \
+ current_dir \
+ path_cmp \
+ path_len \
+ path_manipulations \
+ path_serialize \
+ relative_cd \
+ tempdir \
+ vfs_adjust_stat \
+ vfs_parse_ls_lga \
+ vfs_path_from_str_flags \
+ vfs_path_string_convert \
+ vfs_prefix_to_class \
+ vfs_setup_cwd \
+ vfs_split \
+ vfs_s_get_path
+
+if CHARSET
+TESTS += path_recode \
+ vfs_get_encoding
+endif
+
+check_PROGRAMS = $(TESTS)
+
+canonicalize_pathname_SOURCES = \
+ canonicalize_pathname.c
+
+current_dir_SOURCES = \
+ current_dir.c
+
+path_cmp_SOURCES = \
+ path_cmp.c
+
+path_len_SOURCES = \
+ path_len.c
+
+path_manipulations_SOURCES = \
+ path_manipulations.c
+
+path_recode_SOURCES = \
+ path_recode.c
+
+path_serialize_SOURCES = \
+ path_serialize.c
+
+relative_cd_SOURCES = \
+ relative_cd.c
+
+tempdir_SOURCES = \
+ tempdir.c
+
+vfs_adjust_stat_SOURCES = \
+ vfs_adjust_stat.c
+
+vfs_get_encoding_SOURCES = \
+ vfs_get_encoding.c
+
+vfs_setup_cwd_SOURCES = \
+ vfs_setup_cwd.c
+
+vfs_split_SOURCES = \
+ vfs_split.c
+
+vfs_parse_ls_lga_SOURCES = \
+ vfs_parse_ls_lga.c
+
+vfs_prefix_to_class_SOURCES = \
+ vfs_prefix_to_class.c
+
+vfs_path_from_str_flags_SOURCES = \
+ vfs_path_from_str_flags.c
+
+vfs_path_string_convert_SOURCES = \
+ vfs_path_string_convert.c
+
+vfs_s_get_path_SOURCES = \
+ vfs_s_get_path.c
diff --git a/tests/lib/vfs/Makefile.in b/tests/lib/vfs/Makefile.in
new file mode 100644
index 0000000..b0c0adc
--- /dev/null
+++ b/tests/lib/vfs/Makefile.in
@@ -0,0 +1,1508 @@
+# Makefile.in generated by automake 1.16.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2021 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@ENABLE_MCLIB_TRUE@am__append_1 = $(GLIB_LIBS)
+TESTS = canonicalize_pathname$(EXEEXT) current_dir$(EXEEXT) \
+ path_cmp$(EXEEXT) path_len$(EXEEXT) \
+ path_manipulations$(EXEEXT) path_serialize$(EXEEXT) \
+ relative_cd$(EXEEXT) tempdir$(EXEEXT) vfs_adjust_stat$(EXEEXT) \
+ vfs_parse_ls_lga$(EXEEXT) vfs_path_from_str_flags$(EXEEXT) \
+ vfs_path_string_convert$(EXEEXT) vfs_prefix_to_class$(EXEEXT) \
+ vfs_setup_cwd$(EXEEXT) vfs_split$(EXEEXT) \
+ vfs_s_get_path$(EXEEXT) $(am__EXEEXT_1)
+@CHARSET_TRUE@am__append_2 = path_recode \
+@CHARSET_TRUE@ vfs_get_encoding
+
+check_PROGRAMS = $(am__EXEEXT_2)
+subdir = tests/lib/vfs
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/m4.include/gnulib/mode_t.m4 \
+ $(top_srcdir)/m4.include/gnulib/stat-size.m4 \
+ $(top_srcdir)/m4.include/gnulib/fstypename.m4 \
+ $(top_srcdir)/m4.include/gnulib/fsusage.m4 \
+ $(top_srcdir)/m4.include/gnulib/mountlist.m4 \
+ $(top_srcdir)/m4.include/gnulib/windows-stat-inodes.m4 \
+ $(top_srcdir)/m4.include/gnulib/sys_types_h.m4 \
+ $(top_srcdir)/m4.include/ax_path_lib_pcre.m4 \
+ $(top_srcdir)/m4.include/dx_doxygen.m4 \
+ $(top_srcdir)/m4.include/ax_require_defined.m4 \
+ $(top_srcdir)/m4.include/ax_check_compile_flag.m4 \
+ $(top_srcdir)/m4.include/ax_append_flag.m4 \
+ $(top_srcdir)/m4.include/ax_append_compile_flags.m4 \
+ $(top_srcdir)/m4.include/mc-cflags.m4 \
+ $(top_srcdir)/m4.include/ax_gcc_func_attribute.m4 \
+ $(top_srcdir)/m4.include/mc-check-search-type.m4 \
+ $(top_srcdir)/m4.include/mc-get-fs-info.m4 \
+ $(top_srcdir)/m4.include/mc-with-x.m4 \
+ $(top_srcdir)/m4.include/mc-use-termcap.m4 \
+ $(top_srcdir)/m4.include/mc-with-screen.m4 \
+ $(top_srcdir)/m4.include/mc-with-screen-ncurses.m4 \
+ $(top_srcdir)/m4.include/mc-with-screen-slang.m4 \
+ $(top_srcdir)/m4.include/mc-with-internal-edit.m4 \
+ $(top_srcdir)/m4.include/mc-subshell.m4 \
+ $(top_srcdir)/m4.include/mc-background.m4 \
+ $(top_srcdir)/m4.include/mc-ext2fs-attr.m4 \
+ $(top_srcdir)/m4.include/mc-glib.m4 \
+ $(top_srcdir)/m4.include/mc-vfs.m4 \
+ $(top_srcdir)/m4.include/vfs/rpc.m4 \
+ $(top_srcdir)/m4.include/vfs/socket.m4 \
+ $(top_srcdir)/m4.include/vfs/mc-vfs-extfs.m4 \
+ $(top_srcdir)/m4.include/vfs/mc-vfs-sfs.m4 \
+ $(top_srcdir)/m4.include/vfs/mc-vfs-ftp.m4 \
+ $(top_srcdir)/m4.include/vfs/mc-vfs-sftp.m4 \
+ $(top_srcdir)/m4.include/vfs/mc-vfs-fish.m4 \
+ $(top_srcdir)/m4.include/vfs/mc-vfs-undelfs.m4 \
+ $(top_srcdir)/m4.include/vfs/mc-vfs-tarfs.m4 \
+ $(top_srcdir)/m4.include/vfs/mc-vfs-cpiofs.m4 \
+ $(top_srcdir)/m4.include/mc-version.m4 \
+ $(top_srcdir)/m4.include/mc-tests.m4 \
+ $(top_srcdir)/m4.include/mc-i18n.m4 \
+ $(top_srcdir)/m4.include/mc-assert.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+@CHARSET_TRUE@am__EXEEXT_1 = path_recode$(EXEEXT) \
+@CHARSET_TRUE@ vfs_get_encoding$(EXEEXT)
+am__EXEEXT_2 = canonicalize_pathname$(EXEEXT) current_dir$(EXEEXT) \
+ path_cmp$(EXEEXT) path_len$(EXEEXT) \
+ path_manipulations$(EXEEXT) path_serialize$(EXEEXT) \
+ relative_cd$(EXEEXT) tempdir$(EXEEXT) vfs_adjust_stat$(EXEEXT) \
+ vfs_parse_ls_lga$(EXEEXT) vfs_path_from_str_flags$(EXEEXT) \
+ vfs_path_string_convert$(EXEEXT) vfs_prefix_to_class$(EXEEXT) \
+ vfs_setup_cwd$(EXEEXT) vfs_split$(EXEEXT) \
+ vfs_s_get_path$(EXEEXT) $(am__EXEEXT_1)
+am_canonicalize_pathname_OBJECTS = canonicalize_pathname.$(OBJEXT)
+canonicalize_pathname_OBJECTS = $(am_canonicalize_pathname_OBJECTS)
+canonicalize_pathname_LDADD = $(LDADD)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+am_current_dir_OBJECTS = current_dir.$(OBJEXT)
+current_dir_OBJECTS = $(am_current_dir_OBJECTS)
+current_dir_LDADD = $(LDADD)
+am_path_cmp_OBJECTS = path_cmp.$(OBJEXT)
+path_cmp_OBJECTS = $(am_path_cmp_OBJECTS)
+path_cmp_LDADD = $(LDADD)
+am_path_len_OBJECTS = path_len.$(OBJEXT)
+path_len_OBJECTS = $(am_path_len_OBJECTS)
+path_len_LDADD = $(LDADD)
+am_path_manipulations_OBJECTS = path_manipulations.$(OBJEXT)
+path_manipulations_OBJECTS = $(am_path_manipulations_OBJECTS)
+path_manipulations_LDADD = $(LDADD)
+am_path_recode_OBJECTS = path_recode.$(OBJEXT)
+path_recode_OBJECTS = $(am_path_recode_OBJECTS)
+path_recode_LDADD = $(LDADD)
+am_path_serialize_OBJECTS = path_serialize.$(OBJEXT)
+path_serialize_OBJECTS = $(am_path_serialize_OBJECTS)
+path_serialize_LDADD = $(LDADD)
+am_relative_cd_OBJECTS = relative_cd.$(OBJEXT)
+relative_cd_OBJECTS = $(am_relative_cd_OBJECTS)
+relative_cd_LDADD = $(LDADD)
+am_tempdir_OBJECTS = tempdir.$(OBJEXT)
+tempdir_OBJECTS = $(am_tempdir_OBJECTS)
+tempdir_LDADD = $(LDADD)
+am_vfs_adjust_stat_OBJECTS = vfs_adjust_stat.$(OBJEXT)
+vfs_adjust_stat_OBJECTS = $(am_vfs_adjust_stat_OBJECTS)
+vfs_adjust_stat_LDADD = $(LDADD)
+am_vfs_get_encoding_OBJECTS = vfs_get_encoding.$(OBJEXT)
+vfs_get_encoding_OBJECTS = $(am_vfs_get_encoding_OBJECTS)
+vfs_get_encoding_LDADD = $(LDADD)
+am_vfs_parse_ls_lga_OBJECTS = vfs_parse_ls_lga.$(OBJEXT)
+vfs_parse_ls_lga_OBJECTS = $(am_vfs_parse_ls_lga_OBJECTS)
+vfs_parse_ls_lga_LDADD = $(LDADD)
+am_vfs_path_from_str_flags_OBJECTS = \
+ vfs_path_from_str_flags.$(OBJEXT)
+vfs_path_from_str_flags_OBJECTS = \
+ $(am_vfs_path_from_str_flags_OBJECTS)
+vfs_path_from_str_flags_LDADD = $(LDADD)
+am_vfs_path_string_convert_OBJECTS = \
+ vfs_path_string_convert.$(OBJEXT)
+vfs_path_string_convert_OBJECTS = \
+ $(am_vfs_path_string_convert_OBJECTS)
+vfs_path_string_convert_LDADD = $(LDADD)
+am_vfs_prefix_to_class_OBJECTS = vfs_prefix_to_class.$(OBJEXT)
+vfs_prefix_to_class_OBJECTS = $(am_vfs_prefix_to_class_OBJECTS)
+vfs_prefix_to_class_LDADD = $(LDADD)
+am_vfs_s_get_path_OBJECTS = vfs_s_get_path.$(OBJEXT)
+vfs_s_get_path_OBJECTS = $(am_vfs_s_get_path_OBJECTS)
+vfs_s_get_path_LDADD = $(LDADD)
+am_vfs_setup_cwd_OBJECTS = vfs_setup_cwd.$(OBJEXT)
+vfs_setup_cwd_OBJECTS = $(am_vfs_setup_cwd_OBJECTS)
+vfs_setup_cwd_LDADD = $(LDADD)
+am_vfs_split_OBJECTS = vfs_split.$(OBJEXT)
+vfs_split_OBJECTS = $(am_vfs_split_OBJECTS)
+vfs_split_LDADD = $(LDADD)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/canonicalize_pathname.Po \
+ ./$(DEPDIR)/current_dir.Po ./$(DEPDIR)/path_cmp.Po \
+ ./$(DEPDIR)/path_len.Po ./$(DEPDIR)/path_manipulations.Po \
+ ./$(DEPDIR)/path_recode.Po ./$(DEPDIR)/path_serialize.Po \
+ ./$(DEPDIR)/relative_cd.Po ./$(DEPDIR)/tempdir.Po \
+ ./$(DEPDIR)/vfs_adjust_stat.Po ./$(DEPDIR)/vfs_get_encoding.Po \
+ ./$(DEPDIR)/vfs_parse_ls_lga.Po \
+ ./$(DEPDIR)/vfs_path_from_str_flags.Po \
+ ./$(DEPDIR)/vfs_path_string_convert.Po \
+ ./$(DEPDIR)/vfs_prefix_to_class.Po \
+ ./$(DEPDIR)/vfs_s_get_path.Po ./$(DEPDIR)/vfs_setup_cwd.Po \
+ ./$(DEPDIR)/vfs_split.Po
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(canonicalize_pathname_SOURCES) $(current_dir_SOURCES) \
+ $(path_cmp_SOURCES) $(path_len_SOURCES) \
+ $(path_manipulations_SOURCES) $(path_recode_SOURCES) \
+ $(path_serialize_SOURCES) $(relative_cd_SOURCES) \
+ $(tempdir_SOURCES) $(vfs_adjust_stat_SOURCES) \
+ $(vfs_get_encoding_SOURCES) $(vfs_parse_ls_lga_SOURCES) \
+ $(vfs_path_from_str_flags_SOURCES) \
+ $(vfs_path_string_convert_SOURCES) \
+ $(vfs_prefix_to_class_SOURCES) $(vfs_s_get_path_SOURCES) \
+ $(vfs_setup_cwd_SOURCES) $(vfs_split_SOURCES)
+DIST_SOURCES = $(canonicalize_pathname_SOURCES) $(current_dir_SOURCES) \
+ $(path_cmp_SOURCES) $(path_len_SOURCES) \
+ $(path_manipulations_SOURCES) $(path_recode_SOURCES) \
+ $(path_serialize_SOURCES) $(relative_cd_SOURCES) \
+ $(tempdir_SOURCES) $(vfs_adjust_stat_SOURCES) \
+ $(vfs_get_encoding_SOURCES) $(vfs_parse_ls_lga_SOURCES) \
+ $(vfs_path_from_str_flags_SOURCES) \
+ $(vfs_path_string_convert_SOURCES) \
+ $(vfs_prefix_to_class_SOURCES) $(vfs_s_get_path_SOURCES) \
+ $(vfs_setup_cwd_SOURCES) $(vfs_split_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)'
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/config/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/config/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp \
+ $(top_srcdir)/config/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CHECK_CFLAGS = @CHECK_CFLAGS@
+CHECK_LIBS = @CHECK_LIBS@
+COM_ERR_CFLAGS = @COM_ERR_CFLAGS@
+COM_ERR_LIBS = @COM_ERR_LIBS@
+CP1251 = @CP1251@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CSCOPE = @CSCOPE@
+CTAGS = @CTAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOC_LINGUAS = @DOC_LINGUAS@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
+E2P_CFLAGS = @E2P_CFLAGS@
+E2P_LIBS = @E2P_LIBS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ETAGS = @ETAGS@
+EXEEXT = @EXEEXT@
+EXT2FS_CFLAGS = @EXT2FS_CFLAGS@
+EXT2FS_LIBS = @EXT2FS_LIBS@
+EXTHELPERSDIR = @EXTHELPERSDIR@
+FGREP = @FGREP@
+FILECMD = @FILECMD@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GMODULE_CFLAGS = @GMODULE_CFLAGS@
+GMODULE_LIBS = @GMODULE_LIBS@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+HAVE_FILECMD = @HAVE_FILECMD@
+HAVE_ZIPINFO = @HAVE_ZIPINFO@
+HAVE_nroff = @HAVE_nroff@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBMC_RELEASE = @LIBMC_RELEASE@
+LIBMC_VERSION = @LIBMC_VERSION@
+LIBOBJS = @LIBOBJS@
+LIBS = @CHECK_LIBS@ $(top_builddir)/lib/libmc.la $(am__append_1)
+LIBSSH_CFLAGS = @LIBSSH_CFLAGS@
+LIBSSH_LIBS = @LIBSSH_LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANDOC = @MANDOC@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MAN_DATE = @MAN_DATE@
+MAN_FLAGS = @MAN_FLAGS@
+MAN_VERSION = @MAN_VERSION@
+MCLIBS = @MCLIBS@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = "/lib/vfs"
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCRE_CPPFLAGS = @PCRE_CPPFLAGS@
+PCRE_LIBS = @PCRE_LIBS@
+PERL = @PERL@
+PERL_FOR_BUILD = @PERL_FOR_BUILD@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POSUB = @POSUB@
+PYTHON = @PYTHON@
+RANLIB = @RANLIB@
+RUBY = @RUBY@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLANG_CFLAGS = @SLANG_CFLAGS@
+SLANG_LIBS = @SLANG_LIBS@
+STRIP = @STRIP@
+TESTS_LDFLAGS = @TESTS_LDFLAGS@
+UNZIP = @UNZIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+X11_WWW = @X11_WWW@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = \
+ -DTEST_SHARE_DIR=\"$(abs_srcdir)\" \
+ $(GLIB_CFLAGS) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/lib/vfs \
+ @CHECK_CFLAGS@
+
+AM_LDFLAGS = @TESTS_LDFLAGS@
+EXTRA_DIST = mc.charsets
+canonicalize_pathname_SOURCES = \
+ canonicalize_pathname.c
+
+current_dir_SOURCES = \
+ current_dir.c
+
+path_cmp_SOURCES = \
+ path_cmp.c
+
+path_len_SOURCES = \
+ path_len.c
+
+path_manipulations_SOURCES = \
+ path_manipulations.c
+
+path_recode_SOURCES = \
+ path_recode.c
+
+path_serialize_SOURCES = \
+ path_serialize.c
+
+relative_cd_SOURCES = \
+ relative_cd.c
+
+tempdir_SOURCES = \
+ tempdir.c
+
+vfs_adjust_stat_SOURCES = \
+ vfs_adjust_stat.c
+
+vfs_get_encoding_SOURCES = \
+ vfs_get_encoding.c
+
+vfs_setup_cwd_SOURCES = \
+ vfs_setup_cwd.c
+
+vfs_split_SOURCES = \
+ vfs_split.c
+
+vfs_parse_ls_lga_SOURCES = \
+ vfs_parse_ls_lga.c
+
+vfs_prefix_to_class_SOURCES = \
+ vfs_prefix_to_class.c
+
+vfs_path_from_str_flags_SOURCES = \
+ vfs_path_from_str_flags.c
+
+vfs_path_string_convert_SOURCES = \
+ vfs_path_string_convert.c
+
+vfs_s_get_path_SOURCES = \
+ vfs_s_get_path.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/lib/vfs/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu tests/lib/vfs/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+canonicalize_pathname$(EXEEXT): $(canonicalize_pathname_OBJECTS) $(canonicalize_pathname_DEPENDENCIES) $(EXTRA_canonicalize_pathname_DEPENDENCIES)
+ @rm -f canonicalize_pathname$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(canonicalize_pathname_OBJECTS) $(canonicalize_pathname_LDADD) $(LIBS)
+
+current_dir$(EXEEXT): $(current_dir_OBJECTS) $(current_dir_DEPENDENCIES) $(EXTRA_current_dir_DEPENDENCIES)
+ @rm -f current_dir$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(current_dir_OBJECTS) $(current_dir_LDADD) $(LIBS)
+
+path_cmp$(EXEEXT): $(path_cmp_OBJECTS) $(path_cmp_DEPENDENCIES) $(EXTRA_path_cmp_DEPENDENCIES)
+ @rm -f path_cmp$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(path_cmp_OBJECTS) $(path_cmp_LDADD) $(LIBS)
+
+path_len$(EXEEXT): $(path_len_OBJECTS) $(path_len_DEPENDENCIES) $(EXTRA_path_len_DEPENDENCIES)
+ @rm -f path_len$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(path_len_OBJECTS) $(path_len_LDADD) $(LIBS)
+
+path_manipulations$(EXEEXT): $(path_manipulations_OBJECTS) $(path_manipulations_DEPENDENCIES) $(EXTRA_path_manipulations_DEPENDENCIES)
+ @rm -f path_manipulations$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(path_manipulations_OBJECTS) $(path_manipulations_LDADD) $(LIBS)
+
+path_recode$(EXEEXT): $(path_recode_OBJECTS) $(path_recode_DEPENDENCIES) $(EXTRA_path_recode_DEPENDENCIES)
+ @rm -f path_recode$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(path_recode_OBJECTS) $(path_recode_LDADD) $(LIBS)
+
+path_serialize$(EXEEXT): $(path_serialize_OBJECTS) $(path_serialize_DEPENDENCIES) $(EXTRA_path_serialize_DEPENDENCIES)
+ @rm -f path_serialize$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(path_serialize_OBJECTS) $(path_serialize_LDADD) $(LIBS)
+
+relative_cd$(EXEEXT): $(relative_cd_OBJECTS) $(relative_cd_DEPENDENCIES) $(EXTRA_relative_cd_DEPENDENCIES)
+ @rm -f relative_cd$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(relative_cd_OBJECTS) $(relative_cd_LDADD) $(LIBS)
+
+tempdir$(EXEEXT): $(tempdir_OBJECTS) $(tempdir_DEPENDENCIES) $(EXTRA_tempdir_DEPENDENCIES)
+ @rm -f tempdir$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tempdir_OBJECTS) $(tempdir_LDADD) $(LIBS)
+
+vfs_adjust_stat$(EXEEXT): $(vfs_adjust_stat_OBJECTS) $(vfs_adjust_stat_DEPENDENCIES) $(EXTRA_vfs_adjust_stat_DEPENDENCIES)
+ @rm -f vfs_adjust_stat$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(vfs_adjust_stat_OBJECTS) $(vfs_adjust_stat_LDADD) $(LIBS)
+
+vfs_get_encoding$(EXEEXT): $(vfs_get_encoding_OBJECTS) $(vfs_get_encoding_DEPENDENCIES) $(EXTRA_vfs_get_encoding_DEPENDENCIES)
+ @rm -f vfs_get_encoding$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(vfs_get_encoding_OBJECTS) $(vfs_get_encoding_LDADD) $(LIBS)
+
+vfs_parse_ls_lga$(EXEEXT): $(vfs_parse_ls_lga_OBJECTS) $(vfs_parse_ls_lga_DEPENDENCIES) $(EXTRA_vfs_parse_ls_lga_DEPENDENCIES)
+ @rm -f vfs_parse_ls_lga$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(vfs_parse_ls_lga_OBJECTS) $(vfs_parse_ls_lga_LDADD) $(LIBS)
+
+vfs_path_from_str_flags$(EXEEXT): $(vfs_path_from_str_flags_OBJECTS) $(vfs_path_from_str_flags_DEPENDENCIES) $(EXTRA_vfs_path_from_str_flags_DEPENDENCIES)
+ @rm -f vfs_path_from_str_flags$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(vfs_path_from_str_flags_OBJECTS) $(vfs_path_from_str_flags_LDADD) $(LIBS)
+
+vfs_path_string_convert$(EXEEXT): $(vfs_path_string_convert_OBJECTS) $(vfs_path_string_convert_DEPENDENCIES) $(EXTRA_vfs_path_string_convert_DEPENDENCIES)
+ @rm -f vfs_path_string_convert$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(vfs_path_string_convert_OBJECTS) $(vfs_path_string_convert_LDADD) $(LIBS)
+
+vfs_prefix_to_class$(EXEEXT): $(vfs_prefix_to_class_OBJECTS) $(vfs_prefix_to_class_DEPENDENCIES) $(EXTRA_vfs_prefix_to_class_DEPENDENCIES)
+ @rm -f vfs_prefix_to_class$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(vfs_prefix_to_class_OBJECTS) $(vfs_prefix_to_class_LDADD) $(LIBS)
+
+vfs_s_get_path$(EXEEXT): $(vfs_s_get_path_OBJECTS) $(vfs_s_get_path_DEPENDENCIES) $(EXTRA_vfs_s_get_path_DEPENDENCIES)
+ @rm -f vfs_s_get_path$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(vfs_s_get_path_OBJECTS) $(vfs_s_get_path_LDADD) $(LIBS)
+
+vfs_setup_cwd$(EXEEXT): $(vfs_setup_cwd_OBJECTS) $(vfs_setup_cwd_DEPENDENCIES) $(EXTRA_vfs_setup_cwd_DEPENDENCIES)
+ @rm -f vfs_setup_cwd$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(vfs_setup_cwd_OBJECTS) $(vfs_setup_cwd_LDADD) $(LIBS)
+
+vfs_split$(EXEEXT): $(vfs_split_OBJECTS) $(vfs_split_DEPENDENCIES) $(EXTRA_vfs_split_DEPENDENCIES)
+ @rm -f vfs_split$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(vfs_split_OBJECTS) $(vfs_split_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canonicalize_pathname.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/current_dir.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path_cmp.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path_len.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path_manipulations.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path_recode.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path_serialize.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/relative_cd.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tempdir.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfs_adjust_stat.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfs_get_encoding.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfs_parse_ls_lga.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfs_path_from_str_flags.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfs_path_string_convert.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfs_prefix_to_class.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfs_s_get_path.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfs_setup_cwd.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfs_split.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS: $(check_PROGRAMS)
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+canonicalize_pathname.log: canonicalize_pathname$(EXEEXT)
+ @p='canonicalize_pathname$(EXEEXT)'; \
+ b='canonicalize_pathname'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+current_dir.log: current_dir$(EXEEXT)
+ @p='current_dir$(EXEEXT)'; \
+ b='current_dir'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+path_cmp.log: path_cmp$(EXEEXT)
+ @p='path_cmp$(EXEEXT)'; \
+ b='path_cmp'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+path_len.log: path_len$(EXEEXT)
+ @p='path_len$(EXEEXT)'; \
+ b='path_len'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+path_manipulations.log: path_manipulations$(EXEEXT)
+ @p='path_manipulations$(EXEEXT)'; \
+ b='path_manipulations'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+path_serialize.log: path_serialize$(EXEEXT)
+ @p='path_serialize$(EXEEXT)'; \
+ b='path_serialize'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+relative_cd.log: relative_cd$(EXEEXT)
+ @p='relative_cd$(EXEEXT)'; \
+ b='relative_cd'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+tempdir.log: tempdir$(EXEEXT)
+ @p='tempdir$(EXEEXT)'; \
+ b='tempdir'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+vfs_adjust_stat.log: vfs_adjust_stat$(EXEEXT)
+ @p='vfs_adjust_stat$(EXEEXT)'; \
+ b='vfs_adjust_stat'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+vfs_parse_ls_lga.log: vfs_parse_ls_lga$(EXEEXT)
+ @p='vfs_parse_ls_lga$(EXEEXT)'; \
+ b='vfs_parse_ls_lga'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+vfs_path_from_str_flags.log: vfs_path_from_str_flags$(EXEEXT)
+ @p='vfs_path_from_str_flags$(EXEEXT)'; \
+ b='vfs_path_from_str_flags'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+vfs_path_string_convert.log: vfs_path_string_convert$(EXEEXT)
+ @p='vfs_path_string_convert$(EXEEXT)'; \
+ b='vfs_path_string_convert'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+vfs_prefix_to_class.log: vfs_prefix_to_class$(EXEEXT)
+ @p='vfs_prefix_to_class$(EXEEXT)'; \
+ b='vfs_prefix_to_class'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+vfs_setup_cwd.log: vfs_setup_cwd$(EXEEXT)
+ @p='vfs_setup_cwd$(EXEEXT)'; \
+ b='vfs_setup_cwd'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+vfs_split.log: vfs_split$(EXEEXT)
+ @p='vfs_split$(EXEEXT)'; \
+ b='vfs_split'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+vfs_s_get_path.log: vfs_s_get_path$(EXEEXT)
+ @p='vfs_s_get_path$(EXEEXT)'; \
+ b='vfs_s_get_path'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+path_recode.log: path_recode$(EXEEXT)
+ @p='path_recode$(EXEEXT)'; \
+ b='path_recode'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+vfs_get_encoding.log: vfs_get_encoding$(EXEEXT)
+ @p='vfs_get_encoding$(EXEEXT)'; \
+ b='vfs_get_encoding'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f ./$(DEPDIR)/canonicalize_pathname.Po
+ -rm -f ./$(DEPDIR)/current_dir.Po
+ -rm -f ./$(DEPDIR)/path_cmp.Po
+ -rm -f ./$(DEPDIR)/path_len.Po
+ -rm -f ./$(DEPDIR)/path_manipulations.Po
+ -rm -f ./$(DEPDIR)/path_recode.Po
+ -rm -f ./$(DEPDIR)/path_serialize.Po
+ -rm -f ./$(DEPDIR)/relative_cd.Po
+ -rm -f ./$(DEPDIR)/tempdir.Po
+ -rm -f ./$(DEPDIR)/vfs_adjust_stat.Po
+ -rm -f ./$(DEPDIR)/vfs_get_encoding.Po
+ -rm -f ./$(DEPDIR)/vfs_parse_ls_lga.Po
+ -rm -f ./$(DEPDIR)/vfs_path_from_str_flags.Po
+ -rm -f ./$(DEPDIR)/vfs_path_string_convert.Po
+ -rm -f ./$(DEPDIR)/vfs_prefix_to_class.Po
+ -rm -f ./$(DEPDIR)/vfs_s_get_path.Po
+ -rm -f ./$(DEPDIR)/vfs_setup_cwd.Po
+ -rm -f ./$(DEPDIR)/vfs_split.Po
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f ./$(DEPDIR)/canonicalize_pathname.Po
+ -rm -f ./$(DEPDIR)/current_dir.Po
+ -rm -f ./$(DEPDIR)/path_cmp.Po
+ -rm -f ./$(DEPDIR)/path_len.Po
+ -rm -f ./$(DEPDIR)/path_manipulations.Po
+ -rm -f ./$(DEPDIR)/path_recode.Po
+ -rm -f ./$(DEPDIR)/path_serialize.Po
+ -rm -f ./$(DEPDIR)/relative_cd.Po
+ -rm -f ./$(DEPDIR)/tempdir.Po
+ -rm -f ./$(DEPDIR)/vfs_adjust_stat.Po
+ -rm -f ./$(DEPDIR)/vfs_get_encoding.Po
+ -rm -f ./$(DEPDIR)/vfs_parse_ls_lga.Po
+ -rm -f ./$(DEPDIR)/vfs_path_from_str_flags.Po
+ -rm -f ./$(DEPDIR)/vfs_path_string_convert.Po
+ -rm -f ./$(DEPDIR)/vfs_prefix_to_class.Po
+ -rm -f ./$(DEPDIR)/vfs_s_get_path.Po
+ -rm -f ./$(DEPDIR)/vfs_setup_cwd.Po
+ -rm -f ./$(DEPDIR)/vfs_split.Po
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \
+ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ recheck tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tests/lib/vfs/canonicalize_pathname.c b/tests/lib/vfs/canonicalize_pathname.c
new file mode 100644
index 0000000..c40c81d
--- /dev/null
+++ b/tests/lib/vfs/canonicalize_pathname.c
@@ -0,0 +1,203 @@
+/*
+ lib - canonicalize path
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#ifdef HAVE_CHARSET
+#include "lib/charsets.h"
+#endif
+
+#include "lib/strutil.h"
+#include "lib/util.h"
+#include "lib/vfs/xdirentry.h"
+
+#include "src/vfs/local/local.c"
+
+static struct vfs_class vfs_test_ops;
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+#ifdef HAVE_CHARSET
+ mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
+ load_codepages_list ();
+#endif
+
+ vfs_init_class (&vfs_test_ops, "testfs", VFSF_NOLINKS | VFSF_REMOTE, "ftp");
+ vfs_register_class (&vfs_test_ops);
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+#ifdef HAVE_CHARSET
+ free_codepages_list ();
+#endif
+
+ vfs_shut ();
+
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_canonicalize_path_ds") */
+/* *INDENT-OFF* */
+static const struct test_canonicalize_path_ds
+{
+ const char *input_path;
+ const char *expected_path;
+} test_canonicalize_path_ds[] =
+{
+ { /* 0. UNC path */
+ "//some_server/ww",
+ "//some_server/ww"
+ },
+ { /* 1. join slashes */
+ "///some_server/////////ww",
+ "/some_server/ww"
+ },
+ { /* 2. Collapse "/./" -> "/" */
+ "//some_server//.///////ww/./././.",
+ "//some_server/ww"
+ },
+ {/* 3. Remove leading "./" */
+ "./some_server/ww",
+ "some_server/ww"
+ },
+ { /* 4. some/.. -> . */
+ "some_server/..",
+ "."
+ },
+ { /* 5. Collapse "/.." with the previous part of path */
+ "/some_server/ww/some_server/../ww/../some_server/..//ww/some_server/ww",
+ "/some_server/ww/ww/some_server/ww"
+ },
+ { /* 6. URI style */
+ "/some_server/ww/ftp://user:pass@host.net/path/",
+ "/some_server/ww/ftp://user:pass@host.net/path"
+ },
+ { /* 7. */
+ "/some_server/ww/ftp://user:pass@host.net/path/../../",
+ "/some_server/ww"
+ },
+ { /* 8. */
+ "ftp://user:pass@host.net/path/../../",
+ "."
+ },
+ { /* 9. */
+ "ftp://user/../../",
+ ".."
+ },
+#ifdef HAVE_CHARSET
+ { /* 10. Supported encoding */
+ "/b/#enc:utf-8/../c",
+ "/c"
+ },
+ { /* 11. Unsupported encoding */
+ "/b/#enc:aaaa/../c",
+ "/b/c"
+ },
+ { /* 12. Supported encoding */
+ "/b/../#enc:utf-8/c",
+ "/#enc:utf-8/c"
+ },
+ { /* 13. Unsupported encoding */
+ "/b/../#enc:aaaa/c",
+ "/#enc:aaaa/c"
+ },
+ { /* 14. Supported encoding */
+ "/b/c/#enc:utf-8/..",
+ "/b"
+ },
+ { /* 15. Unsupported encoding */
+ "/b/c/#enc:aaaa/..",
+ "/b/c"
+ },
+ { /* 16. Supported encoding */
+ "/b/c/../#enc:utf-8",
+ "/b/#enc:utf-8"
+ },
+ { /* 17. Unsupported encoding */
+ "/b/c/../#enc:aaaa",
+ "/b/#enc:aaaa"
+ },
+#endif /* HAVE_CHARSET */
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_canonicalize_path_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_canonicalize_path, test_canonicalize_path_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ char *actual_path;
+
+ actual_path = g_strdup (data->input_path);
+
+ /* when */
+ canonicalize_pathname (actual_path);
+
+ /* then */
+ mctest_assert_str_eq (actual_path, data->expected_path) g_free (actual_path);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_canonicalize_path, test_canonicalize_path_ds);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/current_dir.c b/tests/lib/vfs/current_dir.c
new file mode 100644
index 0000000..6ae1651
--- /dev/null
+++ b/tests/lib/vfs/current_dir.c
@@ -0,0 +1,207 @@
+/*
+ lib/vfs - manipulate with current directory
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#include <string.h> /* memset() */
+
+#include "lib/global.h"
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+
+#include "src/vfs/local/local.c"
+
+static struct vfs_s_subclass vfs_test_subclass;
+static struct vfs_class *vfs_test_ops = VFS_CLASS (&vfs_test_subclass);
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Mock */
+static int
+test_chdir (const vfs_path_t * vpath)
+{
+ (void) vpath;
+
+ return 0;
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+ memset (&vfs_test_subclass, 0, sizeof (vfs_test_subclass));
+ vfs_init_class (vfs_test_ops, "testfs", VFSF_UNKNOWN, "test");
+ vfs_test_ops->chdir = test_chdir;
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_cd_ds") */
+/* *INDENT-OFF* */
+static const struct test_cd_ds
+{
+ const char *input_initial_path;
+ const char *input_cd_path;
+ const vfs_flags_t input_class_flags;
+
+ const char *expected_cd_path;
+} test_cd_ds[] =
+{
+ { /* 0. */
+ "/",
+ "/dev/some.file/test://",
+ VFSF_NOLINKS,
+ "/dev/some.file/test://"
+ },
+ { /* 1. */
+ "/",
+ "/dev/some.file/test://bla-bla",
+ VFSF_NOLINKS,
+ "/dev/some.file/test://bla-bla"
+ },
+ { /* 2. */
+ "/dev/some.file/test://bla-bla",
+ "..",
+ VFSF_NOLINKS,
+ "/dev/some.file/test://"
+ },
+ { /* 3. */
+ "/dev/some.file/test://",
+ "..",
+ VFSF_NOLINKS,
+ "/dev"
+ },
+ { /* 4. */
+ "/dev",
+ "..",
+ VFSF_NOLINKS,
+ "/"
+ },
+ { /* 5. */
+ "/",
+ "..",
+ VFSF_NOLINKS,
+ "/"
+ },
+ { /* 6. */
+ "/",
+ "/test://user:pass@host.net/path",
+ VFSF_NOLINKS | VFSF_REMOTE,
+ "/test://user:pass@host.net/path"
+ },
+ { /* 7. */
+ "/test://user:pass@host.net/path",
+ "..",
+ VFSF_NOLINKS | VFSF_REMOTE,
+ "/test://user:pass@host.net/"
+ },
+ { /* 8. */
+ "/test://user:pass@host.net/",
+ "..",
+ VFSF_NOLINKS | VFSF_REMOTE,
+ "/"
+ },
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_cd_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_cd, test_cd_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath;
+
+ vfs_test_ops->flags = data->input_class_flags;
+ vfs_register_class (vfs_test_ops);
+
+ vfs_set_raw_current_dir (vfs_path_from_str (data->input_initial_path));
+
+ vpath = vfs_path_from_str (data->input_cd_path);
+
+ /* when */
+ mc_chdir (vpath);
+
+ /* then */
+ {
+ char *actual_cd_path;
+
+ actual_cd_path = _vfs_get_cwd ();
+ mctest_assert_str_eq (actual_cd_path, data->expected_cd_path);
+ g_free (actual_cd_path);
+ }
+ vfs_path_free (vpath, TRUE);
+
+ vfs_unregister_class (vfs_test_ops);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+ char *cwd;
+
+ tc_core = tcase_create ("Core");
+
+ /* writable directory where check creates temporary files */
+ cwd = g_get_current_dir ();
+ g_setenv ("TEMP", cwd, TRUE);
+ g_free (cwd);
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_cd, test_cd_ds);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/mc.charsets b/tests/lib/vfs/mc.charsets
new file mode 100644
index 0000000..f51ee2a
--- /dev/null
+++ b/tests/lib/vfs/mc.charsets
@@ -0,0 +1,5 @@
+ASCII 7-bit ASCII
+IBM866 CP 866
+KOI8-R KOI8-R
+KOI8-U KOI8-U
+UTF-8 UTF-8
diff --git a/tests/lib/vfs/path_cmp.c b/tests/lib/vfs/path_cmp.c
new file mode 100644
index 0000000..abb3ecd
--- /dev/null
+++ b/tests/lib/vfs/path_cmp.c
@@ -0,0 +1,254 @@
+/* lib/vfs - vfs_path_t compare functions
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#ifdef HAVE_CHARSET
+#include "lib/charsets.h"
+#endif
+
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+#include "lib/vfs/path.h"
+
+#include "src/vfs/local/local.c"
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+ mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
+#ifdef HAVE_CHARSET
+ load_codepages_list ();
+#endif
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+#ifdef HAVE_CHARSET
+ free_codepages_list ();
+#endif
+
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_path_equal_ds") */
+/* *INDENT-OFF* */
+static const struct test_path_equal_ds
+{
+ const char *input_path1;
+ const char *input_path2;
+ const gboolean expected_result;
+} test_path_equal_ds[] =
+{
+ { /* 0. */
+ NULL,
+ NULL,
+ FALSE
+ },
+ { /* 1. */
+ NULL,
+ "/test/path",
+ FALSE
+ },
+ { /* 2. */
+ "/test/path",
+ NULL,
+ FALSE
+ },
+ { /* 3. */
+ "/test/path",
+ "/test/path",
+ TRUE
+ },
+#ifdef HAVE_CHARSET
+ { /* 4. */
+ "/#enc:KOI8-R/теÑтовый/путь",
+ "/теÑтовый/путь",
+ FALSE
+ },
+ { /* 5. */
+ "/теÑтовый/путь",
+ "/#enc:KOI8-R/теÑтовый/путь",
+ FALSE
+ },
+ { /* 6. */
+ "/#enc:KOI8-R/теÑтовый/путь",
+ "/#enc:KOI8-R/теÑтовый/путь",
+ TRUE
+ },
+#endif
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_path_equal_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_path_equal, test_path_equal_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath1, *vpath2;
+ gboolean actual_result;
+
+ vpath1 = vfs_path_from_str (data->input_path1);
+ vpath2 = vfs_path_from_str (data->input_path2);
+
+ /* when */
+ actual_result = vfs_path_equal (vpath1, vpath2);
+
+ /* then */
+ ck_assert_int_eq (actual_result, data->expected_result);
+
+ vfs_path_free (vpath1, TRUE);
+ vfs_path_free (vpath2, TRUE);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_path_equal_len_ds") */
+/* *INDENT-OFF* */
+static const struct test_path_equal_len_ds
+{
+ const char *input_path1;
+ const char *input_path2;
+ const size_t input_length;
+ const gboolean expected_result;
+} test_path_equal_len_ds[] =
+{
+ { /* 0. */
+ NULL,
+ NULL,
+ 0,
+ FALSE
+ },
+ { /* 1. */
+ NULL,
+ NULL,
+ 100,
+ FALSE
+ },
+ { /* 2. */
+ NULL,
+ "/теÑтовый/путь",
+ 10,
+ FALSE
+ },
+ { /* 3. */
+ "/теÑтовый/путь",
+ NULL,
+ 10,
+ FALSE
+ },
+ { /* 4. */
+ "/теÑтовый/путь",
+ "/теÑтовый/путь",
+ 10,
+ TRUE
+ },
+ { /* 5. */
+ "/теÑÑ‚/овый/путь",
+ "/теÑтовый/путь",
+ 8,
+ TRUE
+ },
+ { /* 6. */
+ "/теÑÑ‚/овый/путь",
+ "/теÑтовый/путь",
+ 10,
+ FALSE
+ },
+ { /* 7. */
+ "/теÑтовый/путь",
+ "/теÑÑ‚/овый/путь",
+ 10,
+ FALSE
+ },
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_path_equal_len_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_path_equal_len, test_path_equal_len_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath1, *vpath2;
+ gboolean actual_result;
+
+ vpath1 = vfs_path_from_str (data->input_path1);
+ vpath2 = vfs_path_from_str (data->input_path2);
+
+ /* when */
+ actual_result = vfs_path_equal_len (vpath1, vpath2, data->input_length);
+
+ /* then */
+ ck_assert_int_eq (actual_result, data->expected_result);
+
+ vfs_path_free (vpath1, TRUE);
+ vfs_path_free (vpath2, TRUE);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_path_equal, test_path_equal_ds);
+ mctest_add_parameterized_test (tc_core, test_path_equal_len, test_path_equal_len_ds);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/path_len.c b/tests/lib/vfs/path_len.c
new file mode 100644
index 0000000..dec99ba
--- /dev/null
+++ b/tests/lib/vfs/path_len.c
@@ -0,0 +1,142 @@
+/* lib/vfs - tests for vfspath_len() function.
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#ifdef HAVE_CHARSET
+#include "lib/charsets.h"
+#endif
+
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+#include "lib/vfs/path.h"
+
+#include "src/vfs/local/local.c"
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+ mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
+#ifdef HAVE_CHARSET
+ load_codepages_list ();
+#endif
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+#ifdef HAVE_CHARSET
+ free_codepages_list ();
+#endif
+
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+/* @DataSource("test_path_length_ds") */
+/* *INDENT-OFF* */
+static const struct test_path_length_ds
+{
+ const char *input_path;
+ const size_t expected_length;
+} test_path_length_ds[] =
+{
+ { /* 0. */
+ NULL,
+ 0
+ },
+ { /* 1. */
+ "/",
+ 1
+ },
+ { /* 2. */
+ "/теÑтовый/путь",
+ 26
+ },
+#ifdef HAVE_CHARSET
+ { /* 3. */
+ "/#enc:KOI8-R/теÑтовый/путь",
+ 38
+ },
+#endif /* HAVE_CHARSET */
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_path_length_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_path_length, test_path_length_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath;
+ size_t actual_length;
+
+ vpath = vfs_path_from_str (data->input_path);
+
+ /* when */
+ actual_length = vfs_path_len (vpath);
+
+ /* then */
+ ck_assert_int_eq (actual_length, data->expected_length);
+
+ vfs_path_free (vpath, TRUE);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_path_length, test_path_length_ds);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/path_manipulations.c b/tests/lib/vfs/path_manipulations.c
new file mode 100644
index 0000000..bb4f64d
--- /dev/null
+++ b/tests/lib/vfs/path_manipulations.c
@@ -0,0 +1,458 @@
+/* lib/vfs - test vfs_path_t manipulation functions
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#ifdef HAVE_CHARSET
+#include "lib/charsets.h"
+#endif
+
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+#include "lib/vfs/path.h"
+
+#include "src/vfs/local/local.c"
+
+
+static struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3;
+
+/* --------------------------------------------------------------------------------------------- */
+
+static void
+init_test_classes (void)
+{
+ vfs_init_class (&vfs_test_ops1, "testfs1", VFSF_NOLINKS | VFSF_REMOTE, "test1");
+ vfs_register_class (&vfs_test_ops1);
+
+ vfs_init_class (&vfs_test_ops2, "testfs2", VFSF_UNKNOWN, "test2");
+ vfs_register_class (&vfs_test_ops2);
+
+ vfs_init_class (&vfs_test_ops3, "testfs3", VFSF_LOCAL, "test3");
+ vfs_register_class (&vfs_test_ops3);
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+ init_test_classes ();
+
+ mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
+#ifdef HAVE_CHARSET
+ load_codepages_list ();
+#endif
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+#ifdef HAVE_CHARSET
+ free_codepages_list ();
+#endif
+
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_vfs_path_tokens_count_ds") */
+/* *INDENT-OFF* */
+static const struct test_vfs_path_tokens_count_ds
+{
+ const char *input_path;
+ const vfs_path_flag_t input_flags;
+ const size_t expected_token_count;
+} test_vfs_path_tokens_count_ds[] =
+{
+ { /* 0. */
+ "/",
+ VPF_NONE,
+ 0
+ },
+ { /* 1. */
+ "/path",
+ VPF_NONE,
+ 1
+ },
+ { /* 2. */
+ "/path1/path2/path3",
+ VPF_NONE,
+ 3
+ },
+ { /* 3. */
+ "test3://path1/path2/path3/path4",
+ VPF_NO_CANON,
+ 4
+ },
+ { /* 4. */
+ "path1/path2/path3",
+ VPF_NO_CANON,
+ 3
+ },
+ { /* 5. */
+ "/path1/path2/path3/",
+ VPF_NONE,
+ 3
+ },
+ { /* 6. */
+ "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/",
+ VPF_NONE,
+ 5
+ },
+#ifdef HAVE_CHARSET
+ { /* 7. */
+ "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/"
+ "test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33",
+ VPF_NONE,
+ 11
+ },
+#endif
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_vfs_path_tokens_count_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_vfs_path_tokens_count, test_vfs_path_tokens_count_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ size_t tokens_count;
+ vfs_path_t *vpath;
+
+ vpath = vfs_path_from_str_flags (data->input_path, data->input_flags);
+
+ /* when */
+ tokens_count = vfs_path_tokens_count (vpath);
+
+ /* then */
+ ck_assert_int_eq (tokens_count, data->expected_token_count);
+
+ vfs_path_free (vpath, TRUE);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_vfs_path_tokens_get_ds") */
+/* *INDENT-OFF* */
+static const struct test_vfs_path_tokens_get_ds
+{
+ const char *input_path;
+ const ssize_t input_start_position;
+ const ssize_t input_length;
+
+ const char *expected_path;
+} test_vfs_path_tokens_get_ds[] =
+{
+ { /* 0. Invalid start position */
+ "/",
+ 2,
+ 1,
+ NULL
+ },
+ { /* 1. Invalid negative position */
+ "/path",
+ -3,
+ 1,
+ NULL
+ },
+ { /* 2. Count of tokens is zero. Count should be autocorrected */
+ "/path",
+ 0,
+ 0,
+ "path"
+ },
+ { /* 3. get 'path2/path3' by 1,2 */
+ "/path1/path2/path3/path4",
+ 1,
+ 2,
+ "path2/path3"
+ },
+ { /* 4. get 'path2/path3' by 1,2 from LOCAL VFS */
+ "test3://path1/path2/path3/path4",
+ 1,
+ 2,
+ "path2/path3"
+ },
+ { /* 5. get 'path2/path3' by 1,2 from non-LOCAL VFS */
+ "test2://path1/path2/path3/path4",
+ 1,
+ 2,
+ "test2://path2/path3"
+ },
+ { /* 6. get 'path2/path3' by 1,2 throught non-LOCAL VFS */
+ "/path1/path2/test1://user:pass@some.host:12345/path3/path4",
+ 1,
+ 2,
+ "path2/test1://user:pass@some.host:12345/path3"
+ },
+ { /* 7. get 'path2/path3' by 1,2 where path2 it's LOCAL VFS */
+ "test3://path1/path2/test2://path3/path4",
+ 1,
+ 2,
+ "path2/test2://path3"
+ },
+ { /* 8. get 'path2/path3' by 1,2 where path3 it's LOCAL VFS */
+ "test2://path1/path2/test3://path3/path4",
+ 1,
+ 2,
+ "test2://path2/test3://path3"
+ },
+ { /* 9. get 'path4' by -1,1 */
+ "/path1/path2/path3/path4",
+ -1,
+ 1,
+ "path4"
+ },
+ { /* 10. get 'path2/path3/path4' by -3,0 */
+ "/path1/path2/path3/path4",
+ -3,
+ 0,
+ "path2/path3/path4"
+ },
+#ifdef HAVE_CHARSET
+ { /* 11. get 'path2/path3' by 1,2 from LOCAL VFS with encoding */
+ "test3://path1/path2/test3://#enc:KOI8-R/path3/path4",
+ 1,
+ 2,
+ "path2/test3://#enc:KOI8-R/path3"
+ },
+ { /* 12. get 'path2/path3' by 1,2 with encoding */
+ "#enc:KOI8-R/path1/path2/path3/path4",
+ 1,
+ 2,
+ "#enc:KOI8-R/path2/path3"
+ },
+#endif
+/* TODO: currently this test don't passed. Probably broken string URI parser
+ { *//* 13. get 'path2/path3' by 1,2 from LOCAL VFS *//*
+
+ "test3://path1/path2/test2://test3://path3/path4",
+ 1,
+ 2,
+ "path2/path3"
+ },
+*/
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_vfs_path_tokens_get_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_vfs_path_tokens_get, test_vfs_path_tokens_get_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath;
+ char *actual_path;
+
+ vpath = vfs_path_from_str_flags (data->input_path, VPF_NO_CANON);
+
+ /* when */
+ actual_path = vfs_path_tokens_get (vpath, data->input_start_position, data->input_length);
+
+ /* then */
+ mctest_assert_str_eq (actual_path, data->expected_path);
+
+ g_free (actual_path);
+ vfs_path_free (vpath, TRUE);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_vfs_path_append_vpath_ds") */
+/* *INDENT-OFF* */
+static const struct test_vfs_path_append_vpath_ds
+{
+ const char *input_path1;
+ const char *input_path2;
+ const int expected_element_count;
+ const char *expected_path;
+} test_vfs_path_append_vpath_ds[] =
+{
+ { /* 0. */
+ "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33",
+ "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/",
+ 6,
+ "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33"
+ "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path",
+ },
+#ifdef HAVE_CHARSET
+ { /* 1. */
+ "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33",
+ "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/",
+ 6,
+ "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33"
+ "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path",
+ },
+#endif /* HAVE_CHARSET */
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_vfs_path_append_vpath_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_vfs_path_append_vpath, test_vfs_path_append_vpath_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath1, *vpath2, *vpath3;
+
+ vpath1 = vfs_path_from_str (data->input_path1);
+ vpath2 = vfs_path_from_str (data->input_path2);
+
+ /* when */
+ vpath3 = vfs_path_append_vpath_new (vpath1, vpath2, NULL);
+
+ /* then */
+ ck_assert_int_eq (vfs_path_elements_count (vpath3), data->expected_element_count);
+ mctest_assert_str_eq (vfs_path_as_str (vpath3), data->expected_path);
+
+ vfs_path_free (vpath1, TRUE);
+ vfs_path_free (vpath2, TRUE);
+ vfs_path_free (vpath3, TRUE);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_vfs_path_relative_ds") */
+/* *INDENT-OFF* */
+static const struct test_vfs_path_relative_ds
+{
+ const char *input_path;
+ const char *expected_path;
+ const char *expected_last_path_in_element;
+} test_vfs_path_relative_ds[] =
+{
+ { /* 0. */
+ "../bla-bla",
+ "../bla-bla",
+ "../bla-bla"
+ },
+ { /* 1. */
+ "../path/test1://user:pass@some.host:12345/bla-bla/some/path/",
+ "../path/test1://user:pass@some.host:12345/bla-bla/some/path/",
+ "bla-bla/some/path/"
+ },
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_vfs_path_relative_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_vfs_path_relative, test_vfs_path_relative_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath;
+
+ /* when */
+
+ vpath = vfs_path_from_str_flags (data->input_path, VPF_NO_CANON);
+
+ /* then */
+ mctest_assert_true (vpath->relative);
+ mctest_assert_str_eq (vfs_path_get_last_path_str (vpath), data->expected_last_path_in_element);
+ mctest_assert_str_eq (vfs_path_as_str (vpath), data->expected_path);
+
+ vfs_path_free (vpath, TRUE);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Test(dataSource = "test_vfs_path_relative_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_vfs_path_relative_clone, test_vfs_path_relative_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath, *cloned_vpath;
+
+ vpath = vfs_path_from_str_flags (data->input_path, VPF_NO_CANON);
+
+ /* when */
+
+ cloned_vpath = vfs_path_clone (vpath);
+
+ /* then */
+ mctest_assert_true (cloned_vpath->relative);
+ mctest_assert_str_eq (vfs_path_get_last_path_str (cloned_vpath),
+ data->expected_last_path_in_element);
+ mctest_assert_str_eq (vfs_path_as_str (cloned_vpath), data->expected_path);
+
+ vfs_path_free (vpath, TRUE);
+ vfs_path_free (cloned_vpath, TRUE);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_vfs_path_tokens_count,
+ test_vfs_path_tokens_count_ds);
+ mctest_add_parameterized_test (tc_core, test_vfs_path_tokens_get, test_vfs_path_tokens_get_ds);
+ mctest_add_parameterized_test (tc_core, test_vfs_path_append_vpath,
+ test_vfs_path_append_vpath_ds);
+ mctest_add_parameterized_test (tc_core, test_vfs_path_relative, test_vfs_path_relative_ds);
+ mctest_add_parameterized_test (tc_core, test_vfs_path_relative_clone,
+ test_vfs_path_relative_ds);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/path_recode.c b/tests/lib/vfs/path_recode.c
new file mode 100644
index 0000000..55ec1ad
--- /dev/null
+++ b/tests/lib/vfs/path_recode.c
@@ -0,0 +1,285 @@
+/*
+ lib/vfs - vfs_path_t charset recode functions
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#include "lib/charsets.h"
+
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+#include "lib/vfs/path.h"
+
+#include "src/vfs/local/local.c"
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Mock */
+const char *
+mc_config_get_home_dir (void)
+{
+ return "/mock/home";
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+static void
+test_init_vfs (const char *encoding)
+{
+ str_init_strings (encoding);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+ mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
+
+ mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
+ load_codepages_list ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+static void
+test_deinit_vfs (void)
+{
+ free_codepages_list ();
+ str_uninit_strings ();
+ vfs_shut ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_path_recode_ds") */
+/* *INDENT-OFF* */
+static const struct test_path_recode_ds
+{
+ const char *input_codepage;
+ const char *input_path;
+ const char *expected_element_path;
+ const char *expected_recoded_path;
+} test_path_recode_ds[] =
+{
+ { /* 0. */
+ "UTF-8",
+ "/ÔÅÓÔÏ×ÙÊ/ÐÕÔØ",
+ "/ÔÅÓÔÏ×ÙÊ/ÐÕÔØ",
+ "/ÔÅÓÔÏ×ÙÊ/ÐÕÔØ"
+ },
+ { /* 1. */
+ "UTF-8",
+ "/#enc:KOI8-R/теÑтовый/путь",
+ "/ÔÅÓÔÏ×ÙÊ/ÐÕÔØ",
+ "/#enc:KOI8-R/теÑтовый/путь"
+ },
+ { /* 2. */
+ "KOI8-R",
+ "/теÑтовый/путь",
+ "/теÑтовый/путь",
+ "/теÑтовый/путь"
+ },
+ { /* 3. */
+ "KOI8-R",
+ "/#enc:UTF-8/ÔÅÓÔÏ×ÙÊ/ÐÕÔØ",
+ "/теÑтовый/путь",
+ "/#enc:UTF-8/ÔÅÓÔÏ×ÙÊ/ÐÕÔØ"
+ },
+ { /* 4. Test encode info at start */
+ "UTF-8",
+ "#enc:KOI8-R/bla-bla/some/path",
+ "/bla-bla/some/path",
+ "/#enc:KOI8-R/bla-bla/some/path"
+ },
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_path_recode_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_path_recode, test_path_recode_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath;
+ const vfs_path_element_t *element;
+ const char *vpath_str;
+
+ test_init_vfs (data->input_codepage);
+
+ /* when */
+ vpath = vfs_path_from_str (data->input_path);
+ element = vfs_path_get_by_index (vpath, -1);
+
+ /* then */
+ vpath_str = vfs_path_as_str (vpath);
+ mctest_assert_ptr_ne (vpath, NULL);
+ mctest_assert_str_eq (element->path, data->expected_element_path);
+ mctest_assert_str_eq (vpath_str, data->expected_recoded_path);
+
+ vfs_path_free (vpath, TRUE);
+ test_deinit_vfs ();
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+
+/* --------------------------------------------------------------------------------------------- */
+
+static struct vfs_class vfs_test_ops1;
+
+/* @DataSource("test_path_to_str_flags_ds") */
+/* *INDENT-OFF* */
+static const struct test_path_to_str_flags_ds
+{
+ const char *input_path;
+ const vfs_path_flag_t input_from_str_flags;
+ const vfs_path_flag_t input_to_str_flags;
+ const char *expected_path;
+} test_path_to_str_flags_ds[] =
+{
+ { /* 0. */
+ "test1://user:passwd@127.0.0.1",
+ VPF_NO_CANON,
+ VPF_STRIP_PASSWORD,
+ "test1://user@127.0.0.1/"
+ },
+ { /* 1. */
+ "/test1://user:passwd@host.name/#enc:KOI8-R/теÑтовый/путь",
+ VPF_NONE,
+ VPF_STRIP_PASSWORD,
+ "/test1://user@host.name/#enc:KOI8-R/теÑтовый/путь"
+ },
+ { /* 2. */
+ "/test1://user:passwd@host.name/#enc:KOI8-R/теÑтовый/путь",
+ VPF_NONE,
+ VPF_RECODE,
+ "/test1://user:passwd@host.name/ÔÅÓÔÏ×ÙÊ/ÐÕÔØ"
+ },
+ { /* 3. */
+ "/test1://user:passwd@host.name/#enc:KOI8-R/теÑтовый/путь",
+ VPF_NONE,
+ VPF_RECODE | VPF_STRIP_PASSWORD,
+ "/test1://user@host.name/ÔÅÓÔÏ×ÙÊ/ÐÕÔØ"
+ },
+ { /* 4. */
+ "/mock/home/test/dir",
+ VPF_NONE,
+ VPF_STRIP_HOME,
+ "~/test/dir"
+ },
+ { /* 5. */
+ "/mock/home/test1://user:passwd@host.name/#enc:KOI8-R/теÑтовый/путь",
+ VPF_NONE,
+ VPF_STRIP_HOME | VPF_STRIP_PASSWORD,
+ "~/test1://user@host.name/#enc:KOI8-R/теÑтовый/путь"
+ },
+ { /* 6. */
+ "/mock/home/test1://user:passwd@host.name/#enc:KOI8-R/теÑтовый/путь",
+ VPF_NONE,
+ VPF_STRIP_HOME | VPF_STRIP_PASSWORD | VPF_HIDE_CHARSET,
+ "~/test1://user@host.name/теÑтовый/путь"
+ },
+ { /* 7. */
+ "/mock/home/test1://user:passwd@host.name/#enc:KOI8-R/теÑтовый/путь",
+ VPF_NONE,
+ VPF_STRIP_HOME | VPF_RECODE,
+ "~/test1://user:passwd@host.name/ÔÅÓÔÏ×ÙÊ/ÐÕÔØ"
+ },
+ { /* 8. */
+ "/mock/home/test1://user:passwd@host.name/#enc:KOI8-R/теÑтовый/путь",
+ VPF_NONE,
+ VPF_STRIP_HOME | VPF_RECODE | VPF_STRIP_PASSWORD,
+ "~/test1://user@host.name/ÔÅÓÔÏ×ÙÊ/ÐÕÔØ"
+ },
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_path_to_str_flags_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_path_to_str_flags, test_path_to_str_flags_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath;
+ char *str_path;
+
+ test_init_vfs ("UTF-8");
+
+ vfs_init_class (&vfs_test_ops1, "testfs1", VFSF_NOLINKS | VFSF_REMOTE, "test1");
+ vfs_register_class (&vfs_test_ops1);
+
+ /* when */
+
+ vpath = vfs_path_from_str_flags (data->input_path, data->input_from_str_flags);
+ str_path = vfs_path_to_str_flags (vpath, 0, data->input_to_str_flags);
+
+ /* then */
+ mctest_assert_str_eq (str_path, data->expected_path);
+
+ g_free (str_path);
+ vfs_path_free (vpath, TRUE);
+ test_deinit_vfs ();
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_path_recode, test_path_recode_ds);
+ mctest_add_parameterized_test (tc_core, test_path_to_str_flags, test_path_to_str_flags_ds);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/path_serialize.c b/tests/lib/vfs/path_serialize.c
new file mode 100644
index 0000000..e4812a4
--- /dev/null
+++ b/tests/lib/vfs/path_serialize.c
@@ -0,0 +1,203 @@
+/*
+ lib/vfs - vfs_path_t serialize/deserialize functions
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#ifdef HAVE_CHARSET
+#include "lib/charsets.h"
+#endif
+
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+#include "lib/vfs/path.h"
+
+#include "src/vfs/local/local.c"
+
+static struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3;
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+ vfs_init_class (&vfs_test_ops1, "testfs1", VFSF_NOLINKS | VFSF_REMOTE, "test1");
+ vfs_register_class (&vfs_test_ops1);
+
+ vfs_init_class (&vfs_test_ops2, "testfs2", VFSF_UNKNOWN, "test2");
+ vfs_register_class (&vfs_test_ops2);
+
+ vfs_init_class (&vfs_test_ops3, "testfs3", VFSF_UNKNOWN, "test3");
+ vfs_register_class (&vfs_test_ops3);
+
+ mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
+#ifdef HAVE_CHARSET
+ load_codepages_list ();
+#endif
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+#ifdef HAVE_CHARSET
+ free_codepages_list ();
+#endif
+
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+#ifdef HAVE_CHARSET
+#define ETALON_PATH_STR "/local/path/#test1:user:pass@some.host:12345/bla-bla/some/path/#test2/#enc:KOI8-R/bla-bla/some/path#test3/111/22/33"
+#define ETALON_PATH_URL_STR "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33"
+#define ETALON_SERIALIZED_PATH \
+ "g14:path-element-0" \
+ "p4:pathv12:/local/path/" \
+ "p10:class-namev7:localfs" \
+ "g14:path-element-1" \
+ "p4:pathv18:bla-bla/some/path/" \
+ "p10:class-namev7:testfs1" \
+ "p10:vfs_prefixv5:test1" \
+ "p4:userv4:user" \
+ "p8:passwordv4:pass" \
+ "p4:hostv9:some.host" \
+ "p4:portv5:12345" \
+ "g14:path-element-2" \
+ "p4:pathv17:bla-bla/some/path" \
+ "p10:class-namev7:testfs2" \
+ "p8:encodingv6:KOI8-R" \
+ "p10:vfs_prefixv5:test2" \
+ "g14:path-element-3" \
+ "p4:pathv9:111/22/33" \
+ "p10:class-namev7:testfs3" \
+ "p10:vfs_prefixv5:test3"
+#else
+#define ETALON_PATH_STR "/local/path/#test1:user:pass@some.host:12345/bla-bla/some/path/#test2/bla-bla/some/path#test3/111/22/33"
+#define ETALON_PATH_URL_STR "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33"
+#define ETALON_SERIALIZED_PATH \
+ "g14:path-element-0" \
+ "p4:pathv12:/local/path/" \
+ "p10:class-namev7:localfs" \
+ "g14:path-element-1" \
+ "p4:pathv18:bla-bla/some/path/" \
+ "p10:class-namev7:testfs1" \
+ "p10:vfs_prefixv5:test1" \
+ "p4:userv4:user" \
+ "p8:passwordv4:pass" \
+ "p4:hostv9:some.host" \
+ "p4:portv5:12345" \
+ "g14:path-element-2" \
+ "p4:pathv17:bla-bla/some/path" \
+ "p10:class-namev7:testfs2" \
+ "p10:vfs_prefixv5:test2" \
+ "g14:path-element-3" \
+ "p4:pathv9:111/22/33" \
+ "p10:class-namev7:testfs3" \
+ "p10:vfs_prefixv5:test3"
+#endif
+
+/* *INDENT-OFF* */
+START_TEST (test_path_serialize)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath;
+ char *serialized_vpath;
+ GError *error = NULL;
+
+ /* when */
+ vpath = vfs_path_from_str_flags (ETALON_PATH_STR, VPF_USE_DEPRECATED_PARSER);
+ serialized_vpath = vfs_path_serialize (vpath, &error);
+
+ vfs_path_free (vpath, TRUE);
+
+ if (error != NULL)
+ g_error_free (error);
+
+ /* then */
+ mctest_assert_ptr_ne (serialized_vpath, NULL);
+ mctest_assert_str_eq (serialized_vpath, ETALON_SERIALIZED_PATH);
+}
+/* *INDENT-OFF* */
+END_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* *INDENT-OFF* */
+START_TEST (test_path_deserialize)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath;
+ GError *error = NULL;
+
+ /* when */
+ vpath = vfs_path_deserialize (ETALON_SERIALIZED_PATH, &error);
+
+ /* then */
+ mctest_assert_ptr_ne (vpath, NULL);
+ mctest_assert_str_eq (vfs_path_as_str (vpath), ETALON_PATH_URL_STR);
+
+ vfs_path_free (vpath, TRUE);
+
+}
+/* *INDENT-OFF* */
+END_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ tcase_add_test (tc_core, test_path_serialize);
+ tcase_add_test (tc_core, test_path_deserialize);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/relative_cd.c b/tests/lib/vfs/relative_cd.c
new file mode 100644
index 0000000..406a3e3
--- /dev/null
+++ b/tests/lib/vfs/relative_cd.c
@@ -0,0 +1,221 @@
+/* lib/vfs - test vfs_path_t manipulation functions
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#include <string.h> /* memset() */
+
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+#include "lib/vfs/path.h"
+
+#include "src/vfs/local/local.c"
+
+
+static struct vfs_s_subclass vfs_test_subclass1;
+static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&vfs_test_subclass1);
+
+static int test_chdir (const vfs_path_t * vpath);
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @CapturedValue */
+static vfs_path_t *test_chdir__vpath__captured;
+/* @ThenReturnValue */
+static int test_chdir__return_value;
+
+/* @Mock */
+static int
+test_chdir (const vfs_path_t * vpath)
+{
+ test_chdir__vpath__captured = vfs_path_clone (vpath);
+ return test_chdir__return_value;
+}
+
+static void
+test_chdir__init (void)
+{
+ test_chdir__vpath__captured = NULL;
+}
+
+static void
+test_chdir__deinit (void)
+{
+ vfs_path_free (test_chdir__vpath__captured, TRUE);
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+ memset (&vfs_test_subclass1, 0, sizeof (vfs_test_subclass1));
+ vfs_init_class (vfs_test_ops1, "testfs1", VFSF_NOLINKS | VFSF_REMOTE, "test1");
+ vfs_test_ops1->chdir = test_chdir;
+ vfs_register_class (vfs_test_ops1);
+
+ mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
+
+ vfs_local_ops->chdir = test_chdir;
+
+ test_chdir__init ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+ test_chdir__deinit ();
+
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+/* @DataSource("test_relative_cd_ds") */
+/* *INDENT-OFF* */
+static const struct test_relative_cd_ds
+{
+ const char *input_string;
+ const vfs_path_flag_t input_flags;
+ const char *expected_element_path;
+} test_relative_cd_ds[] =
+{
+ { /* 0. */
+ "/test1://user:pass@some.host:12345/path/to/dir",
+ VPF_NONE,
+ "path/to/dir"
+ },
+ { /* 1. */
+ "some-non-exists-dir",
+ VPF_NO_CANON,
+ "some-non-exists-dir"
+ },
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_relative_cd_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_relative_cd, test_relative_cd_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath;
+ int actual_result;
+
+ test_chdir__return_value = 0;
+
+ vpath = vfs_path_from_str_flags (data->input_string, data->input_flags);
+
+ /* when */
+ actual_result = mc_chdir (vpath);
+
+ /* then */
+ {
+ const vfs_path_element_t *element;
+
+ ck_assert_int_eq (actual_result, 0);
+ element = vfs_path_get_by_index (vpath, -1);
+ mctest_assert_str_eq (element->path, data->expected_element_path);
+ vfs_path_free (vpath, TRUE);
+ }
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* Relative to panel_correct_path_to_show() */
+
+/* @Test */
+/* *INDENT-OFF* */
+START_TEST (test_vpath_to_str_filter)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath, *last_vpath;
+ char *filtered_path;
+ const vfs_path_element_t *path_element;
+
+ /* when */
+ vpath = vfs_path_from_str ("/test1://some.host/dir");
+ path_element = vfs_path_element_clone (vfs_path_get_by_index (vpath, -1));
+ vfs_path_free (vpath, TRUE);
+
+ last_vpath = vfs_path_new ();
+ last_vpath->relative = TRUE;
+
+ vfs_path_add_element (last_vpath, path_element);
+
+ filtered_path = vfs_path_to_str_flags (last_vpath, 0,
+ VPF_STRIP_HOME | VPF_STRIP_PASSWORD | VPF_HIDE_CHARSET);
+
+ /* then */
+ mctest_assert_str_eq (filtered_path, "test1://some.host/dir");
+
+ vfs_path_free (last_vpath, TRUE);
+ g_free (filtered_path);
+}
+/* *INDENT-OFF* */
+END_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+ char *cwd;
+
+ tc_core = tcase_create ("Core");
+
+ /* writable directory where check creates temporary files */
+ cwd = g_get_current_dir ();
+ g_setenv ("TEMP", cwd, TRUE);
+ g_free (cwd);
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_relative_cd, test_relative_cd_ds);
+ tcase_add_test (tc_core, test_vpath_to_str_filter);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/tempdir.c b/tests/lib/vfs/tempdir.c
new file mode 100644
index 0000000..5676eaa
--- /dev/null
+++ b/tests/lib/vfs/tempdir.c
@@ -0,0 +1,140 @@
+/*
+ lib/vfs - manipulations with temp files and dirs
+
+ Copyright (C) 2012-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2012, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#ifndef HAVE_CHARSET
+#define HAVE_CHARSET 1
+#endif
+
+#include "lib/charsets.h"
+
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+#include "lib/vfs/path.h"
+
+#include "src/vfs/local/local.c"
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Test */
+/* *INDENT-OFF* */
+START_TEST (test_mc_tmpdir)
+/* *INDENT-ON* */
+{
+ /* given */
+ const char *tmpdir;
+ const char *env_tmpdir;
+
+ /* when */
+ tmpdir = mc_tmpdir ();
+ env_tmpdir = g_getenv ("MC_TMPDIR");
+
+ /* then */
+ ck_assert_msg (g_file_test (tmpdir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR),
+ "\nNo such directory: %s\n", tmpdir);
+ mctest_assert_str_eq (env_tmpdir, tmpdir);
+}
+/* *INDENT-OFF* */
+END_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Test */
+/* *INDENT-OFF* */
+START_TEST (test_mc_mkstemps)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *pname_vpath = NULL;
+ char *begin_pname;
+ int fd;
+
+ /* when */
+ fd = mc_mkstemps (&pname_vpath, "mctest-", NULL);
+ begin_pname = g_build_filename (mc_tmpdir (), "mctest-", (char *) NULL);
+
+ /* then */
+ close (fd);
+ ck_assert_int_ne (fd, -1);
+ ck_assert_msg (g_file_test
+ (vfs_path_as_str (pname_vpath), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR),
+ "\nNo such file: %s\n", vfs_path_as_str (pname_vpath));
+ unlink (vfs_path_as_str (pname_vpath));
+ ck_assert_msg (strncmp (vfs_path_as_str (pname_vpath), begin_pname, strlen (begin_pname)) == 0,
+ "\nstart of %s should be equal to %s\n", vfs_path_as_str (pname_vpath),
+ begin_pname);
+ vfs_path_free (pname_vpath, TRUE);
+}
+/* *INDENT-OFF* */
+END_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ tcase_add_test (tc_core, test_mc_tmpdir);
+ tcase_add_test (tc_core, test_mc_mkstemps);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/vfs_adjust_stat.c b/tests/lib/vfs/vfs_adjust_stat.c
new file mode 100644
index 0000000..a687c45
--- /dev/null
+++ b/tests/lib/vfs/vfs_adjust_stat.c
@@ -0,0 +1,205 @@
+/*
+ lib/vfs - test vfs_adjust_stat() functionality
+
+ Copyright (C) 2017-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Andrew Borodin <aborodin@vmail.ru>, 2017
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#include <sys/stat.h>
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_test_vfs_adjust_stat_ds") */
+/* *INDENT-OFF* */
+static const struct test_vfs_adjust_stat_ds
+{
+ struct stat etalon_stat;
+} test_vfs_adjust_stat_ds[] =
+{
+ /* 0 */
+ {
+ .etalon_stat =
+ {
+ .st_size = 0,
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ .st_blksize = 512,
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ .st_blocks = 0
+#endif
+ }
+ },
+ /* 1 */
+ {
+ .etalon_stat =
+ {
+ .st_size = 4096,
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ .st_blksize = 512,
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ .st_blocks = 8
+#endif
+ }
+ },
+ /* 2 */
+ {
+ .etalon_stat =
+ {
+ .st_size = 4096,
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ .st_blksize = 1024,
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ .st_blocks = 8
+#endif
+ }
+ },
+ /* 3 */
+ {
+ .etalon_stat =
+ {
+ .st_size = 4096,
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ .st_blksize = 2048,
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ .st_blocks = 8
+#endif
+ }
+ },
+ /* 4 */
+ {
+ .etalon_stat =
+ {
+ .st_size = 4096,
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ .st_blksize = 4096,
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ .st_blocks = 8
+#endif
+ }
+ },
+ /* 5 */
+ {
+ .etalon_stat =
+ {
+ .st_size = 5000,
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ .st_blksize = 512,
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ .st_blocks = 10
+#endif
+ }
+ },
+ /* 6 */
+ {
+ .etalon_stat =
+ {
+ .st_size = 5000,
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ .st_blksize = 1024,
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ .st_blocks = 10
+#endif
+ }
+ },
+ /* 7 */
+ {
+ .etalon_stat =
+ {
+ .st_size = 5000,
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ .st_blksize = 2048,
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ .st_blocks = 12
+#endif
+ }
+ },
+ /* 8 */
+ {
+ .etalon_stat =
+ {
+ .st_size = 5000,
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ .st_blksize = 4096,
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ .st_blocks = 16
+#endif
+ }
+ }
+};
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Test(dataSource = "test_vfs_adjust_stat_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_vfs_adjust_stat, test_vfs_adjust_stat_ds)
+/* *INDENT-ON* */
+{
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ /* given */
+ struct stat expected_stat;
+
+ expected_stat.st_size = data->etalon_stat.st_size;
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ expected_stat.st_blksize = data->etalon_stat.st_blksize;
+#endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
+ /* when */
+ vfs_adjust_stat (&expected_stat);
+
+ /* then */
+ ck_assert_int_eq (data->etalon_stat.st_blocks, expected_stat.st_blocks);
+#else
+ ck_assert_int_eq (0, 0);
+#endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_vfs_adjust_stat, test_vfs_adjust_stat_ds);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/vfs_get_encoding.c b/tests/lib/vfs/vfs_get_encoding.c
new file mode 100644
index 0000000..f27720d
--- /dev/null
+++ b/tests/lib/vfs/vfs_get_encoding.c
@@ -0,0 +1,159 @@
+/*
+ lib/vfs - test vfs_get_encoding() functionality
+
+ Copyright (C) 2013-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Andrew Borodin <aborodin@vmail.ru>, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#include "lib/vfs/path.c" /* for testing of static vfs_get_encoding() */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_vfs_get_encoding_ds") */
+/* *INDENT-OFF* */
+static const struct test_vfs_get_encoding_ds
+{
+ const char *path;
+ const char *expected_encoding;
+} test_vfs_get_encoding_ds[] =
+{
+ { /* 0 */
+ "",
+ NULL
+ },
+ { /* 1 */
+ "aaaa",
+ NULL
+ },
+ { /* 2 */
+ "/aaaa",
+ NULL
+ },
+ { /* 3 */
+ "aaaa/bbbb",
+ NULL
+ },
+ { /* 4 */
+ "/aaaa/bbbb",
+ NULL
+ },
+ { /* 5 */
+ "#enc:UTF-8/aaaa",
+ "UTF-8"
+ },
+ { /* 6 */
+ "/#enc:UTF-8/aaaa",
+ "UTF-8"
+ },
+ { /* 7 */
+ "/aaaa/#enc:UTF-8/bbbb",
+ "UTF-8"
+ },
+ { /* 8 */
+ "/aaaa/#enc:UTF-8/bbbb/#enc:KOI8-R",
+ "KOI8-R"
+ },
+ { /* 9 */
+ "/aaaa/#enc:UTF-8/bbbb/#enc:KOI8-R/cccc",
+ "KOI8-R"
+ },
+ { /* 10 */
+ "/aaaa/#enc:UTF-8/bbbb/cccc#enc:KOI8-R/dddd",
+ "UTF-8"
+ },
+ { /* 11 */
+ "/#enc:UTF-8/bbbb/cccc#enc:KOI8-R/dddd",
+ "UTF-8"
+ },
+ { /* 12 */
+ "#enc:UTF-8/bbbb/cccc#enc:KOI8-R/dddd",
+ "UTF-8"
+ },
+ { /* 13 */
+ "aaaa#enc:UTF-8/bbbb/cccc#enc:KOI8-R/dddd",
+ NULL
+ },
+ { /* 14 */
+ "/aaaa/#enc:UTF-8/bbbb/#enc:KOI8-R#enc:IBM866/cccc",
+ "KOI8-R#enc:IBM866"
+ }
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_vfs_get_encoding_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_vfs_get_encoding, test_vfs_get_encoding_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ char *actual_encoding;
+
+ /* when */
+ actual_encoding = vfs_get_encoding (data->path, -1);
+
+ /* then */
+ mctest_assert_str_eq (actual_encoding, data->expected_encoding);
+
+ g_free (actual_encoding);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_vfs_get_encoding, test_vfs_get_encoding_ds);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/vfs_parse_ls_lga.c b/tests/lib/vfs/vfs_parse_ls_lga.c
new file mode 100644
index 0000000..98d2d78
--- /dev/null
+++ b/tests/lib/vfs/vfs_parse_ls_lga.c
@@ -0,0 +1,426 @@
+/*
+ lib/vfs - test vfs_parse_ls_lga() functionality
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#include <stdio.h>
+
+#include "lib/vfs/utilvfs.h"
+#include "lib/vfs/xdirentry.h"
+#include "lib/strutil.h"
+
+#include "src/vfs/local/local.c"
+
+
+struct vfs_s_subclass test_subclass1;
+static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
+
+struct vfs_s_entry *vfs_root_entry;
+static struct vfs_s_inode *vfs_root_inode;
+static struct vfs_s_super *vfs_test_super;
+
+/* *INDENT-OFF* */
+void message (int flags, const char *title, const char *text, ...) G_GNUC_PRINTF (3, 4);
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ static struct stat initstat;
+
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+ vfs_init_subclass (&test_subclass1, "testfs1", VFSF_NOLINKS | VFSF_REMOTE, "test1");
+ vfs_register_class (vfs_test_ops1);
+
+ vfs_test_super = g_new0 (struct vfs_s_super, 1);
+ vfs_test_super->me = vfs_test_ops1;
+
+ vfs_root_inode = vfs_s_new_inode (vfs_test_ops1, vfs_test_super, &initstat);
+ vfs_root_entry = vfs_s_new_entry (vfs_test_ops1, "/", vfs_root_inode);
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+ vfs_s_free_entry (vfs_test_ops1, vfs_root_entry);
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Mock */
+void
+message (int flags, const char *title, const char *text, ...)
+{
+ char *p;
+ va_list ap;
+
+ (void) flags;
+ (void) title;
+
+ va_start (ap, text);
+ p = g_strdup_vprintf (text, ap);
+ va_end (ap);
+ printf ("message(): %s\n", p);
+ g_free (p);
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+static void
+fill_stat_struct (struct stat *etalon_stat, int iterator)
+{
+
+#ifdef HAVE_STRUCT_STAT_ST_MTIM
+ etalon_stat->st_atim.tv_nsec = etalon_stat->st_mtim.tv_nsec = etalon_stat->st_ctim.tv_nsec = 0;
+#endif
+
+ switch (iterator)
+ {
+ case 0:
+ etalon_stat->st_dev = 0;
+ etalon_stat->st_ino = 0;
+ etalon_stat->st_mode = 0x41fd;
+ etalon_stat->st_nlink = 10;
+ etalon_stat->st_uid = 500;
+ etalon_stat->st_gid = 500;
+#ifdef HAVE_STRUCT_STAT_ST_RDEV
+ etalon_stat->st_rdev = 0;
+#endif
+ etalon_stat->st_size = 4096;
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ etalon_stat->st_blksize = 512;
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ etalon_stat->st_blocks = 8;
+#endif
+ etalon_stat->st_atime = 1308838140;
+ etalon_stat->st_mtime = 1308838140;
+ etalon_stat->st_ctime = 1308838140;
+ break;
+ case 1:
+ etalon_stat->st_dev = 0;
+ etalon_stat->st_ino = 0;
+ etalon_stat->st_mode = 0xa1ff;
+ etalon_stat->st_nlink = 10;
+ etalon_stat->st_uid = 500;
+ etalon_stat->st_gid = 500;
+#ifdef HAVE_STRUCT_STAT_ST_RDEV
+ etalon_stat->st_rdev = 0;
+#endif
+ etalon_stat->st_size = 11;
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ etalon_stat->st_blksize = 512;
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ etalon_stat->st_blocks = 1;
+#endif
+ etalon_stat->st_atime = 1268431200;
+ etalon_stat->st_mtime = 1268431200;
+ etalon_stat->st_ctime = 1268431200;
+ break;
+ case 2:
+ etalon_stat->st_dev = 0;
+ etalon_stat->st_ino = 0;
+ etalon_stat->st_mode = 0x41fd;
+ etalon_stat->st_nlink = 10;
+ etalon_stat->st_uid = 500;
+ etalon_stat->st_gid = 500;
+#ifdef HAVE_STRUCT_STAT_ST_RDEV
+ etalon_stat->st_rdev = 0;
+#endif
+ etalon_stat->st_size = 4096;
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ etalon_stat->st_blksize = 512;
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ etalon_stat->st_blocks = 8;
+#endif
+ etalon_stat->st_atime = 1308838140;
+ etalon_stat->st_mtime = 1308838140;
+ etalon_stat->st_ctime = 1308838140;
+ break;
+ case 3:
+ etalon_stat->st_dev = 0;
+ etalon_stat->st_ino = 0;
+ etalon_stat->st_mode = 0x41fd;
+ etalon_stat->st_nlink = 10;
+ etalon_stat->st_uid = 500;
+ etalon_stat->st_gid = 500;
+#ifdef HAVE_STRUCT_STAT_ST_RDEV
+ etalon_stat->st_rdev = 0;
+#endif
+ etalon_stat->st_size = 4096;
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ etalon_stat->st_blksize = 512;
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ etalon_stat->st_blocks = 8;
+#endif
+ etalon_stat->st_atime = 1308838140;
+ etalon_stat->st_mtime = 1308838140;
+ etalon_stat->st_ctime = 1308838140;
+ break;
+ default:
+ break;
+ }
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_vfs_parse_ls_lga_ds") */
+/* *INDENT-OFF* */
+static const struct test_vfs_parse_ls_lga_ds
+{
+ const char *input_string;
+ int expected_result;
+ const char *expected_filename;
+ const char *expected_linkname;
+ const size_t expected_filepos;
+} test_vfs_parse_ls_lga_ds[] =
+{
+ { /* 0. */
+ "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root",
+ 1,
+ "build_root",
+ NULL,
+ 0
+ },
+ { /* 1. */
+ "lrwxrwxrwx 1 500 500 11 Mar 13 2010 COPYING -> doc/COPYING",
+ 1,
+ "COPYING",
+ "doc/COPYING",
+ 0
+ },
+ { /* 2. */
+ "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..",
+ 1,
+ "..",
+ NULL,
+ 0
+ },
+ { /* 3. */
+ "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root",
+ 1,
+ "build_root",
+ NULL,
+ 0
+ },
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_vfs_parse_ls_lga_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_vfs_parse_ls_lga, test_vfs_parse_ls_lga_ds)
+/* *INDENT-ON* */
+
+{
+ /* given */
+ size_t filepos = 0;
+ struct stat etalon_stat;
+ static struct stat test_stat;
+ char *filename = NULL;
+ char *linkname = NULL;
+ gboolean actual_result;
+
+ vfs_parse_ls_lga_init ();
+
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ etalon_stat.st_blocks = 0;
+#endif
+ etalon_stat.st_size = 0;
+ etalon_stat.st_mode = 0;
+ fill_stat_struct (&etalon_stat, _i);
+
+ /* when */
+ actual_result =
+ vfs_parse_ls_lga (data->input_string, &test_stat, &filename, &linkname, &filepos);
+
+ /* then */
+ ck_assert_int_eq (actual_result, data->expected_result);
+
+ mctest_assert_str_eq (filename, data->expected_filename);
+ mctest_assert_str_eq (linkname, data->expected_linkname);
+
+ ck_assert_int_eq (etalon_stat.st_dev, test_stat.st_dev);
+ ck_assert_int_eq (etalon_stat.st_ino, test_stat.st_ino);
+ ck_assert_int_eq (etalon_stat.st_mode, test_stat.st_mode);
+ ck_assert_int_eq (etalon_stat.st_uid, test_stat.st_uid);
+ ck_assert_int_eq (etalon_stat.st_gid, test_stat.st_gid);
+#ifdef HAVE_STRUCT_STAT_ST_RDEV
+ ck_assert_int_eq (etalon_stat.st_rdev, test_stat.st_rdev);
+#endif
+ ck_assert_int_eq (etalon_stat.st_size, test_stat.st_size);
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+ ck_assert_int_eq (etalon_stat.st_blksize, test_stat.st_blksize);
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+ ck_assert_int_eq (etalon_stat.st_blocks, test_stat.st_blocks);
+#endif
+
+ /* FIXME: these commented checks are related to time zone!
+ ck_assert_int_eq (etalon_stat.st_atime, test_stat.st_atime);
+ ck_assert_int_eq (etalon_stat.st_mtime, test_stat.st_mtime);
+ ck_assert_int_eq (etalon_stat.st_ctime, test_stat.st_ctime);
+ */
+
+#ifdef HAVE_STRUCT_STAT_ST_MTIM
+ ck_assert_int_eq (0, test_stat.st_atim.tv_nsec);
+ ck_assert_int_eq (0, test_stat.st_mtim.tv_nsec);
+ ck_assert_int_eq (0, test_stat.st_ctim.tv_nsec);
+#endif
+
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Test */
+/* *INDENT-OFF* */
+START_TEST (test_vfs_parse_ls_lga_reorder)
+/* *INDENT-ON* */
+{
+ /* given */
+ size_t filepos = 0;
+ struct vfs_s_entry *ent1, *ent2, *ent3;
+
+ vfs_parse_ls_lga_init ();
+
+ /* init ent1 */
+ ent1 = vfs_s_generate_entry (vfs_test_ops1, NULL, vfs_root_inode, 0);
+ vfs_parse_ls_lga
+ ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root1", &ent1->ino->st,
+ &ent1->name, &ent1->ino->linkname, &filepos);
+ vfs_s_store_filename_leading_spaces (ent1, filepos);
+ vfs_s_insert_entry (vfs_test_ops1, vfs_root_inode, ent1);
+
+
+ /* init ent2 */
+ ent2 = vfs_s_generate_entry (vfs_test_ops1, NULL, vfs_root_inode, 0);
+ vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root2",
+ &ent2->ino->st, &ent2->name, &ent2->ino->linkname, &filepos);
+ vfs_s_store_filename_leading_spaces (ent2, filepos);
+ vfs_s_insert_entry (vfs_test_ops1, vfs_root_inode, ent2);
+
+ /* init ent3 */
+ ent3 = vfs_s_generate_entry (vfs_test_ops1, NULL, vfs_root_inode, 0);
+ vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..",
+ &ent3->ino->st, &ent3->name, &ent3->ino->linkname, &filepos);
+ vfs_s_store_filename_leading_spaces (ent3, filepos);
+ vfs_s_insert_entry (vfs_test_ops1, vfs_root_inode, ent3);
+
+ /* when */
+ vfs_s_normalize_filename_leading_spaces (vfs_root_inode, vfs_parse_ls_lga_get_final_spaces ());
+
+ /* then */
+ mctest_assert_str_eq (ent1->name, " build_root1");
+ mctest_assert_str_eq (ent2->name, " build_root2");
+}
+/* *INDENT-OFF* */
+END_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+#define parce_one_line(ent_index, ls_output) {\
+ ent[ent_index] = vfs_s_generate_entry (vfs_test_ops1, NULL, vfs_root_inode, 0);\
+ if (! vfs_parse_ls_lga (ls_output,\
+ &ent[ent_index]->ino->st, &ent[ent_index]->name, &ent[ent_index]->ino->linkname, &filepos))\
+ {\
+ ck_abort_msg ("An error occurred while parse ls output");\
+ return;\
+ }\
+ vfs_s_store_filename_leading_spaces (ent[ent_index], filepos);\
+ vfs_s_insert_entry (vfs_test_ops1, vfs_root_inode, ent[ent_index]);\
+ \
+}
+
+/* @Test */
+/* *INDENT-OFF* */
+START_TEST (test_vfs_parse_ls_lga_unaligned)
+/* *INDENT-ON* */
+{
+ /* given */
+ size_t filepos = 0;
+ struct vfs_s_entry *ent[4];
+
+ vfs_parse_ls_lga_init ();
+
+ parce_one_line (0, "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root1");
+ parce_one_line (1, "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root2");
+ parce_one_line (2, "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..");
+ parce_one_line (3,
+ "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root 0");
+
+ /* when */
+ vfs_s_normalize_filename_leading_spaces (vfs_root_inode, vfs_parse_ls_lga_get_final_spaces ());
+
+ /* then */
+ mctest_assert_str_eq (ent[0]->name, "build_root1");
+ mctest_assert_str_eq (ent[0]->name, "build_root1");
+ mctest_assert_str_eq (ent[1]->name, " build_root2");
+ mctest_assert_str_eq (ent[3]->name, " build_root 0");
+}
+/* *INDENT-OFF* */
+END_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_vfs_parse_ls_lga, test_vfs_parse_ls_lga_ds);
+ tcase_add_test (tc_core, test_vfs_parse_ls_lga_reorder);
+ tcase_add_test (tc_core, test_vfs_parse_ls_lga_unaligned);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/vfs_path_from_str_flags.c b/tests/lib/vfs/vfs_path_from_str_flags.c
new file mode 100644
index 0000000..d4e949b
--- /dev/null
+++ b/tests/lib/vfs/vfs_path_from_str_flags.c
@@ -0,0 +1,125 @@
+/* lib/vfs - test vfs_path_from_str_flags() function
+
+ Copyright (C) 2013-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+#include "lib/vfs/path.h"
+
+#include "src/vfs/local/local.c"
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Mock */
+const char *
+mc_config_get_home_dir (void)
+{
+ return "/mock/test";
+}
+
+/* --------------------------------------------------------------------------------------------- */
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_from_to_string_ds") */
+/* *INDENT-OFF* */
+static const struct test_strip_home_ds
+{
+ const char *input_string;
+ const char *expected_result;
+} test_strip_home_ds[] =
+{
+ { /* 0. */
+ "/mock/test/some/path",
+ "~/some/path"
+ },
+ { /* 1. */
+ "/mock/testttt/some/path",
+ "/mock/testttt/some/path"
+ },
+};
+/* *INDENT-ON* */
+
+/* @Test */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_strip_home, test_strip_home_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *actual_result;
+
+ /* when */
+ actual_result = vfs_path_from_str_flags (data->input_string, VPF_STRIP_HOME);
+
+ /* then */
+ mctest_assert_str_eq (actual_result->str, data->expected_result);
+
+ vfs_path_free (actual_result, TRUE);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_strip_home, test_strip_home_ds);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/vfs_path_string_convert.c b/tests/lib/vfs/vfs_path_string_convert.c
new file mode 100644
index 0000000..38272bd
--- /dev/null
+++ b/tests/lib/vfs/vfs_path_string_convert.c
@@ -0,0 +1,335 @@
+/*
+ lib/vfs - get vfs_path_t from string
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#ifdef HAVE_CHARSET
+#include "lib/charsets.h"
+#endif
+
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+#include "lib/vfs/path.c" /* for testing static methods */
+
+#include "src/vfs/local/local.c"
+
+static struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3;
+
+#define ETALON_PATH_STR "/#test1/bla-bla/some/path/#test2/bla-bla/some/path#test3/111/22/33"
+#define ETALON_PATH_URL_STR "/test1://bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33"
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+ vfs_init_class (&vfs_test_ops1, "testfs1", VFSF_NOLINKS, "test1");
+ vfs_register_class (&vfs_test_ops1);
+
+ vfs_init_class (&vfs_test_ops2, "testfs2", VFSF_REMOTE, "test2");
+ vfs_register_class (&vfs_test_ops2);
+
+ vfs_init_class (&vfs_test_ops3, "testfs3", VFSF_UNKNOWN, "test3");
+ vfs_register_class (&vfs_test_ops3);
+
+#ifdef HAVE_CHARSET
+ mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
+ load_codepages_list ();
+#endif /* HAVE_CHARSET */
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+#ifdef HAVE_CHARSET
+ free_codepages_list ();
+#endif /* HAVE_CHARSET */
+
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+/* @DataSource("test_from_to_string_ds") */
+/* *INDENT-OFF* */
+static const struct test_from_to_string_ds
+{
+ const char *input_string;
+ const char *expected_result;
+ const char *expected_element_path;
+ const size_t expected_elements_count;
+ struct vfs_class *expected_vfs_class;
+} test_from_to_string_ds[] =
+{
+ { /* 0. */
+ ETALON_PATH_STR,
+ ETALON_PATH_URL_STR,
+ "111/22/33",
+ 4,
+ &vfs_test_ops3
+ },
+ { /* 1. */
+ "/",
+ "/",
+ "/",
+ 1,
+ VFS_CLASS (&local_subclass)
+ },
+ { /* 2. */
+ "/test1://bla-bla/some/path/test2://user:passwd@some.host:1234/bla-bla/some/path/test3://111/22/33",
+ "/test1://bla-bla/some/path/test2://user:passwd@some.host:1234/bla-bla/some/path/test3://111/22/33",
+ "111/22/33",
+ 4,
+ &vfs_test_ops3
+ },
+#ifdef HAVE_CHARSET
+ { /* 3. */
+ "/#test1/bla-bla1/some/path/#test2/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
+ "/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
+ "111/22/33",
+ 4,
+ &vfs_test_ops3
+ },
+ { /* 4. */
+ "/#test1/bla-bla1/#enc:IBM866/some/path/#test2/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
+ "/test1://#enc:IBM866/bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
+ "111/22/33",
+ 4,
+ &vfs_test_ops3
+ },
+ { /* 5. */
+ "/#test1/bla-bla1/some/path/#test2/bla-bla2/#enc:IBM866/#enc:KOI8-R/some/path#test3/111/22/33",
+ "/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
+ "111/22/33",
+ 4,
+ &vfs_test_ops3
+ },
+ { /* 6. */
+ "/#test1/bla-bla1/some/path/#test2/bla-bla2/#enc:IBM866/some/#enc:KOI8-R/path#test3/111/22/33",
+ "/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
+ "111/22/33",
+ 4,
+ &vfs_test_ops3
+ },
+ { /* 7. */
+ "/#test1/bla-bla1/some/path/#test2/#enc:IBM866/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
+ "/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
+ "111/22/33",
+ 4,
+ &vfs_test_ops3
+ },
+ { /* 8. */
+ "/#test1/bla-bla1/some/path/#enc:IBM866/#test2/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
+ "/test1://#enc:IBM866/bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33",
+ "111/22/33",
+ 4,
+ &vfs_test_ops3
+ },
+#endif /* HAVE_CHARSET */
+};
+/* *INDENT-ON* */
+
+/* @Test */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_from_to_string, test_from_to_string_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath;
+ size_t vpath_len;
+ const vfs_path_element_t *path_element;
+ const char *actual_result;
+
+ vpath = vfs_path_from_str_flags (data->input_string, VPF_USE_DEPRECATED_PARSER);
+
+ /* when */
+ vpath_len = vfs_path_elements_count (vpath);
+ actual_result = vfs_path_as_str (vpath);
+ path_element = vfs_path_get_by_index (vpath, -1);
+
+ /* then */
+ ck_assert_int_eq (vpath_len, data->expected_elements_count);
+ mctest_assert_str_eq (actual_result, data->expected_result);
+ mctest_assert_ptr_eq (path_element->class, data->expected_vfs_class);
+ mctest_assert_str_eq (path_element->path, data->expected_element_path);
+
+ vfs_path_free (vpath, TRUE);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_partial_string_by_index_ds") */
+/* *INDENT-OFF* */
+static const struct test_partial_string_by_index_ds
+{
+ const char *input_string;
+ const off_t element_index;
+ const char *expected_result;
+} test_partial_string_by_index_ds[] =
+{
+ { /* 0. */
+ ETALON_PATH_STR,
+ -1,
+ "/test1://bla-bla/some/path/test2://bla-bla/some/path"
+ },
+ { /* 1. */
+ ETALON_PATH_STR,
+ -2,
+ "/test1://bla-bla/some/path/"
+ },
+ { /* 2. */
+ ETALON_PATH_STR,
+ -3,
+ "/"
+ },
+ { /* 3. Index out of bound */
+ ETALON_PATH_STR,
+ -4,
+ ""
+ },
+ { /* 4. */
+ ETALON_PATH_STR,
+ 1,
+ "/"
+ },
+ { /* 5. */
+ ETALON_PATH_STR,
+ 2,
+ "/test1://bla-bla/some/path/"
+ },
+ { /* 6. */
+ ETALON_PATH_STR,
+ 3,
+ "/test1://bla-bla/some/path/test2://bla-bla/some/path"
+ },
+ { /* 6. */
+ ETALON_PATH_STR,
+ 4,
+ ETALON_PATH_URL_STR
+ },
+ { /* 7. Index out of bound */
+ ETALON_PATH_STR,
+ 5,
+ ETALON_PATH_URL_STR
+ },
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_partial_string_by_index_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_partial_string_by_index, test_partial_string_by_index_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath;
+ char *actual_result;
+ vpath = vfs_path_from_str_flags (data->input_string, VPF_USE_DEPRECATED_PARSER);
+
+ /* when */
+ actual_result = vfs_path_to_str_elements_count (vpath, data->element_index);
+
+ /* then */
+ mctest_assert_str_eq (actual_result, data->expected_result);
+ g_free (actual_result);
+
+ vfs_path_free (vpath, TRUE);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+#ifdef HAVE_CHARSET
+/* --------------------------------------------------------------------------------------------- */
+
+#define ETALON_STR "/path/to/file.ext/test1://#enc:KOI8-R"
+/* @Test */
+/* *INDENT-OFF* */
+START_TEST (test_vfs_path_encoding_at_end)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_path_t *vpath;
+ const char *result;
+ const vfs_path_element_t *element;
+
+ vpath =
+ vfs_path_from_str_flags ("/path/to/file.ext#test1:/#enc:KOI8-R", VPF_USE_DEPRECATED_PARSER);
+
+ /* when */
+ result = vfs_path_as_str (vpath);
+ element = vfs_path_get_by_index (vpath, -1);
+
+ /* then */
+ mctest_assert_str_eq (element->path, "");
+ mctest_assert_not_null (element->encoding);
+ mctest_assert_str_eq (result, ETALON_STR);
+
+ vfs_path_free (vpath, TRUE);
+}
+
+/* *INDENT-OFF* */
+END_TEST
+/* *INDENT-ON* */
+#endif /* HAVE_CHARSET */
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_from_to_string, test_from_to_string_ds);
+ mctest_add_parameterized_test (tc_core, test_partial_string_by_index,
+ test_partial_string_by_index_ds);
+#ifdef HAVE_CHARSET
+ tcase_add_test (tc_core, test_vfs_path_encoding_at_end);
+#endif
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/vfs_prefix_to_class.c b/tests/lib/vfs/vfs_prefix_to_class.c
new file mode 100644
index 0000000..0be9840
--- /dev/null
+++ b/tests/lib/vfs/vfs_prefix_to_class.c
@@ -0,0 +1,170 @@
+/*
+ lib/vfs - test vfs_prefix_to_class() functionality
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+#include "lib/vfs/vfs.c" /* for testing static methods */
+
+#include "src/vfs/local/local.c"
+
+static struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3;
+
+/* --------------------------------------------------------------------------------------------- */
+
+static int
+test_which (struct vfs_class *me, const char *path)
+{
+ (void) me;
+
+ if ((strcmp (path, "test_1:") == 0) ||
+ (strcmp (path, "test_2:") == 0) ||
+ (strcmp (path, "test_3:") == 0) || (strcmp (path, "test_4:") == 0))
+ return 1;
+ return -1;
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+ vfs_init_class (&vfs_test_ops1, "testfs1", VFSF_NOLINKS | VFSF_REMOTE, "test1");
+ vfs_test_ops1.which = test_which;
+ vfs_register_class (&vfs_test_ops1);
+
+ vfs_init_class (&vfs_test_ops2, "testfs2", VFSF_UNKNOWN, "test2");
+ vfs_register_class (&vfs_test_ops2);
+
+ vfs_init_class (&vfs_test_ops3, "testfs3", VFSF_UNKNOWN, "test3");
+ vfs_register_class (&vfs_test_ops3);
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_vfs_prefix_to_class_ds") */
+/* *INDENT-OFF* */
+static const struct test_vfs_prefix_to_class_ds
+{
+ const char *input_string;
+ const struct vfs_class *expected_result;
+} test_vfs_prefix_to_class_ds[] =
+{
+ { /* 0 */
+ "test_1:",
+ &vfs_test_ops1
+ },
+ { /* 1 */
+ "test_2:",
+ &vfs_test_ops1
+ },
+ { /* 2 */
+ "test_3:",
+ &vfs_test_ops1
+ },
+ { /* 3 */
+ "test_4:",
+ &vfs_test_ops1
+ },
+ { /* 4 */
+ "test2:",
+ &vfs_test_ops2
+ },
+ { /* 5 */
+ "test3:",
+ &vfs_test_ops3
+ },
+ {
+ "test1:",
+ NULL
+ },
+ { /* 6 */
+ "test_5:",
+ NULL
+ },
+ { /* 7 */
+ "test4:",
+ NULL
+ },
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_vfs_prefix_to_class_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_vfs_prefix_to_class, test_vfs_prefix_to_class_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ struct vfs_class *actual_result;
+
+ /* when */
+ actual_result = vfs_prefix_to_class ((char *) data->input_string);
+
+ /* then */
+ mctest_assert_ptr_eq (actual_result, data->expected_result);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_vfs_prefix_to_class, test_vfs_prefix_to_class_ds);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/vfs_s_get_path.c b/tests/lib/vfs/vfs_s_get_path.c
new file mode 100644
index 0000000..c4f2cba
--- /dev/null
+++ b/tests/lib/vfs/vfs_s_get_path.c
@@ -0,0 +1,168 @@
+/*
+ lib/vfs - test vfs_s_get_path() function
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#include "lib/strutil.h"
+#include "lib/vfs/direntry.c" /* for testing static methods */
+
+#include "src/vfs/local/local.c"
+
+#define ARCH_NAME "/path/to/some/file.ext"
+#define ETALON_PATH "path/to/test1_file.ext"
+#define ETALON_VFS_NAME "#test2:user:pass@host.net"
+#define ETALON_VFS_URL_NAME "test2://user:pass@host.net"
+
+struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3;
+static struct vfs_class *vfs_test_ops1 = VFS_CLASS (&test_subclass1);
+static struct vfs_class *vfs_test_ops2 = VFS_CLASS (&test_subclass2);
+static struct vfs_class *vfs_test_ops3 = VFS_CLASS (&test_subclass3);
+
+/* --------------------------------------------------------------------------------------------- */
+
+static int
+test1_mock_open_archive (struct vfs_s_super *super, const vfs_path_t * vpath,
+ const vfs_path_element_t * vpath_element)
+{
+ struct vfs_s_inode *root;
+
+ mctest_assert_str_eq (vfs_path_as_str (vpath), "/" ETALON_VFS_URL_NAME ARCH_NAME);
+
+ super->name = g_strdup (vfs_path_as_str (vpath));
+ root = vfs_s_new_inode (vpath_element->class, super, NULL);
+ super->root = root;
+ return 0;
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+static int
+test1_mock_archive_same (const vfs_path_element_t * vpath_element, struct vfs_s_super *super,
+ const vfs_path_t * vpath, void *cookie)
+{
+ const vfs_path_element_t *path_element;
+
+ (void) vpath_element;
+ (void) super;
+ (void) cookie;
+
+ path_element = vfs_path_get_by_index (vpath, -1);
+ if (strcmp (ARCH_NAME, path_element->path) != 0)
+ return 0;
+ return 1;
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+ vfs_init_subclass (&test_subclass1, "testfs1", VFSF_NOLINKS | VFSF_REMOTE, "test1");
+ test_subclass1.open_archive = test1_mock_open_archive;
+ test_subclass1.archive_same = test1_mock_archive_same;
+ test_subclass1.archive_check = NULL;
+ vfs_register_class (vfs_test_ops1);
+
+ vfs_init_subclass (&test_subclass2, "testfs2", VFSF_UNKNOWN, "test2");
+ vfs_register_class (vfs_test_ops2);
+
+ vfs_init_subclass (&test_subclass3, "testfs3", VFSF_UNKNOWN, "test3");
+ vfs_register_class (vfs_test_ops3);
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+
+void
+vfs_die (const char *m)
+{
+ printf ("VFS_DIE: '%s'\n", m);
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Test */
+/* *INDENT-OFF* */
+START_TEST (test_vfs_s_get_path)
+/* *INDENT-ON* */
+{
+ /* given */
+ struct vfs_s_super *archive;
+ const char *result;
+
+ /* when */
+ vfs_path_t *vpath =
+ vfs_path_from_str_flags ("/" ETALON_VFS_NAME ARCH_NAME "#test1:/" ETALON_PATH,
+ VPF_USE_DEPRECATED_PARSER);
+
+ result = vfs_s_get_path (vpath, &archive, 0);
+
+ /* then */
+ mctest_assert_str_eq (result, ETALON_PATH);
+ mctest_assert_str_eq (archive->name, "/" ETALON_VFS_URL_NAME ARCH_NAME);
+
+ g_free (vpath);
+
+}
+/* *INDENT-OFF* */
+END_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ tcase_add_test (tc_core, test_vfs_s_get_path);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/vfs_setup_cwd.c b/tests/lib/vfs/vfs_setup_cwd.c
new file mode 100644
index 0000000..9390731
--- /dev/null
+++ b/tests/lib/vfs/vfs_setup_cwd.c
@@ -0,0 +1,157 @@
+/*
+ lib/vfs - test vfs_setup_cwd() functionality
+
+ Copyright (C) 2013-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#include <stdlib.h>
+
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+#include "src/vfs/local/local.c"
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Mock */
+char *
+g_get_current_dir (void)
+{
+ return g_strdup ("/some/path");
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+static gboolean mc_stat__is_2nd_call_different = FALSE;
+static gboolean mc_stat__call_count = 0;
+
+/* @Mock */
+int
+mc_stat (const vfs_path_t * vpath, struct stat *my_stat)
+{
+ (void) vpath;
+
+ if (mc_stat__call_count++ > 1 && mc_stat__is_2nd_call_different)
+ {
+ my_stat->st_ino = 2;
+ my_stat->st_dev = 22;
+ }
+ else
+ {
+ my_stat->st_ino = 1;
+ my_stat->st_dev = 11;
+ }
+ if (mc_stat__call_count > 2)
+ {
+ mc_stat__call_count = 0;
+ }
+ return 0;
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_vfs_setup_cwd_symlink_ds") */
+/* *INDENT-OFF* */
+static const struct test_vfs_setup_cwd_symlink_ds
+{
+ gboolean is_2nd_call_different;
+ const char *expected_result;
+} test_vfs_setup_cwd_symlink_ds[] =
+{
+ { /* 0. */
+ TRUE,
+ "/some/path"
+ },
+ { /* 1. */
+ FALSE,
+ "/some/path2"
+ },
+};
+/* *INDENT-ON* */
+
+/* @Test */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_vfs_setup_cwd_symlink, test_vfs_setup_cwd_symlink_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ vfs_set_raw_current_dir (NULL);
+ mc_stat__is_2nd_call_different = data->is_2nd_call_different;
+ mc_stat__call_count = 0;
+ setenv ("PWD", "/some/path2", 1);
+
+ /* when */
+ vfs_setup_cwd ();
+
+ /* then */
+ mctest_assert_str_eq (vfs_path_as_str (vfs_get_raw_current_dir ()), data->expected_result);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_vfs_setup_cwd_symlink,
+ test_vfs_setup_cwd_symlink_ds);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */
diff --git a/tests/lib/vfs/vfs_split.c b/tests/lib/vfs/vfs_split.c
new file mode 100644
index 0000000..9333766
--- /dev/null
+++ b/tests/lib/vfs/vfs_split.c
@@ -0,0 +1,207 @@
+/*
+ lib/vfs - test vfs_split() functionality
+
+ Copyright (C) 2011-2022
+ Free Software Foundation, Inc.
+
+ Written by:
+ Slava Zanko <slavazanko@gmail.com>, 2011, 2013
+
+ This file is part of the Midnight Commander.
+
+ The Midnight Commander is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ The Midnight Commander is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_SUITE_NAME "/lib/vfs"
+
+#include "tests/mctest.h"
+
+#include "lib/strutil.h"
+#include "lib/vfs/xdirentry.h"
+#include "lib/vfs/path.c" /* for testing static methods */
+
+#include "src/vfs/local/local.c"
+
+static struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3;
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @Before */
+static void
+setup (void)
+{
+ str_init_strings (NULL);
+
+ vfs_init ();
+ vfs_init_localfs ();
+ vfs_setup_work_dir ();
+
+ vfs_init_class (&vfs_test_ops1, "testfs1", VFSF_NOLINKS | VFSF_REMOTE, "test1");
+ vfs_register_class (&vfs_test_ops1);
+
+ vfs_init_class (&vfs_test_ops2, "testfs2", VFSF_UNKNOWN, "test2");
+ vfs_register_class (&vfs_test_ops2);
+
+ vfs_init_class (&vfs_test_ops3, "testfs3", VFSF_UNKNOWN, "test3");
+ vfs_register_class (&vfs_test_ops3);
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @After */
+static void
+teardown (void)
+{
+ vfs_shut ();
+ str_uninit_strings ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+/* @DataSource("test_vfs_split_ds") */
+/* *INDENT-OFF* */
+static const struct test_vfs_split_ds
+{
+ const char *input_string;
+ const char *expected_path;
+ const char *expected_local;
+ const char *expected_op;
+ const struct vfs_class *expected_result;
+} test_vfs_split_ds[] =
+{
+ { /* 0. */
+ "#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/#test3:/qqq/www/eee.rr",
+ "#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/",
+ "qqq/www/eee.rr",
+ "test3:",
+ &vfs_test_ops3
+ },
+ { /* 1. */
+ "#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/",
+ "#test1:/bla-bla/some/path/",
+ "bla-bla/some/path2/",
+ "test2:",
+ &vfs_test_ops2
+ },
+ { /* 2. */
+ "#test1:/bla-bla/some/path/",
+ "",
+ "bla-bla/some/path/",
+ "test1:",
+ &vfs_test_ops1
+ },
+ { /* 3. */
+ "",
+ "",
+ NULL,
+ NULL,
+ NULL
+ },
+ { /* 4. split with local */
+ "/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2#test3:/qqq/www/eee.rr",
+ "/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2",
+ "qqq/www/eee.rr",
+ "test3:",
+ &vfs_test_ops3
+ },
+ { /* 5. split with local */
+ "/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2",
+ "/local/path/#test1:/bla-bla/some/path/",
+ "bla-bla/some/path2",
+ "test2:",
+ &vfs_test_ops2
+ },
+ { /* 6. split with local */
+ "/local/path/#test1:/bla-bla/some/path/",
+ "/local/path/",
+ "bla-bla/some/path/",
+ "test1:",
+ &vfs_test_ops1
+ },
+ { /* 7. split with local */
+ "/local/path/",
+ "/local/path/",
+ NULL,
+ NULL,
+ NULL
+ },
+ { /* 8. split with URL */
+ "#test2:username:passwd@somehost.net/bla-bla/some/path2",
+ "",
+ "bla-bla/some/path2",
+ "test2:username:passwd@somehost.net",
+ &vfs_test_ops2
+ },
+ { /* 9. split URL with semi */
+ "/local/path/#test1:/bla-bla/some/path/#test2:username:p!a@s#s$w%d@somehost.net/bla-bla/some/path2",
+ "/local/path/#test1:/bla-bla/some/path/",
+ "bla-bla/some/path2",
+ "test2:username:p!a@s#s$w%d@somehost.net",
+ &vfs_test_ops2
+ },
+ { /* 10. split with semi in path */
+ "#test2:/bl#a-bl#a/so#me/pa#th2",
+ "",
+ "bl#a-bl#a/so#me/pa#th2",
+ "test2:",
+ &vfs_test_ops2
+ }
+};
+/* *INDENT-ON* */
+
+/* @Test(dataSource = "test_vfs_split_ds") */
+/* *INDENT-OFF* */
+START_PARAMETRIZED_TEST (test_vfs_split, test_vfs_split_ds)
+/* *INDENT-ON* */
+{
+ /* given */
+ const char *local = NULL, *op = NULL;
+ struct vfs_class *actual_result;
+ char *path;
+
+ path = g_strdup (data->input_string);
+
+ /* when */
+ actual_result = _vfs_split_with_semi_skip_count (path, &local, &op, 0);
+
+ /* then */
+ mctest_assert_ptr_eq (actual_result, data->expected_result);
+ mctest_assert_str_eq (path, data->expected_path);
+ mctest_assert_str_eq (local, data->expected_local);
+ mctest_assert_str_eq (op, data->expected_op);
+ g_free (path);
+}
+/* *INDENT-OFF* */
+END_PARAMETRIZED_TEST
+/* *INDENT-ON* */
+
+/* --------------------------------------------------------------------------------------------- */
+
+int
+main (void)
+{
+ TCase *tc_core;
+
+ tc_core = tcase_create ("Core");
+
+ tcase_add_checked_fixture (tc_core, setup, teardown);
+
+ /* Add new tests here: *************** */
+ mctest_add_parameterized_test (tc_core, test_vfs_split, test_vfs_split_ds);
+ /* *********************************** */
+
+ return mctest_run_all (tc_core);
+}
+
+/* --------------------------------------------------------------------------------------------- */