* sim/cris/asm/badarch1.ms, sim/cris/c/badldso1.c,
sim/cris/c/badldso2.c, sim/cris/c/badldso3.c, sim/cris/c/helloaout.c, sim/cris/c/hellodyn.c, sim/cris/c/hellodyn2.c, sim/cris/c/writev1.c, sim/cris/c/writev2.c: New tests. * sim/cris/c/c.exp: If compiler links libc.so when attempting to link dynamically, create symlink named "lib" to the directory where it is found. Handle new test-case option "dynamic".
This commit is contained in:
parent
c06ccdf1b6
commit
fe524faa87
@ -1,5 +1,14 @@
|
||||
2008-12-30 Hans-Peter Nilsson <hp@axis.com>
|
||||
|
||||
* sim/cris/asm/badarch1.ms, sim/cris/c/badldso1.c,
|
||||
sim/cris/c/badldso2.c, sim/cris/c/badldso3.c,
|
||||
sim/cris/c/helloaout.c, sim/cris/c/hellodyn.c,
|
||||
sim/cris/c/hellodyn2.c, sim/cris/c/writev1.c,
|
||||
sim/cris/c/writev2.c: New tests.
|
||||
* sim/cris/c/c.exp: If compiler links libc.so when attempting to
|
||||
link dynamically, create symlink named "lib" to the directory
|
||||
where it is found. Handle new test-case option "dynamic".
|
||||
|
||||
* sim/cris/asm/opterr1.ms, sim/cris/asm/opterr2.ms: Adjust for
|
||||
differences in getopt_long error message quoting.
|
||||
|
||||
|
5
sim/testsuite/sim/cris/asm/badarch1.ms
Normal file
5
sim/testsuite/sim/cris/asm/badarch1.ms
Normal file
@ -0,0 +1,5 @@
|
||||
# mach: crisv3 crisv8 crisv10 crisv32
|
||||
# xerror:
|
||||
# output: *: not a CRIS program `/bin/sh'\n
|
||||
# sim: /bin/sh
|
||||
.include "nopv32t.ms"
|
7
sim/testsuite/sim/cris/c/badldso1.c
Normal file
7
sim/testsuite/sim/cris/c/badldso1.c
Normal file
@ -0,0 +1,7 @@
|
||||
/*
|
||||
#notarget: cris*-*-elf
|
||||
#dynamic:
|
||||
#xerror:
|
||||
#output: *: could not load ELF interpreter `*' for program `*'\n
|
||||
*/
|
||||
#include "hello.c"
|
8
sim/testsuite/sim/cris/c/badldso2.c
Normal file
8
sim/testsuite/sim/cris/c/badldso2.c
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
#notarget: cris*-*-elf
|
||||
#dynamic:
|
||||
#xerror:
|
||||
#cc: additional_flags=-Wl,-dynamic-linker,/dev/null
|
||||
#output: *: could not load ELF interpreter `*' for program `*'\n
|
||||
*/
|
||||
#include "hello.c"
|
9
sim/testsuite/sim/cris/c/badldso3.c
Normal file
9
sim/testsuite/sim/cris/c/badldso3.c
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
#notarget: cris*-*-elf
|
||||
#dynamic:
|
||||
#xerror:
|
||||
#cc: additional_flags=-Wl,-dynamic-linker,/compilercheck.x
|
||||
#sim: --sysroot=@exedir@
|
||||
#output: *: could not load ELF interpreter `*' for program `*'\n
|
||||
*/
|
||||
#include "hello.c"
|
@ -30,6 +30,23 @@ if [istarget cris-*-*] {
|
||||
if { [target_compile $srcdir/$subdir/hello.c compilercheck.x \
|
||||
"executable" "" ] == "" } {
|
||||
set has_cc 1
|
||||
|
||||
# Now check if we can link a program dynamically, and where
|
||||
# libc.so is located. If it is, we provide a sym link to the
|
||||
# directory (which must end in /lib) in [pwd], so /lib/ld.so.1 is
|
||||
# found (which must reside along libc.so). We don't bother
|
||||
# replacing the board ldflags like below as we don't care about
|
||||
# detrimental effects on the executable from the specs and
|
||||
# -static in the board ldflags, we just add -Bdynamic.
|
||||
if [regexp "(.*/lib)/libc.so" \
|
||||
[target_compile $srcdir/$subdir/hello.c compilercheck.x \
|
||||
"executable" \
|
||||
"ldflags=-print-file-name=libc.so -Wl,-Bdynamic"] \
|
||||
xxx libcsodir] {
|
||||
file delete lib
|
||||
verbose -log "Creating link to $libcsodir in [pwd]"
|
||||
file link lib $libcsodir
|
||||
}
|
||||
} {
|
||||
verbose -log "Can't execute C compiler"
|
||||
set has_cc 0
|
||||
@ -48,6 +65,8 @@ proc anytarget { targets } {
|
||||
}
|
||||
|
||||
foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
|
||||
set orig_ldflags ""
|
||||
|
||||
if ![runtest_file_p $runtests $src] {
|
||||
continue
|
||||
}
|
||||
@ -84,6 +103,7 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
|
||||
set opts(xfail) ""
|
||||
set opts(target) ""
|
||||
set opts(notarget) ""
|
||||
set opts(dynamic) ""
|
||||
|
||||
# Clear any machine specific options specified in a previous test case
|
||||
if [info exists opts(sim,$mach)] {
|
||||
@ -120,6 +140,16 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
|
||||
}
|
||||
}
|
||||
|
||||
if { $opt_name == "dynamic" \
|
||||
&& [info exists board_info([target_info name],ldflags)] } {
|
||||
# Weed out -static from ldflags, but keep the original in
|
||||
# $orig_ldflags.
|
||||
set orig_ldflags $board_info([target_info name],ldflags)
|
||||
set ldflags " $orig_ldflags "
|
||||
regsub -all " -static " $ldflags " " ldflags
|
||||
set board_info([target_info name],ldflags) $ldflags
|
||||
}
|
||||
|
||||
foreach m $opt_machs {
|
||||
set opts($opt_name,$m) $opt_val
|
||||
}
|
||||
@ -160,6 +190,10 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
|
||||
continue
|
||||
}
|
||||
|
||||
if { $orig_ldflags != "" } {
|
||||
set board_info([target_info name],ldflags) $orig_ldflags
|
||||
}
|
||||
|
||||
verbose -log "Simulating $src with $opts(sim,$mach)"
|
||||
|
||||
# Time to setup xfailures and kfailures.
|
||||
|
10
sim/testsuite/sim/cris/c/helloaout.c
Normal file
10
sim/testsuite/sim/cris/c/helloaout.c
Normal file
@ -0,0 +1,10 @@
|
||||
/* Make sure we don't just assume ELF all over. (We have to jump
|
||||
through hoops to get runnable a.out out of the ELF setup, and
|
||||
having problems with a.out and discontinous section arrangements
|
||||
doesn't help. Adjust as needed to get a.out which says "pass". If
|
||||
necessary, move to the asm subdir. By design, it doesn't work with
|
||||
CRIS v32.)
|
||||
#target: cris-*-elf
|
||||
#cc: ldflags=-Wl,-mcrisaout\ -sim\ -Ttext=0
|
||||
*/
|
||||
#include "hello.c"
|
5
sim/testsuite/sim/cris/c/hellodyn.c
Normal file
5
sim/testsuite/sim/cris/c/hellodyn.c
Normal file
@ -0,0 +1,5 @@
|
||||
/*
|
||||
#dynamic:
|
||||
#sim: --sysroot=@exedir@
|
||||
*/
|
||||
#include "hello.c"
|
5
sim/testsuite/sim/cris/c/hellodyn2.c
Normal file
5
sim/testsuite/sim/cris/c/hellodyn2.c
Normal file
@ -0,0 +1,5 @@
|
||||
/*
|
||||
#dynamic:
|
||||
#sim: --sysroot=@exedir@ --load-vma
|
||||
*/
|
||||
#include "hello.c"
|
25
sim/testsuite/sim/cris/c/writev1.c
Normal file
25
sim/testsuite/sim/cris/c/writev1.c
Normal file
@ -0,0 +1,25 @@
|
||||
/* Trivial test of writev.
|
||||
#notarget: cris*-*-elf
|
||||
#output: abcdefghijklmn\npass\n
|
||||
*/
|
||||
#include <sys/uio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define X(x) {x, sizeof (x) -1}
|
||||
struct iovec v[] = {
|
||||
X("a"),
|
||||
X("bcd"),
|
||||
X("efghi"),
|
||||
X("j"),
|
||||
X("klmn\n"),
|
||||
};
|
||||
|
||||
int main (void)
|
||||
{
|
||||
if (writev (1, v, sizeof v / sizeof (v[0])) != 15)
|
||||
abort ();
|
||||
|
||||
printf ("pass\n");
|
||||
return 0;
|
||||
}
|
28
sim/testsuite/sim/cris/c/writev2.c
Normal file
28
sim/testsuite/sim/cris/c/writev2.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* Trivial test of failing writev: invalid file descriptor.
|
||||
#notarget: cris*-*-elf
|
||||
*/
|
||||
#include <sys/uio.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define X(x) {x, sizeof (x) -1}
|
||||
struct iovec v[] = {
|
||||
X("a"),
|
||||
X("bcd"),
|
||||
X("efghi"),
|
||||
X("j"),
|
||||
X("klmn\n"),
|
||||
};
|
||||
|
||||
int main (void)
|
||||
{
|
||||
if (writev (99, v, sizeof v / sizeof (v[0])) != -1
|
||||
/* The simulator write gives EINVAL instead of EBADF; let's
|
||||
cope. */
|
||||
|| (errno != EBADF && errno != EINVAL))
|
||||
abort ();
|
||||
|
||||
printf ("pass\n");
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user