From da663418c686d8b1e89055fbc25a05bbfeb18ac4 Mon Sep 17 00:00:00 2001 From: William King Date: Thu, 7 Oct 1999 02:31:34 +0000 Subject: [PATCH] added -b option to support chdir to a base directory so that data files can be specified w/out full paths in tests --- lib/tests/t_api.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/tests/t_api.c b/lib/tests/t_api.c index 4fc814cf41..f8280a566e 100644 --- a/lib/tests/t_api.c +++ b/lib/tests/t_api.c @@ -32,6 +32,7 @@ #include "include/tests/t_api.h" static char *Usage = "\t-a : run all tests\n" + "\t-b : chdir to dir before running tests" "\t-c : use specified config file\n" "\t-d : set debug level to debug_level\n" "\t-h : print test info\n" @@ -42,6 +43,7 @@ static char *Usage = "\t-a : run all tests\n" "\t-q : use 'timeout' as the timeout value\n"; /* * -a --> run all tests + * -b dir --> chdir to dir before running tests * -tn --> run test n * -c config --> use config file 'config' * -d --> turn on api debugging @@ -65,6 +67,7 @@ static char *T_config; static char T_tvec[T_MAXTESTS / 8]; static char *T_env[T_MAXENV + 1]; static char T_buf[T_BIGBUF]; +static char *T_dir; static int t_initconf(char *path); static int t_dumpconf(char *path); @@ -96,13 +99,16 @@ main(int argc, char **argv) T_timeout = T_TIMEOUT; /* parse args */ - while ((c = isc_commandline_parse(argc, argv, ":at:c:d:n:huxq:")) + while ((c = isc_commandline_parse(argc, argv, ":at:c:d:n:huxq:b:")) != -1) { if (c == 'a') { /* flag all tests to be run */ memset(T_tvec, 0xffff, sizeof(T_tvec)); /* memset(T_tvec, UINT_MAX, sizeof(T_tvec)); */ } + else if (c == 'b') { + T_dir = isc_commandline_argument; + } else if (c == 't') { tnum = atoi(isc_commandline_argument); if ((tnum > 0) && (tnum < T_MAXTESTS)) { @@ -161,6 +167,9 @@ main(int argc, char **argv) } } + if (T_dir != NULL) + (void) chdir(T_dir); + /* output time to journal */ date = t_getdate();