Hello!

On Thu, May 25, 2023 at 07:30:27PM +0400, Sergey Kandaurov wrote:

> # HG changeset patch
> # User Sergey Kandaurov <pluk...@nginx.com>
> # Date 1685028552 -14400
> #      Thu May 25 19:29:12 2023 +0400
> # Node ID 4dad7cf8ebe807f9230a82dde5fc02b5e12e390b
> # Parent  acd68670b0649da2fbcfd3e8231c9805d50abcb5
> Tests: added has_feature() test for CryptX.
> 
> diff --git a/h3_absolute_redirect.t b/h3_absolute_redirect.t
> --- a/h3_absolute_redirect.t
> +++ b/h3_absolute_redirect.t
> @@ -23,10 +23,7 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
> -my $t = Test::Nginx->new()->has(qw/http http_v3 proxy rewrite/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 proxy rewrite cryptx/)
>       ->has_daemon('openssl')->plan(23);
>  
>  $t->write_file_expand('nginx.conf', <<'EOF');
> diff --git a/h3_headers.t b/h3_headers.t
> --- a/h3_headers.t
> +++ b/h3_headers.t
> @@ -23,10 +23,7 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
> -my $t = Test::Nginx->new()->has(qw/http http_v3 proxy rewrite/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 proxy rewrite cryptx/)
>       ->has_daemon('openssl')->plan(68)
>       ->write_file_expand('nginx.conf', <<'EOF');
>  
> diff --git a/h3_keepalive.t b/h3_keepalive.t
> --- a/h3_keepalive.t
> +++ b/h3_keepalive.t
> @@ -23,10 +23,7 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
> -my $t = Test::Nginx->new()->has(qw/http http_v3/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 cryptx/)
>       ->has_daemon('openssl')->plan(15)
>       ->write_file_expand('nginx.conf', <<'EOF');
>  
> diff --git a/h3_limit_conn.t b/h3_limit_conn.t
> --- a/h3_limit_conn.t
> +++ b/h3_limit_conn.t
> @@ -23,10 +23,7 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
> -my $t = Test::Nginx->new()->has(qw/http http_v3 limit_conn proxy/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 limit_conn proxy cryptx/)
>       ->has_daemon('openssl')->plan(2);
>  
>  $t->write_file_expand('nginx.conf', <<'EOF');
> diff --git a/h3_limit_req.t b/h3_limit_req.t
> --- a/h3_limit_req.t
> +++ b/h3_limit_req.t
> @@ -23,10 +23,7 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
> -my $t = Test::Nginx->new()->has(qw/http http_v3 proxy limit_req/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 proxy limit_req cryptx/)
>       ->has_daemon('openssl')->plan(6);
>  
>  $t->write_file_expand('nginx.conf', <<'EOF');
> diff --git a/h3_proxy.t b/h3_proxy.t
> --- a/h3_proxy.t
> +++ b/h3_proxy.t
> @@ -23,10 +23,7 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
> -my $t = Test::Nginx->new()->has(qw/http http_v3 proxy/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 proxy cryptx/)
>       ->has_daemon('openssl')->plan(3)
>       ->write_file_expand('nginx.conf', <<'EOF');
>  
> diff --git a/h3_proxy_max_temp_file_size.t b/h3_proxy_max_temp_file_size.t
> --- a/h3_proxy_max_temp_file_size.t
> +++ b/h3_proxy_max_temp_file_size.t
> @@ -23,10 +23,7 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
> -my $t = Test::Nginx->new()->has(qw/http http_v3 proxy/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 proxy cryptx/)
>       ->has_daemon('openssl')->plan(4);
>  
>  $t->write_file_expand('nginx.conf', <<'EOF');
> diff --git a/h3_reusable.t b/h3_reusable.t
> --- a/h3_reusable.t
> +++ b/h3_reusable.t
> @@ -23,10 +23,7 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
> -my $t = Test::Nginx->new()->has(qw/http http_v3/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 cryptx/)
>       ->has_daemon('openssl')->plan(1)
>       ->write_file_expand('nginx.conf', <<'EOF');
>  
> diff --git a/h3_server_name.t b/h3_server_name.t
> --- a/h3_server_name.t
> +++ b/h3_server_name.t
> @@ -24,11 +24,8 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
>  my $t = Test::Nginx->new()
> -     ->has(qw/http http_ssl http_v2 http_v3 rewrite socket_ssl_alpn/)
> +     ->has(qw/http http_ssl http_v2 http_v3 rewrite socket_ssl_alpn cryptx/)
>       ->has_daemon('openssl')->plan(6);
>  
>  $t->write_file_expand('nginx.conf', <<'EOF');
> diff --git a/h3_server_tokens.t b/h3_server_tokens.t
> --- a/h3_server_tokens.t
> +++ b/h3_server_tokens.t
> @@ -23,10 +23,7 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
> -my $t = Test::Nginx->new()->has(qw/http http_v3 rewrite/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 rewrite cryptx/)
>       ->has_daemon('openssl')->plan(12);
>  
>  $t->write_file_expand('nginx.conf', <<'EOF');
> diff --git a/h3_ssl_reject_handshake.t b/h3_ssl_reject_handshake.t
> --- a/h3_ssl_reject_handshake.t
> +++ b/h3_ssl_reject_handshake.t
> @@ -23,10 +23,7 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
> -my $t = Test::Nginx->new()->has(qw/http http_v3/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 cryptx/)
>       ->has_daemon('openssl')->plan(7)
>       ->write_file_expand('nginx.conf', <<'EOF');
>  
> diff --git a/h3_ssl_session_reuse.t b/h3_ssl_session_reuse.t
> --- a/h3_ssl_session_reuse.t
> +++ b/h3_ssl_session_reuse.t
> @@ -23,10 +23,7 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
> -my $t = Test::Nginx->new()->has(qw/http http_v3/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 cryptx/)
>       ->has_daemon('openssl')->plan(8)
>       ->write_file_expand('nginx.conf', <<'EOF');
>  
> diff --git a/h3_trailers.t b/h3_trailers.t
> --- a/h3_trailers.t
> +++ b/h3_trailers.t
> @@ -23,10 +23,7 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
> -my $t = Test::Nginx->new()->has(qw/http http_v3/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 cryptx/)
>       ->has_daemon('openssl')->plan(8);
>  
>  $t->write_file_expand('nginx.conf', <<'EOF');
> diff --git a/lib/Test/Nginx.pm b/lib/Test/Nginx.pm
> --- a/lib/Test/Nginx.pm
> +++ b/lib/Test/Nginx.pm
> @@ -288,6 +288,13 @@ sub has_feature($) {
>               return 1;
>       }
>  
> +     if ($feature eq 'cryptx') {
> +             eval { require Crypt::Misc; };
> +             return 0 if $@;
> +             eval { die if $Crypt::Misc::VERSION < 0.067; };
> +             return !$@;
> +     }
> +
>       return 0;
>  }
>  
> diff --git a/quic_migration.t b/quic_migration.t
> --- a/quic_migration.t
> +++ b/quic_migration.t
> @@ -23,13 +23,10 @@ use Test::Nginx::HTTP3;
>  select STDERR; $| = 1;
>  select STDOUT; $| = 1;
>  
> -eval { require Crypt::Misc; die if $Crypt::Misc::VERSION < 0.067; };
> -plan(skip_all => 'CryptX version >= 0.067 required') if $@;
> -
>  plan(skip_all => '127.0.0.20 local address required')
>       unless defined IO::Socket::INET->new( LocalAddr => '127.0.0.20' );
>  
> -my $t = Test::Nginx->new()->has(qw/http http_v3/)
> +my $t = Test::Nginx->new()->has(qw/http http_v3 cryptx/)
>       ->has_daemon('openssl')->plan(2);
>  
>  $t->write_file_expand('nginx.conf', <<'EOF');

Looks good.

-- 
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to