mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
test-nss-hosts: make buffer size configurable too and document it
This commit is contained in:
parent
e2aa384bcd
commit
f0cb09bb0f
@ -198,11 +198,6 @@ All tools:
|
|||||||
prefixed with `:` in which case the kernel command line option takes
|
prefixed with `:` in which case the kernel command line option takes
|
||||||
precedence, if it is specified as well.
|
precedence, if it is specified as well.
|
||||||
|
|
||||||
installed systemd tests:
|
|
||||||
|
|
||||||
* `$SYSTEMD_TEST_DATA` — override the location of test data. This is useful if
|
|
||||||
a test executable is moved to an arbitrary location.
|
|
||||||
|
|
||||||
`nss-systemd`:
|
`nss-systemd`:
|
||||||
|
|
||||||
* `$SYSTEMD_NSS_BYPASS_SYNTHETIC=1` — if set, `nss-systemd` won't synthesize
|
* `$SYSTEMD_NSS_BYPASS_SYNTHETIC=1` — if set, `nss-systemd` won't synthesize
|
||||||
@ -302,6 +297,14 @@ installed systemd tests:
|
|||||||
* `$SYSTEMD_SYSVRCND_PATH` — Controls where `systemd-sysv-generator` looks for
|
* `$SYSTEMD_SYSVRCND_PATH` — Controls where `systemd-sysv-generator` looks for
|
||||||
SysV init script runlevel link farms.
|
SysV init script runlevel link farms.
|
||||||
|
|
||||||
|
systemd tests:
|
||||||
|
|
||||||
|
* `$SYSTEMD_TEST_DATA` — override the location of test data. This is useful if
|
||||||
|
a test executable is moved to an arbitrary location.
|
||||||
|
|
||||||
|
* `$SYSTEMD_TEST_NSS_BUFSIZE` — size of scratch buffers for "reentrant"
|
||||||
|
functions exported by the nss modules.
|
||||||
|
|
||||||
fuzzers:
|
fuzzers:
|
||||||
|
|
||||||
* `$SYSTEMD_FUZZ_OUTPUT` — A boolean that specifies whether to write output to
|
* `$SYSTEMD_FUZZ_OUTPUT` — A boolean that specifies whether to write output to
|
||||||
|
@ -17,12 +17,15 @@
|
|||||||
#include "main-func.h"
|
#include "main-func.h"
|
||||||
#include "nss-test-util.h"
|
#include "nss-test-util.h"
|
||||||
#include "nss-util.h"
|
#include "nss-util.h"
|
||||||
|
#include "parse-util.h"
|
||||||
#include "path-util.h"
|
#include "path-util.h"
|
||||||
#include "stdio-util.h"
|
#include "stdio-util.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
|
|
||||||
|
static size_t arg_bufsize = 1024;
|
||||||
|
|
||||||
static const char* af_to_string(int family, char *buf, size_t buf_len) {
|
static const char* af_to_string(int family, char *buf, size_t buf_len) {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
@ -99,7 +102,7 @@ static void print_struct_hostent(struct hostent *host, const char *canon) {
|
|||||||
static void test_gethostbyname4_r(void *handle, const char *module, const char *name) {
|
static void test_gethostbyname4_r(void *handle, const char *module, const char *name) {
|
||||||
const char *fname;
|
const char *fname;
|
||||||
_nss_gethostbyname4_r_t f;
|
_nss_gethostbyname4_r_t f;
|
||||||
char buffer[2000];
|
char buffer[arg_bufsize];
|
||||||
struct gaih_addrtuple *pat = NULL;
|
struct gaih_addrtuple *pat = NULL;
|
||||||
int errno1 = 999, errno2 = 999; /* nss-dns doesn't set those */
|
int errno1 = 999, errno2 = 999; /* nss-dns doesn't set those */
|
||||||
int32_t ttl = INT32_MAX; /* nss-dns wants to return the lowest ttl,
|
int32_t ttl = INT32_MAX; /* nss-dns wants to return the lowest ttl,
|
||||||
@ -151,7 +154,7 @@ static void test_gethostbyname4_r(void *handle, const char *module, const char *
|
|||||||
static void test_gethostbyname3_r(void *handle, const char *module, const char *name, int af) {
|
static void test_gethostbyname3_r(void *handle, const char *module, const char *name, int af) {
|
||||||
const char *fname;
|
const char *fname;
|
||||||
_nss_gethostbyname3_r_t f;
|
_nss_gethostbyname3_r_t f;
|
||||||
char buffer[2000];
|
char buffer[arg_bufsize];
|
||||||
int errno1 = 999, errno2 = 999; /* nss-dns doesn't set those */
|
int errno1 = 999, errno2 = 999; /* nss-dns doesn't set those */
|
||||||
int32_t ttl = INT32_MAX; /* nss-dns wants to return the lowest ttl,
|
int32_t ttl = INT32_MAX; /* nss-dns wants to return the lowest ttl,
|
||||||
and will access this variable through *ttlp,
|
and will access this variable through *ttlp,
|
||||||
@ -186,7 +189,7 @@ static void test_gethostbyname3_r(void *handle, const char *module, const char *
|
|||||||
static void test_gethostbyname2_r(void *handle, const char *module, const char *name, int af) {
|
static void test_gethostbyname2_r(void *handle, const char *module, const char *name, int af) {
|
||||||
const char *fname;
|
const char *fname;
|
||||||
_nss_gethostbyname2_r_t f;
|
_nss_gethostbyname2_r_t f;
|
||||||
char buffer[2000];
|
char buffer[arg_bufsize];
|
||||||
int errno1 = 999, errno2 = 999; /* nss-dns doesn't set those */
|
int errno1 = 999, errno2 = 999; /* nss-dns doesn't set those */
|
||||||
enum nss_status status;
|
enum nss_status status;
|
||||||
char pretty_status[DECIMAL_STR_MAX(enum nss_status)];
|
char pretty_status[DECIMAL_STR_MAX(enum nss_status)];
|
||||||
@ -214,7 +217,7 @@ static void test_gethostbyname2_r(void *handle, const char *module, const char *
|
|||||||
static void test_gethostbyname_r(void *handle, const char *module, const char *name) {
|
static void test_gethostbyname_r(void *handle, const char *module, const char *name) {
|
||||||
const char *fname;
|
const char *fname;
|
||||||
_nss_gethostbyname_r_t f;
|
_nss_gethostbyname_r_t f;
|
||||||
char buffer[2000];
|
char buffer[arg_bufsize];
|
||||||
int errno1 = 999, errno2 = 999; /* nss-dns doesn't set those */
|
int errno1 = 999, errno2 = 999; /* nss-dns doesn't set those */
|
||||||
enum nss_status status;
|
enum nss_status status;
|
||||||
char pretty_status[DECIMAL_STR_MAX(enum nss_status)];
|
char pretty_status[DECIMAL_STR_MAX(enum nss_status)];
|
||||||
@ -245,7 +248,7 @@ static void test_gethostbyaddr2_r(void *handle,
|
|||||||
|
|
||||||
const char *fname;
|
const char *fname;
|
||||||
_nss_gethostbyaddr2_r_t f;
|
_nss_gethostbyaddr2_r_t f;
|
||||||
char buffer[2000];
|
char buffer[arg_bufsize];
|
||||||
int errno1 = 999, errno2 = 999; /* nss-dns doesn't set those */
|
int errno1 = 999, errno2 = 999; /* nss-dns doesn't set those */
|
||||||
enum nss_status status;
|
enum nss_status status;
|
||||||
char pretty_status[DECIMAL_STR_MAX(enum nss_status)];
|
char pretty_status[DECIMAL_STR_MAX(enum nss_status)];
|
||||||
@ -283,7 +286,7 @@ static void test_gethostbyaddr_r(void *handle,
|
|||||||
|
|
||||||
const char *fname;
|
const char *fname;
|
||||||
_nss_gethostbyaddr_r_t f;
|
_nss_gethostbyaddr_r_t f;
|
||||||
char buffer[2000];
|
char buffer[arg_bufsize];
|
||||||
int errno1 = 999, errno2 = 999; /* nss-dns doesn't set those */
|
int errno1 = 999, errno2 = 999; /* nss-dns doesn't set those */
|
||||||
enum nss_status status;
|
enum nss_status status;
|
||||||
char pretty_status[DECIMAL_STR_MAX(enum nss_status)];
|
char pretty_status[DECIMAL_STR_MAX(enum nss_status)];
|
||||||
@ -404,8 +407,16 @@ static int parse_argv(int argc, char **argv,
|
|||||||
_cleanup_strv_free_ char **modules = NULL, **names = NULL;
|
_cleanup_strv_free_ char **modules = NULL, **names = NULL;
|
||||||
_cleanup_free_ struct local_address *addrs = NULL;
|
_cleanup_free_ struct local_address *addrs = NULL;
|
||||||
size_t n_allocated = 0;
|
size_t n_allocated = 0;
|
||||||
|
const char *p;
|
||||||
int r, n = 0;
|
int r, n = 0;
|
||||||
|
|
||||||
|
p = getenv("SYSTEMD_TEST_NSS_BUFSIZE");
|
||||||
|
if (p) {
|
||||||
|
r = safe_atozu(p, &arg_bufsize);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to parse $SYSTEMD_TEST_NSS_BUFSIZE");
|
||||||
|
}
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
modules = strv_new(argv[1]);
|
modules = strv_new(argv[1]);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user