From ad1e35ab3c83e0136557726c432340ee19621822 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Wed, 26 Oct 2022 14:42:03 +0100 Subject: Testsuite: Automation for TLDA regen --- test/aux-fixed/exim-ca/README.regenerate | 1 + test/aux-fixed/exim-ca/tlsa_regenerate | 8 ++++++++ test/aux-fixed/exim-ca/tlsa_regenerate.awk | 31 ++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100755 test/aux-fixed/exim-ca/tlsa_regenerate create mode 100644 test/aux-fixed/exim-ca/tlsa_regenerate.awk (limited to 'test/aux-fixed') 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; } -- cgit v1.2.3