Fix make check for objdir != srcdir, reported by Bernard Leak <bernard@brenda-arkle...
authorSimon Josefsson <simon@josefsson.org>
Fri, 27 Jan 2006 12:25:51 +0000 (12:25 +0000)
committerSimon Josefsson <simon@josefsson.org>
Fri, 27 Jan 2006 12:25:51 +0000 (12:25 +0000)
tests/Makefile.am
tests/Test_parser.c
tests/Test_tree.c

index e79017b..0ac13af 100644 (file)
@@ -9,3 +9,7 @@ Test_parser_LDADD = ../lib/libtasn1.la
 
 Test_tree_SOURCES = Test_tree.c  
 Test_tree_LDADD = ../lib/libtasn1.la
+
+TESTS_ENVIRONMENT = \
+       ASN1PARSER=$(srcdir)/Test_parser.asn \
+       ASN1TREE=$(srcdir)/Test_tree.asn
index 12f6cb5..ef7a1f0 100644 (file)
@@ -1,5 +1,6 @@
 /*
  *      Copyright (C) 2002 Fabio Fiorina
+ *      Copyright (C) 2006 Simon Josefsson
  *
  * This file is part of LIBTASN1.
  *
@@ -38,7 +39,7 @@ typedef struct{
   char *errorDescription;
 } test_type;
 
-char fileCorrectName[]="Test_parser.asn";
+char *fileCorrectName;
 char fileErroredName[]="Test_parser_ERROR.asn";
 
 #define _FILE_ "Test_parser_ERROR.asn"
@@ -149,10 +150,14 @@ main(int argc,char *argv[])
   test_type *test;
   int errorCounter=0,testCounter=0;
 
+  fileCorrectName = getenv ("ASN1PARSER");
+  if (!fileCorrectName)
+    fileCorrectName="Test_parser.asn";
+
   printf("\n\n/****************************************/\n");
   printf(    "/*     Test sequence : Test_parser      */\n");
   printf(    "/****************************************/\n\n");
-
+  printf("ASN1PARSER: %s\n", fileCorrectName);
 
   result=asn1_parser2tree(fileCorrectName,&definitions,errorDescription);
 
index 7cdd068..fccbc36 100644 (file)
@@ -1,5 +1,6 @@
 /*
  *      Copyright (C) 2002 Fabio Fiorina
+ *      Copyright (C) 2006 Simon Josefsson
  *
  * This file is part of LIBTASN1.
  *
@@ -415,17 +416,22 @@ main(int argc,char *argv[])
   int k;
   int start,end;
   const char *str_p=NULL;
+  const char *treefile = getenv ("ASN1TREE");
+
+  if (!treefile)
+    treefile = "Test_tree.asn";
 
   printf("\n\n/****************************************/\n");
   printf(    "/*     Test sequence : Test_tree        */\n");
   printf(    "/****************************************/\n\n");
+  printf("ASN1TREE: %s\n", treefile);
 
   /* Check version */
   if(asn1_check_version("0.2.11")==NULL)
     printf("\nLibrary version check ERROR:\n actual version: %s\n\n",asn1_check_version(NULL));
 
   if(1)
-    result=asn1_parser2tree("Test_tree.asn",&definitions,errorDescription);
+    result=asn1_parser2tree(treefile,&definitions,errorDescription);
   else
     result=asn1_array2tree(Test_tree_asn1_tab,&definitions,errorDescription);