diff options
author | Lee Thompson <thompson@dtosolutions.com> | 2012-12-04 19:50:10 -0600 |
---|---|---|
committer | Lee Thompson <thompson@dtosolutions.com> | 2012-12-04 19:50:10 -0600 |
commit | a156fb19de017c6d101b0e4cebbe3ea6819e7d40 (patch) | |
tree | 33092125c98c1107a798a9d84a5b20447cb7dc17 /jq_test.c | |
parent | ca862a594cef170c493f60199ca2775c07962fbf (diff) |
get testing working in autoconf
Diffstat (limited to 'jq_test.c')
-rw-r--r-- | jq_test.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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; |