Honor spa_config_path for ztest '-f' option

The new spa_config_path string was lost from ztest_run_zdb() during
the onnv_141 merge.  This commit puts it back in place so the '-f'
option is properly honored.

Additionally this function had been tweaked so ztest could be run
in-tree but that broke running it when installed as a package.  I've
updated that chunk to detect where it's running and try to do the
right thing in both cases.

Closes #49
This commit is contained in:
Brian Behlendorf 2010-08-12 16:08:16 -07:00
parent e87ec55b90
commit d24fbedd01
1 changed files with 7 additions and 3 deletions

View File

@ -4901,12 +4901,16 @@ ztest_run_zdb(char *pool)
zdb = umem_alloc(MAXPATHLEN + MAXNAMELEN + 20, UMEM_NOFAIL);
zbuf = umem_alloc(1024, UMEM_NOFAIL);
/* Designed to be run exclusively in the development tree */
VERIFY(realpath(getexecname(), bin) != NULL);
strstr(bin, "/ztest/")[0] = '\0';
if (strncmp(bin, "/usr/sbin/ztest", 14) == 0) {
strcpy(bin, "/usr/sbin/zdb"); /* Installed */
} else {
strstr(bin, "/ztest/")[0] = '\0'; /* In-tree */
strcat(bin, "/zdb/zdb");
}
(void) sprintf(zdb,
"%s/zdb/zdb -bcc%s%s -U /tmp/zpool.cache %s",
"%s -bcc%s%s -U %s %s",
bin,
zopt_verbose >= 3 ? "s" : "",
zopt_verbose >= 4 ? "v" : "",