get testing working in autoconf

This commit is contained in:
Lee Thompson committed 2012-12-04 19:50:10 -06:00
1 parent ca862a594c
commit a156fb19de
4 files changed
+19 -5

No files matched your search

+12 -1
View File
@@ -24,10 +24,21 @@ static int skipline(const char* buf) {
}
static void run_jq_tests() {
FILE* testdata = fopen("testdata","r");
FILE* testdata = NULL;
char buf[4096];
int tests = 0, passed = 0;
testdata = fopen("testdata","r");
if ( NULL == testdata )
{
/* in an autoconf distcheck, the binary file will be in a _build subdirectory */
testdata = fopen("../testdata", "r");
if ( NULL == testdata )
{
fprintf(stderr, "Could not find testdata file\n");
exit(1);
}
}
while (1) {
if (!fgets(buf, sizeof(buf), testdata)) break;
if (skipline(buf)) continue;