summaryrefslogtreecommitdiffstats
path: root/jq_test.c
diff options
context:
space:
mode:
authorLee Thompson <thompson@dtosolutions.com>2012-12-04 19:50:10 -0600
committerLee Thompson <thompson@dtosolutions.com>2012-12-04 19:50:10 -0600
commita156fb19de017c6d101b0e4cebbe3ea6819e7d40 (patch)
tree33092125c98c1107a798a9d84a5b20447cb7dc17 /jq_test.c
parentca862a594cef170c493f60199ca2775c07962fbf (diff)
get testing working in autoconf
Diffstat (limited to 'jq_test.c')
-rw-r--r--jq_test.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/jq_test.c b/jq_test.c
index b4674c81..dd41a2f9 100644
--- a/jq_test.c
+++ b/jq_test.c
@@ -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;