mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 05:27:44 +00:00
tests: Fix KeyFile test so it works from harness
The auth/keys test tries to find a file that's distributed as part of the test suite. However, it currently only looks in the CWD to find it. Modify the test so that if it's run from the test harness, it will use the harnesses SOURCE environment variable to locate the KeyFile Change-Id: I93e16a01eae79b38ab01c81a57d2a47c28479b27 Reviewed-on: http://gerrit.openafs.org/4213 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
bc16fe0a43
commit
926755bf22
@ -101,6 +101,7 @@ int main(int argc, char **argv)
|
||||
struct afsconf_typedKeyList *typedKeyList;
|
||||
char *dirname;
|
||||
char *keyfile;
|
||||
char *keyfilesrc;
|
||||
afs_int32 kvno;
|
||||
int code;
|
||||
int i;
|
||||
@ -114,8 +115,18 @@ int main(int argc, char **argv)
|
||||
if (asprintf(&keyfile, "%s/KeyFile", dirname) == -1)
|
||||
goto out;
|
||||
|
||||
/* Work out the path to our KeyFile. If the test harness hasn't set
|
||||
* the SOURCE environment variable, then assume it is in our CWD */
|
||||
if (getenv("SOURCE") == NULL) {
|
||||
keyfilesrc = strdup("KeyFile");
|
||||
} else {
|
||||
if (asprintf(&keyfilesrc, "%s/auth/KeyFile", getenv("SOURCE")) == -1)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* First, copy in a known keyfile */
|
||||
code = copy("KeyFile", keyfile);
|
||||
code = copy(keyfilesrc, keyfile);
|
||||
free(keyfilesrc);
|
||||
if (code)
|
||||
goto out;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user