Skip to content

Instantly share code, notes, and snippets.

@skx
Last active May 4, 2018 10:25
Show Gist options
  • Save skx/9693551168649298d38a23482ac1f44a to your computer and use it in GitHub Desktop.
Save skx/9693551168649298d38a23482ac1f44a to your computer and use it in GitHub Desktop.
m4 for overseer test definitions
#!/usr/bin/m4
# Define a macro for a tinc-protocol test
define(`tinc', `$1 must run tcp with port 655 with banner "^0 \S+ 17$"')
# builder.steve.org.uk
tinc(`176.9.183.97')
# master.steve.org.uk
tinc(`176.9.183.98')
# git.steve.org.uk
tinc(`176.9.183.99')
# www.steve.fi
tinc(`176.9.183.100')
# blogspam.net
tinc(`176.9.183.101')
# mail.steve.org.uk
tinc(`176.9.183.102')
$ ./generate.sh
#!/usr/bin/m4
# Define a macro for a tinc-protocol test
# builder.steve.org.uk
176.9.183.97 must run tcp with port 655 with banner "^0 \S+ 17$"
# master.steve.org.uk
176.9.183.98 must run tcp with port 655 with banner "^0 \S+ 17$"
# git.steve.org.uk
176.9.183.99 must run tcp with port 655 with banner "^0 \S+ 17$"
# www.steve.fi
176.9.183.100 must run tcp with port 655 with banner "^0 \S+ 17$"
# blogspam.net
176.9.183.101 must run tcp with port 655 with banner "^0 \S+ 17$"
# mail.steve.org.uk
176.9.183.102 must run tcp with port 655 with banner "^0 \S+ 17$"
frodo ~ $
@skx
Copy link
Author

skx commented May 4, 2018

I wrote a protocol-tester overseer, which lets you run tests on hosts/services.

It is natural to want to write macros, but I didn't want to add support to the parser. Instead if an input file is executable then the output of executing it is parsed, rather than just the literal contents, which allows local macros to be built/used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment