X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=tests%2Fauth%2Fkeys-t.c;h=5c483c5378fa8074b075829b3430f72a70ef3c3c;hp=9e53958c1f6b74a62f817df13d08c8b3cd90900c;hb=2aa4cb047596b654a175f5a22197c2923002a271;hpb=d0d69ccb643104d06a3036da4b70bd878062f743 diff --git a/tests/auth/keys-t.c b/tests/auth/keys-t.c index 9e53958..5c483c5 100644 --- a/tests/auth/keys-t.c +++ b/tests/auth/keys-t.c @@ -36,7 +36,7 @@ #include #include -#include +#include #include "test.h" #include "common.h" @@ -101,21 +101,34 @@ int main(int argc, char **argv) struct afsconf_typedKeyList *typedKeyList; char *dirname; char *keyfile; + char *keyfilesrc; afs_int32 kvno; int code; int i; + afstest_SkipTestsIfBadHostname(); + plan(134); /* Create a temporary afs configuration directory */ - dirname = buildTestConfig(); + dirname = afstest_BuildTestConfig(); 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; @@ -546,12 +559,12 @@ int main(int argc, char **argv) afsconf_Close(dir); - unlinkTestConfig(dirname); + afstest_UnlinkTestConfig(dirname); free(dirname); free(keyfile); /* Start a new test configuration */ - dirname = buildTestConfig(); + dirname = afstest_BuildTestConfig(); dir = afsconf_Open(dirname); ok(dir != NULL, "Sucessfully opened brand new config directory"); if (dir == NULL) @@ -572,7 +585,7 @@ int main(int argc, char **argv) " ... with the right key"); out: - unlinkTestConfig(dirname); + afstest_UnlinkTestConfig(dirname); return 0; }