/* Check access(2) trivially. Newlib doesn't have it.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <unistd.h>
#include <stdio.h>
/*
-#notarget: cris*-*-elf
+#progos: linux
#xerror:
#output: *: could not load ELF interpreter `*' for program `*'\n
*/
/*
-#notarget: cris*-*-elf
+#progos: linux
#xerror:
#cc: additional_flags=-Wl,-dynamic-linker,/dev/null
#output: *: could not load ELF interpreter `*' for program `*'\n
/*
-#notarget: cris*-*-elf
+#progos: linux
#xerror:
#cc: additional_flags=-Wl,-dynamic-linker,/compilercheck.x
#sim: --sysroot=$pwd
# Using target_compile, since it is less noisy,
global global_cc_works
+global global_cc_os
if { $global_cc_works == 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
set opts(sim) ""
set opts(output) ""
set opts(progoptions) ""
+ set opts(progos) ""
set opts(timeout) ""
set opts(mach) ""
set opts(xerror) "no"
continue
}
+ if { $opts(progos) != "" && $opts(progos) != $global_cc_os } {
+ untested $testname
+ continue
+ }
+
# If no machine specific options, default to the general version.
if ![info exists opts(sim,$mach)] {
set opts(sim,$mach) $opts(sim)
/*
-#notarget: cris*-*-elf
+#progos: linux
#output: got: a\nthen: bc\nexit: 0\n
*/
/* Make sure the thread system trivially works with trace output.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-trace=basic --trace-file=$pwd/clone2.tmp
#output: got: a\nthen: bc\nexit: 0\n
*/
/* Check that exiting from a parent thread does not kill the child.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <stddef.h>
/* Check that TRT happens when we reach the #threads implementation limit.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <stddef.h>
/* Check that unimplemented clone syscalls get the right treatment.
-#notarget: cris*-*-elf
+#progos: linux
#xerror:
#output: Unimplemented clone syscall *
#output: program stopped with signal 4 (*).\n
/* As the included file, but specifying silent ENOSYS.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=enosys-quiet
#output: ENOSYS\n
#output: xyzzy\n
/* Compiler options:
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-pthread
#output: Starting process a\naaaaaaaaStarting process b\nababbbbbbbbb
/* Check exit_group(2) trivially. Newlib doesn't have it and the
pre-v32 glibc requires updated headers we'd have to check or adjust
for.
-#notarget: cris-*-* *-*-elf
+#progos: linux
#output: exit_group\n
*/
#include <unistd.h>
/* Check exit_group(2) trivially with non-zero status.
-#notarget: cris-*-* *-*-elf
+#progos: linux
#output: exit_group\n
#xerror:
*/
/* Check that we get the expected message for unsupported fcntl calls.
-#notarget: cris*-*-elf
+#progos: linux
#xerror:
#output: Unimplemented fcntl*
#output: program stopped with signal 4 (*).\n
/* As the included file, but specifying silent ENOSYS.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=enosys-quiet
#output: ENOSYS\n
#output: xyzzy\n
/* Check that the ftruncate syscall works trivially.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <stdio.h>
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
/* Check that we get a proper error indication if trying ftruncate on a
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <unistd.h>
works. Jump through a few hoops to avoid reading the host
ld.so.cache (having no absolute path specified for the executable
falls back on loading through the same mechanisms as a DSO).
-#notarget: *-*-elf
+#progos: linux
#sim: --sysroot=$pwd $pwd/lib/ld.so.1 --library-path /
*/
#include "hello.c"
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#define _GNU_SOURCE
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#define _GNU_SOURCE
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#define _GNU_SOURCE
/* Just check that MAP_DENYWRITE is "honored" (ignored).
-#notarget: cris*-*-elf
+#progos: linux
*/
#define MMAP_FLAGS (MAP_PRIVATE|MAP_DENYWRITE)
#include "mmap1.c"
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#define _GNU_SOURCE
/* Check that mmapping specifying a previously mmapped address without
MAP_FIXED works; that we just don't get the same address.
-#notarget: cris*-*-elf
+#progos: linux
*/
#define NO_MUNMAP
#define MMAP_FLAGS2 MAP_PRIVATE
/* Check that mmapping a page-aligned size, larger than the file,
works.
-#notarget: cris*-*-elf
+#progos: linux
*/
/* Make sure we get an address where the size fits. */
/* Check that mmapping 0 using MAP_FIXED works, both with/without
there being previously mmapped contents.
-#notarget: cris*-*-elf
+#progos: linux
*/
#define MMAP_FLAGS1 MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED
#define NO_MUNMAP
/* Check unimplemented-output for mprotect call.
-#notarget: cris*-*-elf
+#progos: linux
#xerror:
#output: Unimplemented mprotect call (0x0, 0x2001, 0x4)\n
#output: program stopped with signal 4 (*).\n
/* As the included file, but specifying silent ENOSYS.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=enosys-quiet
#output: ENOSYS\n
#output: xyzzy\n
/* Check that TRT happens when error on too many opened files.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --sysroot=$pwd
*/
#include <stddef.h>
/* Check for proper pipe semantics at corner cases.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <stddef.h>
/* Check that closing a pipe with a nonempty buffer works.
-#notarget: cris*-*-elf
+#progos: linux
#output: got: a\ngot: b\nexit: 0\n
*/
/* Check that TRT happens when error on pipe call.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <stddef.h>
/* Check that TRT happens for pipe corner cases.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <stddef.h>
#include <signal.h>
/* Check that TRT happens for pipe corner cases (for our definition of TRT).
-#notarget: cris*-*-elf
+#progos: linux
#xerror:
#output: Terminating simulation due to writing pipe * from one single thread\n
#output: program stopped with signal 4 (*).\n
/* Check that writing an inordinate amount of data works (somewhat).
-#notarget: cris*-*-elf
+#progos: linux
#output: got: a\nexit: 0\n
This test-case will *not* work on host (or for real): the first
pipemax+1 bytes will be successfully written. It's just for
/* Check for proper pipe semantics at corner cases.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <stdio.h>
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <unistd.h>
/* Check that odd cases of readlink work.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <unistd.h>
/* As readlink5.c (sic), but specifying silent ENOSYS.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=enosys-quiet --argv0 ./readlink11.c.x
#output: ENOSYS\n
#output: xyzzy\n
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <unistd.h>
/* Simulator options:
-#notarget: cris*-*-elf
+#progos: linux
#sim: --sysroot=$pwd
*/
#define SYSROOTED 1
/* Check for corner case: readlink of too-long name.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <unistd.h>
/* Check that unsupported readlink calls don't cause the simulator to abort.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --argv0 ./readlink5.c.x
#xerror:
#output: Unimplemented readlink syscall (*)\n
/* Check that rare readlink calls don't cause the simulator to abort.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --argv0 $pwd/readlink6.c.x
*/
#include "readlink2.c"
/* Check that rare readlink calls don't cause the simulator to abort.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --env-unset PWD
*/
#include "readlink2.c"
/* Check that rare readlink calls don't cause the simulator to abort.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --sysroot=$pwd --env-unset PWD
*/
#define SYSROOTED 1
/* Check that odd cases of readlink work.
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-DX="$pwd"
*/
/* Compiler options:
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-pthread
#xerror:
#output: Unimplemented rt_sigprocmask syscall (0x3, 0x0, 0x3dff*\n
/* As the included file, but specifying silent ENOSYS.
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-pthread
#sim: --cris-unknown-syscall=enosys-quiet
#output: ENOSYS\n
/* Test that TRT happens for invalid rt_sigsuspend calls. Single-thread.
-#notarget: cris*-*-elf
+#progos: linux
#xerror:
#output: Unimplemented rt_sigsuspend syscall arguments (0x1, 0x2)\n
#output: program stopped with signal 4 (*).\n
/* As the included file, but specifying silent ENOSYS.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=enosys-quiet
#output: ENOSYS\n
#output: xyzzy\n
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sched.h>
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sched.h>
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sched.h>
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sched.h>
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sched.h>
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sched.h>
/* Check corner error case: specifying invalid PID.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sched.h>
/* Check corner error case: specifying invalid PID.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <string.h>
#include <sched.h>
/* Check corner error case: specifying invalid scheduling policy.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sched.h>
/* Check corner error case: specifying unimplemented resource.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sys/time.h>
#include <sys/resource.h>
/* Check that the syscall set_thread_area is supported and does the right thing.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <unistd.h>
/* Check that TRT happens when trying to IGN an non-ignorable signal, more than one thread.
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-pthread
#xerror:
#output: Exiting pid 42 due to signal 9\n
/* Check that TRT happens when getting a non-standard (realtime) signal, more than one thread.
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-pthread
#xerror:
#output: Unimplemented signal: 77\n
/* Check that TRT happens for a signal sent to a non-existent process/thread, more than one thread.
#cc: additional_flags=-pthread
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <stdlib.h>
/* As the included file, but specifying silent ENOSYS.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=enosys-quiet
#output: ENOSYS\n
#output: xyzzy\n
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <stdio.h>
/* Check that TRT happens at an abort (3) call, more than one thread.
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-pthread
#xerror:
#output: Exiting pid 42 due to signal 6\n
/* Check that TRT happens at an non-abort non-caught signal, more than one thread.
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-pthread
#xerror:
#output: Exiting pid 42 due to signal 7\n
/* Check unsupported case of sigaction syscall.
-#notarget: cris*-*-elf
+#progos: linux
#xerror:
#output: Unimplemented rt_sigaction syscall (0x8, 0x3df*\n
#output: program stopped with signal 4 (*).\n
/* Check that TRT happens at an non-abort ignored signal, more than one thread.
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-pthread
*/
/* Test that TRT happens for spurious sigreturn calls. Single-thread.
-#notarget: cris*-*-elf
+#progos: linux
#xerror:
#output: Invalid sigreturn syscall: no signal handler active (0x1, 0x2, 0x3, 0x4, 0x5, 0x6)\n
#output: program stopped with signal 4 (*).\n
/* Check that TRT happens for spurious sigreturn calls. Multiple threads.
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-pthread
#xerror:
#output: Invalid sigreturn syscall: no signal handler active (0x1, 0x2, 0x3, 0x4, 0x5, 0x6)\n
/* As the included file, but specifying silent ENOSYS.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=enosys-quiet
#output: ENOSYS\n
#output: xyzzy\n
/* As the included file, but specifying silent ENOSYS.
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-pthread
#sim: --cris-unknown-syscall=enosys-quiet
#output: ENOSYS\n
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sys/types.h>
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sys/types.h>
/* Simulator options:
-#notarget: cris*-*-elf
+#progos: linux
#sim: --sysroot=$pwd
*/
/* Check that lstat:ing an nonexistent file works as expected.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sys/types.h>
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sys/types.h>
/* For this test, we need to do the lstat syscall directly, or else
glibc gets a SEGV.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <unistd.h>
/* Test unknown-syscall output.
-#notarget: cris*-*-elf
+#progos: linux
#xerror:
#output: Unimplemented syscall: 166 (0x1, 0x2, 0x3, 0x4, 0x5, 0x6)\n
#output: program stopped with signal 4 (*).\n
/* Test unknown-syscall output.
-#notarget: cris*-*-elf
+#progos: linux
#xerror:
#output: Unimplemented syscall: 0 (0x3, 0x2, 0x1, 0x4, 0x6, 0x5)\n
#output: program stopped with signal 4 (*).\n
/* As the included file, just actually specifying the default.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=stop
#xerror:
#output: Unimplemented syscall: 166 (0x1, 0x2, 0x3, 0x4, 0x5, 0x6)\n
/* As the included file, just actually specifying the default.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=stop
#xerror:
#output: Unimplemented syscall: 0 (0x3, 0x2, 0x1, 0x4, 0x6, 0x5)\n
/* As the included file, but specifying ENOSYS with message.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=enosys
#output: Unimplemented syscall: 166 (0x1, 0x2, 0x3, 0x4, 0x5, 0x6)\n
#output: ENOSYS\n
/* As the included file, but specifying ENOSYS with message.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=enosys
#output: Unimplemented syscall: 0 (0x3, 0x2, 0x1, 0x4, 0x6, 0x5)\n
#output: ENOSYS\n
/* As the included file, but specifying silent ENOSYS.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=enosys-quiet
#output: ENOSYS\n
#output: xyzzy\n
/* As the included file, but specifying silent ENOSYS.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=enosys-quiet
#output: ENOSYS\n
#output: xyzzy\n
/*
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <unistd.h>
#xerror:
#output: Unimplemented _sysctl syscall *\n
#output: program stopped with signal 4 (*).\n
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <unistd.h>
/* As the included file, but specifying silent ENOSYS.
-#notarget: cris*-*-elf
+#progos: linux
#sim: --cris-unknown-syscall=enosys-quiet
#output: ENOSYS\n
#output: xyzzy\n
/* Compiler options:
#cc: additional_flags=-pthread
-#notarget: cris*-*-elf
+#progos: linux
A sanity check for syscalls resulting from
pthread_getschedparam and pthread_setschedparam. */
/* Compiler options:
#cc: additional_flags=-pthread
-#notarget: cris*-*-elf
+#progos: linux
To test sched_yield in the presencs of threads. Core from ex1.c. */
/* Compiler options:
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-pthread
#output: abb ok\n
/* Compiler options:
-#notarget: cris*-*-elf
+#progos: linux
#cc: additional_flags=-pthread
#output: abbb ok\n
/* Check that the truncate syscall works trivially.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <stdio.h>
/*
#sim: --sysroot=$pwd
-#notarget: cris*-*-elf
+#progos: linux
*/
#define PREFIX "/"
#include "truncate1.c"
/* Check corner error case: specifying unimplemented resource.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sys/time.h>
/* Check that the right machine name appears in the uname result.
-#notarget: *-*-elf
+#progos: linux
*/
#include <sys/utsname.h>
#include <stdio.h>
/* Trivial test of writev.
-#notarget: cris*-*-elf
+#progos: linux
#output: abcdefghijklmn\npass\n
*/
#include <sys/uio.h>
/* Trivial test of failing writev: invalid file descriptor.
-#notarget: cris*-*-elf
+#progos: linux
*/
#include <sys/uio.h>
#include <errno.h>
--- /dev/null
+/* Used by the test harness to see if toolchain targets Linux. */
+#ifdef __linux__
+int main()
+{
+ return 0;
+}
+#else
+# error "not linux"
+#endif
--- /dev/null
+/* Used by the test harness to see if toolchain uses newlib. */
+#include <newlib.h>
+#if defined(__NEWLIB__) || defined(_NEWLIB_VERSION)
+int main()
+{
+ return 0;
+}
+#else
+# error "not newlib"
+#endif
global srcdir
global global_cpp_works
global global_cc_works
+ global global_cc_os
# See if we have a preprocessor available.
set result [target_compile $srcdir/lib/compilercheck.c \
$objdir/compilercheck.x "preprocess" ""]
set global_cpp_works [string equal "" "$result"]
- # See if we have a compiler available.
- set result [target_compile $srcdir/lib/compilercheck.c \
- $objdir/compilercheck.x "executable" ""]
- set global_cc_works [string equal "" "$result"]
+ # See if we have a compiler available, and which environment it's targeting.
+ if { [target_compile $srcdir/lib/newlibcheck.c \
+ $objdir/compilercheck.x "executable" ""] == "" } {
+ verbose -log "Found newlib C compiler"
+ set global_cc_works 1
+ set global_cc_os "newlib"
+ } elseif { [target_compile $srcdir/lib/linuxcheck.c \
+ $objdir/compilercheck.x "executable" ""] == "" } {
+ verbose -log "Found Linux C compiler"
+ set global_cc_works 1
+ set global_cc_os "linux"
+ } elseif { [target_compile $srcdir/lib/compilercheck.c \
+ $objdir/compilercheck.x "executable" ""] == "" } {
+ verbose -log "Found C compiler, but unknown OS"
+ set global_cc_works 1
+ set global_cc_os ""
+ } {
+ verbose -log "Can't execute C compiler"
+ set global_cc_works 0
+ }
file delete $objdir/compilercheck.x
}
# cc[(mach-list)]: <compiler options>
# sim[(mach-list)]: <simulator options>
# progopts: <arguments to the program being simulated>
+# progos: OS required for the test
# status: program exit status to treat as "pass"
# output: program output pattern to match with string-match
# xerror: program is expected to return with a "failure" exit code
global SIMFLAGS_FOR_TARGET
global global_cpp_works
global global_cc_works
+ global global_cc_os
if ![file exists $sim_path] {
unsupported "$name: missing simulator $sim_path"
set opts(ld) ""
set opts(cc) ""
set opts(progopts) ""
+ set opts(progos) ""
set opts(sim) ""
set opts(status) "0"
set opts(output) ""
}
}
+ if { $opts(progos) != "" && $opts(progos) != $global_cc_os } {
+ untested $subdir/$name
+ return
+ }
+
set testname $name
set sourcefile $file
if { $seen_output == 0 } {