From: Zbigniew Jędrzejewski-Szmek Date: Tue, 28 May 2019 12:35:20 +0000 (+0200) Subject: test-user-util: add simple test for make_salt() X-Git-Tag: v243-rc1~335^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=521ff2fcd057aed893932e09a78eea8088871518;p=thirdparty%2Fsystemd.git test-user-util: add simple test for make_salt() --- diff --git a/src/test/test-user-util.c b/src/test/test-user-util.c index 1a507bc00a7..fd7878fde20 100644 --- a/src/test/test-user-util.c +++ b/src/test/test-user-util.c @@ -191,6 +191,20 @@ static void test_get_group_creds_one(const char *id, const char *name, gid_t gid assert_se(rgid == gid); } +static void test_make_salt(void) { + log_info("/* %s */", __func__); + + _cleanup_free_ char *s, *t; + + assert_se(make_salt(&s) == 0); + log_info("got %s", s); + + assert_se(make_salt(&t) == 0); + log_info("got %s", t); + + assert(!streq(s, t)); +} + int main(int argc, char *argv[]) { test_uid_to_name_one(0, "root"); test_uid_to_name_one(UID_NOBODY, NOBODY_USER_NAME); @@ -221,5 +235,7 @@ int main(int argc, char *argv[]) { test_valid_gecos(); test_valid_home(); + test_make_salt(); + return 0; }