tests: Accommodate c-tap-harness 4.7
[openafs.git] / tests / volser / vos-t.c
index a8b8f54..05ec8fd 100644 (file)
@@ -69,7 +69,7 @@ TestListAddrs(struct ubik_client *client, char *dirname)
        close(outpipe[0]);
        close(outpipe[1]);
 
-       build = getenv("BUILD");
+       build = getenv("C_TAP_BUILD");
        if (build == NULL)
            build = "..";
 
@@ -78,7 +78,7 @@ TestListAddrs(struct ubik_client *client, char *dirname)
            exit(1);
        }
        execl(binPath, "vos",
-             "listaddrs", "-config", dirname, "-noauth", NULL);
+             "listaddrs", "-config", dirname, "-noauth", "-noresolve", NULL);
        exit(1);
     }
     close(outpipe[1]);
@@ -96,15 +96,18 @@ main(int argc, char **argv)
     char *dirname;
     struct afsconf_dir *dir;
     int code, secIndex;
-    pid_t serverPid;
+    pid_t serverPid = 0;
     struct rx_securityClass *secClass;
     struct ubik_client *ubikClient = NULL;
     int ret = 0;
+    char *argv0 = afstest_GetProgname(argv);
 
     /* Skip all tests if the current hostname can't be resolved */
     afstest_SkipTestsIfBadHostname();
     /* Skip all tests if the current hostname is on the loopback network */
     afstest_SkipTestsIfLoopbackNetIsDefault();
+    /* Skip all tests if a vlserver is already running on this system. */
+    afstest_SkipTestsIfServerRunning("afs3-vlserver");
 
     plan(6);
 
@@ -116,14 +119,14 @@ main(int argc, char **argv)
 
     code = afstest_AddDESKeyFile(dir);
     if (code) {
-       afs_com_err("vos-t", code, "while adding test DES keyfile");
+       afs_com_err(argv0, code, "while adding test DES keyfile");
        ret = 1;
        goto out;
     }
 
     code = afstest_StartVLServer(dirname, &serverPid);
     if (code) {
-       afs_com_err("vos-t", code, "while starting the vlserver");
+       afs_com_err(argv0, code, "while starting the vlserver");
        ret = 1;
        goto out;
     }
@@ -131,7 +134,7 @@ main(int argc, char **argv)
     code = afsconf_ClientAuthSecure(dir, &secClass, &secIndex);
     is_int(code, 0, "Successfully got security class");
     if (code) {
-       afs_com_err("authname-t", code, "while getting anonymous secClass");
+       afs_com_err(argv0, code, "while getting anonymous secClass");
        ret = 1;
        goto out;
     }
@@ -140,17 +143,19 @@ main(int argc, char **argv)
                                 secClass, secIndex, &ubikClient);
     is_int(code, 0, "Successfully built ubik client structure");
     if (code) {
-       afs_com_err("vos-t", code, "while building ubik client");
+       afs_com_err(argv0, code, "while building ubik client");
        ret = 1;
        goto out;
     }
 
     TestListAddrs(ubikClient, dirname);
 
-    code = afstest_StopServer(serverPid);
-    is_int(0, code, "Server exited cleanly");
-
 out:
+    if (serverPid != 0) {
+       code = afstest_StopServer(serverPid);
+       is_int(0, code, "Server exited cleanly");
+    }
+
     afstest_UnlinkTestConfig(dirname);
     return ret;
 }