You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2010/01/15 21:01:08 UTC

svn commit: r899793 - /spamassassin/trunk/t/sa_compile.t

Author: mmartinec
Date: Fri Jan 15 20:01:08 2010
New Revision: 899793

URL: http://svn.apache.org/viewvc?rev=899793&view=rev
Log:
Bug 6263: sa_compile.t test fails if re2c not found, or installed re2c version is too old

Modified:
    spamassassin/trunk/t/sa_compile.t

Modified: spamassassin/trunk/t/sa_compile.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/sa_compile.t?rev=899793&r1=899792&r2=899793&view=diff
==============================================================================
--- spamassassin/trunk/t/sa_compile.t (original)
+++ spamassassin/trunk/t/sa_compile.t Fri Jan 15 20:01:08 2010
@@ -5,7 +5,24 @@
 use SATest; sa_t_init("sa_compile");
 use Test;
 
-use constant TEST_ENABLED => conf_bool('run_long_tests');
+# called from BEGIN
+sub re2c_version_new_enough {
+
+  my $re2c_ver = `re2c -V 2>&1`;
+  if (!defined $re2c_ver || $re2c_ver =~ /^$/) {
+    print "re2c not found, or 're2c -V' not supported, skipping test\n";
+    return;
+  }
+
+  chop $re2c_ver;
+  my $newenough = ($re2c_ver+0 >= 001200);   # 0.12.0 seems safe enough as a baseline
+  print "re2c version ($re2c_ver) new enough? ".($newenough ? "yes" : "no")."\n";
+  return $newenough;
+}
+
+use constant TEST_ENABLED => conf_bool('run_long_tests')
+                                && re2c_version_new_enough();
+
 BEGIN { 
   if (-e 't/test_dir') {
     chdir 't';
@@ -13,6 +30,7 @@
   if (-e 'test_dir') {
     unshift(@INC, '../blib/lib');
   }
+
   plan tests => ((TEST_ENABLED && !$RUNNING_ON_WINDOWS) ? 5 : 0);
 };