Revert "remove vpath test for user dir the test was broken and fixing is insane"

Summary:
This reverts commit 954a534bc0.

It appears that the concerns from this commit are invalid. The case of
~asdf/ does not have any fallback case, if there is no getpwent on this
system, then there will be simply an error, same for the case of a
missing user. In such a case nothing will be written in the buffer /
returned by eina_vpath. The windows build problem can be
fixed by a simple #ifdef'ing the test code.

Reviewers: raster, zmike, cedric, vtorri

Reviewed By: vtorri

Subscribers: vtorri, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8671
This commit is contained in:
Marcel Hollerbach 2019-05-15 09:49:48 -04:00 committed by Mike Blumenkrantz
parent b050294635
commit f417fb26e8
1 changed files with 17 additions and 0 deletions

View File

@ -61,9 +61,26 @@ EFL_START_TEST(eina_test_vpath_snprintf)
}
EFL_END_TEST
EFL_START_TEST(eina_test_vpath_user)
{
#ifdef HAVE_GETPWENT
char buf[PATH_MAX];
char cmp[PATH_MAX];
struct passwd *pwent;
pwent = getpwuid(getuid());
eina_vpath_resolve_snprintf(buf, sizeof(buf), "~%s/foo/bar/king/kong/", pwent->pw_name);
snprintf(cmp, sizeof(cmp), "%s/foo/bar/king/kong/", pwent->pw_dir);
ck_assert_str_eq(buf, cmp);
#endif
}
EFL_END_TEST
void eina_test_vpath(TCase *tc)
{
tcase_add_test(tc, eina_test_vpath_invalid);
tcase_add_test(tc, eina_test_vpath_valid);
tcase_add_test(tc, eina_test_vpath_snprintf);
tcase_add_test(tc, eina_test_vpath_user);
}