tests: More fixes for the vos test
authorSimon Wilkinson <sxw@your-file-system.com>
Sun, 22 Apr 2012 17:19:07 +0000 (18:19 +0100)
committerDerrick Brashear <shadow@dementix.org>
Mon, 23 Apr 2012 01:49:58 +0000 (18:49 -0700)
The vos test wasn't running correctly from runtests, as it contained
a relative path which assumed that the CWD was tests/volser, rather
than tests/

Modify this to use the BUILD environment variable when invoked from
runtests, and also add an exit after the exec(), so that if we do
fail to launch the binary we don't have two processes both running
the same code.

Change-Id: I7b2d7e6a517e9e9f74f15803da7507037671226a
Reviewed-on: http://gerrit.openafs.org/7265
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

tests/volser/vos-t.c

index eb58547..8eb32ea 100644 (file)
@@ -60,12 +60,20 @@ TestListAddrs(struct ubik_client *client, char *dirname)
     pipe(outpipe);
     pid = fork();
     if (pid == 0) {
+       char *build, *binPath;
+
        dup2(outpipe[1], STDOUT_FILENO); /* Redirect stdout into pipe */
        close(outpipe[0]);
        close(outpipe[1]);
 
-       execl("../../src/volser/vos", "vos",
+       build = getenv("BUILD");
+       if (build == NULL)
+           build = "..";
+
+       asprintf(&binPath, "%s/../src/volser/vos", build);
+       execl(binPath, "vos",
              "listaddrs", "-config", dirname, "-noauth", NULL);
+       exit(1);
     }
     close(outpipe[1]);
     buffer = malloc(4096);