rsyslog / liblognorm

a fast samples-based log normalization library
http://www.liblognorm.com
GNU Lesser General Public License v2.1
99 stars 64 forks source link

Parallel execution of test suite breaks tests #371

Open enter-github-username opened 1 year ago

enter-github-username commented 1 year ago

Automake allows the execution of tests in parallel by adding the -j parameter to make check. However, doing this breaks a large amount of tests (like e.g. tests/usrdef_ipaddr_dotdot.sh), as they use the same "tmp.rulebase" file and delete all other *.rulebase files after finishing, interfering with each other.

You should be able to reproduce this issue by running make check with the -j flag, e.g. make -j16 check. The log files of the affected tests will contain errors like:

liblognorm error: rulebase file tmp.rulebase[7]: invalid field type '"literal", "text"
liblognorm error: rulebase file tmp.rulebase[10]: invalid field type '"num", "type"'
liblognorm error: rulebase file tmp.rulebase[11]: invalid field type '@two-hex-bytes'
liblognorm error: rulebase file tmp.rulebase[1]: invalid field type '@IPaddr'

A possible solution may be to always specify a certain rulebase file per test, so e.g. not using add_rule etc. without the second parameter (which would cause it to default back to "tmp.rulebase"). Additionally, cleanup_tmp_files would have to be changed to e.g. reset_rules as well, to only delete a certain, given rulebase file.