INN commit: branches/2.5/tests/lib (innconf-t.c)

INN Commit rra at isc.org
Tue Feb 9 19:03:38 UTC 2010


    Date: Tuesday, February 9, 2010 @ 11:03:38
  Author: iulius
Revision: 8977

Regular expression should only match at the beginning of the line.
Otherwise "./configure --prefix=/opt/portable" will fail on test 8
because additional lines matches "port".
Test 8 has to be adjusted to not count and depend on comment lines.

Besides, fix an issue of undefined domain or fromhost being unset.

Reported by Heiko Schlichting.

Modified:
  branches/2.5/tests/lib/innconf-t.c

-------------+
 innconf-t.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Modified: innconf-t.c
===================================================================
--- innconf-t.c	2010-02-09 19:02:48 UTC (rev 8976)
+++ innconf-t.c	2010-02-09 19:03:38 UTC (rev 8977)
@@ -10,9 +10,14 @@
 
 /* We will have strings, integers, bools and lists. */
 static const char grep[] =
-"egrep 'mta|organization|ovmethod|hismethod|path|port|overview|pgpverify'\
- ../../samples/inn.conf > config/tmp";
+"(egrep '^(mta|organization|ovmethod|hismethod|path|port|extraoverview|pgpverify)'\
+ ../../samples/inn.conf; echo 'domain: \"news.example.org\"';\
+ echo 'fromhost: \"news.example.org\"';) > config/tmp";
 
+static const char sed[] =
+"sed 's/^#\\(domain\\|fromhost\\):/\\1: \"news.example.org\"/'\
+ ../../samples/inn.conf > config/tmp2";
+
 int
 main(void)
 {
@@ -28,13 +33,16 @@
 
     test_init(9);
 
-    ok(1, innconf_read("../../samples/inn.conf"));
+    if (system(sed) != 0)
+        die("Unable to create stripped configuration file");
+    ok(1, innconf_read("config/tmp2"));
     standard = innconf;
     innconf = NULL;
     if (system(grep) != 0)
         die("Unable to create stripped configuration file");
     ok(2, innconf_read("config/tmp"));
     unlink("config/tmp");
+    unlink("config/tmp2");
     ok(3, innconf_compare(standard, innconf));
     innconf_free(standard);
     innconf_free(innconf);
@@ -56,7 +64,7 @@
     fclose(config);
     ok(7, !innconf_check("config/tmp"));
     unlink("config/tmp");
-    ok_string(8, "config/tmp:37: unknown parameter foo\n", errors);
+    ok_string(8, "config/tmp:28: unknown parameter foo\n", errors);
     errors_uncapture();
     free(errors);
     errors = NULL;




More information about the inn-committers mailing list