From f417fb26e88c10afec74a09a3f0b93b97c143b48 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Wed, 15 May 2019 09:49:48 -0400 Subject: [PATCH] Revert "remove vpath test for user dir the test was broken and fixing is insane" Summary: This reverts commit 954a534bc0e7f30e66cc7dfd15ac79544e92671f. 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 --- src/tests/eina/eina_test_vpath.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/tests/eina/eina_test_vpath.c b/src/tests/eina/eina_test_vpath.c index cad61bd831..7a38712acc 100644 --- a/src/tests/eina/eina_test_vpath.c +++ b/src/tests/eina/eina_test_vpath.c @@ -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); }