diff options
Diffstat (limited to 'newlib/testsuite')
-rw-r--r-- | newlib/testsuite/include/check.h | 4 | ||||
-rw-r--r-- | newlib/testsuite/lib/checkoutput.exp | 13 | ||||
-rw-r--r-- | newlib/testsuite/lib/flags.exp | 8 | ||||
-rw-r--r-- | newlib/testsuite/lib/newlib.exp | 4 | ||||
-rw-r--r-- | newlib/testsuite/lib/passfail.exp | 10 | ||||
-rw-r--r-- | newlib/testsuite/newlib.string/memmove1.c | 184 |
6 files changed, 11 insertions, 212 deletions
diff --git a/newlib/testsuite/include/check.h b/newlib/testsuite/include/check.h index 70a71a1b9..df7f0cfa2 100644 --- a/newlib/testsuite/include/check.h +++ b/newlib/testsuite/include/check.h @@ -1,11 +1,7 @@ -#include <stdio.h> -#include <stdlib.h> - #define CHECK(a) { \ if (!(a)) \ { \ printf ("Failed " #a " in <%s> at line %d\n", __FILE__, __LINE__); \ - fflush(stdout); \ abort(); \ } \ } diff --git a/newlib/testsuite/lib/checkoutput.exp b/newlib/testsuite/lib/checkoutput.exp index 146f87b00..8cb46925f 100644 --- a/newlib/testsuite/lib/checkoutput.exp +++ b/newlib/testsuite/lib/checkoutput.exp @@ -9,19 +9,17 @@ # It assumes one line of output per test. proc newlib_check_output { srcfile expectlist } { - global subdir srcdir tmpdir + global objdir subdir srcdir set srcfullname "$srcdir/$subdir/$srcfile" - set test_driver "$tmpdir/[file tail [file rootname $srcfullname].x]" + 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 "$subdir/$srcfile compilation" - unresolved "$subdir/$srcfile output" + fail "Failed to compile $srcfile.\n" return } - pass "$subdir/$srcfile compilation" set result [newlib_load $test_driver ""] set status [lindex $result 0] @@ -32,12 +30,11 @@ proc newlib_check_output { srcfile expectlist } { foreach { expectedval } $expectlist { set gotval [string trim [lindex $output_lines 0] "\r"] if { ! [string match $expectedval $gotval] } { - verbose -log "$subdir/$srcfile: Expected: $expectedval Got: $gotval " - fail "$subdir/$srcfile output" + fail "$srcfile: Expected: $expectedval Got: $gotval " return } set output_lines [lrange $output_lines 1 end] } - pass "$subdir/$srcfile output" + pass $srcfile } diff --git a/newlib/testsuite/lib/flags.exp b/newlib/testsuite/lib/flags.exp index ebc69286f..f6bffde1f 100644 --- a/newlib/testsuite/lib/flags.exp +++ b/newlib/testsuite/lib/flags.exp @@ -12,20 +12,12 @@ # directories, rather than in the build and source paths of the # compiler being used. -if {![llength [info procs saved_libgloss_link_flags]]} { - rename libgloss_link_flags saved_libgloss_link_flags -} - proc libgloss_link_flags { args } { global target_cpu # These values come from the local site.exp. global srcdir objdir global multibuildtop - if {![info exists multibuildtop]} { - return [saved_libgloss_link_flags $args] - } - verbose "In newlib version of libgloss_link_flags...\n" if [isnative] { diff --git a/newlib/testsuite/lib/newlib.exp b/newlib/testsuite/lib/newlib.exp index f1df40e52..c53a8a819 100644 --- a/newlib/testsuite/lib/newlib.exp +++ b/newlib/testsuite/lib/newlib.exp @@ -23,7 +23,7 @@ proc newlib_init { args } { global newlib_initialized global target_info # These values are initialized in the local site.exp file. - global srcdir objdir tmpdir + global srcdir objdir global host_triplet target_triplet global old_ld_library_path @@ -34,7 +34,7 @@ proc newlib_init { args } { if {[target_info needs_status_wrapper] != "" && \ [target_info needs_status_wrapper] != "0" && \ ![info exists gluefile]} { - set gluefile ${tmpdir}/testglue.o; + set gluefile ${objdir}/testsuite/testglue.o; set result [build_wrapper $gluefile]; if { $result != "" } { set gluefile [lindex $result 0]; diff --git a/newlib/testsuite/lib/passfail.exp b/newlib/testsuite/lib/passfail.exp index 5e7eb21e7..82dc0093c 100644 --- a/newlib/testsuite/lib/passfail.exp +++ b/newlib/testsuite/lib/passfail.exp @@ -32,21 +32,19 @@ proc newlib_pass_fail_all { flag exclude_list } { # compiles and runs. proc newlib_pass_fail { srcfile } { - global srcdir tmpdir subdir + global srcdir objdir subdir set fullsrcfile "$srcdir/$subdir/$srcfile" - set test_driver "$tmpdir/[file rootname $srcfile].x" + set test_driver "$objdir/testsuite/[file rootname $srcfile].x" set comp_output [newlib_target_compile "$fullsrcfile" "$test_driver" "executable" ""] if { $comp_output != "" } { - fail "$subdir/$srcfile compilation" - unresolved "$subdir/$srcfile execution" + fail "Failed to compile $fullsrcfile.\n" } else { - pass "$subdir/$srcfile compilation" set result [newlib_load $test_driver ""] set status [lindex $result 0] - $status "$subdir/$srcfile execution" + $status "$fullsrcfile" } } diff --git a/newlib/testsuite/newlib.string/memmove1.c b/newlib/testsuite/newlib.string/memmove1.c deleted file mode 100644 index d3f1d6692..000000000 --- a/newlib/testsuite/newlib.string/memmove1.c +++ /dev/null @@ -1,184 +0,0 @@ -/* A minor test-program for memmove. - Copyright (C) 2005 Axis Communications. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Neither the name of Axis Communications nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS - COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. */ - -/* Test moves of 0..MAX bytes; overlapping-src-higher, - overlapping-src-lower and non-overlapping. The overlap varies with - 1..N where N is the size moved. This means an order of MAX**2 - iterations. The size of an octet may seem appropriate for MAX and - makes an upper limit for simple testing. For the CRIS simulator, - making this 256 added 90s to the test-run (2GHz P4) while 64 (4s) was - enough to spot the bugs that had crept in, hence the number chosen. */ -#define MAX 64 - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#define TOO_MANY_ERRORS 11 -int errors = 0; - -#define DEBUGP \ - if (errors == TOO_MANY_ERRORS) \ - printf ("Further errors omitted\n"); \ - else if (errors < TOO_MANY_ERRORS) \ - printf - -/* A safe target-independent memmove. */ - -void -mymemmove (unsigned char *dest, unsigned char *src, size_t n) -{ - size_t i; - - if ((src <= dest && src + n <= dest) - || src >= dest) - while (n-- > 0) - *dest++ = *src++; - else - { - dest += n; - src += n; - while (n-- > 0) - *--dest = *--src; - } -} - -/* It's either the noinline attribute or forcing the test framework to - pass -fno-builtin-memmove. */ -void -xmemmove (unsigned char *dest, unsigned char *src, size_t n) - __attribute__ ((__noinline__)); - -void -xmemmove (unsigned char *dest, unsigned char *src, size_t n) -{ - void *retp; - retp = memmove (dest, src, n); - - if (retp != dest) - { - errors++; - DEBUGP ("memmove of n bytes returned %p instead of dest=%p\n", - retp, dest); - } -} - - -/* Fill the array with something we can associate with a position, but - not exactly the same as the position index. */ - -void -fill (unsigned char dest[MAX*3]) -{ - size_t i; - for (i = 0; i < MAX*3; i++) - dest[i] = (10 + i) % MAX; -} - -int -main (void) -{ - size_t i; - int errors = 0; - - /* Leave some room before and after the area tested, so we can detect - overwrites of up to N bytes, N being the amount tested. If you - want to test using valgrind, make these malloced instead. */ - unsigned char from_test[MAX*3]; - unsigned char to_test[MAX*3]; - unsigned char from_known[MAX*3]; - unsigned char to_known[MAX*3]; - - /* Non-overlap. */ - for (i = 0; i < MAX; i++) - { - /* Do the memmove first before setting the known array, so we know - it didn't change any of the known array. */ - fill (from_test); - fill (to_test); - xmemmove (to_test + MAX, 1 + from_test + MAX, i); - - fill (from_known); - fill (to_known); - mymemmove (to_known + MAX, 1 + from_known + MAX, i); - - if (memcmp (to_known, to_test, sizeof (to_known)) != 0) - { - errors++; - DEBUGP ("memmove failed non-overlap test for %d bytes\n", i); - } - } - - /* Overlap-from-before. */ - for (i = 0; i < MAX; i++) - { - size_t j; - for (j = 0; j < i; j++) - { - fill (to_test); - xmemmove (to_test + MAX * 2 - i, to_test + MAX * 2 - i - j, i); - - fill (to_known); - mymemmove (to_known + MAX * 2 - i, to_known + MAX * 2 - i - j, i); - - if (memcmp (to_known, to_test, sizeof (to_known)) != 0) - { - errors++; - DEBUGP ("memmove failed for %d bytes," - " with src %d bytes before dest\n", - i, j); - } - } - } - - /* Overlap-from-after. */ - for (i = 0; i < MAX; i++) - { - size_t j; - for (j = 0; j < i; j++) - { - fill (to_test); - xmemmove (to_test + MAX, to_test + MAX + j, i); - - fill (to_known); - mymemmove (to_known + MAX, to_known + MAX + j, i); - - if (memcmp (to_known, to_test, sizeof (to_known)) != 0) - { - errors++; - DEBUGP ("memmove failed when moving %d bytes," - " with src %d bytes after dest\n", - i, j); - } - } - } - - if (errors != 0) - abort (); - exit (0); -} |