Skip to content

Commit

Permalink
tests: add codeset-utf8 as a feature
Browse files Browse the repository at this point in the history
To avoid having to use <precheck> for tests that require UTF-8 support.

Closes curl#15039
  • Loading branch information
bagder committed Sep 26, 2024
1 parent 5fb1b64 commit 0b70b23
Show file tree
Hide file tree
Showing 22 changed files with 24 additions and 61 deletions.
1 change: 1 addition & 0 deletions tests/FILEFORMAT.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ Features testable here are:
- `brotli`
- `c-ares`
- `CharConv`
- `codeset-utf8`. If the running codeset is UTF-8 capable.
- `cookies`
- `crypto`
- `Debug`
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test1034
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ none
IDN
http
proxy
codeset-utf8
</features>
<setenv>
LC_ALL=
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
HTTP over proxy with malformatted IDN host name
</name>
Expand Down
6 changes: 2 additions & 4 deletions tests/data/test1035
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,17 @@ none
IDN
http
proxy
codeset-utf8
</features>
<setenv>
LC_ALL=
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
HTTP over proxy with too long IDN host name
</name>
<command>
http://too-long-IDN-name-cürl-rüles-la-la-la-dee-da-flooby-nooby.local/page/%TESTNUMBER -x %HOSTIP:%NOLISTENPORT
http://too-long-IDN-name-c�rl-r�les-la-la-la-dee-da-flooby-nooby.local/page/%TESTNUMBER -x %HOSTIP:%NOLISTENPORT
</command>
</client>

Expand Down
4 changes: 1 addition & 3 deletions tests/data/test1448
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ http
</server>
<features>
IDN
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
Redirect following to UTF-8 IDN host name
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test165
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ http
<features>
IDN
proxy
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
HTTP over proxy with IDN host name
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test2046
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ http
</server>
<features>
IDN
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
Connection reuse with IDN host name
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test2047
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ http
<features>
IDN
proxy
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
Connection reuse with IDN host name over HTTP proxy
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test955
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ smtp
</server>
<features>
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP without SMTPUTF8 support - UTF-8 based sender (local part only)
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test956
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ smtp
</server>
<features>
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP without SMTPUTF8 support - UTF-8 based recipient (local part only)
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test957
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ smtp
</server>
<features>
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP VRFY without SMTPUTF8 support - UTF-8 based recipient (local part only)
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test958
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ smtp
</server>
<features>
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP external VRFY without SMTPUTF8 support - UTF-8 based recipient (local part only)
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test959
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ smtp
<features>
!IDN
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP without SMTPUTF8 support - UTF-8 based sender (host part only)
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test960
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ smtp
<features>
!IDN
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP without SMTPUTF8 support - UTF-8 based recipient (host part only)
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test961
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ smtp
<features>
!IDN
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP external VRFY without SMTPUTF8 support - UTF-8 based recipient (host part only)
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test962
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ smtp
<features>
IDN
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP without SMTPUTF8 support - UTF-8 based sender (host part only)
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test963
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ smtp
<features>
IDN
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP without SMTPUTF8 support (IDN Enabled) - UTF-8 based recipient (host part only)
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test964
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ smtp
<features>
IDN
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP external VRFY without SMTPUTF8 support (IDN Enabled) - UTF-8 based recipient (host part only)
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test965
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ smtp
<features>
IDN
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP with SMTPUTF8 support - UTF-8 based sender
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test966
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ smtp
<features>
IDN
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP with SMTPUTF8 support - UTF-8 based recipient
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test967
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ smtp
<features>
IDN
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP external VRFY with SMTPUTF8 support
</name>
Expand Down
4 changes: 1 addition & 3 deletions tests/data/test968
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ smtp
<features>
IDN
!win32
codeset-utf8
</features>
<setenv>
LC_ALL=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
</setenv>
<precheck>
perl -MI18N::Langinfo=langinfo,CODESET -e 'die "Needs a UTF-8 locale" if (lc(langinfo(CODESET())) ne "utf-8");'
</precheck>
<name>
SMTP VRFY with SMTPUTF8 support
</name>
Expand Down
2 changes: 2 additions & 0 deletions tests/runtests.pl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ BEGIN

use Digest::MD5 qw(md5);
use List::Util 'sum';
use I18N::Langinfo qw(langinfo CODESET);

use pathhelp qw(
exe_ext
Expand Down Expand Up @@ -825,6 +826,7 @@ sub checksystemfeatures {
$feature{"large-time"} = 1;
$feature{"sha512-256"} = 1;
$feature{"local-http"} = servers::localhttp();
$feature{"codeset-utf8"} = lc(langinfo(CODESET())) eq "utf-8";

# make each protocol an enabled "feature"
for my $p (@protocols) {
Expand Down

0 comments on commit 0b70b23

Please sign in to comment.