1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

get testing working in autoconf

This commit is contained in:
Lee Thompson
2012-12-04 19:50:10 -06:00
parent ca862a594c
commit a156fb19de
4 changed files with 19 additions and 5 deletions

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;