Skip to content
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/recipes/80-test_cms.t: Fix the "CAdES ko" test #19731

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions test/recipes/80-test_cms.t
Expand Up @@ -451,10 +451,10 @@ my @smime_cms_cades_tests = (
my @smime_cms_cades_ko_tests = (
[ "sign content DER format, RSA key, not CAdES-BES compatible",
[ @prov, "-sign", "-in", $smcont, "-outform", "DER", "-nodetach",
"-certfile", $smroot, "-signer", $smrsa1, "-out", "{output}.cms" ],
"-certfile", $smroot, "-signer", $smrsa1, "-out", "cades-ko.cms" ],
"fail to verify token since requiring CAdES-BES compatibility",
[ @prov, "-verify", "-cades", "-in", "{output}.cms", "-inform", "DER",
"-CAfile", $smroot, "-out", "{output}.txt" ],
[ @prov, "-verify", "-cades", "-in", "cades-ko.cms", "-inform", "DER",
"-CAfile", $smroot, "-out", "cades-ko.txt" ],
\&final_compare
]
);
Expand Down Expand Up @@ -800,6 +800,7 @@ subtest "CAdES ko tests\n" => sub {
SKIP: {
my $skip_reason = check_availability($$_[0]);
skip $skip_reason, 1 if $skip_reason;
1 while unlink "cades-ko.txt";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is a loop required here?

Also, doesn't this leave cades-ko.txt undeleted on the final loop? Or, maybe that doesn't matter...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's required on VMS, where files may exist in multiple generations (so cades-ko.txt;1, cades-ko.txt;2, ...)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding deleting all but for the final loop, you're right about that. However, the array we use has only one element. The function runner_loop handles that better, but isn't quite suitable for this particular test because of the second negative test. I've thoughts on reworking runner_loop, but that's overkill for this fix.


ok(run(app(["openssl", "cms", @{$$_[1]}])), $$_[0]);
ok(!run(app(["openssl", "cms", @{$$_[3]}])), $$_[2]);
Expand Down