summaryrefslogtreecommitdiff
path: root/test/aux-fixed
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2022-10-26 14:42:03 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2022-11-03 22:33:03 +0000
commitad1e35ab3c83e0136557726c432340ee19621822 (patch)
tree855bf5ab735a47d96b50ca2cfb8105deae53e452 /test/aux-fixed
parent44c3863eb634def9cb5b64ca43f463bd7bf72b6f (diff)
Testsuite: Automation for TLDA regen
Diffstat (limited to 'test/aux-fixed')
-rwxr-xr-xtest/aux-fixed/exim-ca/README.regenerate1
-rwxr-xr-xtest/aux-fixed/exim-ca/tlsa_regenerate8
-rw-r--r--test/aux-fixed/exim-ca/tlsa_regenerate.awk31
3 files changed, 40 insertions, 0 deletions
diff --git a/test/aux-fixed/exim-ca/README.regenerate b/test/aux-fixed/exim-ca/README.regenerate
index a4d7ff9c0..7a1ef2936 100755
--- a/test/aux-fixed/exim-ca/README.regenerate
+++ b/test/aux-fixed/exim-ca/README.regenerate
@@ -2,3 +2,4 @@ WARNING for Exim Testsuite:
If you change these certificates you will also need to update the TLSA records in dnszone-src/db.test.ex
and dnszones-src/db.example.com (the commands are next to each one).
+The script "tlsa_regenerate" automates this.
diff --git a/test/aux-fixed/exim-ca/tlsa_regenerate b/test/aux-fixed/exim-ca/tlsa_regenerate
new file mode 100755
index 000000000..e3cc2f406
--- /dev/null
+++ b/test/aux-fixed/exim-ca/tlsa_regenerate
@@ -0,0 +1,8 @@
+
+cd `git rev-parse --show-toplevel`/test
+
+for f in dnszones-src/db.test.ex dnszones-src/db.example.com
+do
+ awk -f aux-fixed/exim-ca/tlsa_regenerate.awk $f >new
+ mv new $f
+done
diff --git a/test/aux-fixed/exim-ca/tlsa_regenerate.awk b/test/aux-fixed/exim-ca/tlsa_regenerate.awk
new file mode 100644
index 000000000..17802f022
--- /dev/null
+++ b/test/aux-fixed/exim-ca/tlsa_regenerate.awk
@@ -0,0 +1,31 @@
+# The commands beaing read-out and run assume CWD is the test/ directory
+#
+# start collecting a command to run
+/^; TLSA_AUTOGEN$/ { active = 1; print; next; }
+#
+# keep appending to the command while there is a continuation-line marker (trailing backslash)
+active==1 && /^;/ { print;
+ if (NF > 1)
+ {
+ cmdstr = cmdstr " " substr($0, 2);
+ if (cmdstr ~ /\\$/)
+ cmdstr = substr(cmdstr, 1, length(cmdstr)-1);
+ else
+ active = 2;
+ }
+ next;
+ }
+#
+# apply the command to the next TLSA linem and go quiescent
+active==2 && /TLSA/ { cmdstr | getline cmdres;
+ if (NF == 7)
+ { printf("%s %s %s %s %s %s %s\n", $1, $2, $3, $4, $5, $6, cmdres); }
+ else
+ { printf("%s %s %s %s %s %s\n", $1, $2, $3, $4, $5, cmdres); }
+ cmdstr = "";
+ active = 0;
+ next;
+ }
+#
+# just copy other lines
+{ print; }