blob: dc842123d0527682800ba5c280493a95154cabc7 [file] [log] [blame]
Denys Vlasenkod8528b82010-01-31 05:15:38 +01001#!/bin/sh
2# Copyright 2010 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details.
4
5. ./testing.sh
Denys Vlasenkod8528b82010-01-31 05:15:38 +01006test -f "$bindir/.config" && . "$bindir/.config"
7
Denys Vlasenko9297dbc2010-07-05 21:37:12 +02008rm -rf ls.testdir 2>/dev/null
Denys Vlasenkod8528b82010-01-31 05:15:38 +01009mkdir ls.testdir || exit 1
10
11# testing "test name" "command" "expected result" "file input" "stdin"
12
Denys Vlasenko3d5b6062010-01-31 05:55:55 +010013# With Unicode provided by libc locale, I'm not sure this test can pass.
14# I suspect we might fail to skip exactly correct number of bytes
Denys Vlasenkob1edf202010-01-31 16:34:37 +010015# over broked unicode sequences.
Denys Vlasenko19158a82010-03-26 14:06:56 +010016test x"$CONFIG_UNICODE_SUPPORT" = x"y" \
Denys Vlasenko9297dbc2010-07-05 21:37:12 +020017&& test x"$CONFIG_UNICODE_USING_LOCALE" != x"y" \
Denys Vlasenkod8528b82010-01-31 05:15:38 +010018&& test x"$CONFIG_SUBST_WCHAR" = x"63" \
19&& test x"$CONFIG_LAST_SUPPORTED_WCHAR" = x"767" \
Denys Vlasenko9297dbc2010-07-05 21:37:12 +020020&& test x"$CONFIG_FEATURE_LS_SORTFILES" = x"y" \
Denys Vlasenko40e4e882010-01-31 16:04:30 +010021&& testing "ls unicode test with codepoints limited to 767" \
Denys Vlasenkod8528b82010-01-31 05:15:38 +010022"(cd ls.testdir && sh ../ls.mk_uni_tests) && ls -1 ls.testdir" \
23'0001_1__Some_correct_UTF-8_text___________________________________________|
240002_2__Boundary_condition_test_cases_____________________________________|
250003_2.1__First_possible_sequence_of_a_certain_length_____________________|
260004_2.1.2__2_bytes__U-00000080_:________"?"______________________________|
270005_2.1.3__3_bytes__U-00000800_:________"?"______________________________|
280006_2.1.4__4_bytes__U-00010000_:________"?"______________________________|
290007_2.1.5__5_bytes__U-00200000_:________"?"______________________________|
300008_2.1.6__6_bytes__U-04000000_:________"?"______________________________|
310009_2.2__Last_possible_sequence_of_a_certain_length______________________|
320010_2.2.1__1_byte___U-0000007F_:________"?"______________________________|
330011_2.2.2__2_bytes__U-000007FF_:________"?"______________________________|
340012_2.2.3__3_bytes__U-0000FFFF_:________"?"______________________________|
350013_2.2.4__4_bytes__U-001FFFFF_:________"?"______________________________|
360014_2.2.5__5_bytes__U-03FFFFFF_:________"?"______________________________|
370015_2.2.6__6_bytes__U-7FFFFFFF_:________"?"______________________________|
380016_2.3__Other_boundary_conditions_______________________________________|
390017_2.3.1__U-0000D7FF_=_ed_9f_bf_=_"?"___________________________________|
400018_2.3.2__U-0000E000_=_ee_80_80_=_"?"___________________________________|
410019_2.3.3__U-0000FFFD_=_ef_bf_bd_=_"?"___________________________________|
420020_2.3.4__U-0010FFFF_=_f4_8f_bf_bf_=_"?"________________________________|
430021_2.3.5__U-00110000_=_f4_90_80_80_=_"?"________________________________|
440022_3__Malformed_sequences_______________________________________________|
450023_3.1__Unexpected_continuation_bytes___________________________________|
460024_3.1.1__First_continuation_byte_0x80:_"?"_____________________________|
470025_3.1.2__Last__continuation_byte_0xbf:_"?"_____________________________|
480026_3.1.3__2_continuation_bytes:_"??"____________________________________|
490027_3.1.4__3_continuation_bytes:_"???"___________________________________|
500028_3.1.5__4_continuation_bytes:_"????"__________________________________|
510029_3.1.6__5_continuation_bytes:_"?????"_________________________________|
520030_3.1.7__6_continuation_bytes:_"??????"________________________________|
530031_3.1.8__7_continuation_bytes:_"???????"_______________________________|
540032_3.1.9__Sequence_of_all_64_possible_continuation_bytes__0x80-0xbf_:___|
550033____"????????????????_________________________________________________|
560034_____????????????????_________________________________________________|
570035_____????????????????_________________________________________________|
580036_____????????????????"________________________________________________|
590037_3.2__Lonely_start_characters_________________________________________|
600038_3.2.1__All_32_first_bytes_of_2-byte_sequences__0xc0-0xdf_,___________|
610039________each_followed_by_a_space_character:___________________________|
620040____"?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?__________________________________|
630041_____?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_"________________________________|
640042_3.2.2__All_16_first_bytes_of_3-byte_sequences__0xe0-0xef_,___________|
650043________each_followed_by_a_space_character:___________________________|
660044____"?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_"________________________________|
670045_3.2.3__All_8_first_bytes_of_4-byte_sequences__0xf0-0xf7_,____________|
680046________each_followed_by_a_space_character:___________________________|
690047____"?_?_?_?_?_?_?_?_"________________________________________________|
700048_3.2.4__All_4_first_bytes_of_5-byte_sequences__0xf8-0xfb_,____________|
710049________each_followed_by_a_space_character:___________________________|
720050____"?_?_?_?_"________________________________________________________|
730051_3.2.5__All_2_first_bytes_of_6-byte_sequences__0xfc-0xfd_,____________|
740052________each_followed_by_a_space_character:___________________________|
750053____"?_?_"____________________________________________________________|
760054_3.3__Sequences_with_last_continuation_byte_missing___________________|
770055_3.3.1__2-byte_sequence_with_last_byte_missing__U+0000_:_____"?"______|
Denys Vlasenko3d5b6062010-01-31 05:55:55 +0100780056_3.3.2__3-byte_sequence_with_last_byte_missing__U+0000_:_____"?"______|
790057_3.3.3__4-byte_sequence_with_last_byte_missing__U+0000_:_____"?"______|
800058_3.3.4__5-byte_sequence_with_last_byte_missing__U+0000_:_____"?"______|
810059_3.3.5__6-byte_sequence_with_last_byte_missing__U+0000_:_____"?"______|
Denys Vlasenkod8528b82010-01-31 05:15:38 +0100820060_3.3.6__2-byte_sequence_with_last_byte_missing__U-000007FF_:_"?"______|
Denys Vlasenko3d5b6062010-01-31 05:55:55 +0100830061_3.3.7__3-byte_sequence_with_last_byte_missing__U-0000FFFF_:_"?"______|
840062_3.3.8__4-byte_sequence_with_last_byte_missing__U-001FFFFF_:_"?"______|
850063_3.3.9__5-byte_sequence_with_last_byte_missing__U-03FFFFFF_:_"?"______|
860064_3.3.10_6-byte_sequence_with_last_byte_missing__U-7FFFFFFF_:_"?"______|
Denys Vlasenkod8528b82010-01-31 05:15:38 +0100870065_3.4__Concatenation_of_incomplete_sequences___________________________|
Denys Vlasenko3d5b6062010-01-31 05:55:55 +0100880066____"??????????"______________________________________________________|
Denys Vlasenkod8528b82010-01-31 05:15:38 +0100890067_3.5__Impossible_bytes________________________________________________|
900068_3.5.1__fe_=_"?"______________________________________________________|
910069_3.5.2__ff_=_"?"______________________________________________________|
920070_3.5.3__fe_fe_ff_ff_=_"????"__________________________________________|
930071_4__Overlong_sequences________________________________________________|
940072_4.1__Examples_of_an_overlong_ASCII_character_________________________|
Denys Vlasenko3d5b6062010-01-31 05:55:55 +0100950073_4.1.1_U+002F_=_c0_af_____________=_"?"_______________________________|
960074_4.1.2_U+002F_=_e0_80_af__________=_"?"_______________________________|
970075_4.1.3_U+002F_=_f0_80_80_af_______=_"?"_______________________________|
980076_4.1.4_U+002F_=_f8_80_80_80_af____=_"?"_______________________________|
990077_4.1.5_U+002F_=_fc_80_80_80_80_af_=_"?"_______________________________|
Denys Vlasenkod8528b82010-01-31 05:15:38 +01001000078_4.2__Maximum_overlong_sequences______________________________________|
Denys Vlasenko3d5b6062010-01-31 05:55:55 +01001010079_4.2.1__U-0000007F_=_c1_bf_____________=_"?"__________________________|
Denys Vlasenkod8528b82010-01-31 05:15:38 +01001020080_4.2.2__U-000007FF_=_e0_9f_bf__________=_"?"__________________________|
1030081_4.2.3__U-0000FFFF_=_f0_8f_bf_bf_______=_"?"__________________________|
1040082_4.2.4__U-001FFFFF_=_f8_87_bf_bf_bf____=_"?"__________________________|
1050083_4.2.5__U-03FFFFFF_=_fc_83_bf_bf_bf_bf_=_"?"__________________________|
1060084_4.3__Overlong_representation_of_the_NUL_character____________________|
Denys Vlasenko3d5b6062010-01-31 05:55:55 +01001070085_4.3.1__U+0000_=_c0_80_____________=_"?"______________________________|
1080086_4.3.2__U+0000_=_e0_80_80__________=_"?"______________________________|
1090087_4.3.3__U+0000_=_f0_80_80_80_______=_"?"______________________________|
1100088_4.3.4__U+0000_=_f8_80_80_80_80____=_"?"______________________________|
1110089_4.3.5__U+0000_=_fc_80_80_80_80_80_=_"?"______________________________|
Denys Vlasenkod8528b82010-01-31 05:15:38 +01001120090_5__Illegal_code_positions____________________________________________|
1130091_5.1_Single_UTF-16_surrogates_________________________________________|
1140092_5.1.1__U+D800_=_ed_a0_80_=_"?"_______________________________________|
1150093_5.1.2__U+DB7F_=_ed_ad_bf_=_"?"_______________________________________|
1160094_5.1.3__U+DB80_=_ed_ae_80_=_"?"_______________________________________|
1170095_5.1.4__U+DBFF_=_ed_af_bf_=_"?"_______________________________________|
1180096_5.1.5__U+DC00_=_ed_b0_80_=_"?"_______________________________________|
1190097_5.1.6__U+DF80_=_ed_be_80_=_"?"_______________________________________|
1200098_5.1.7__U+DFFF_=_ed_bf_bf_=_"?"_______________________________________|
1210099_5.2_Paired_UTF-16_surrogates_________________________________________|
1220100_5.2.1__U+D800_U+DC00_=_ed_a0_80_ed_b0_80_=_"??"______________________|
1230101_5.2.2__U+D800_U+DFFF_=_ed_a0_80_ed_bf_bf_=_"??"______________________|
1240102_5.2.3__U+DB7F_U+DC00_=_ed_ad_bf_ed_b0_80_=_"??"______________________|
1250103_5.2.4__U+DB7F_U+DFFF_=_ed_ad_bf_ed_bf_bf_=_"??"______________________|
1260104_5.2.5__U+DB80_U+DC00_=_ed_ae_80_ed_b0_80_=_"??"______________________|
1270105_5.2.6__U+DB80_U+DFFF_=_ed_ae_80_ed_bf_bf_=_"??"______________________|
1280106_5.2.7__U+DBFF_U+DC00_=_ed_af_bf_ed_b0_80_=_"??"______________________|
1290107_5.2.8__U+DBFF_U+DFFF_=_ed_af_bf_ed_bf_bf_=_"??"______________________|
1300108_5.3_Other_illegal_code_positions_____________________________________|
1310109_5.3.1__U+FFFE_=_ef_bf_be_=_"?"_______________________________________|
1320110_5.3.2__U+FFFF_=_ef_bf_bf_=_"?"_______________________________________|
133' "" ""
134
Denys Vlasenko40e4e882010-01-31 16:04:30 +0100135# Currently fails on "0080_4.2.2__U-000007FF_=_e0_9f_bf" line
Denys Vlasenko19158a82010-03-26 14:06:56 +0100136test x"$CONFIG_UNICODE_SUPPORT" = x"y" \
Denys Vlasenko9297dbc2010-07-05 21:37:12 +0200137&& test x"$CONFIG_UNICODE_USING_LOCALE" != x"y" \
Denys Vlasenko40e4e882010-01-31 16:04:30 +0100138&& test x"$CONFIG_SUBST_WCHAR" = x"63" \
139&& test x"$CONFIG_LAST_SUPPORTED_WCHAR" = x"0" \
140&& testing "ls unicode test with unlimited codepoints" \
141"(cd ls.testdir && sh ../ls.mk_uni_tests) && ls -1 ls.testdir" \
142'0001_1__Some_correct_UTF-8_text___________________________________________|
1430002_2__Boundary_condition_test_cases_____________________________________|
1440003_2.1__First_possible_sequence_of_a_certain_length_____________________|
1450004_2.1.2__2_bytes__U-00000080_:________"?"______________________________|
1460005_2.1.3__3_bytes__U-00000800_:________"ࠀ"______________________________|
Denys Vlasenkob1edf202010-01-31 16:34:37 +01001470006_2.1.4__4_bytes__U-00010000_:________"𐀀"______________________________|
Denys Vlasenko40e4e882010-01-31 16:04:30 +01001480007_2.1.5__5_bytes__U-00200000_:________"?"______________________________|
1490008_2.1.6__6_bytes__U-04000000_:________"?"______________________________|
1500009_2.2__Last_possible_sequence_of_a_certain_length______________________|
1510010_2.2.1__1_byte___U-0000007F_:________"?"______________________________|
1520011_2.2.2__2_bytes__U-000007FF_:________"߿"______________________________|
1530012_2.2.3__3_bytes__U-0000FFFF_:________"?"______________________________|
1540013_2.2.4__4_bytes__U-001FFFFF_:________"?"______________________________|
1550014_2.2.5__5_bytes__U-03FFFFFF_:________"?"______________________________|
1560015_2.2.6__6_bytes__U-7FFFFFFF_:________"?"______________________________|
1570016_2.3__Other_boundary_conditions_______________________________________|
Denys Vlasenkob1edf202010-01-31 16:34:37 +01001580017_2.3.1__U-0000D7FF_=_ed_9f_bf_=_"퟿"___________________________________|
Denys Vlasenko40e4e882010-01-31 16:04:30 +01001590018_2.3.2__U-0000E000_=_ee_80_80_=_"?"___________________________________|
Denys Vlasenkob1edf202010-01-31 16:34:37 +01001600019_2.3.3__U-0000FFFD_=_ef_bf_bd_=_"�"___________________________________|
Denys Vlasenko40e4e882010-01-31 16:04:30 +01001610020_2.3.4__U-0010FFFF_=_f4_8f_bf_bf_=_"?"________________________________|
1620021_2.3.5__U-00110000_=_f4_90_80_80_=_"?"________________________________|
1630022_3__Malformed_sequences_______________________________________________|
1640023_3.1__Unexpected_continuation_bytes___________________________________|
1650024_3.1.1__First_continuation_byte_0x80:_"?"_____________________________|
1660025_3.1.2__Last__continuation_byte_0xbf:_"?"_____________________________|
1670026_3.1.3__2_continuation_bytes:_"??"____________________________________|
1680027_3.1.4__3_continuation_bytes:_"???"___________________________________|
1690028_3.1.5__4_continuation_bytes:_"????"__________________________________|
1700029_3.1.6__5_continuation_bytes:_"?????"_________________________________|
1710030_3.1.7__6_continuation_bytes:_"??????"________________________________|
1720031_3.1.8__7_continuation_bytes:_"???????"_______________________________|
1730032_3.1.9__Sequence_of_all_64_possible_continuation_bytes__0x80-0xbf_:___|
1740033____"????????????????_________________________________________________|
1750034_____????????????????_________________________________________________|
1760035_____????????????????_________________________________________________|
1770036_____????????????????"________________________________________________|
1780037_3.2__Lonely_start_characters_________________________________________|
1790038_3.2.1__All_32_first_bytes_of_2-byte_sequences__0xc0-0xdf_,___________|
1800039________each_followed_by_a_space_character:___________________________|
1810040____"?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?__________________________________|
1820041_____?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_"________________________________|
1830042_3.2.2__All_16_first_bytes_of_3-byte_sequences__0xe0-0xef_,___________|
1840043________each_followed_by_a_space_character:___________________________|
1850044____"?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_"________________________________|
1860045_3.2.3__All_8_first_bytes_of_4-byte_sequences__0xf0-0xf7_,____________|
1870046________each_followed_by_a_space_character:___________________________|
1880047____"?_?_?_?_?_?_?_?_"________________________________________________|
1890048_3.2.4__All_4_first_bytes_of_5-byte_sequences__0xf8-0xfb_,____________|
1900049________each_followed_by_a_space_character:___________________________|
1910050____"?_?_?_?_"________________________________________________________|
1920051_3.2.5__All_2_first_bytes_of_6-byte_sequences__0xfc-0xfd_,____________|
1930052________each_followed_by_a_space_character:___________________________|
1940053____"?_?_"____________________________________________________________|
1950054_3.3__Sequences_with_last_continuation_byte_missing___________________|
1960055_3.3.1__2-byte_sequence_with_last_byte_missing__U+0000_:_____"?"______|
1970056_3.3.2__3-byte_sequence_with_last_byte_missing__U+0000_:_____"?"______|
1980057_3.3.3__4-byte_sequence_with_last_byte_missing__U+0000_:_____"?"______|
1990058_3.3.4__5-byte_sequence_with_last_byte_missing__U+0000_:_____"?"______|
2000059_3.3.5__6-byte_sequence_with_last_byte_missing__U+0000_:_____"?"______|
2010060_3.3.6__2-byte_sequence_with_last_byte_missing__U-000007FF_:_"?"______|
2020061_3.3.7__3-byte_sequence_with_last_byte_missing__U-0000FFFF_:_"?"______|
2030062_3.3.8__4-byte_sequence_with_last_byte_missing__U-001FFFFF_:_"?"______|
2040063_3.3.9__5-byte_sequence_with_last_byte_missing__U-03FFFFFF_:_"?"______|
2050064_3.3.10_6-byte_sequence_with_last_byte_missing__U-7FFFFFFF_:_"?"______|
2060065_3.4__Concatenation_of_incomplete_sequences___________________________|
2070066____"??????????"______________________________________________________|
2080067_3.5__Impossible_bytes________________________________________________|
2090068_3.5.1__fe_=_"?"______________________________________________________|
2100069_3.5.2__ff_=_"?"______________________________________________________|
2110070_3.5.3__fe_fe_ff_ff_=_"????"__________________________________________|
2120071_4__Overlong_sequences________________________________________________|
2130072_4.1__Examples_of_an_overlong_ASCII_character_________________________|
2140073_4.1.1_U+002F_=_c0_af_____________=_"?"_______________________________|
2150074_4.1.2_U+002F_=_e0_80_af__________=_"?"_______________________________|
2160075_4.1.3_U+002F_=_f0_80_80_af_______=_"?"_______________________________|
2170076_4.1.4_U+002F_=_f8_80_80_80_af____=_"?"_______________________________|
2180077_4.1.5_U+002F_=_fc_80_80_80_80_af_=_"?"_______________________________|
2190078_4.2__Maximum_overlong_sequences______________________________________|
2200079_4.2.1__U-0000007F_=_c1_bf_____________=_"?"__________________________|
2210080_4.2.2__U-000007FF_=_e0_9f_bf__________=_"?"__________________________|
2220081_4.2.3__U-0000FFFF_=_f0_8f_bf_bf_______=_"?"__________________________|
2230082_4.2.4__U-001FFFFF_=_f8_87_bf_bf_bf____=_"?"__________________________|
2240083_4.2.5__U-03FFFFFF_=_fc_83_bf_bf_bf_bf_=_"?"__________________________|
2250084_4.3__Overlong_representation_of_the_NUL_character____________________|
2260085_4.3.1__U+0000_=_c0_80_____________=_"?"______________________________|
2270086_4.3.2__U+0000_=_e0_80_80__________=_"?"______________________________|
2280087_4.3.3__U+0000_=_f0_80_80_80_______=_"?"______________________________|
2290088_4.3.4__U+0000_=_f8_80_80_80_80____=_"?"______________________________|
2300089_4.3.5__U+0000_=_fc_80_80_80_80_80_=_"?"______________________________|
2310090_5__Illegal_code_positions____________________________________________|
2320091_5.1_Single_UTF-16_surrogates_________________________________________|
2330092_5.1.1__U+D800_=_ed_a0_80_=_"?"_______________________________________|
2340093_5.1.2__U+DB7F_=_ed_ad_bf_=_"?"_______________________________________|
2350094_5.1.3__U+DB80_=_ed_ae_80_=_"?"_______________________________________|
2360095_5.1.4__U+DBFF_=_ed_af_bf_=_"?"_______________________________________|
2370096_5.1.5__U+DC00_=_ed_b0_80_=_"?"_______________________________________|
2380097_5.1.6__U+DF80_=_ed_be_80_=_"?"_______________________________________|
2390098_5.1.7__U+DFFF_=_ed_bf_bf_=_"?"_______________________________________|
2400099_5.2_Paired_UTF-16_surrogates_________________________________________|
2410100_5.2.1__U+D800_U+DC00_=_ed_a0_80_ed_b0_80_=_"??"______________________|
2420101_5.2.2__U+D800_U+DFFF_=_ed_a0_80_ed_bf_bf_=_"??"______________________|
2430102_5.2.3__U+DB7F_U+DC00_=_ed_ad_bf_ed_b0_80_=_"??"______________________|
2440103_5.2.4__U+DB7F_U+DFFF_=_ed_ad_bf_ed_bf_bf_=_"??"______________________|
2450104_5.2.5__U+DB80_U+DC00_=_ed_ae_80_ed_b0_80_=_"??"______________________|
2460105_5.2.6__U+DB80_U+DFFF_=_ed_ae_80_ed_bf_bf_=_"??"______________________|
2470106_5.2.7__U+DBFF_U+DC00_=_ed_af_bf_ed_b0_80_=_"??"______________________|
2480107_5.2.8__U+DBFF_U+DFFF_=_ed_af_bf_ed_bf_bf_=_"??"______________________|
2490108_5.3_Other_illegal_code_positions_____________________________________|
2500109_5.3.1__U+FFFE_=_ef_bf_be_=_"?"_______________________________________|
2510110_5.3.2__U+FFFF_=_ef_bf_bf_=_"?"_______________________________________|
252' "" ""
253
Denys Vlasenkod8528b82010-01-31 05:15:38 +0100254# Clean up
255rm -rf ls.testdir 2>/dev/null
256
257exit $FAILCOUNT