From: Damir Tomic Date: Fri, 19 Jun 2015 11:58:37 +0000 (+0200) Subject: c_fileHandlingTest.h: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f5e35d522fd39f0646037adb779b742af58aea8;p=thirdparty%2Fntp.git c_fileHandlingTest.h: added different paths depening on the build dir, maybe this will work on freebsd run-keyFile.c: slight change bk: 558403edVtZV7qfVMYMd2cV5sVe4Sg --- diff --git a/sntp/tests/c_fileHandlingTest.h b/sntp/tests/c_fileHandlingTest.h index 34d368923..2ce075c60 100644 --- a/sntp/tests/c_fileHandlingTest.h +++ b/sntp/tests/c_fileHandlingTest.h @@ -5,6 +5,7 @@ #include "c_sntptest.h" #include +#include enum DirectoryType { @@ -14,7 +15,7 @@ enum DirectoryType { const char * CreatePath(const char* filename, enum DirectoryType argument) { - char * path = malloc (sizeof (char) * 100); + char * path = malloc (sizeof (char) * 256); /* if (m_params.size() >= argument + 1) { @@ -30,7 +31,20 @@ const char * CreatePath(const char* filename, enum DirectoryType argument) { //return path; - strcpy(path,"../../../sntp/tests/data/"); + char cwd[1024]; + if (getcwd(cwd, sizeof(cwd)) != NULL) + printf("Current working dir: %s\n", cwd); + + + if(strstr(cwd,"_build") == NULL){ //if it's run as make distcheck, it's in a different directory! + strcpy(path,"../../../sntp/tests/data/"); + } + + else { + strcpy(path,"../../../../sntp/tests/data/"); + } + + strcat(path,filename); return path; diff --git a/sntp/tests/run-keyFile.c b/sntp/tests/run-keyFile.c index 0a6380d33..43b7f9466 100644 --- a/sntp/tests/run-keyFile.c +++ b/sntp/tests/run-keyFile.c @@ -47,6 +47,7 @@ char *progname; int main(int argc, char *argv[]) { progname = argv[0]; + //printf("NUM: %d , %s\n",argc,argv[0]); Unity.TestFile = "keyFile.c"; UnityBegin("keyFile.c"); RUN_TEST(test_ReadEmptyKeyFile, 53);