Skip to content

Commit 521ff2f

Browse files
committed
test-user-util: add simple test for make_salt()
1 parent cec82cb commit 521ff2f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/test/test-user-util.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,20 @@ static void test_get_group_creds_one(const char *id, const char *name, gid_t gid
191191
assert_se(rgid == gid);
192192
}
193193

194+
static void test_make_salt(void) {
195+
log_info("/* %s */", __func__);
196+
197+
_cleanup_free_ char *s, *t;
198+
199+
assert_se(make_salt(&s) == 0);
200+
log_info("got %s", s);
201+
202+
assert_se(make_salt(&t) == 0);
203+
log_info("got %s", t);
204+
205+
assert(!streq(s, t));
206+
}
207+
194208
int main(int argc, char *argv[]) {
195209
test_uid_to_name_one(0, "root");
196210
test_uid_to_name_one(UID_NOBODY, NOBODY_USER_NAME);
@@ -221,5 +235,7 @@ int main(int argc, char *argv[]) {
221235
test_valid_gecos();
222236
test_valid_home();
223237

238+
test_make_salt();
239+
224240
return 0;
225241
}

0 commit comments

Comments
 (0)