diff options
Diffstat (limited to 'newlib/testsuite')
-rw-r--r-- | newlib/testsuite/config/default.exp | 7 | ||||
-rw-r--r-- | newlib/testsuite/lib/checkoutput.exp | 40 | ||||
-rw-r--r-- | newlib/testsuite/lib/flags.exp | 82 | ||||
-rw-r--r-- | newlib/testsuite/lib/newlib.exp | 101 | ||||
-rw-r--r-- | newlib/testsuite/lib/passfail.exp | 39 | ||||
-rw-r--r-- | newlib/testsuite/newlib.locale/UTF-8.c | 397 | ||||
-rw-r--r-- | newlib/testsuite/newlib.locale/UTF-8.exp | 88 | ||||
-rw-r--r-- | newlib/testsuite/newlib.locale/locale.exp | 13 | ||||
-rw-r--r-- | newlib/testsuite/newlib.string/string.exp | 12 | ||||
-rw-r--r-- | newlib/testsuite/newlib.string/tstring.c | 349 |
10 files changed, 0 insertions, 1128 deletions
diff --git a/newlib/testsuite/config/default.exp b/newlib/testsuite/config/default.exp deleted file mode 100644 index 474218214..000000000 --- a/newlib/testsuite/config/default.exp +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. -# -# Permission to use, copy, modify, and distribute this software -# is freely granted, provided that this notice is preserved. -# - -load_lib standard.exp diff --git a/newlib/testsuite/lib/checkoutput.exp b/newlib/testsuite/lib/checkoutput.exp deleted file mode 100644 index 8cb46925f..000000000 --- a/newlib/testsuite/lib/checkoutput.exp +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. -# -# Permission to use, copy, modify, and distribute this software -# is freely granted, provided that this notice is preserved. -# - -# newlib_check_output takes the basename of the test source file, and -# a list of TCL regular expressions representing the expected output. -# It assumes one line of output per test. - -proc newlib_check_output { srcfile expectlist } { - global objdir subdir srcdir - - set srcfullname "$srcdir/$subdir/$srcfile" - set test_driver "$objdir/testsuite/[file tail [file rootname $srcfullname].x]" - - set comp_output [newlib_target_compile "$srcfullname" "$test_driver" "executable" ""] - - if { $comp_output != "" } { - fail "Failed to compile $srcfile.\n" - return - } - - set result [newlib_load $test_driver ""] - set status [lindex $result 0] - set output [lindex $result 1] - - set output_lines [split $output "\n"] - - foreach { expectedval } $expectlist { - set gotval [string trim [lindex $output_lines 0] "\r"] - if { ! [string match $expectedval $gotval] } { - fail "$srcfile: Expected: $expectedval Got: $gotval " - return - } - set output_lines [lrange $output_lines 1 end] - } - - pass $srcfile -} diff --git a/newlib/testsuite/lib/flags.exp b/newlib/testsuite/lib/flags.exp deleted file mode 100644 index f6bffde1f..000000000 --- a/newlib/testsuite/lib/flags.exp +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. -# -# Permission to use, copy, modify, and distribute this software -# is freely granted, provided that this notice is preserved. -# - -# flags.exp: overrides the dejagnu versions of libgloss_link_flags, -# newlib_link_flags, and newlib_include_flags. - -# These versions of the procedures generate link and include flags -# by searching for the needed files in the current build and source -# directories, rather than in the build and source paths of the -# compiler being used. - -proc libgloss_link_flags { args } { - global target_cpu - # These values come from the local site.exp. - global srcdir objdir - global multibuildtop - - verbose "In newlib version of libgloss_link_flags...\n" - - if [isnative] { - return "" - } - - if [is_remote host] { - return "" - } - - set target_build_path "$objdir/$multibuildtop.." - - set gloss_srcdir [lookfor_file ${srcdir} libgloss/$target_cpu] - - if { $gloss_srcdir == "" } { - return "" - } - - if [file exists $target_build_path/libgloss/$target_cpu] { - verbose "libgloss path is $target_build_path/libgloss/$target_cpu" 2 - return "-B$target_build_path/libgloss/$target_cpu/ -L$target_build_path/libgloss/$target_cpu -L$gloss_srcdir" - } else { - verbose -log "No libgloss support for this target." 2 - return "" - } -} - -proc newlib_link_flags { args } { - global tool_root_dir - global srcdir objdir - - verbose "In newlib version of newlib_link_flags...\n" - - if [is_remote host] { - return "" - } - - set ld_script_path [lookfor_file ${tool_root_dir} "ld/ldscripts"]; - if { $ld_script_path != "" } { - set result "-L[file dirname $ld_script_path]" - } else { - set result "" - } - - return "$result -B$objdir -L$objdir" -} - -proc newlib_include_flags { args } { - global srcdir objdir - - verbose "In newlib version of newlib_include_flags...\n" - - if [is_remote host] { - return "" - } - - set newlib_dir [lookfor_file ${srcdir} newlib/libc/include/assert.h] - if { ${newlib_dir} != "" } { - set newlib_dir [file dirname ${newlib_dir}] - } - return " -I$objdir/targ-include -I${newlib_dir}" -} diff --git a/newlib/testsuite/lib/newlib.exp b/newlib/testsuite/lib/newlib.exp deleted file mode 100644 index 48f527e7a..000000000 --- a/newlib/testsuite/lib/newlib.exp +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. -# -# Permission to use, copy, modify, and distribute this software -# is freely granted, provided that this notice is preserved. -# - -# flags.exp overrides the dejagnu versions of libgloss_link_flags, -# newlib_link_flags, and newlib_include_flags. -load_lib flags.exp - -proc newlib_version { } { - global tool_version - - verbose "In newlib version...\n" - - return $tool_version -} - -set newlib_initialized 0 - -proc newlib_init { args } { - global gluefile wrap_flags - global newlib_initialized - global target_info - # These values are initialized in the local site.exp file. - global srcdir objdir - global host_triplet target_triplet - global old_ld_library_path - - verbose "In newlib_init...\n" - - if { $newlib_initialized == 1 } { return; } - - if {[target_info needs_status_wrapper] != "" && \ - [target_info needs_status_wrapper] != "0" && \ - ![info exists gluefile]} { - set gluefile ${objdir}/testsuite/testglue.o; - set result [build_wrapper $gluefile]; - if { $result != "" } { - set gluefile [lindex $result 0]; - set wrap_flags [lindex $result 1]; - } else { - unset gluefile - } - } - - if [string match $host_triplet $target_triplet] then { - if [string match "i686-pc-linux-gnu" $host_triplet] then { - set old_ld_library_path [getenv LD_LIBRARY_PATH] - setenv LD_LIBRARY_PATH "$objdir/.libs" - } - } -} - -proc newlib_target_compile { source dest type options } { - global gluefile wrap_flags - global srcdir objdir - global host_triplet target_triplet - - verbose "In newlib_target_compile...\n" - - if {[target_info needs_status_wrapper] != "" && \ - [target_info needs_status_wrapper] != "0" && \ - [info exists gluefile] } { - lappend options "libs=$gluefile" - lappend options "ldflags=$wrap_flags" - } - - if [string match $host_triplet $target_triplet] then { - if [string match "i686-pc-linux-gnu" $host_triplet] then { - lappend options "libs=$objdir/crt0.o -lc -lgcc" - lappend options "ldflags=-nostdlib -L$objdir/.libs [newlib_include_flags]" - } - } - - return [target_compile $source $dest $type $options] -} - -proc newlib_finish { } { - global old_ld_library_path - global host_triplet target_triplet - - verbose "In newlib_finish...\n" - - if [string match $host_triplet $target_triplet] then { - if [string match "i686-pc-linux-gnu" $host_triplet] then { - setenv LD_LIBRARY_PATH "$old_ld_library_path" - } - } -} - -proc newlib_exit { } { - global gluefile; - - verbose "In newlib_exit...\n" - - if [info exists gluefile] { - file_on_build delete $gluefile; - unset gluefile; - } -} diff --git a/newlib/testsuite/lib/passfail.exp b/newlib/testsuite/lib/passfail.exp deleted file mode 100644 index 8a44d274d..000000000 --- a/newlib/testsuite/lib/passfail.exp +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. -# -# Permission to use, copy, modify, and distribute this software -# is freely granted, provided that this notice is preserved. -# - -# newlib_pass_fail compiles and runs all the source files in the test -# directory that are not included in the check_output_tests list. -# check_output_tests lists the sources' basenames. - -proc newlib_pass_fail { check_output_tests } { - global srcdir objdir subdir runtests - - foreach testcase [glob -nocomplain $srcdir/$subdir/*.c] { - # If we're only testing specific files and this isn't one of them, skip it. - if ![runtest_file_p $runtests $testcase] then { - continue - } - - # Exclude tests which require their output to be checked - if {[lsearch $check_output_tests "[file tail $testcase]"] != -1} then { - continue - } - - set test_driver "$objdir/testsuite/[file tail [file rootname $testcase].x]" - - set comp_output [newlib_target_compile "$testcase" "$test_driver" "executable" ""] - - if { $comp_output != "" } { - fail "Failed to compile $testcase.\n" - fail "$testcase" - } else { - pass "Compiled $testcase.\n" - set result [newlib_load $test_driver ""] - set status [lindex $result 0] - $status "$testcase" - } - } -} diff --git a/newlib/testsuite/newlib.locale/UTF-8.c b/newlib/testsuite/newlib.locale/UTF-8.c deleted file mode 100644 index 36213af6a..000000000 --- a/newlib/testsuite/newlib.locale/UTF-8.c +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. - * - * Permission to use, copy, modify, and distribute this software - * is freely granted, provided that this notice is preserved. - * - * Tests gleaned from Markus Kuhn's UTF-8 and Unicode FAQ, - * and specifically, his UTF-8-test.txt decoder stress test file. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <locale.h> - -#define MAX_BYTES 65 - -int num_invalid(const char *s, int len); - -char first[6][6] = { - {0x0}, /* U-00000000 */ - {0xc2, 0x80}, /* U-00000080 */ - {0xe0, 0xa0, 0x80}, /* U-00000800 */ - {0xf0, 0x90, 0x80, 0x80}, /* U-00010000 */ - {0xf8, 0x88, 0x80, 0x80, 0x80}, /* U-00200000 */ - {0xfc, 0x84, 0x80, 0x80, 0x80, 0x80} /* U-04000000 */ -}; - -char last[6][6] = { - {0x7f}, /* U-0000007F */ - {0xdf, 0xbf}, /* U-000007FF */ - {0xef, 0xbf, 0xbf}, /* U-0000FFFF */ - {0xf7, 0xbf, 0xbf, 0xbf}, /* U-001FFFFF */ - {0xfb, 0xbf, 0xbf, 0xbf, 0xbf}, /* U-03FFFFFF */ - {0xfd, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf} /* U-7FFFFFFF */ -}; - -char boundary[5][6] = { - {0xed, 0x9f, 0xbf}, /* U-0000D7FF */ - {0xee, 0x80, 0x80}, /* U-0000E000 */ - {0xef, 0xbf, 0xbd}, /* U-0000FFFD */ - {0xf4, 0x8f, 0xbf, 0xbf}, /* U-0010FFFF */ - {0xf4, 0x90, 0x80, 0x80} /* U-00110000 */ -}; - -char continuation_bytes[8][7] = { - {0x80}, - {0xbf}, - {0x80, 0xbf}, - {0x80, 0xbf, 0x80}, - {0x80, 0xbf, 0x80, 0xbf}, - {0x80, 0xbf, 0x80, 0xbf, 0x80}, - {0x80, 0xbf, 0x80, 0xbf, 0x80, 0xbf}, - {0x80, 0xbf, 0x80, 0xbf, 0x80, 0xbf, 0x80} -}; - -char all_continuation_bytes[64]; - - -char all_two_byte_seq[32]; -char all_three_byte_seq[16]; -char all_four_byte_seq[8]; -char all_five_byte_seq[4]; -char all_six_byte_seq[2]; - -char incomplete_seq[10][6] = { - {0xc2}, /* U-00000080 */ - {0xe0, 0x80}, /* U-00000800 */ - {0xf0, 0x80, 0x80}, /* U-00010000 */ - {0xf8, 0x80, 0x80, 0x80}, /* U-00200000 */ - {0xfc, 0x80, 0x80, 0x80, 0x80}, /* U-04000000 */ - {0xdf}, /* U-000007FF */ - {0xef, 0xbf}, /* U-0000FFFF */ - {0xf7, 0xbf, 0xbf}, /* U-001FFFFF */ - {0xfb, 0xbf, 0xbf, 0xbf}, /* U-03FFFFFF */ - {0xfd, 0xbf, 0xbf, 0xbf, 0xbf} /* U-7FFFFFFF */ -}; - -char incomplete_seq_concat[30]; - -char impossible_bytes[3][4] = { - {0xfe}, - {0xff}, - {0xfe, 0xfe, 0xff, 0xff} -}; - -char overlong[5][6] = { - {0xc0, 0xaf}, - {0xe0, 0x80, 0xaf}, - {0xf0, 0x80, 0x80, 0xaf}, - {0xf8, 0x80, 0x80, 0x80, 0xaf}, - {0xfc, 0x80, 0x80, 0x80, 0x80, 0xaf} -}; - -char overlong_max[5][6] = { - {0xc1, 0xbf}, - {0xe0, 0x9f, 0xbf}, - {0xf0, 0x8f, 0xbf, 0xbf}, - {0xf8, 0x87, 0xbf, 0xbf, 0xbf}, - {0xfc, 0x83, 0xbf, 0xbf, 0xbf, 0xbf} -}; - -char overlong_nul[5][6] = { - {0xc0, 0x80}, - {0xe0, 0x80, 0x80}, - {0xf0, 0x80, 0x80, 0x80}, - {0xf8, 0x80, 0x80, 0x80, 0x80}, - {0xfc, 0x80, 0x80, 0x80, 0x80, 0x80} -}; - -char single_surrogates[7][3] = { - {0xed, 0xa0, 0x80}, - {0xed, 0xad, 0xbf}, - {0xed, 0xae, 0x80}, - {0xed, 0xaf, 0xbf}, - {0xed, 0xb0, 0x80}, - {0xed, 0xbe, 0x80}, - {0xed, 0xbf, 0xbf} -}; - -char paired_surrogates[8][6] = { - {0xed, 0xa0, 0x80, 0xed, 0xb0, 0x80}, - {0xed, 0xa0, 0x80, 0xed, 0xbf, 0xbf}, - {0xed, 0xad, 0xbf, 0xed, 0xb0, 0x80}, - {0xed, 0xad, 0xbf, 0xed, 0xbf, 0xbf}, - {0xed, 0xae, 0x80, 0xed, 0xb0, 0x80}, - {0xed, 0xae, 0x80, 0xed, 0xbf, 0xbf}, - {0xed, 0xaf, 0xbf, 0xed, 0xb0, 0x80}, - {0xed, 0xaf, 0xbf, 0xed, 0xbf, 0xbf} -}; - -char illegal_pos[2][3] = { - {0xff, 0xfe}, - {0xff, 0xff} -}; - -int main() - { - wchar_t wchar; - int retval; - int i; - - if (!setlocale(LC_CTYPE, "UTF-8")) - { - printf("Failed to set UTF-8 locale.\n"); - return 1; - } - else - printf("Set UTF-8 locale.\n"); - - /* 2 Boundary condition test cases */ - /* 2.1 First possible sequence of a certain length */ - retval = mbtowc(&wchar, first[0], MAX_BYTES); - if (retval == 0) - printf("2.1.1: U-%08d\n", wchar); - else - printf("2.1.1: Invalid\n"); - - for (i = 2; i < 7; i++) - { - retval = mbtowc (&wchar, first[i-1], MAX_BYTES); - if (retval == i) - printf("2.1.%d: U-%08x\n", i, wchar); - else - printf("2.1.%d: Invalid\n", i); - } - - /* 2.2 Last possible sequence of a certain length */ - for (i = 1; i < 7; i++) - { - retval = mbtowc (&wchar, last[i-1], MAX_BYTES); - if (retval == i) - printf("2.2.%d: U-%08x\n", i, wchar); - else - printf("2.2.%d: Invalid\n", i); - } - - /* 2.3 Other boundary conditions */ - for (i = 1; i < 6; i++) - { - retval = mbtowc (&wchar, boundary[i-1], MAX_BYTES); - if ((i < 4 && retval == 3) || (i > 3 && retval == 4)) - printf("2.3.%d: U-%08x\n", i, wchar); - else - printf("2.3.%d: Invalid\n", i); - } - - /* 3 Malformed sequences */ - /* 3.1 Unexpected continuation bytes */ - retval = mbtowc (&wchar, continuation_bytes[0], MAX_BYTES); - if (retval == 1) - printf("3.1.1: U-%08x\n", wchar); - else - printf("3.1.1: 1 Invalid\n"); - - retval = mbtowc (&wchar, continuation_bytes[1], MAX_BYTES); - if (retval == 1) - printf("3.1.2: U-%08x\n", wchar); - else - printf("3.1.2: 1 Invalid\n"); - - for(i=2; i< 8; i++) - { - retval = num_invalid(continuation_bytes[i], i); - if (retval == -1) - printf("3.1.%d: Valid Character Found\n", i+1); - else - printf("3.1.%d: %d Invalid\n", i+1, retval); - } - - for(i = 0x80; i < 0xc0; i++) - all_continuation_bytes[i-0x80] = i; - - retval = num_invalid(all_continuation_bytes, 0xc0 - 0x80); - if (retval == -1) - printf("3.1.9: Valid Character Found\n"); - else - printf("3.1.9: %d Invalid\n", retval); - - /* 3.2 Lonely start characters */ - for(i = 0xc0; i < 0xe0; i++) - all_two_byte_seq[i-0xc0] = i; - - retval = num_invalid(all_two_byte_seq, 0xe0 - 0xc0); - if (retval == -1) - printf("3.2.1: Valid Character Found\n"); - else - printf("3.2.1: %d Invalid\n", retval); - - for(i = 0xe0; i < 0xf0; i++) - all_three_byte_seq[i-0xe0] = i; - - retval = num_invalid(all_three_byte_seq, 0xf0 - 0xe0); - if (retval == -1) - printf("3.2.2: Valid Character Found\n"); - else - printf("3.2.2: %d Invalid\n", retval); - - for(i = 0xf0; i < 0xf8; i++) - all_four_byte_seq[i-0xf0] = i; - - retval = num_invalid(all_four_byte_seq, 0xf8 - 0xf0); - if (retval == -1) - printf("3.2.3: Valid Character Found\n"); - else - printf("3.2.3: %d Invalid\n", retval); - - for(i = 0xf8; i < 0xfc; i++) - all_five_byte_seq[i-0xf8] = i; - - retval = num_invalid(all_five_byte_seq, 0xfc - 0xf8); - if (retval == -1) - printf("3.2.4: Valid Character Found\n"); - else - printf("3.2.4: %d Invalid\n", retval); - - for(i = 0xfc; i < 0xfe; i++) - all_six_byte_seq[i-0xfc] = i; - - retval = num_invalid(all_six_byte_seq, 0xfe - 0xfc); - if (retval == -1) - printf("3.2.5: Valid Character Found\n"); - else - printf("3.2.5: %d Invalid\n", retval); - - /* 3.3 Sequences with last continuation byte missing */ - for(i = 1; i < 6; i++) - { - retval = mbtowc(&wchar, incomplete_seq[i-1], i); - if(retval == -1) - printf("3.3.%d: 1 Invalid\n", i); - else - printf("3.3.%d: Valid Character Found\n", i); - } - - for(i = 6; i < 11; i++) - { - retval = mbtowc(&wchar, incomplete_seq[i-1], i - 5); - if(retval == -1) - printf("3.3.%d: 1 Invalid\n", i); - else - printf("3.3.%d: Valid Character Found\n", i); - } - - /* 3.4 Concatenation of incomplete sequences */ - /* This test is excluded because the mbtowc function does not return the - number of bytes read in an invalid multi-byte sequence. */ - - /* 3.5 Impossible bytes */ - retval = mbtowc(&wchar, impossible_bytes[0], 1); - if(retval == -1) - printf("3.5.1: 1 Invalid\n"); - else - printf("3.5.1: Valid Character Found\n"); - - retval = mbtowc(&wchar, impossible_bytes[1], 1); - if(retval == -1) - printf("3.5.2: 1 Invalid\n"); - else - printf("3.5.2: Valid Character Found\n"); - - retval = mbtowc(&wchar, impossible_bytes[2], 4); - if(retval == -1) - printf("3.5.3: 1 Invalid\n"); - else - printf("3.5.3: Valid Character Found\n"); - - /* 4 Overlong sequences */ - /* 4.1 Examples of an overlong ASCII character */ - for(i = 2; i < 7; i++) - { - retval = mbtowc(&wchar, overlong[i-2], i); - if(retval == -1) - printf("4.1.%d: 1 Invalid\n", i-1); - else - printf("4.1.%d: Valid Character Found\n", i-1); - } - - /* 4.2 Maximum overlong sequences */ - for(i = 2; i < 7; i++) - { - retval = mbtowc(&wchar, overlong_max[i-2], i); - if(retval == -1) - printf("4.2.%d: 1 Invalid\n", i-1); - else - printf("4.2.%d: Valid Character Found\n", i-1); - } - - /* 4.3 Overlong representation of the NUL character */ - for(i = 2; i < 7; i++) - { - retval = mbtowc(&wchar, overlong_nul[i-2], i); - if(retval == -1) - printf("4.3.%d: 1 Invalid\n", i-1); - else - printf("4.3.%d: Valid Character Found\n", i-1); - } - - /* 5 Illegal code positions */ - /* 5.1 Single UTF-16 surrogates */ - for (i = 1; i < 8; i++) - { - retval = mbtowc(&wchar, single_surrogates[i-1], 3); - if(retval == -1) - printf("5.1.%d: 1 Invalid\n", i); - else - printf("5.1.%d: Valid Character Found\n", i); - } - - /* 5.2 Paired UTF-16 surrogates */ - for (i = 1; i < 8; i++) - { - retval = mbtowc(&wchar, paired_surrogates[i-1], 6); - if(retval == -1) - printf("5.2.%d: 1 Invalid\n", i); - else - printf("5.2.%d: Valid Character Found\n", i); - } - - /* 5.3 Other illegal code positions */ - retval = mbtowc(&wchar, illegal_pos[0], 3); - if(retval == -1) - printf("5.3.1: 1 Invalid\n"); - else - printf("5.3.1: Valid Character Found\n"); - - retval = mbtowc(&wchar, illegal_pos[1], 3); - if(retval == -1) - printf("5.3.2: 1 Invalid\n"); - else - printf("5.3.2: Valid Character Found\n"); - - return 0; - } - -/* return number of invalid characters in string, - returns -1 if a valid character is found */ -int -num_invalid(const char *s, int len) -{ - int retval = 0; - int i = 0; - int num_inv = 0; - wchar_t wchar; - const char *t; - - t = s; - - for(i=0; i<len; t++, i++) - { - retval = mbtowc (&wchar, t, len - i); - if(retval == -1) - num_inv++; - else - return -1; - } - return num_inv; -} diff --git a/newlib/testsuite/newlib.locale/UTF-8.exp b/newlib/testsuite/newlib.locale/UTF-8.exp deleted file mode 100644 index e97c963fc..000000000 --- a/newlib/testsuite/newlib.locale/UTF-8.exp +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. -# -# Permission to use, copy, modify, and distribute this software -# is freely granted, provided that this notice is preserved. -# - -load_lib checkoutput.exp - -set expected_output { -"Set UTF-8 locale." -"* U-00000000" -"* U-00000080" -"* U-00000800" -"* U-00010000" -"* U-00200000" -"* U-04000000" -"* U-0000007f" -"* U-000007ff" -"* U-0000ffff" -"* U-001fffff" -"* U-03ffffff" -"* U-7fffffff" -"* U-0000d7ff" -"* U-0000e000" -"* U-0000fffd" -"* U-0010ffff" -"* U-00110000" -"* 1 Invalid" -"* 1 Invalid" -"* 2 Invalid" -"* 3 Invalid" -"* 4 Invalid" -"* 5 Invalid" -"* 6 Invalid" -"* 7 Invalid" -"* 64 Invalid" -"* 32 Invalid" -"* 16 Invalid" -"* 8 Invalid" -"* 4 Invalid" -"* 2 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -"* 1 Invalid" -} - -newlib_check_output UTF-8.c $expected_output diff --git a/newlib/testsuite/newlib.locale/locale.exp b/newlib/testsuite/newlib.locale/locale.exp deleted file mode 100644 index 77aa719fb..000000000 --- a/newlib/testsuite/newlib.locale/locale.exp +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. -# -# Permission to use, copy, modify, and distribute this software -# is freely granted, provided that this notice is preserved. -# - -load_lib passfail.exp - -set nonpassfailtests { -"UTF-8.c" -} - -newlib_pass_fail $nonpassfailtests diff --git a/newlib/testsuite/newlib.string/string.exp b/newlib/testsuite/newlib.string/string.exp deleted file mode 100644 index 2b602960a..000000000 --- a/newlib/testsuite/newlib.string/string.exp +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. -# -# Permission to use, copy, modify, and distribute this software -# is freely granted, provided that this notice is preserved. -# - -load_lib passfail.exp - -set nonpassfailtests { -} - -newlib_pass_fail $nonpassfailtests diff --git a/newlib/testsuite/newlib.string/tstring.c b/newlib/testsuite/newlib.string/tstring.c deleted file mode 100644 index f7dd2d6e7..000000000 --- a/newlib/testsuite/newlib.string/tstring.c +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. - * - * Permission to use, copy, modify, and distribute this software - * is freely granted, provided that this notice is preserved. - */ - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> - -#ifndef MAX_1 -#define MAX_1 66000 -#endif - -#define MAX_2 (2 * MAX_1 + MAX_1 / 10) - -void eprintf (int line, char *result, char *expected, int size) -{ - if (size != 0) - printf ("Failure at line %d, result is <%.*s>, should be <%s> of size %d\n", - line, size, result, expected, size); - else - printf ("Failure at line %d, result is <%s>, should be <%s>\n", - line, result, expected); -} - -void mycopy (char *target, char *source, int size) -{ - int i; - - for (i = 0; i < size; ++i) - { - target[i] = source[i]; - } -} - -void myset (char *target, char ch, int size) -{ - int i; - - for (i = 0; i < size; ++i) - { - target[i] = ch; - } -} - -int main() -{ - char target[MAX_1] = "A"; - char first_char; - char second_char; - char array[] = "abcdefghijklmnopqrstuvwxz"; - char array2[] = "0123456789!@#$%^&*("; - char buffer2[MAX_1]; - char buffer3[MAX_1]; - char buffer4[MAX_1]; - char buffer5[MAX_2]; - char buffer6[MAX_2]; - char buffer7[MAX_2]; - char expected[MAX_1]; - char *tmp1, *tmp2, *tmp3, *tmp4, *tmp5, *tmp6, *tmp7; - int i, j, k, x, z, align_test_iterations; - - int test_failed = 0; - - tmp1 = target; - tmp2 = buffer2; - tmp3 = buffer3; - tmp4 = buffer4; - tmp5 = buffer5; - tmp6 = buffer6; - tmp7 = buffer7; - - tmp2[0] = 'Z'; - tmp2[1] = '\0'; - - if (memset (target, 'X', 0) != target || - memcpy (target, "Y", 0) != target || - memmove (target, "K", 0) != target || - strncpy (tmp2, "4", 0) != tmp2 || - strncat (tmp2, "123", 0) != tmp2 || - strcat (target, "") != target) - { - eprintf (__LINE__, target, "A", 0); - test_failed = 1; - } - - if (strcmp (target, "A") || strlen(target) != 1 || memchr (target, 'A', 0) != NULL - || memcmp (target, "J", 0) || strncmp (target, "A", 1) || strncmp (target, "J", 0) || - tmp2[0] != 'Z' || tmp2[1] != '\0') - { - eprintf (__LINE__, target, "A", 0); - test_failed = 1; - } - - tmp2[2] = 'A'; - if (strcpy (target, "") != target || - strncpy (tmp2, "", 4) != tmp2 || - strcat (target, "") != target) - { - eprintf (__LINE__, target, "", 0); - test_failed = 1; - } - - if (target[0] != '\0' || strncmp (target, "", 1) || - memcmp (tmp2, "\0\0\0\0", 4)) - { - eprintf (__LINE__, target, "", 0); - test_failed = 1; - } - - tmp2[2] = 'A'; - if (strncat (tmp2, "1", 3) != tmp2 || - memcmp (tmp2, "1\0A", 3)) - { - eprintf (__LINE__, tmp2, "1\0A", 3); - test_failed = 1; - } - - if (strcpy (tmp3, target) != tmp3 || - strcat (tmp3, "X") != tmp3 || - strncpy (tmp2, "X", 2) != tmp2 || - memset (target, tmp2[0], 1) != target) - { - eprintf (__LINE__, target, "X", 0); - test_failed = 1; - } - - if (strcmp (target, "X") || strlen (target) != 1 || - memchr (target, 'X', 2) != target || - strchr (target, 'X') != target || - memchr (target, 'Y', 2) != NULL || - strchr (target, 'Y') != NULL || - strcmp (tmp3, target) || - strncmp (tmp3, target, 2) || - memcmp (target, "K", 0) || - strncmp (target, tmp3, 3)) - { - eprintf (__LINE__, target, "X", 0); - test_failed = 1; - } - - if (strcpy (tmp3, "Y") != tmp3 || - strcat (tmp3, "Y") != tmp3 || - memset (target, 'Y', 2) != target) - { - eprintf (__LINE__, target, "Y", 0); - test_failed = 1; - } - - target[2] = '\0'; - if (memcmp (target, "YY", 2) || strcmp (target, "YY") || - strlen (target) != 2 || memchr (target, 'Y', 2) != target || - strcmp (tmp3, target) || - strncmp (target, tmp3, 3) || - strncmp (target, tmp3, 4) || - strncmp (target, tmp3, 2) || - strchr (target, 'Y') != target) - { - eprintf (__LINE__, target, "YY", 2); - test_failed = 1; - } - - strcpy (target, "WW"); - if (memcmp (target, "WW", 2) || strcmp (target, "WW") || - strlen (target) != 2 || memchr (target, 'W', 2) != target || - strchr (target, 'W') != target) - { - eprintf (__LINE__, target, "WW", 2); - test_failed = 1; - } - - if (strncpy (target, "XX", 16) != target || - memcmp (target, "XX\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16)) - { - eprintf (__LINE__, target, "XX\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16); - test_failed = 1; - } - - if (strcpy (tmp3, "ZZ") != tmp3 || - strcat (tmp3, "Z") != tmp3 || - memcpy (tmp4, "Z", 2) != tmp4 || - strcat (tmp4, "ZZ") != tmp4 || - memset (target, 'Z', 3) != target) - { - eprintf (__LINE__, target, "ZZZ", 3); - test_failed = 1; - } - - target[3] = '\0'; - tmp5[0] = '\0'; - strncat (tmp5, "123", 2); - if (memcmp (target, "ZZZ", 3) || strcmp (target, "ZZZ") || - strcmp (tmp3, target) || strcmp (tmp4, target) || - strncmp (target, "ZZZ", 4) || strncmp (target, "ZZY", 3) <= 0 || - strncmp ("ZZY", target, 4) >= 0 || - memcmp (tmp5, "12", 3) || - strlen (target) != 3) - { - eprintf (__LINE__, target, "ZZZ", 3); - test_failed = 1; - } - - target[2] = 'K'; - if (memcmp (target, "ZZZ", 2) || strcmp (target, "ZZZ") >= 0 || - memcmp (target, "ZZZ", 3) >= 0 || strlen (target) != 3 || - memchr (target, 'K', 3) != target + 2 || - strncmp (target, "ZZZ", 2) || strncmp (target, "ZZZ", 4) >= 0 || - strchr (target, 'K') != target + 2) - { - eprintf (__LINE__, target, "ZZK", 3); - test_failed = 1; - } - - strcpy (target, "AAA"); - if (memcmp (target, "AAA", 3) || strcmp (target, "AAA") || - strncmp (target, "AAA", 3) || - strlen (target) != 3) - { - eprintf (__LINE__, target, "AAA", 3); - test_failed = 1; - } - - j = 5; - while (j < MAX_1) - { - for (i = j-1; i <= j+1; ++i) - { - /* don't bother checking unaligned data in the larger - sizes since it will waste time without performing additional testing */ - if (i <= 16 * sizeof(long)) - { - align_test_iterations = 2*sizeof(long); - if (i <= 2 * sizeof(long) + 1) - z = 2; - else - z = 2 * sizeof(long); - } - else - { - align_test_iterations = 1; - } - - for (x = 0; x < align_test_iterations; ++x) - { - tmp1 = target + x; - tmp2 = buffer2 + x; - tmp3 = buffer3 + x; - tmp4 = buffer4 + x; - tmp5 = buffer5 + x; - tmp6 = buffer6 + x; - - first_char = array[i % (sizeof(array) - 1)]; - second_char = array2[i % (sizeof(array2) - 1)]; - memset (tmp1, first_char, i); - mycopy (tmp2, tmp1, i); - myset (tmp2 + z, second_char, i - z - 1); - if (memcpy (tmp1 + z, tmp2 + z, i - z - 1) != tmp1 + z) - { - printf ("error at line %d\n", __LINE__); - test_failed = 1; - } - - tmp1[i] = '\0'; - tmp2[i] = '\0'; - if (strcpy (expected, tmp2) != expected) - { - printf ("error at line %d\n", __LINE__); - test_failed = 1; - } - tmp2[i-z] = first_char + 1; - if (memmove (tmp2 + z + 1, tmp2 + z, i - z - 1) != tmp2 + z + 1 || - memset (tmp3, first_char, i) != tmp3) - { - printf ("error at line %d\n", __LINE__); - test_failed = 1; - } - - myset (tmp4, first_char, i); - tmp5[0] = '\0'; - if (strncpy (tmp5, tmp1, i+1) != tmp5 || - strcat (tmp5, tmp1) != tmp5) - { - printf ("error at line %d\n", __LINE__); - test_failed = 1; - } - mycopy (tmp6, tmp1, i); - mycopy (tmp6 + i, tmp1, i + 1); - - tmp7[2*i+z] = second_char; - strcpy (tmp7, tmp1); - - strchr (tmp1, second_char); - - if (memcmp (tmp1, expected, i) || strcmp (tmp1, expected) || - strncmp (tmp1, expected, i) || - strncmp (tmp1, expected, i+1) || - strcmp (tmp1, tmp2) >= 0 || memcmp (tmp1, tmp2, i) >= 0 || - strncmp (tmp1, tmp2, i+1) >= 0 || - strlen (tmp1) != i || memchr (tmp1, first_char, i) != tmp1 || - strchr (tmp1, first_char) != tmp1 || - memchr (tmp1, second_char, i) != tmp1 + z || - strchr (tmp1, second_char) != tmp1 + z || - strcmp (tmp5, tmp6) || - strncat (tmp7, tmp1, i+2) != tmp7 || - strcmp (tmp7, tmp6) || - tmp7[2*i+z] != second_char) - { - eprintf (__LINE__, tmp1, expected, 0); - printf ("x is %d\n",x); - printf ("i is %d\n", i); - printf ("tmp1 is <%p>\n", tmp1); - printf ("tmp5 is <%p> <%s>\n", tmp5, tmp5); - printf ("tmp6 is <%p> <%s>\n", tmp6, tmp6); - test_failed = 1; - } - - for (k = 1; k <= align_test_iterations && k <= i; ++k) - { - if (memcmp (tmp3, tmp4, i - k + 1) != 0 || - strncmp (tmp3, tmp4, i - k + 1) != 0) - { - printf ("Failure at line %d, comparing %.*s with %.*s\n", - __LINE__, i, tmp3, i, tmp4); - test_failed = 1; - } - tmp4[i-k] = first_char + 1; - if (memcmp (tmp3, tmp4, i) >= 0 || - strncmp (tmp3, tmp4, i) >= 0 || - memcmp (tmp4, tmp3, i) <= 0 || - strncmp (tmp4, tmp3, i) <= 0) - { - printf ("Failure at line %d, comparing %.*s with %.*s\n", - __LINE__, i, tmp3, i, tmp4); - test_failed = 1; - } - tmp4[i-k] = first_char; - } - } - } - j = ((2 * j) >> 2) << 2; - } - - if (test_failed) - abort(); - else - exit(0); -} |