Fix sendmail and squid checks#104
Open
jessp01 wants to merge 2 commits into
Open
Conversation
`/var/log/maillog`
With this change, the test will give up after a minute but will check for
the expected pattern in the log every second
This script runs with `/bin/sh` but really, it will fail in all below
places with multiple POSIX compat shells and was clearly designed to run
with BASH:
```
if [ $MTA_ACCEPT == 0 ] # W: In POSIX sh, == in place of = is undefined.
if [[ $mail =~ $regex ]] # W: In POSIX sh, [[ ]] is undefined.
if ([ $MTA_ACCEPT == 0 ] && [ $DELIVERED == 0 ]) # W: In POSIX sh, == in place of = is undefined.
egrep -q "${BASH_REMATCH[1]}\:.*stat\=Sent" /var/log/maillog # W: In POSIX sh, BASH_REMATCH is undefined.
echo -e # W: In POSIX sh, echo flags are undefined.
```
Wherever possible, I replaced `==` with `=` (which will work with BASH
and any POSIX compat shell) but since there are other BASH specific
features that are being used, changed to `#!/bin/bash`
single test directly, it will fail with: > tests/p_squid/squid_test.sh: line 9: [: : integer expression expected Fixed by setting `SKIP_QA_HARNESS` to 1 if it is unset.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tests/p_sendmail/20_sendmail_mta.sh
Allow more than 1 second for relevant entries to appear in
/var/log/maillogWith this change, the test will give up after a minute but will check for
the expected pattern in the log every second
This script runs with
/bin/shbut really, it will fail in all belowplaces with multiple POSIX compat shells and was clearly designed to run
with BASH:
Wherever possible, I replaced
==with=(which will work with BASHand any POSIX compat shell) but since there are other BASH specific
features that are being used, changed to
#!/bin/bashtests/p_squid/squid_test.sh
SKIP_QA_HARNESSis set inruntests.sh(line 17) but if you run thissingle test directly, it will fail with:
Fixed by setting
SKIP_QA_HARNESSto 1 if it is unset.