25-test_rusext.t 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #! /usr/bin/env perl
  2. # Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License 2.0 (the "License"). You may not use
  5. # this file except in compliance with the License. You can obtain a copy
  6. # in the file LICENSE in the source distribution or at
  7. # https://www.openssl.org/source/license.html
  8. use strict;
  9. use warnings;
  10. use File::Spec;
  11. use OpenSSL::Test::Utils;
  12. use OpenSSL::Test qw/:DEFAULT srctop_file/;
  13. setup("test_rusext");
  14. plan tests => 7;
  15. require_ok(srctop_file('test', 'recipes', 'tconversion.pl'));
  16. my $pem = srctop_file("test/certs", "grfc.pem");
  17. my $out_msb = "grfc.msb";
  18. my $out_utf8 = "grfc.utf8";
  19. ok(run(app(["openssl", "x509", "-text", "-in", $pem, "-out", $out_msb,
  20. "-nameopt", "esc_msb", "-certopt", "no_pubkey"])));
  21. is(cmp_text($out_msb, srctop_file('test', 'recipes', '25-test_rusext_data', 'grfc.msb')),
  22. 0, 'Comparing esc_msb output');
  23. ok(run(app(["openssl", "x509", "-text", "-in", $pem, "-out", $out_utf8,
  24. "-nameopt", "utf8", "-certopt", "no_pubkey"])));
  25. is(cmp_text($out_utf8, srctop_file('test', 'recipes', '25-test_rusext_data', 'grfc.utf8')),
  26. 0, 'Comparing utf8 output');
  27. ok(run(app(["openssl", "x509", "-text", "-in", $pem, "-out", $out_utf8,
  28. "-certopt", "no_pubkey"])));
  29. is(cmp_text($out_utf8, srctop_file('test', 'recipes', '25-test_rusext_data', 'grfc.utf8')),
  30. 0, 'Comparing cyrillic utf8 output by default');