aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2016-01-24 22:49:06 -0800
committerLev Walkin <vlm@lionet.info>2016-01-24 22:49:06 -0800
commit08068b26d31a9382cae0606edeb9c2a0fe18b30f (patch)
tree362d1ddd319cf437b47df6ea3ac7c5e923d75cd3
parent8ca13c8a984a13e033231000aa786575c8ed915f (diff)
environment override for tests directory
-rw-r--r--libasn1fix/Makefile.am1
-rw-r--r--libasn1fix/check_fixer.c11
2 files changed, 9 insertions, 3 deletions
diff --git a/libasn1fix/Makefile.am b/libasn1fix/Makefile.am
index 44131d7a..71df46a9 100644
--- a/libasn1fix/Makefile.am
+++ b/libasn1fix/Makefile.am
@@ -39,5 +39,6 @@ check_crange_LDADD = $(noinst_LTLIBRARIES) \
check_PROGRAMS = check_crange check_fixer
+TESTS_ENVIRONMENT = ASN1_TESTS_DIR=${top_srcdir}/tests
TESTS = ${check_PROGRAMS}
diff --git a/libasn1fix/check_fixer.c b/libasn1fix/check_fixer.c
index ff4d19ce..4a616e0c 100644
--- a/libasn1fix/check_fixer.c
+++ b/libasn1fix/check_fixer.c
@@ -58,9 +58,14 @@ main(int ac, char **av) {
* Go into a directory with tests.
*/
if(ac <= 1) {
- fprintf(stderr, "Testing in " TOP_SRCDIR_S "/tests...\n");
- ret = chdir(TOP_SRCDIR_S "/tests");
- assert(ret == 0);
+ const char *asn1_tests_dir = getenv("ASN1_TESTS_DIR");
+ if(!asn1_tests_dir)
+ asn1_tests_dir = TOP_SRCDIR_S "/tests";
+ fprintf(stderr, "Testing in %s...\n", asn1_tests_dir);
+ ret = chdir(asn1_tests_dir);
+ if(ret == -1)
+ fprintf(stderr, "%s: %s\n", asn1_tests_dir, strerror(errno));
+ assert(ret == 0);
#ifdef _WIN32
dir = _findfirst("*.asn1", &c_file);
assert(dir != -1L);