From 81703ad4d4bd0fe4b1afca24b6a34ee91da0ec6d Mon Sep 17 00:00:00 2001 From: ngie Date: Wed, 31 May 2017 08:32:05 +0000 Subject: MFC r319027,r319028,r319029,r319030,r319031,r319033,r319034,r319035,r319036,r319037,r319038,r319039,r319040,r319041,r319042,r319043,r319044,r319045,r319046: r319027: lib/libc/tests/nss: use calloc appropriately The pattern used prior to this commit was `calloc(1, n * sizeof(type))`; the pattern that should be used however is `calloc(n, sizeof(type))`. r319028: Sort make variables to suit style.Makefile(5) This is being done prior to functional changes. r319029: Staticize functions and remove unused variables to aid with bumping WARNS r319030: Fix -Wsign-compare warnings r319031: getusershell_test: staticize run_tests(..) to fix warnings r319033: getserv_test: fix -Wsign-compare and -Wmissing-prototypes warnings r319034: getaddrinfo_test: fix -Wsign-compare warnings r319035: getrpc_test: fix -Wmissing-prototypes and -Wsign-compare warnings r319036: getproto_test: fix -Wmissing-prototypes and -Wsign-compare warnings r319037: getaddrinfo_test: mark unused function parameters __unused to fix -Wunused warnings r319038: getusershell_test: mark mdata parameter in compare_usershell __unused r319039: getserv_test: mark unused parameters __unused to fix corresponding warnings r319040: getrpc_test: fix -Wunused warnings - Mark unused function parameters unused. - Remove an unused function prototype. r319041: getproto_test: fix -Wunused warnings Mark unused parameters __unused in functions. r319042: gethostby_test: fix multiple warning types - Fix -Wmissing-declaration warning by staticizing run_tests. - Fix -Wsign-compare warnings by casting size_t types to int for comparisons. Reindent some of the code in sdump_hostent(..) to accomodate the overall changes. r319043: getpw_test: fix -Wunused warnings - Mark unused parameters __unused. - Put dump_passwd under DEBUG as it's only used in that case. r319044: getgr_test: fix -Wunused warnings r319045: Fix -Wunused and -Wshadow warnings r319046: Fix a -Wunused-but-set-variable warning reported by gcc 6.3.0 --- lib/libc/tests/nss/Makefile | 15 +++---- lib/libc/tests/nss/getaddrinfo_test.c | 28 ++++++------- lib/libc/tests/nss/getgr_test.c | 12 +++--- lib/libc/tests/nss/gethostby_test.c | 75 +++++++++++++++++----------------- lib/libc/tests/nss/getproto_test.c | 14 +++---- lib/libc/tests/nss/getpw_test.c | 12 +++--- lib/libc/tests/nss/getrpc_test.c | 16 ++++---- lib/libc/tests/nss/getserv_test.c | 14 +++---- lib/libc/tests/nss/getusershell_test.c | 7 ++-- 9 files changed, 95 insertions(+), 98 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/tests/nss/Makefile b/lib/libc/tests/nss/Makefile index 6075b31..a4bbcfa 100644 --- a/lib/libc/tests/nss/Makefile +++ b/lib/libc/tests/nss/Makefile @@ -1,18 +1,13 @@ # $FreeBSD$ +.PATH: ${.CURDIR:H}/resolv + PACKAGE= tests TESTSDIR= ${TESTSBASE}/lib/libc/nss BINDIR= ${TESTSDIR} -.PATH: ${.CURDIR:H}/resolv - -${PACKAGE}FILES+= mach - -WARNS?= 1 -CFLAGS+= -I${SRCTOP}/tests - ATF_TESTS_C+= getaddrinfo_test ATF_TESTS_C+= getgr_test ATF_TESTS_C+= gethostby_test @@ -23,4 +18,10 @@ ATF_TESTS_C+= getrpc_test ATF_TESTS_C+= getserv_test ATF_TESTS_C+= getusershell_test +${PACKAGE}FILES+= mach + +WARNS?= 1 + +CFLAGS+= -I${SRCTOP}/tests + .include diff --git a/lib/libc/tests/nss/getaddrinfo_test.c b/lib/libc/tests/nss/getaddrinfo_test.c index 0c9704f..98b11a2 100644 --- a/lib/libc/tests/nss/getaddrinfo_test.c +++ b/lib/libc/tests/nss/getaddrinfo_test.c @@ -28,7 +28,7 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include #include #include @@ -125,7 +125,8 @@ compare_addrinfo_(struct addrinfo *ai1, struct addrinfo *ai2) } static int -compare_addrinfo(struct addrinfo *ai1, struct addrinfo *ai2, void *mdata) +compare_addrinfo(struct addrinfo *ai1, struct addrinfo *ai2, + void *mdata __unused) { int rv; @@ -144,7 +145,7 @@ compare_addrinfo(struct addrinfo *ai1, struct addrinfo *ai2, void *mdata) return (rv); } -void +static void free_addrinfo(struct addrinfo *ai) { if (ai == NULL) @@ -164,30 +165,30 @@ sdump_addrinfo(struct addrinfo *ai, char *buffer, size_t buflen) ai->ai_flags, ai->ai_family, ai->ai_socktype, ai->ai_protocol, ai->ai_addrlen); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; written = snprintf(buffer, buflen, "%s ", ai->ai_canonname == NULL ? "(null)" : ai->ai_canonname); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; if (ai->ai_addr == NULL) { written = snprintf(buffer, buflen, "(null)"); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; } else { - for (i = 0; i < ai->ai_addrlen; i++) { + for (i = 0; i < (int)ai->ai_addrlen; i++) { written = snprintf(buffer, buflen, - i + 1 != ai->ai_addrlen ? "%d." : "%d", + i + 1 != (int)ai->ai_addrlen ? "%d." : "%d", ((unsigned char *)ai->ai_addr)[i]); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -199,7 +200,7 @@ sdump_addrinfo(struct addrinfo *ai, char *buffer, size_t buflen) if (ai->ai_next != NULL) { written = snprintf(buffer, buflen, ":"); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -309,12 +310,11 @@ addrinfo_read_snapshot_func(struct addrinfo *ai, char *line) { struct addrinfo *ai2; char *s, *ps; - int i, rv; + int rv; printf("1 line read from snapshot:\n%s\n", line); rv = 0; - i = 0; ps = line; s = strsep(&ps, ":"); @@ -344,7 +344,7 @@ addrinfo_read_snapshot_func(struct addrinfo *ai, char *line) } static int -addrinfo_test_correctness(struct addrinfo *ai, void *mdata) +addrinfo_test_correctness(struct addrinfo *ai, void *mdata __unused) { printf("testing correctness with the following data:\n"); @@ -409,7 +409,7 @@ addrinfo_read_hostlist_func(struct addrinfo *ai, char *line) return (0); } -void +static void run_tests(char *hostlist_file, char *snapshot_file, int ai_family) { struct addrinfo_test_data td, td_snap; diff --git a/lib/libc/tests/nss/getgr_test.c b/lib/libc/tests/nss/getgr_test.c index 5730a62..43e6518 100644 --- a/lib/libc/tests/nss/getgr_test.c +++ b/lib/libc/tests/nss/getgr_test.c @@ -49,8 +49,6 @@ enum test_methods { TEST_BUILD_SNAPSHOT = 16, }; -static enum test_methods method = TEST_BUILD_SNAPSHOT; - DECLARE_TEST_DATA(group) DECLARE_TEST_FILE_SNAPSHOT(group) DECLARE_1PASS_TEST(group) @@ -104,7 +102,7 @@ clone_group(struct group *dest, struct group const *src) for (cp = src->gr_mem; *cp; ++cp) ++members_num; - dest->gr_mem = calloc(1, (members_num + 1) * sizeof(char *)); + dest->gr_mem = calloc(members_num + 1, sizeof(char *)); ATF_REQUIRE(dest->gr_mem != NULL); for (cp = src->gr_mem; *cp; ++cp) { @@ -179,7 +177,7 @@ sdump_group(struct group *grp, char *buffer, size_t buflen) written = snprintf(buffer, buflen, "%s:%s:%d:", grp->gr_name, grp->gr_passwd, grp->gr_gid); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -189,7 +187,7 @@ sdump_group(struct group *grp, char *buffer, size_t buflen) written = snprintf(buffer, buflen, "%s%s", cp == grp->gr_mem ? "" : ",", *cp); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -309,7 +307,7 @@ group_fill_test_data(struct group_test_data *td) } static int -group_test_correctness(struct group *grp, void *mdata) +group_test_correctness(struct group *grp, void *mdata __unused) { printf("testing correctness with the following data:\n"); dump_group(grp); @@ -387,7 +385,7 @@ group_test_getgrgid(struct group *grp_model, void *mdata) } static int -group_test_getgrent(struct group *grp, void *mdata) +group_test_getgrent(struct group *grp, void *mdata __unused) { /* Only correctness can be checked when doing 1-pass test for * getgrent(). */ diff --git a/lib/libc/tests/nss/gethostby_test.c b/lib/libc/tests/nss/gethostby_test.c index 618f747..a059770 100644 --- a/lib/libc/tests/nss/gethostby_test.c +++ b/lib/libc/tests/nss/gethostby_test.c @@ -87,8 +87,6 @@ static int hostent_test_gethostbyaddr(struct hostent *, void *); static int hostent_test_getaddrinfo_eq(struct hostent *, void *); static int hostent_test_getnameinfo_eq(struct hostent *, void *); -static void usage(void) __attribute__((__noreturn__)); - IMPLEMENT_TEST_DATA(hostent) IMPLEMENT_TEST_FILE_SNAPSHOT(hostent) IMPLEMENT_1PASS_TEST(hostent) @@ -163,8 +161,7 @@ clone_hostent(struct hostent *dest, struct hostent const *src) for (cp = src->h_aliases; *cp; ++cp) ++aliases_num; - dest->h_aliases = calloc(1, (aliases_num + 1) * - sizeof(char *)); + dest->h_aliases = calloc(aliases_num + 1, sizeof(char *)); ATF_REQUIRE(dest->h_aliases != NULL); for (cp = src->h_aliases; *cp; ++cp) { @@ -178,7 +175,7 @@ clone_hostent(struct hostent *dest, struct hostent const *src) for (cp = src->h_addr_list; *cp; ++cp) ++addrs_num; - dest->h_addr_list = calloc(1, (addrs_num + 1) * sizeof(char *)); + dest->h_addr_list = calloc(addrs_num + 1, sizeof(char *)); ATF_REQUIRE(dest->h_addr_list != NULL); for (cp = src->h_addr_list; *cp; ++cp) { @@ -413,7 +410,7 @@ sdump_hostent(struct hostent *ht, char *buffer, size_t buflen) written = snprintf(buffer, buflen, "%s %d %d", ht->h_name, ht->h_addrtype, ht->h_length); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -422,7 +419,7 @@ sdump_hostent(struct hostent *ht, char *buffer, size_t buflen) for (cp = ht->h_aliases; *cp; ++cp) { written = snprintf(buffer, buflen, " %s",*cp); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -432,59 +429,61 @@ sdump_hostent(struct hostent *ht, char *buffer, size_t buflen) } else { written = snprintf(buffer, buflen, " noaliases"); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; } } else { written = snprintf(buffer, buflen, " (null)"); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; } written = snprintf(buffer, buflen, " : "); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; if (ht->h_addr_list != NULL) { if (*(ht->h_addr_list) != NULL) { for (cp = ht->h_addr_list; *cp; ++cp) { - for (i = 0; i < ht->h_length; ++i ) { - written = snprintf(buffer, buflen, - i + 1 != ht->h_length ? "%d." : "%d", - (unsigned char)(*cp)[i]); - buffer += written; - if (written > buflen) - return; - buflen -= written; - - if (buflen == 0) - return; - } + for (i = 0; i < (size_t)ht->h_length; ++i) { + written = snprintf(buffer, buflen, + i + 1 != (size_t)ht->h_length ? + "%d." : "%d", + (unsigned char)(*cp)[i]); + buffer += written; + if (written > (int)buflen) + return; + buflen -= written; + + if (buflen == 0) + return; + } - if (*(cp + 1) ) { - written = snprintf(buffer, buflen, " "); - buffer += written; - if (written > buflen) - return; - buflen -= written; - } + if (*(cp + 1)) { + written = snprintf(buffer, buflen, + " "); + buffer += written; + if (written > (int)buflen) + return; + buflen -= written; + } } } else { written = snprintf(buffer, buflen, " noaddrs"); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; } } else { written = snprintf(buffer, buflen, " (null)"); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; } @@ -676,7 +675,7 @@ dump_hostent(struct hostent *result) } static int -hostent_test_correctness(struct hostent *ht, void *mdata) +hostent_test_correctness(struct hostent *ht, void *mdata __unused) { #ifdef DEBUG @@ -759,7 +758,7 @@ hostent_test_gethostbyaddr(struct hostent *he, void *mdata) } static int -hostent_test_getaddrinfo_eq(struct hostent *he, void *mdata) +hostent_test_getaddrinfo_eq(struct hostent *he, void *mdata __unused) { struct addrinfo *ai, hints; int rv; @@ -798,7 +797,7 @@ hostent_test_getaddrinfo_eq(struct hostent *he, void *mdata) } static int -hostent_test_getnameinfo_eq(struct hostent *he, void *mdata) +hostent_test_getnameinfo_eq(struct hostent *he, void *mdata __unused) { char **cp; char buffer[NI_MAXHOST]; @@ -921,15 +920,15 @@ hostent_test_getnameinfo_eq(struct hostent *he, void *mdata) return (0); } -int -run_tests(const char *hostlist_file, const char *snapshot_file, int af_type, +static int +run_tests(const char *hostlist_file, const char *snapshot_file, int _af_type, enum test_methods method, bool use_ipv6_mapping) { struct hostent_test_data td, td_addr, td_snap; res_state statp; int rv = -2; - switch (af_type) { + switch (_af_type) { case AF_INET: ATF_REQUIRE_FEATURE("inet"); ATF_REQUIRE(!use_ipv6_mapping); @@ -938,7 +937,7 @@ run_tests(const char *hostlist_file, const char *snapshot_file, int af_type, ATF_REQUIRE_FEATURE("inet6"); break; default: - atf_tc_fail("unhandled address family: %d", af_type); + atf_tc_fail("unhandled address family: %d", _af_type); break; } diff --git a/lib/libc/tests/nss/getproto_test.c b/lib/libc/tests/nss/getproto_test.c index 5ae8555..5e2bec5 100644 --- a/lib/libc/tests/nss/getproto_test.c +++ b/lib/libc/tests/nss/getproto_test.c @@ -99,7 +99,7 @@ clone_protoent(struct protoent *dest, struct protoent const *src) for (cp = src->p_aliases; *cp; ++cp) ++aliases_num; - dest->p_aliases = calloc(1, (aliases_num+1) * sizeof(char *)); + dest->p_aliases = calloc(aliases_num + 1, sizeof(char *)); assert(dest->p_aliases != NULL); for (cp = src->p_aliases; *cp; ++cp) { @@ -172,16 +172,16 @@ sdump_protoent(struct protoent *pe, char *buffer, size_t buflen) written = snprintf(buffer, buflen, "%s %d", pe->p_name, pe->p_proto); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; if (pe->p_aliases != NULL) { if (*(pe->p_aliases) != '\0') { for (cp = pe->p_aliases; *cp; ++cp) { - written = snprintf(buffer, buflen, " %s",*cp); + written = snprintf(buffer, buflen, " %s", *cp); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -288,7 +288,7 @@ protoent_fill_test_data(struct protoent_test_data *td) } static int -protoent_test_correctness(struct protoent *pe, void *mdata) +protoent_test_correctness(struct protoent *pe, void *mdata __unused) { printf("testing correctness with the following data:\n"); dump_protoent(pe); @@ -388,14 +388,14 @@ protoent_test_getprotobynumber(struct protoent *pe_model, void *mdata) } static int -protoent_test_getprotoent(struct protoent *pe, void *mdata) +protoent_test_getprotoent(struct protoent *pe, void *mdata __unused) { /* Only correctness can be checked when doing 1-pass test for * getprotoent(). */ return (protoent_test_correctness(pe, NULL)); } -int +static int run_tests(const char *snapshot_file, enum test_methods method) { struct protoent_test_data td, td_snap, td_2pass; diff --git a/lib/libc/tests/nss/getpw_test.c b/lib/libc/tests/nss/getpw_test.c index 98f890f..c7ad2e5 100644 --- a/lib/libc/tests/nss/getpw_test.c +++ b/lib/libc/tests/nss/getpw_test.c @@ -47,8 +47,6 @@ enum test_methods { TEST_BUILD_SNAPSHOT }; -static enum test_methods method = TEST_BUILD_SNAPSHOT; - DECLARE_TEST_DATA(passwd) DECLARE_TEST_FILE_SNAPSHOT(passwd) DECLARE_1PASS_TEST(passwd) @@ -59,7 +57,9 @@ static int compare_passwd(struct passwd *, struct passwd *, void *); static void free_passwd(struct passwd *); static void sdump_passwd(struct passwd *, char *, size_t); +#ifdef DEBUG static void dump_passwd(struct passwd *); +#endif static int passwd_read_snapshot_func(struct passwd *, char *); @@ -97,7 +97,7 @@ clone_passwd(struct passwd *dest, struct passwd const *src) } static int -compare_passwd(struct passwd *pwd1, struct passwd *pwd2, void *mdata) +compare_passwd(struct passwd *pwd1, struct passwd *pwd2, void *mdata __unused) { ATF_REQUIRE(pwd1 != NULL); ATF_REQUIRE(pwd2 != NULL); @@ -142,6 +142,7 @@ sdump_passwd(struct passwd *pwd, char *buffer, size_t buflen) pwd->pw_fields); } +#ifdef DEBUG static void dump_passwd(struct passwd *pwd) { @@ -152,6 +153,7 @@ dump_passwd(struct passwd *pwd) } else printf("(null)\n"); } +#endif static int passwd_read_snapshot_func(struct passwd *pwd, char *line) @@ -251,7 +253,7 @@ passwd_fill_test_data(struct passwd_test_data *td) } static int -passwd_test_correctness(struct passwd *pwd, void *mdata) +passwd_test_correctness(struct passwd *pwd, void *mdata __unused) { #ifdef DEBUG @@ -363,7 +365,7 @@ passwd_test_getpwuid(struct passwd *pwd_model, void *mdata) } static int -passwd_test_getpwent(struct passwd *pwd, void *mdata) +passwd_test_getpwent(struct passwd *pwd, void *mdata __unused) { /* Only correctness can be checked when doing 1-pass test for * getpwent(). */ diff --git a/lib/libc/tests/nss/getrpc_test.c b/lib/libc/tests/nss/getrpc_test.c index 54e04b2..6b9f30d 100644 --- a/lib/libc/tests/nss/getrpc_test.c +++ b/lib/libc/tests/nss/getrpc_test.c @@ -70,8 +70,6 @@ static int rpcent_test_getrpcbyname(struct rpcent *, void *); static int rpcent_test_getrpcbynumber(struct rpcent *, void *); static int rpcent_test_getrpcent(struct rpcent *, void *); -static void usage(void) __attribute__((__noreturn__)); - IMPLEMENT_TEST_DATA(rpcent) IMPLEMENT_TEST_FILE_SNAPSHOT(rpcent) IMPLEMENT_1PASS_TEST(rpcent) @@ -100,7 +98,7 @@ clone_rpcent(struct rpcent *dest, struct rpcent const *src) for (cp = src->r_aliases; *cp; ++cp) ++aliases_num; - dest->r_aliases = calloc(1, (aliases_num + 1) * sizeof(char *)); + dest->r_aliases = calloc(aliases_num + 1, sizeof(char *)); ATF_REQUIRE(dest->r_aliases != NULL); for (cp = src->r_aliases; *cp; ++cp) { @@ -173,16 +171,16 @@ sdump_rpcent(struct rpcent *rpc, char *buffer, size_t buflen) written = snprintf(buffer, buflen, "%s %d", rpc->r_name, rpc->r_number); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; if (rpc->r_aliases != NULL) { if (*(rpc->r_aliases) != '\0') { for (cp = rpc->r_aliases; *cp; ++cp) { - written = snprintf(buffer, buflen, " %s",*cp); + written = snprintf(buffer, buflen, " %s", *cp); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -289,7 +287,7 @@ rpcent_fill_test_data(struct rpcent_test_data *td) } static int -rpcent_test_correctness(struct rpcent *rpc, void *mdata) +rpcent_test_correctness(struct rpcent *rpc, void *mdata __unused) { printf("testing correctness with the following data:\n"); @@ -390,7 +388,7 @@ rpcent_test_getrpcbynumber(struct rpcent *rpc_model, void *mdata) } static int -rpcent_test_getrpcent(struct rpcent *rpc, void *mdata) +rpcent_test_getrpcent(struct rpcent *rpc, void *mdata __unused) { /* @@ -400,7 +398,7 @@ rpcent_test_getrpcent(struct rpcent *rpc, void *mdata) return (rpcent_test_correctness(rpc, NULL)); } -int +static int run_tests(const char *snapshot_file, enum test_methods method) { struct rpcent_test_data td, td_snap, td_2pass; diff --git a/lib/libc/tests/nss/getserv_test.c b/lib/libc/tests/nss/getserv_test.c index 29c1dfa..dcde929 100644 --- a/lib/libc/tests/nss/getserv_test.c +++ b/lib/libc/tests/nss/getserv_test.c @@ -102,7 +102,7 @@ clone_servent(struct servent *dest, struct servent const *src) for (cp = src->s_aliases; *cp; ++cp) ++aliases_num; - dest->s_aliases = calloc(1, (aliases_num + 1) * sizeof(char *)); + dest->s_aliases = calloc(aliases_num + 1, sizeof(char *)); ATF_REQUIRE(dest->s_aliases != NULL); for (cp = src->s_aliases; *cp; ++cp) { @@ -177,16 +177,16 @@ sdump_servent(struct servent *serv, char *buffer, size_t buflen) written = snprintf(buffer, buflen, "%s %d %s", serv->s_name, ntohs(serv->s_port), serv->s_proto); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; if (serv->s_aliases != NULL) { if (*(serv->s_aliases) != '\0') { for (cp = serv->s_aliases; *cp; ++cp) { - written = snprintf(buffer, buflen, " %s",*cp); + written = snprintf(buffer, buflen, " %s", *cp); buffer += written; - if (written > buflen) + if (written > (int)buflen) return; buflen -= written; @@ -300,7 +300,7 @@ servent_fill_test_data(struct servent_test_data *td) } static int -servent_test_correctness(struct servent *serv, void *mdata) +servent_test_correctness(struct servent *serv, void *mdata __unused) { printf("testing correctness with the following data:\n"); dump_servent(serv); @@ -403,14 +403,14 @@ servent_test_getservbyport(struct servent *serv_model, void *mdata) } static int -servent_test_getservent(struct servent *serv, void *mdata) +servent_test_getservent(struct servent *serv, void *mdata __unused) { /* Only correctness can be checked when doing 1-pass test for * getservent(). */ return (servent_test_correctness(serv, NULL)); } -int +static int run_tests(const char *snapshot_file, enum test_methods method) { struct servent_test_data td, td_snap, td_2pass; diff --git a/lib/libc/tests/nss/getusershell_test.c b/lib/libc/tests/nss/getusershell_test.c index ccd8cf9..e5c4b67 100644 --- a/lib/libc/tests/nss/getusershell_test.c +++ b/lib/libc/tests/nss/getusershell_test.c @@ -48,8 +48,6 @@ struct usershell { char *path; }; -static enum test_methods method = TEST_GETUSERSHELL; - DECLARE_TEST_DATA(usershell) DECLARE_TEST_FILE_SNAPSHOT(usershell) DECLARE_2PASS_TEST(usershell) @@ -78,7 +76,8 @@ clone_usershell(struct usershell *dest, struct usershell const *src) } static int -compare_usershell(struct usershell *us1, struct usershell *us2, void *mdata) +compare_usershell(struct usershell *us1, struct usershell *us2, + void *mdata __unused) { int rv; @@ -134,7 +133,7 @@ usershell_read_snapshot_func(struct usershell *us, char *line) return (0); } -int +static int run_tests(const char *snapshot_file, enum test_methods method) { struct usershell_test_data td, td_snap; -- cgit v1.1