New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test qmail-inject recipient address qualification. #232
base: schmonz-qmail-qfilter-osf
Are you sure you want to change the base?
Test qmail-inject recipient address qualification. #232
Conversation
Almost there ;) I would very much prefer to not have to create a separate inject binary. Would it be possible to let the filter grep for the expected "To: " line and return success or failure? Then it should be possible to just qmail-inject and look at it's return code to see if the filter has accepted the mail or not. At least that would be the solution with the least possible side effects I can think of. |
Yes, I'd feel much better if we could directly test the real But how? Linker tricks aren't portable enough. Relinking a fake |
I wonder why all tests pass if this should detect the regression? |
7bae68d
to
351bf60
Compare
I've made the failing test fail the build, so the checks should look uniformly bad now :-) In an attempt to avoid
... tests can depend on Copying seems wasteful, but for our autobuilds the time consumed is in the noise, and for local development we don't need to be running the This approach seems weird but also obvious enough that we'll be unlikely to screw things up. |
Also, the filter no longer drops a sentinel-file turd to indicate the bug. Instead it uses the customerror API from #195. Perfect fit :-) |
2f965c6
to
f791a11
Compare
3f6b2a8
to
a1dbda3
Compare
From qmail-qfilter.git at commit 68ef8ee3d0e546ff1fec9d49f66e1c88e63ac1ba (the newest available on master, dated 2017-10-26).
Co-authored-by: Amitai Schleier <schmonz-web-git@schmonz.com> Co-authored-by: Astrid Sawatsky <astrid.sawatzky@gmx.de> Co-authored-by: Evan Theriault <evanontario@hotmail.com> Co-authored-by: Jacqueline Bilston <jmasonlee@gmail.com> Co-authored-by: Joel Samaroo <xsamarjoex@gmail.com> Co-authored-by: Patrick Ledzian <LiveActionCactus@users.noreply.github.com> Co-authored-by: Trung Vo <ttrung.vo@gmail.com> Co-authored-by: Yevhen Viktorov <y3vg3nk0@gmail.com>
f791a11
to
03c3cfd
Compare
a1dbda3
to
d46a02a
Compare
d46a02a
to
5f2547a
Compare
7015b72
to
0603868
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch does not touch to any existing file beyond the Makefile.
This means very easy to integrate into an existing QMAIL setup.
It also should be straightforward to resolve the merge conflicts thanks to this.
|
||
static const char* qqargv[2]; | ||
|
||
/* a replacement for setenv(3) for systems that don't have one */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given setenv(3) is in POSIX,
https://pubs.opengroup.org/onlinepubs/9699919799/functions/setenv.html
I am simply curious about which system does not support it.
Maybe you ran into an counterexample?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The POSIX one also has no vallen
, I see in the rest of the code why this was desired.
This also means using memcpy for '\0'-terminated strings, which could be error-prone, but it looks correctly handled in all invocations of mysetenv.
munmap((void*)env, env_len); | ||
} | ||
|
||
/* Create a temporary invisible file opened for read/write */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it! Disk storage, no cleanup needed.
Using
qmail-qfilter
(proposed in #227), turn the minimal reproducer from #147 into an automated regression test. It's an integration test, not a unit test, because it executesqmail-inject
[*] the same way our systems would. Thanks toqmail-qfilter
, the test does not involve a real queue in any way.#229 probably fixes #147, and these tests will help us be confident of that.
[*] Or rather,
tests/testable/qmail-inject
, which is identical modulo linking with a custom definition ofauto_qmail
that points into the source tree