I found the test28 and test29 tests difficult to understand, and
they seemed to not provide the intended coverage.  Rewrite them for
clarity and completeness.
---
 src/postconf/Makefile.in      | 40 +++++--------------------
 src/postconf/test28-main.cf   | 22 ++++++++++++++
 src/postconf/test28-master.cf |  2 ++
 src/postconf/test28.ref       | 11 ++++---
 src/postconf/test29-main.cf   | 55 +++++++++++++++++++++++++++++++++++
 src/postconf/test29.ref       | 49 +++++++++++++++++++------------
 6 files changed, 124 insertions(+), 55 deletions(-)
 create mode 100644 src/postconf/test28-main.cf
 create mode 100644 src/postconf/test28-master.cf
 create mode 100644 src/postconf/test29-main.cf

diff --git a/src/postconf/Makefile.in b/src/postconf/Makefile.in
index 9e5e3b966..e23a81f87 100644
--- a/src/postconf/Makefile.in
+++ b/src/postconf/Makefile.in
@@ -430,48 +430,22 @@ test27:   $(PROG) test27.ref
 
 # Test macro expansion, type:table parsing and scoping.
 
-test28:        $(PROG) test28.ref
+test28:        $(PROG) test28-main.cf test28-master.cf test28.ref
        rm -f main.cf master.cf
-       touch main.cf master.cf
-       echo 'xx = proxy:ldap:foo' >> main.cf
-       echo 'foo_domain = bar' >> main.cf
-       echo 'header_checks = ldap:hh' >> main.cf
-       echo 'hh_domain = whatever' >> main.cf
-       echo 'zz = $$yy' >> main.cf
-       echo 'yy = aap' >> main.cf
-       echo 'db = memcache' >> main.cf
-       echo whatevershebrings unix - n n - 0 other >> master.cf
-       echo ' -o body_checks=$$db:$$zz' >> master.cf
-       echo 'aap_domain = whatever' >> main.cf
-       echo 'aa_domain = whatever' >> main.cf
+       cp test28-main.cf main.cf
+       cp test28-master.cf master.cf
        touch -t 197101010000 main.cf
+       touch master.cf
        $(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test28.tmp 2>&1
        diff test28.ref test28.tmp
        rm -f main.cf master.cf test28.tmp
 
 # Test the handling of known and unknown database-defined suffixes.
 
-test29:        $(PROG) test29.ref
+test29:        $(PROG) test29-main.cf test29.ref
        rm -f main.cf master.cf
-       touch main.cf master.cf
-       echo 'ldapxx = proxy:ldap:ldapfoo' >> main.cf
-       echo 'ldapfoo_domain = bar' >> main.cf
-       echo 'ldapfoo_domainx = bar' >> main.cf
-       echo 'mysqlxx = proxy:mysql:mysqlfoo' >> main.cf
-       echo 'mysqlfoo_domain = bar' >> main.cf
-       echo 'mysqlfoo_domainx = bar' >> main.cf
-       echo 'pgsqlxx = proxy:pgsql:pgsqlfoo' >> main.cf
-       echo 'pgsqlfoo_domain = bar' >> main.cf
-       echo 'pgsqlfoo_domainx = bar' >> main.cf
-       echo 'sqlitexx = proxy:sqlite:sqlitefoo' >> main.cf
-       echo 'sqlitefoo_domain = bar' >> main.cf
-       echo 'sqlitefoo_domainx = bar' >> main.cf
-       echo 'memcachexx = proxy:memcache:memcachefoo' >> main.cf
-       echo 'memcachefoo_domain = bar' >> main.cf
-       echo 'memcachefoo_domainx = bar' >> main.cf
-       echo 'mongodbxx = proxy:mongodb:mongodbfoo' >> main.cf
-       echo 'mongodbfoo_domain = bar' >> main.cf
-       echo 'mongodbfoo_domainx = bar' >> main.cf
+       cp test29-main.cf main.cf
+       touch master.cf
        touch -t 197101010000 main.cf
        $(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test29.tmp 2>&1
        diff test29.ref test29.tmp
diff --git a/src/postconf/test28-main.cf b/src/postconf/test28-main.cf
new file mode 100644
index 000000000..6f33bc398
--- /dev/null
+++ b/src/postconf/test28-main.cf
@@ -0,0 +1,22 @@
+_unused_tables =
+ ldap:_unused_ldap
+ proxy:ldap:_unused_proxy_ldap
+_unused_ldap_domain = whatever
+_unused_proxy_ldap_domain = whatever
+
+header_checks = $_used_tables
+_used_tables =
+ ldap:_used_ldap
+ proxy:ldap:_used_proxy_ldap
+_used_ldap_domain = whatever
+_used_proxy_ldap_domain = whatever
+
+# These are referenced by master.cf ($aap_domain is referenced indirectly via
+# the memcache:aap table specified as $db:$zz in master.cf).
+zz = $yy
+yy = aap
+db = memcache
+aap_domain = whatever
+
+# There is no db table with the name "aa", not even in an unused variable.
+aa_domain = whatever
diff --git a/src/postconf/test28-master.cf b/src/postconf/test28-master.cf
new file mode 100644
index 000000000..9f42beb9c
--- /dev/null
+++ b/src/postconf/test28-master.cf
@@ -0,0 +1,2 @@
+whatevershebrings unix - n n - 0 other
+ -o body_checks=$db:$zz
diff --git a/src/postconf/test28.ref b/src/postconf/test28.ref
index 4e9373463..fdd723188 100644
--- a/src/postconf/test28.ref
+++ b/src/postconf/test28.ref
@@ -1,10 +1,13 @@
+_used_ldap_domain = whatever
+_used_proxy_ldap_domain = whatever
+_used_tables = ldap:_used_ldap proxy:ldap:_used_proxy_ldap
 aap_domain = whatever
 config_directory = .
 db = memcache
-header_checks = ldap:hh
-hh_domain = whatever
+header_checks = $_used_tables
 yy = aap
 zz = $yy
-./postconf: warning: ./main.cf: unused parameter: foo_domain=bar
-./postconf: warning: ./main.cf: unused parameter: xx=proxy:ldap:foo
+./postconf: warning: ./main.cf: unused parameter: _unused_ldap_domain=whatever
+./postconf: warning: ./main.cf: unused parameter: 
_unused_proxy_ldap_domain=whatever
+./postconf: warning: ./main.cf: unused parameter: 
_unused_tables=ldap:_unused_ldap proxy:ldap:_unused_proxy_ldap
 ./postconf: warning: ./main.cf: unused parameter: aa_domain=whatever
diff --git a/src/postconf/test29-main.cf b/src/postconf/test29-main.cf
new file mode 100644
index 000000000..9fc223748
--- /dev/null
+++ b/src/postconf/test29-main.cf
@@ -0,0 +1,55 @@
+_ldap_tables =
+ ldap:_ldap
+ proxy:ldap:_proxy_ldap
+_ldap_domain = whatever
+_ldap_domainx = whatever
+_proxy_ldap_domain = whatever
+_proxy_ldap_domainx = whatever
+
+_memcache_tables =
+ memcache:_memcache
+ proxy:memcache:_proxy_memcache
+_memcache_domain = whatever
+_memcache_domainx = whatever
+_proxy_memcache_domain = whatever
+_proxy_memcache_domainx = whatever
+
+_mongodb_tables =
+ mongodb:_mongodb
+ proxy:mongodb:_proxy_mongodb
+_mongodb_domain = whatever
+_mongodb_domainx = whatever
+_proxy_mongodb_domain = whatever
+_proxy_mongodb_domainx = whatever
+
+_mysql_tables =
+ mysql:_mysql
+ proxy:mysql:_proxy_mysql
+_mysql_domain = whatever
+_mysql_domainx = whatever
+_proxy_mysql_domain = whatever
+_proxy_mysql_domainx = whatever
+
+_pgsql_tables =
+ pgsql:_pgsql
+ proxy:pgsql:_proxy_pgsql
+_pgsql_domain = whatever
+_pgsql_domainx = whatever
+_proxy_pgsql_domain = whatever
+_proxy_pgsql_domainx = whatever
+
+_sqlite_tables =
+ sqlite:_sqlite
+ proxy:sqlite:_proxy_sqlite
+_sqlite_domain = whatever
+_sqlite_domainx = whatever
+_proxy_sqlite_domain = whatever
+_proxy_sqlite_domainx = whatever
+
+header_checks =
+ $_ldap_tables
+ $_memcache_tables
+ $_mongodb_tables
+ $_mysql_tables
+ $_pgsql_tables
+ $_sqlite_tables
diff --git a/src/postconf/test29.ref b/src/postconf/test29.ref
index c3bbaecab..b188d5215 100644
--- a/src/postconf/test29.ref
+++ b/src/postconf/test29.ref
@@ -1,19 +1,32 @@
+_ldap_domain = whatever
+_ldap_tables = ldap:_ldap proxy:ldap:_proxy_ldap
+_memcache_domain = whatever
+_memcache_tables = memcache:_memcache proxy:memcache:_proxy_memcache
+_mongodb_domain = whatever
+_mongodb_tables = mongodb:_mongodb proxy:mongodb:_proxy_mongodb
+_mysql_domain = whatever
+_mysql_tables = mysql:_mysql proxy:mysql:_proxy_mysql
+_pgsql_domain = whatever
+_pgsql_tables = pgsql:_pgsql proxy:pgsql:_proxy_pgsql
+_proxy_ldap_domain = whatever
+_proxy_memcache_domain = whatever
+_proxy_mongodb_domain = whatever
+_proxy_mysql_domain = whatever
+_proxy_pgsql_domain = whatever
+_proxy_sqlite_domain = whatever
+_sqlite_domain = whatever
+_sqlite_tables = sqlite:_sqlite proxy:sqlite:_proxy_sqlite
 config_directory = .
-./postconf: warning: ./main.cf: unused parameter: pgsqlfoo_domain=bar
-./postconf: warning: ./main.cf: unused parameter: sqlitefoo_domain=bar
-./postconf: warning: ./main.cf: unused parameter: ldapxx=proxy:ldap:ldapfoo
-./postconf: warning: ./main.cf: unused parameter: mongodbfoo_domain=bar
-./postconf: warning: ./main.cf: unused parameter: 
sqlitexx=proxy:sqlite:sqlitefoo
-./postconf: warning: ./main.cf: unused parameter: mysqlfoo_domain=bar
-./postconf: warning: ./main.cf: unused parameter: sqlitefoo_domainx=bar
-./postconf: warning: ./main.cf: unused parameter: memcachefoo_domain=bar
-./postconf: warning: ./main.cf: unused parameter: pgsqlfoo_domainx=bar
-./postconf: warning: ./main.cf: unused parameter: mongodbfoo_domainx=bar
-./postconf: warning: ./main.cf: unused parameter: ldapfoo_domainx=bar
-./postconf: warning: ./main.cf: unused parameter: ldapfoo_domain=bar
-./postconf: warning: ./main.cf: unused parameter: 
memcachexx=proxy:memcache:memcachefoo
-./postconf: warning: ./main.cf: unused parameter: memcachefoo_domainx=bar
-./postconf: warning: ./main.cf: unused parameter: mysqlfoo_domainx=bar
-./postconf: warning: ./main.cf: unused parameter: mysqlxx=proxy:mysql:mysqlfoo
-./postconf: warning: ./main.cf: unused parameter: 
mongodbxx=proxy:mongodb:mongodbfoo
-./postconf: warning: ./main.cf: unused parameter: pgsqlxx=proxy:pgsql:pgsqlfoo
+header_checks = $_ldap_tables $_memcache_tables $_mongodb_tables 
$_mysql_tables $_pgsql_tables $_sqlite_tables
+./postconf: warning: ./main.cf: unused parameter: _proxy_ldap_domainx=whatever
+./postconf: warning: ./main.cf: unused parameter: 
_proxy_sqlite_domainx=whatever
+./postconf: warning: ./main.cf: unused parameter: 
_proxy_mongodb_domainx=whatever
+./postconf: warning: ./main.cf: unused parameter: _memcache_domainx=whatever
+./postconf: warning: ./main.cf: unused parameter: _proxy_mysql_domainx=whatever
+./postconf: warning: ./main.cf: unused parameter: 
_proxy_memcache_domainx=whatever
+./postconf: warning: ./main.cf: unused parameter: _mongodb_domainx=whatever
+./postconf: warning: ./main.cf: unused parameter: _ldap_domainx=whatever
+./postconf: warning: ./main.cf: unused parameter: _sqlite_domainx=whatever
+./postconf: warning: ./main.cf: unused parameter: _proxy_pgsql_domainx=whatever
+./postconf: warning: ./main.cf: unused parameter: _mysql_domainx=whatever
+./postconf: warning: ./main.cf: unused parameter: _pgsql_domainx=whatever
-- 
2.49.0

_______________________________________________
Postfix-devel mailing list -- postfix-devel@postfix.org
To unsubscribe send an email to postfix-devel-le...@postfix.org

Reply via email to