From f522b1317829affd35914f053dfb219c1e20dae0 Mon Sep 17 00:00:00 2001 From: cvs2svn <> Date: Thu, 17 Dec 2009 21:48:50 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'newlib-1_18_0'. Sprout from master 2009-12-17 21:48:49 UTC Jeff Johnston '' Cherrypick from cygnus 1999-05-03 07:29:06 UTC Richard Henderson '19990502 sourceware import': README config/mt-d30v config/mt-netware config/mt-ospace etc/add-log.el etc/add-log.vi etc/configbuild.ein etc/configbuild.fig etc/configbuild.jin etc/configbuild.tin etc/configdev.ein etc/configdev.fig etc/configdev.jin etc/configdev.tin makefile.vms Delete: djunpack.bat include/COPYING include/COPYING3 include/ChangeLog include/ChangeLog-9103 include/MAINTAINERS include/alloca-conf.h include/ansidecl.h include/aout/ChangeLog include/aout/adobe.h include/aout/aout64.h include/aout/ar.h include/aout/dynix3.h include/aout/encap.h include/aout/host.h include/aout/hp.h include/aout/hp300hpux.h include/aout/hppa.h include/aout/ranlib.h include/aout/reloc.h include/aout/stab.def include/aout/stab_gnu.h include/aout/sun4.h include/bfdlink.h include/binary-io.h include/bout.h include/cgen/ChangeLog include/cgen/basic-modes.h include/cgen/basic-ops.h include/cgen/bitset.h include/coff/ChangeLog include/coff/ChangeLog-9103 include/coff/alpha.h include/coff/apollo.h include/coff/arm.h include/coff/aux-coff.h include/coff/ecoff.h include/coff/external.h include/coff/go32exe.h include/coff/h8300.h include/coff/h8500.h include/coff/i386.h include/coff/i860.h include/coff/i960.h include/coff/ia64.h include/coff/internal.h include/coff/m68k.h include/coff/m88k.h include/coff/maxq.h include/coff/mcore.h include/coff/mips.h include/coff/mipspe.h include/coff/or32.h include/coff/pe.h include/coff/powerpc.h include/coff/rs6000.h include/coff/rs6k64.h include/coff/sh.h include/coff/sparc.h include/coff/sym.h include/coff/symconst.h include/coff/ti.h include/coff/tic30.h include/coff/tic4x.h include/coff/tic54x.h include/coff/tic80.h include/coff/w65.h include/coff/we32k.h include/coff/x86_64.h include/coff/xcoff.h include/coff/z80.h include/coff/z8k.h include/demangle.h include/dis-asm.h include/dwarf2.h include/dyn-string.h include/elf/ChangeLog include/elf/ChangeLog-9103 include/elf/alpha.h include/elf/arc.h include/elf/arm.h include/elf/avr.h include/elf/bfin.h include/elf/common.h include/elf/cr16.h include/elf/cr16c.h include/elf/cris.h include/elf/crx.h include/elf/d10v.h include/elf/d30v.h include/elf/dlx.h include/elf/dwarf.h include/elf/external.h include/elf/fr30.h include/elf/frv.h include/elf/h8.h include/elf/hppa.h include/elf/i370.h include/elf/i386.h include/elf/i860.h include/elf/i960.h include/elf/ia64.h include/elf/internal.h include/elf/ip2k.h include/elf/iq2000.h include/elf/lm32.h include/elf/m32c.h include/elf/m32r.h include/elf/m68hc11.h include/elf/m68k.h include/elf/mcore.h include/elf/mep.h include/elf/microblaze.h include/elf/mips.h include/elf/mmix.h include/elf/mn10200.h include/elf/mn10300.h include/elf/moxie.h include/elf/msp430.h include/elf/mt.h include/elf/openrisc.h include/elf/or32.h include/elf/pj.h include/elf/ppc.h include/elf/ppc64.h include/elf/reloc-macros.h include/elf/rx.h include/elf/s390.h include/elf/score.h include/elf/sh.h include/elf/sparc.h include/elf/spu.h include/elf/v850.h include/elf/vax.h include/elf/vxworks.h include/elf/x86-64.h include/elf/xc16x.h include/elf/xstormy16.h include/elf/xtensa.h include/fibheap.h include/filenames.h include/floatformat.h include/fnmatch.h include/fopen-bin.h include/fopen-same.h include/fopen-vms.h include/gdb/ChangeLog include/gdb/callback.h include/gdb/fileio.h include/gdb/remote-sim.h include/gdb/signals.h include/gdb/sim-arm.h include/gdb/sim-cr16.h include/gdb/sim-d10v.h include/gdb/sim-frv.h include/gdb/sim-h8300.h include/gdb/sim-lm32.h include/gdb/sim-m32c.h include/gdb/sim-ppc.h include/gdb/sim-rx.h include/gdb/sim-sh.h include/gdbm.h include/getopt.h include/hashtab.h include/hp-symtab.h include/ieee.h include/libiberty.h include/lto-symtab.h include/md5.h include/nlm/ChangeLog include/nlm/alpha-ext.h include/nlm/common.h include/nlm/external.h include/nlm/i386-ext.h include/nlm/internal.h include/nlm/ppc-ext.h include/nlm/sparc32-ext.h include/oasys.h include/objalloc.h include/obstack.h include/opcode/ChangeLog include/opcode/ChangeLog-9103 include/opcode/alpha.h include/opcode/arc.h include/opcode/arm.h include/opcode/avr.h include/opcode/bfin.h include/opcode/cgen.h include/opcode/convex.h include/opcode/cr16.h include/opcode/cris.h include/opcode/crx.h include/opcode/d10v.h include/opcode/d30v.h include/opcode/dlx.h include/opcode/h8300.h include/opcode/hppa.h include/opcode/i370.h include/opcode/i386.h include/opcode/i860.h include/opcode/i960.h include/opcode/ia64.h include/opcode/m68hc11.h include/opcode/m68k.h include/opcode/m88k.h include/opcode/maxq.h include/opcode/mips.h include/opcode/mmix.h include/opcode/mn10200.h include/opcode/mn10300.h include/opcode/moxie.h include/opcode/msp430.h include/opcode/np1.h include/opcode/ns32k.h include/opcode/or32.h include/opcode/pdp11.h include/opcode/pj.h include/opcode/pn.h include/opcode/ppc.h include/opcode/pyr.h include/opcode/rx.h include/opcode/s390.h include/opcode/score-datadep.h include/opcode/score-inst.h include/opcode/sparc.h include/opcode/spu-insns.h include/opcode/spu.h include/opcode/tahoe.h include/opcode/tic30.h include/opcode/tic4x.h include/opcode/tic54x.h include/opcode/tic80.h include/opcode/v850.h include/opcode/vax.h include/os9k.h include/partition.h include/plugin-api.h include/progress.h include/safe-ctype.h include/sha1.h include/sort.h include/splay-tree.h include/symcat.h include/xregex.h include/xregex2.h include/xtensa-config.h include/xtensa-isa-internal.h include/xtensa-isa.h winsup/COPYING winsup/CYGWIN_LICENSE winsup/ChangeLog winsup/Makefile.common winsup/Makefile.in winsup/README winsup/acinclude.m4 winsup/aclocal.m4 winsup/configure winsup/configure.in winsup/cygserver/ChangeLog winsup/cygserver/Makefile.in winsup/cygserver/README winsup/cygserver/aclocal.m4 winsup/cygserver/bsd_helper.cc winsup/cygserver/bsd_helper.h winsup/cygserver/bsd_log.cc winsup/cygserver/bsd_log.h winsup/cygserver/bsd_mutex.cc winsup/cygserver/bsd_mutex.h winsup/cygserver/client.cc winsup/cygserver/configure winsup/cygserver/configure.in winsup/cygserver/cygserver-config winsup/cygserver/cygserver.cc winsup/cygserver/cygserver.conf winsup/cygserver/msg.cc winsup/cygserver/process.cc winsup/cygserver/process.h winsup/cygserver/sem.cc winsup/cygserver/setpwd.cc winsup/cygserver/shm.cc winsup/cygserver/sysv_msg.cc winsup/cygserver/sysv_sem.cc winsup/cygserver/sysv_shm.cc winsup/cygserver/threaded_queue.cc winsup/cygserver/threaded_queue.h winsup/cygserver/transport.cc winsup/cygserver/transport.h winsup/cygserver/transport_pipes.cc winsup/cygserver/transport_pipes.h winsup/cygserver/woutsup.h winsup/cygwin/ChangeLog winsup/cygwin/ChangeLog-1995 winsup/cygwin/ChangeLog-1996 winsup/cygwin/ChangeLog-1997 winsup/cygwin/ChangeLog-1998 winsup/cygwin/ChangeLog-1999 winsup/cygwin/ChangeLog-2000 winsup/cygwin/ChangeLog-2001 winsup/cygwin/ChangeLog-2002 winsup/cygwin/ChangeLog-2003 winsup/cygwin/ChangeLog-2004 winsup/cygwin/ChangeLog-2005 winsup/cygwin/ChangeLog-2006 winsup/cygwin/ChangeLog-2007 winsup/cygwin/ChangeLog-2008 winsup/cygwin/Makefile.in winsup/cygwin/ROADMAP winsup/cygwin/acconfig.h winsup/cygwin/aclocal.m4 winsup/cygwin/analyze_sigfe winsup/cygwin/assert.cc winsup/cygwin/autoload.cc winsup/cygwin/automode.c winsup/cygwin/binmode.c winsup/cygwin/child_info.h winsup/cygwin/config.h.in winsup/cygwin/config/i386/profile.h winsup/cygwin/configure winsup/cygwin/configure.in winsup/cygwin/cpuid.h winsup/cygwin/crt0.c winsup/cygwin/ctype.cc winsup/cygwin/cxx.cc winsup/cygwin/cygerrno.h winsup/cygwin/cygheap.cc winsup/cygwin/cygheap.h winsup/cygwin/cygheap_malloc.h winsup/cygwin/cyglsa.h winsup/cygwin/cygmagic winsup/cygwin/cygmalloc.h winsup/cygwin/cygprops.h winsup/cygwin/cygserver.h winsup/cygwin/cygserver_ipc.h winsup/cygwin/cygserver_msg.h winsup/cygwin/cygserver_sem.h winsup/cygwin/cygserver_setpwd.h winsup/cygwin/cygserver_shm.h winsup/cygwin/cygthread.cc winsup/cygwin/cygthread.h winsup/cygwin/cygtls.cc winsup/cygwin/cygtls.h winsup/cygwin/cygwin-cxx.h winsup/cygwin/cygwin-shilka winsup/cygwin/cygwin.din winsup/cygwin/cygwin.sc winsup/cygwin/cygwin_version.h winsup/cygwin/dcrt0.cc winsup/cygwin/debug.cc winsup/cygwin/debug.h winsup/cygwin/devices.cc winsup/cygwin/devices.h winsup/cygwin/devices.in winsup/cygwin/dir.cc winsup/cygwin/dlfcn.cc winsup/cygwin/dll_init.cc winsup/cygwin/dll_init.h winsup/cygwin/dll_init.sgml winsup/cygwin/dllfixdbg winsup/cygwin/dlmalloc.c winsup/cygwin/dlmalloc.h winsup/cygwin/dtable.cc winsup/cygwin/dtable.h winsup/cygwin/dtable.sgml winsup/cygwin/environ.cc winsup/cygwin/environ.h winsup/cygwin/errno.cc winsup/cygwin/exceptions.cc winsup/cygwin/exec.cc winsup/cygwin/external.cc winsup/cygwin/external.sgml winsup/cygwin/fcntl.cc winsup/cygwin/fhandler.cc winsup/cygwin/fhandler.h winsup/cygwin/fhandler_clipboard.cc winsup/cygwin/fhandler_console.cc winsup/cygwin/fhandler_disk_file.cc winsup/cygwin/fhandler_dsp.cc winsup/cygwin/fhandler_fifo.cc winsup/cygwin/fhandler_floppy.cc winsup/cygwin/fhandler_mailslot.cc winsup/cygwin/fhandler_mem.cc winsup/cygwin/fhandler_netdrive.cc winsup/cygwin/fhandler_nodevice.cc winsup/cygwin/fhandler_proc.cc winsup/cygwin/fhandler_process.cc winsup/cygwin/fhandler_procnet.cc winsup/cygwin/fhandler_random.cc winsup/cygwin/fhandler_raw.cc winsup/cygwin/fhandler_registry.cc winsup/cygwin/fhandler_serial.cc winsup/cygwin/fhandler_socket.cc winsup/cygwin/fhandler_tape.cc winsup/cygwin/fhandler_termios.cc winsup/cygwin/fhandler_tty.cc winsup/cygwin/fhandler_virtual.cc winsup/cygwin/fhandler_virtual.h winsup/cygwin/fhandler_windows.cc winsup/cygwin/fhandler_zero.cc winsup/cygwin/flock.cc winsup/cygwin/fork.cc winsup/cygwin/gcrt0.c winsup/cygwin/gendef winsup/cygwin/gendevices winsup/cygwin/gentls_offsets winsup/cygwin/glob.cc winsup/cygwin/glob_pattern_p.cc winsup/cygwin/globals.cc winsup/cygwin/gmon.c winsup/cygwin/gmon.h winsup/cygwin/grp.cc winsup/cygwin/heap.cc winsup/cygwin/heap.h winsup/cygwin/hires.h winsup/cygwin/hookapi.cc winsup/cygwin/how-autoload-works.txt winsup/cygwin/how-cygheap-works.txt winsup/cygwin/how-cygtls-works.txt winsup/cygwin/how-fhandlers-work.txt winsup/cygwin/how-signals-work.txt winsup/cygwin/how-spawn-works.txt winsup/cygwin/how-to-debug-cygwin.txt winsup/cygwin/how-vfork-works.txt winsup/cygwin/include/a.out.h winsup/cygwin/include/arpa/ftp.h winsup/cygwin/include/arpa/inet.h winsup/cygwin/include/arpa/nameser.h winsup/cygwin/include/arpa/nameser_compat.h winsup/cygwin/include/arpa/telnet.h winsup/cygwin/include/asm/byteorder.h winsup/cygwin/include/asm/socket.h winsup/cygwin/include/asm/types.h winsup/cygwin/include/attr/xattr.h winsup/cygwin/include/bits/wordsize.h winsup/cygwin/include/byteswap.h winsup/cygwin/include/cygwin/_types.h winsup/cygwin/include/cygwin/acl.h winsup/cygwin/include/cygwin/config.h winsup/cygwin/include/cygwin/core_dump.h winsup/cygwin/include/cygwin/cygwin_dll.h winsup/cygwin/include/cygwin/fs.h winsup/cygwin/include/cygwin/grp.h winsup/cygwin/include/cygwin/hdreg.h winsup/cygwin/include/cygwin/icmp.h winsup/cygwin/include/cygwin/if.h winsup/cygwin/include/cygwin/in.h winsup/cygwin/include/cygwin/in6.h winsup/cygwin/include/cygwin/in_systm.h winsup/cygwin/include/cygwin/ipc.h winsup/cygwin/include/cygwin/kd.h winsup/cygwin/include/cygwin/msg.h winsup/cygwin/include/cygwin/mtio.h winsup/cygwin/include/cygwin/rdevio.h winsup/cygwin/include/cygwin/sem.h winsup/cygwin/include/cygwin/shm.h winsup/cygwin/include/cygwin/signal.h winsup/cygwin/include/cygwin/socket.h winsup/cygwin/include/cygwin/sockios.h winsup/cygwin/include/cygwin/stat.h winsup/cygwin/include/cygwin/stdlib.h winsup/cygwin/include/cygwin/sys_time.h winsup/cygwin/include/cygwin/sysproto.h winsup/cygwin/include/cygwin/time.h winsup/cygwin/include/cygwin/types.h winsup/cygwin/include/cygwin/utmp.h winsup/cygwin/include/cygwin/version.h winsup/cygwin/include/cygwin/wait.h winsup/cygwin/include/dlfcn.h winsup/cygwin/include/elf.h winsup/cygwin/include/endian.h winsup/cygwin/include/err.h winsup/cygwin/include/exceptions.h winsup/cygwin/include/fcntl.h winsup/cygwin/include/features.h winsup/cygwin/include/fnmatch.h winsup/cygwin/include/fts.h winsup/cygwin/include/ftw.h winsup/cygwin/include/getopt.h winsup/cygwin/include/glob.h winsup/cygwin/include/icmp.h winsup/cygwin/include/ifaddrs.h winsup/cygwin/include/inttypes.h winsup/cygwin/include/io.h winsup/cygwin/include/lastlog.h winsup/cygwin/include/libgen.h winsup/cygwin/include/limits.h winsup/cygwin/include/machine/stdlib.h winsup/cygwin/include/mapi.h winsup/cygwin/include/memory.h winsup/cygwin/include/mntent.h winsup/cygwin/include/mqueue.h winsup/cygwin/include/net/if.h winsup/cygwin/include/netdb.h winsup/cygwin/include/netinet/in.h winsup/cygwin/include/netinet/in_systm.h winsup/cygwin/include/netinet/ip.h winsup/cygwin/include/netinet/ip_icmp.h winsup/cygwin/include/netinet/tcp.h winsup/cygwin/include/netinet/udp.h winsup/cygwin/include/paths.h winsup/cygwin/include/poll.h winsup/cygwin/include/pthread.h winsup/cygwin/include/pty.h winsup/cygwin/include/resolv.h winsup/cygwin/include/sched.h winsup/cygwin/include/search.h winsup/cygwin/include/semaphore.h winsup/cygwin/include/stdint.h winsup/cygwin/include/strings.h winsup/cygwin/include/sys/acl.h winsup/cygwin/include/sys/copying.dj winsup/cygwin/include/sys/cygwin.h winsup/cygwin/include/sys/dirent.h winsup/cygwin/include/sys/elf32.h winsup/cygwin/include/sys/elf64.h winsup/cygwin/include/sys/elf_common.h winsup/cygwin/include/sys/elf_generic.h winsup/cygwin/include/sys/file.h winsup/cygwin/include/sys/ioctl.h winsup/cygwin/include/sys/ipc.h winsup/cygwin/include/sys/kd.h winsup/cygwin/include/sys/lock.h winsup/cygwin/include/sys/mman.h winsup/cygwin/include/sys/mount.h winsup/cygwin/include/sys/msg.h winsup/cygwin/include/sys/mtio.h winsup/cygwin/include/sys/param.h winsup/cygwin/include/sys/poll.h winsup/cygwin/include/sys/procfs.h winsup/cygwin/include/sys/queue.h winsup/cygwin/include/sys/resource.h winsup/cygwin/include/sys/sched.h winsup/cygwin/include/sys/select.h winsup/cygwin/include/sys/sem.h winsup/cygwin/include/sys/shm.h winsup/cygwin/include/sys/smallprint.h winsup/cygwin/include/sys/socket.h winsup/cygwin/include/sys/soundcard.h winsup/cygwin/include/sys/statfs.h winsup/cygwin/include/sys/statvfs.h winsup/cygwin/include/sys/stdio.h winsup/cygwin/include/sys/strace.h winsup/cygwin/include/sys/sysinfo.h winsup/cygwin/include/sys/syslimits.h winsup/cygwin/include/sys/syslog.h winsup/cygwin/include/sys/sysmacros.h winsup/cygwin/include/sys/sysproto.h winsup/cygwin/include/sys/termio.h winsup/cygwin/include/sys/termios.h winsup/cygwin/include/sys/ttychars.h winsup/cygwin/include/sys/uio.h winsup/cygwin/include/sys/un.h winsup/cygwin/include/sys/utime.h winsup/cygwin/include/sys/utmp.h winsup/cygwin/include/sys/utsname.h winsup/cygwin/include/sys/vfs.h winsup/cygwin/include/sys/wait.h winsup/cygwin/include/sysexits.h winsup/cygwin/include/syslog.h winsup/cygwin/include/termio.h winsup/cygwin/include/tzfile.h winsup/cygwin/include/utmpx.h winsup/cygwin/include/wait.h winsup/cygwin/init.cc winsup/cygwin/ioctl.cc winsup/cygwin/ipc.cc winsup/cygwin/kernel32.cc winsup/cygwin/lib/_cygwin_crt0_common.cc winsup/cygwin/lib/crt0.h winsup/cygwin/lib/cygwin_attach_dll.c winsup/cygwin/lib/cygwin_crt0.c winsup/cygwin/lib/dll_entry.c winsup/cygwin/lib/dll_main.cc winsup/cygwin/lib/libcmain.c winsup/cygwin/lib/premain0.c winsup/cygwin/lib/premain1.c winsup/cygwin/lib/premain2.c winsup/cygwin/lib/premain3.c winsup/cygwin/lib/pseudo-reloc.c winsup/cygwin/libc/bsdlib.cc winsup/cygwin/libc/fnmatch.c winsup/cygwin/libc/fts.c winsup/cygwin/libc/ftw.c winsup/cygwin/libc/getopt.c winsup/cygwin/libc/inet_addr.c winsup/cygwin/libc/inet_network.c winsup/cygwin/libc/minires-os-if.c winsup/cygwin/libc/minires.c winsup/cygwin/libc/minires.h winsup/cygwin/libc/nftw.c winsup/cygwin/libc/rcmd.cc winsup/cygwin/libc/rexec.cc winsup/cygwin/libc/strptime.cc winsup/cygwin/libc/xsique.cc winsup/cygwin/libstdcxx_wrapper.cc winsup/cygwin/localtime.cc winsup/cygwin/lsearch.cc winsup/cygwin/malloc.cc winsup/cygwin/malloc_wrapper.cc winsup/cygwin/mcount.c winsup/cygwin/miscfuncs.cc winsup/cygwin/miscfuncs.h winsup/cygwin/mkglobals_h winsup/cygwin/mkimport winsup/cygwin/mkstatic winsup/cygwin/mktemp.cc winsup/cygwin/mkvers.sh winsup/cygwin/mmap.cc winsup/cygwin/mmap_helper.h winsup/cygwin/mount.cc winsup/cygwin/mount.h winsup/cygwin/msg.cc winsup/cygwin/mtinfo.h winsup/cygwin/net.cc winsup/cygwin/netdb.cc winsup/cygwin/nfs.cc winsup/cygwin/nfs.h winsup/cygwin/ntdll.h winsup/cygwin/ntea.cc winsup/cygwin/passwd.cc winsup/cygwin/path.cc winsup/cygwin/path.h winsup/cygwin/path.sgml winsup/cygwin/perprocess.h winsup/cygwin/pinfo.cc winsup/cygwin/pinfo.h winsup/cygwin/pipe.cc winsup/cygwin/poll.cc winsup/cygwin/posix.sgml winsup/cygwin/posix_ipc.cc winsup/cygwin/profil.c winsup/cygwin/profil.h winsup/cygwin/pseudo-reloc.cc winsup/cygwin/pthread.cc winsup/cygwin/pwdgrp.h winsup/cygwin/random.cc winsup/cygwin/regex/COPYRIGHT winsup/cygwin/regex/cclass.h winsup/cygwin/regex/cname.h winsup/cygwin/regex/engine.c winsup/cygwin/regex/engine.ih winsup/cygwin/regex/mkh winsup/cygwin/regex/regcomp.c winsup/cygwin/regex/regcomp.ih winsup/cygwin/regex/regerror.c winsup/cygwin/regex/regerror.ih winsup/cygwin/regex/regex.3 winsup/cygwin/regex/regex.7 winsup/cygwin/regex/regex.h winsup/cygwin/regex/regex2.h winsup/cygwin/regex/regexec.c winsup/cygwin/regex/regfree.c winsup/cygwin/regex/tests winsup/cygwin/regex/utils.h winsup/cygwin/registry.cc winsup/cygwin/registry.h winsup/cygwin/resource.cc winsup/cygwin/scandir.cc winsup/cygwin/sched.cc winsup/cygwin/sec_acl.cc winsup/cygwin/sec_auth.cc winsup/cygwin/sec_helper.cc winsup/cygwin/security.cc winsup/cygwin/security.h winsup/cygwin/security.sgml winsup/cygwin/select.cc winsup/cygwin/select.h winsup/cygwin/sem.cc winsup/cygwin/setlsapwd.cc winsup/cygwin/shared.cc winsup/cygwin/shared_info.h winsup/cygwin/shm.cc winsup/cygwin/signal.cc winsup/cygwin/sigproc.cc winsup/cygwin/sigproc.h winsup/cygwin/smallprint.cc winsup/cygwin/sortdin winsup/cygwin/spawn.cc winsup/cygwin/speclib winsup/cygwin/stackdump.sgml winsup/cygwin/strace.cc winsup/cygwin/strfuncs.cc winsup/cygwin/string.h winsup/cygwin/strsep.cc winsup/cygwin/strsig.cc winsup/cygwin/sync.cc winsup/cygwin/sync.h winsup/cygwin/syscalls.cc winsup/cygwin/sysconf.cc winsup/cygwin/syslog.cc winsup/cygwin/termios.cc winsup/cygwin/textmode.c winsup/cygwin/textreadmode.c winsup/cygwin/thread.cc winsup/cygwin/thread.h winsup/cygwin/timer.cc winsup/cygwin/times.cc winsup/cygwin/tls_pbuf.cc winsup/cygwin/tls_pbuf.h winsup/cygwin/tlsoffsets.h winsup/cygwin/tty.cc winsup/cygwin/tty.h winsup/cygwin/tz_posixrules.h winsup/cygwin/uinfo.cc winsup/cygwin/uname.cc winsup/cygwin/wait.cc winsup/cygwin/wchar.h winsup/cygwin/winbase.h winsup/cygwin/wincap.cc winsup/cygwin/wincap.h winsup/cygwin/window.cc winsup/cygwin/winf.cc winsup/cygwin/winf.h winsup/cygwin/wininfo.h winsup/cygwin/winsup.h winsup/cygwin/winver.rc winsup/doc/ChangeLog winsup/doc/Makefile.in winsup/doc/README winsup/doc/aclocal.m4 winsup/doc/configure winsup/doc/configure.in winsup/doc/cygserver.sgml winsup/doc/cygwin-api.in.sgml winsup/doc/cygwin-ug-net.in.sgml winsup/doc/cygwin-ug.in.sgml winsup/doc/cygwin.dsl winsup/doc/cygwinenv.sgml winsup/doc/dll.sgml winsup/doc/doctool.c winsup/doc/doctool.txt winsup/doc/effectively.sgml winsup/doc/faq-api.xml winsup/doc/faq-programming.xml winsup/doc/faq-resources.xml winsup/doc/faq-sections.xml winsup/doc/faq-setup.xml winsup/doc/faq-using.xml winsup/doc/faq-what.xml winsup/doc/faq.xml winsup/doc/fhandler-tut.txt winsup/doc/filemodes.sgml winsup/doc/gcc.sgml winsup/doc/gdb.sgml winsup/doc/legal.sgml winsup/doc/new-features.sgml winsup/doc/ntsec.sgml winsup/doc/overview.sgml winsup/doc/overview2.sgml winsup/doc/pathnames.sgml winsup/doc/programming.sgml winsup/doc/setup-net.sgml winsup/doc/setup.sgml winsup/doc/setup2.sgml winsup/doc/textbinary.sgml winsup/doc/using.sgml winsup/doc/windres.sgml winsup/lsaauth/ChangeLog winsup/lsaauth/Makefile.in winsup/lsaauth/aclocal.m4 winsup/lsaauth/configure winsup/lsaauth/configure.in winsup/lsaauth/cyglsa-config winsup/lsaauth/cyglsa.c winsup/lsaauth/cyglsa.din winsup/lsaauth/cyglsa64.dll winsup/lsaauth/make-64bit-version-with-visual-c.bat winsup/lsaauth/mslsa.def winsup/mingw/CONTRIBUTORS winsup/mingw/CRT_fp10.c winsup/mingw/CRT_fp8.c winsup/mingw/CRT_noglob.c winsup/mingw/CRTfmode.c winsup/mingw/CRTglob.c winsup/mingw/CRTinit.c winsup/mingw/ChangeLog winsup/mingw/DISCLAIMER winsup/mingw/Makefile.in winsup/mingw/README winsup/mingw/TODO winsup/mingw/aclocal.m4 winsup/mingw/binmode.c winsup/mingw/config.guess winsup/mingw/config.sub winsup/mingw/configure winsup/mingw/configure.in winsup/mingw/cpu_features.c winsup/mingw/cpu_features.h winsup/mingw/crt1.c winsup/mingw/crtdll.def winsup/mingw/crtmt.c winsup/mingw/crtst.c winsup/mingw/dllcrt1.c winsup/mingw/dllmain.c winsup/mingw/gccmain.c winsup/mingw/include/_mingw.h winsup/mingw/include/assert.h winsup/mingw/include/complex.h winsup/mingw/include/conio.h winsup/mingw/include/ctype.h winsup/mingw/include/dir.h winsup/mingw/include/direct.h winsup/mingw/include/dirent.h winsup/mingw/include/dos.h winsup/mingw/include/errno.h winsup/mingw/include/excpt.h winsup/mingw/include/fcntl.h winsup/mingw/include/fenv.h winsup/mingw/include/float.h winsup/mingw/include/getopt.h winsup/mingw/include/inttypes.h winsup/mingw/include/io.h winsup/mingw/include/libgen.h winsup/mingw/include/limits.h winsup/mingw/include/locale.h winsup/mingw/include/malloc.h winsup/mingw/include/math.h winsup/mingw/include/mbctype.h winsup/mingw/include/mbstring.h winsup/mingw/include/mem.h winsup/mingw/include/memory.h winsup/mingw/include/process.h winsup/mingw/include/search.h winsup/mingw/include/setjmp.h winsup/mingw/include/share.h winsup/mingw/include/signal.h winsup/mingw/include/stdint.h winsup/mingw/include/stdio.h winsup/mingw/include/stdlib.h winsup/mingw/include/string.h winsup/mingw/include/strings.h winsup/mingw/include/sys/fcntl.h winsup/mingw/include/sys/file.h winsup/mingw/include/sys/locking.h winsup/mingw/include/sys/param.h winsup/mingw/include/sys/stat.h winsup/mingw/include/sys/time.h winsup/mingw/include/sys/timeb.h winsup/mingw/include/sys/types.h winsup/mingw/include/sys/unistd.h winsup/mingw/include/sys/utime.h winsup/mingw/include/tchar.h winsup/mingw/include/time.h winsup/mingw/include/unistd.h winsup/mingw/include/utime.h winsup/mingw/include/values.h winsup/mingw/include/varargs.h winsup/mingw/include/wchar.h winsup/mingw/include/wctype.h winsup/mingw/init.c winsup/mingw/install-sh winsup/mingw/isascii.c winsup/mingw/iscsym.c winsup/mingw/iscsymf.c winsup/mingw/jamfile winsup/mingw/main.c winsup/mingw/man/dirname.man winsup/mingw/mingwex/Makefile.in winsup/mingw/mingwex/_Exit.c winsup/mingw/mingwex/atoll.c winsup/mingw/mingwex/basename.c winsup/mingw/mingwex/btowc.c winsup/mingw/mingwex/complex/cabs.c winsup/mingw/mingwex/complex/cabsf.c winsup/mingw/mingwex/complex/cabsl.c winsup/mingw/mingwex/complex/cacos.c winsup/mingw/mingwex/complex/cacosf.c winsup/mingw/mingwex/complex/cacosh.c winsup/mingw/mingwex/complex/cacoshf.c winsup/mingw/mingwex/complex/cacoshl.c winsup/mingw/mingwex/complex/cacosl.c winsup/mingw/mingwex/complex/carg.c winsup/mingw/mingwex/complex/cargf.c winsup/mingw/mingwex/complex/cargl.c winsup/mingw/mingwex/complex/casin.c winsup/mingw/mingwex/complex/casinf.c winsup/mingw/mingwex/complex/casinh.c winsup/mingw/mingwex/complex/casinhf.c winsup/mingw/mingwex/complex/casinhl.c winsup/mingw/mingwex/complex/casinl.c winsup/mingw/mingwex/complex/catan.c winsup/mingw/mingwex/complex/catanf.c winsup/mingw/mingwex/complex/catanh.c winsup/mingw/mingwex/complex/catanhf.c winsup/mingw/mingwex/complex/catanhl.c winsup/mingw/mingwex/complex/catanl.c winsup/mingw/mingwex/complex/ccos.c winsup/mingw/mingwex/complex/ccosf.c winsup/mingw/mingwex/complex/ccosh.c winsup/mingw/mingwex/complex/ccoshf.c winsup/mingw/mingwex/complex/ccoshl.c winsup/mingw/mingwex/complex/ccosl.c winsup/mingw/mingwex/complex/cexp.c winsup/mingw/mingwex/complex/cexpf.c winsup/mingw/mingwex/complex/cexpl.c winsup/mingw/mingwex/complex/cimag.c winsup/mingw/mingwex/complex/cimagf.c winsup/mingw/mingwex/complex/cimagl.c winsup/mingw/mingwex/complex/clog.c winsup/mingw/mingwex/complex/clogf.c winsup/mingw/mingwex/complex/clogl.c winsup/mingw/mingwex/complex/cpow.c winsup/mingw/mingwex/complex/cpowf.c winsup/mingw/mingwex/complex/cpowl.c winsup/mingw/mingwex/complex/cproj.c winsup/mingw/mingwex/complex/cprojf.c winsup/mingw/mingwex/complex/cprojl.c winsup/mingw/mingwex/complex/creal.c winsup/mingw/mingwex/complex/crealf.c winsup/mingw/mingwex/complex/creall.c winsup/mingw/mingwex/complex/csin.c winsup/mingw/mingwex/complex/csinf.c winsup/mingw/mingwex/complex/csinh.c winsup/mingw/mingwex/complex/csinhf.c winsup/mingw/mingwex/complex/csinhl.c winsup/mingw/mingwex/complex/csinl.c winsup/mingw/mingwex/complex/csqrt.c winsup/mingw/mingwex/complex/csqrtf.c winsup/mingw/mingwex/complex/csqrtl.c winsup/mingw/mingwex/complex/ctan.c winsup/mingw/mingwex/complex/ctanf.c winsup/mingw/mingwex/complex/ctanh.c winsup/mingw/mingwex/complex/ctanhf.c winsup/mingw/mingwex/complex/ctanhl.c winsup/mingw/mingwex/complex/ctanl.c winsup/mingw/mingwex/dirent.c winsup/mingw/mingwex/dirname.c winsup/mingw/mingwex/feclearexcept.c winsup/mingw/mingwex/fegetenv.c winsup/mingw/mingwex/fegetexceptflag.c winsup/mingw/mingwex/fegetround.c winsup/mingw/mingwex/feholdexcept.c winsup/mingw/mingwex/feraiseexcept.c winsup/mingw/mingwex/fesetenv.c winsup/mingw/mingwex/fesetexceptflag.c winsup/mingw/mingwex/fesetround.c winsup/mingw/mingwex/fetestexcept.c winsup/mingw/mingwex/feupdateenv.c winsup/mingw/mingwex/ftruncate.c winsup/mingw/mingwex/fwide.c winsup/mingw/mingwex/gdtoa/README winsup/mingw/mingwex/gdtoa/README.mingw winsup/mingw/mingwex/gdtoa/arithchk.c winsup/mingw/mingwex/gdtoa/dmisc.c winsup/mingw/mingwex/gdtoa/dtoa.c winsup/mingw/mingwex/gdtoa/g__fmt.c winsup/mingw/mingwex/gdtoa/g_dfmt.c winsup/mingw/mingwex/gdtoa/g_ffmt.c winsup/mingw/mingwex/gdtoa/g_xfmt.c winsup/mingw/mingwex/gdtoa/gd_arith.h winsup/mingw/mingwex/gdtoa/gd_qnan.h winsup/mingw/mingwex/gdtoa/gdtoa.c winsup/mingw/mingwex/gdtoa/gdtoa.h winsup/mingw/mingwex/gdtoa/gdtoa_fltrnds.h winsup/mingw/mingwex/gdtoa/gdtoaimp.h winsup/mingw/mingwex/gdtoa/gethex.c winsup/mingw/mingwex/gdtoa/gmisc.c winsup/mingw/mingwex/gdtoa/hd_init.c winsup/mingw/mingwex/gdtoa/hexnan.c winsup/mingw/mingwex/gdtoa/misc.c winsup/mingw/mingwex/gdtoa/qnan.c winsup/mingw/mingwex/gdtoa/smisc.c winsup/mingw/mingwex/gdtoa/strtodg.c winsup/mingw/mingwex/gdtoa/strtodnrp.c winsup/mingw/mingwex/gdtoa/strtof.c winsup/mingw/mingwex/gdtoa/strtopx.c winsup/mingw/mingwex/gdtoa/sum.c winsup/mingw/mingwex/gdtoa/ulp.c winsup/mingw/mingwex/getopt.c winsup/mingw/mingwex/gettimeofday.c winsup/mingw/mingwex/imaxabs.c winsup/mingw/mingwex/imaxdiv.c winsup/mingw/mingwex/isblank.c winsup/mingw/mingwex/iswblank.c winsup/mingw/mingwex/lltoa.c winsup/mingw/mingwex/lltow.c winsup/mingw/mingwex/math/acosf.c winsup/mingw/mingwex/math/acosh.c winsup/mingw/mingwex/math/acoshf.c winsup/mingw/mingwex/math/acoshl.c winsup/mingw/mingwex/math/acosl.c winsup/mingw/mingwex/math/asinf.c winsup/mingw/mingwex/math/asinh.c winsup/mingw/mingwex/math/asinhf.c winsup/mingw/mingwex/math/asinhl.c winsup/mingw/mingwex/math/asinl.c winsup/mingw/mingwex/math/atan2f.c winsup/mingw/mingwex/math/atan2l.c winsup/mingw/mingwex/math/atanf.c winsup/mingw/mingwex/math/atanh.c winsup/mingw/mingwex/math/atanhf.c winsup/mingw/mingwex/math/atanhl.c winsup/mingw/mingwex/math/atanl.c winsup/mingw/mingwex/math/cbrt.c winsup/mingw/mingwex/math/cbrtf.c winsup/mingw/mingwex/math/cbrtl.c winsup/mingw/mingwex/math/ceilf.S winsup/mingw/mingwex/math/ceill.S winsup/mingw/mingwex/math/cephes_mconf.h winsup/mingw/mingwex/math/copysign.S winsup/mingw/mingwex/math/copysignf.S winsup/mingw/mingwex/math/copysignl.S winsup/mingw/mingwex/math/cosf.S winsup/mingw/mingwex/math/coshf.c winsup/mingw/mingwex/math/coshl.c winsup/mingw/mingwex/math/cosl.S winsup/mingw/mingwex/math/erfl.c winsup/mingw/mingwex/math/exp2.S winsup/mingw/mingwex/math/exp2f.S winsup/mingw/mingwex/math/exp2l.S winsup/mingw/mingwex/math/expf.c winsup/mingw/mingwex/math/expl.c winsup/mingw/mingwex/math/expm1.c winsup/mingw/mingwex/math/expm1f.c winsup/mingw/mingwex/math/expm1l.c winsup/mingw/mingwex/math/fabs.c winsup/mingw/mingwex/math/fabsf.c winsup/mingw/mingwex/math/fabsl.c winsup/mingw/mingwex/math/fastmath.h winsup/mingw/mingwex/math/fdim.c winsup/mingw/mingwex/math/fdimf.c winsup/mingw/mingwex/math/fdiml.c winsup/mingw/mingwex/math/floorf.S winsup/mingw/mingwex/math/floorl.S winsup/mingw/mingwex/math/fma.S winsup/mingw/mingwex/math/fmaf.S winsup/mingw/mingwex/math/fmal.c winsup/mingw/mingwex/math/fmax.c winsup/mingw/mingwex/math/fmaxf.c winsup/mingw/mingwex/math/fmaxl.c winsup/mingw/mingwex/math/fmin.c winsup/mingw/mingwex/math/fminf.c winsup/mingw/mingwex/math/fminl.c winsup/mingw/mingwex/math/fmodf.c winsup/mingw/mingwex/math/fmodl.c winsup/mingw/mingwex/math/fp_consts.c winsup/mingw/mingwex/math/fp_consts.h winsup/mingw/mingwex/math/fp_constsf.c winsup/mingw/mingwex/math/fp_constsl.c winsup/mingw/mingwex/math/fpclassify.c winsup/mingw/mingwex/math/fpclassifyf.c winsup/mingw/mingwex/math/fpclassifyl.c winsup/mingw/mingwex/math/frexpf.c winsup/mingw/mingwex/math/frexpl.S winsup/mingw/mingwex/math/fucom.c winsup/mingw/mingwex/math/hypotf.c winsup/mingw/mingwex/math/hypotl.c winsup/mingw/mingwex/math/ilogb.S winsup/mingw/mingwex/math/ilogbf.S winsup/mingw/mingwex/math/ilogbl.S winsup/mingw/mingwex/math/isnan.c winsup/mingw/mingwex/math/isnanf.c winsup/mingw/mingwex/math/isnanl.c winsup/mingw/mingwex/math/ldexpf.c winsup/mingw/mingwex/math/ldexpl.c winsup/mingw/mingwex/math/lgamma.c winsup/mingw/mingwex/math/lgammaf.c winsup/mingw/mingwex/math/lgammal.c winsup/mingw/mingwex/math/llrint.c winsup/mingw/mingwex/math/llrintf.c winsup/mingw/mingwex/math/llrintl.c winsup/mingw/mingwex/math/log10f.S winsup/mingw/mingwex/math/log10l.S winsup/mingw/mingwex/math/log1p.S winsup/mingw/mingwex/math/log1pf.S winsup/mingw/mingwex/math/log1pl.S winsup/mingw/mingwex/math/log2.S winsup/mingw/mingwex/math/log2f.S winsup/mingw/mingwex/math/log2l.S winsup/mingw/mingwex/math/logb.c winsup/mingw/mingwex/math/logbf.c winsup/mingw/mingwex/math/logbl.c winsup/mingw/mingwex/math/logf.S winsup/mingw/mingwex/math/logl.S winsup/mingw/mingwex/math/lrint.c winsup/mingw/mingwex/math/lrintf.c winsup/mingw/mingwex/math/lrintl.c winsup/mingw/mingwex/math/lround_generic.c winsup/mingw/mingwex/math/modff.c winsup/mingw/mingwex/math/modfl.c winsup/mingw/mingwex/math/nearbyint.S winsup/mingw/mingwex/math/nearbyintf.S winsup/mingw/mingwex/math/nearbyintl.S winsup/mingw/mingwex/math/nextafterf.c winsup/mingw/mingwex/math/nextafterl.c winsup/mingw/mingwex/math/nexttoward.c winsup/mingw/mingwex/math/nexttowardf.c winsup/mingw/mingwex/math/pow.c winsup/mingw/mingwex/math/powf.c winsup/mingw/mingwex/math/powi.c winsup/mingw/mingwex/math/powif.c winsup/mingw/mingwex/math/powil.c winsup/mingw/mingwex/math/powl.c winsup/mingw/mingwex/math/remainder.S winsup/mingw/mingwex/math/remainderf.S winsup/mingw/mingwex/math/remainderl.S winsup/mingw/mingwex/math/remquo.S winsup/mingw/mingwex/math/remquof.S winsup/mingw/mingwex/math/remquol.S winsup/mingw/mingwex/math/rint.c winsup/mingw/mingwex/math/rintf.c winsup/mingw/mingwex/math/rintl.c winsup/mingw/mingwex/math/round_generic.c winsup/mingw/mingwex/math/round_internal.h winsup/mingw/mingwex/math/s_erf.c winsup/mingw/mingwex/math/scalbn.S winsup/mingw/mingwex/math/scalbnf.S winsup/mingw/mingwex/math/scalbnl.S winsup/mingw/mingwex/math/sf_erf.c winsup/mingw/mingwex/math/signbit.c winsup/mingw/mingwex/math/signbitf.c winsup/mingw/mingwex/math/signbitl.c winsup/mingw/mingwex/math/sinf.S winsup/mingw/mingwex/math/sinhf.c winsup/mingw/mingwex/math/sinhl.c winsup/mingw/mingwex/math/sinl.S winsup/mingw/mingwex/math/sqrtf.c winsup/mingw/mingwex/math/sqrtl.c winsup/mingw/mingwex/math/tanf.S winsup/mingw/mingwex/math/tanhf.c winsup/mingw/mingwex/math/tanhl.c winsup/mingw/mingwex/math/tanl.S winsup/mingw/mingwex/math/tgamma.c winsup/mingw/mingwex/math/tgammaf.c winsup/mingw/mingwex/math/tgammal.c winsup/mingw/mingwex/math/trunc.c winsup/mingw/mingwex/math/truncf.c winsup/mingw/mingwex/math/truncl.c winsup/mingw/mingwex/mb_wc_common.h winsup/mingw/mingwex/mbrtowc.c winsup/mingw/mingwex/mbsinit.c winsup/mingw/mingwex/mingw-aligned-malloc.c winsup/mingw/mingwex/mingw-fseek.c winsup/mingw/mingwex/sitest.c winsup/mingw/mingwex/stdio/fopen64.c winsup/mingw/mingwex/stdio/fprintf.c winsup/mingw/mingwex/stdio/fseeko64.c winsup/mingw/mingwex/stdio/ftello64.c winsup/mingw/mingwex/stdio/lseek64.c winsup/mingw/mingwex/stdio/pformat.c winsup/mingw/mingwex/stdio/pformat.h winsup/mingw/mingwex/stdio/printf.c winsup/mingw/mingwex/stdio/snprintf.c winsup/mingw/mingwex/stdio/snwprintf.c winsup/mingw/mingwex/stdio/sprintf.c winsup/mingw/mingwex/stdio/vfprintf.c winsup/mingw/mingwex/stdio/vfscanf.c winsup/mingw/mingwex/stdio/vfwscanf.c winsup/mingw/mingwex/stdio/vprintf.c winsup/mingw/mingwex/stdio/vscanf.c winsup/mingw/mingwex/stdio/vsnprintf.c winsup/mingw/mingwex/stdio/vsnwprintf.c winsup/mingw/mingwex/stdio/vsprintf.c winsup/mingw/mingwex/stdio/vsscanf.c winsup/mingw/mingwex/stdio/vswscanf.c winsup/mingw/mingwex/stdio/vwscanf.c winsup/mingw/mingwex/strtoimax.c winsup/mingw/mingwex/strtoumax.c winsup/mingw/mingwex/tdelete.c winsup/mingw/mingwex/testwmem.c winsup/mingw/mingwex/tfind.c winsup/mingw/mingwex/tsearch.c winsup/mingw/mingwex/tst-aligned-malloc.c winsup/mingw/mingwex/twalk.c winsup/mingw/mingwex/ulltoa.c winsup/mingw/mingwex/ulltow.c winsup/mingw/mingwex/usleep.c winsup/mingw/mingwex/wcrtomb.c winsup/mingw/mingwex/wcstof.c winsup/mingw/mingwex/wcstoimax.c winsup/mingw/mingwex/wcstold.c winsup/mingw/mingwex/wcstoumax.c winsup/mingw/mingwex/wctob.c winsup/mingw/mingwex/wctrans.c winsup/mingw/mingwex/wctype.c winsup/mingw/mingwex/wdirent.c winsup/mingw/mingwex/wmemchr.c winsup/mingw/mingwex/wmemcmp.c winsup/mingw/mingwex/wmemcpy.c winsup/mingw/mingwex/wmemmove.c winsup/mingw/mingwex/wmemset.c winsup/mingw/mingwex/wtoll.c winsup/mingw/mkinstalldirs winsup/mingw/moldname.def.in winsup/mingw/msvcrt.def.in winsup/mingw/mthr.c winsup/mingw/mthr_init.c winsup/mingw/mthr_stub.c winsup/mingw/ofmt_stub.s winsup/mingw/profile/COPYING winsup/mingw/profile/CYGWIN_LICENSE winsup/mingw/profile/Makefile.in winsup/mingw/profile/gcrt0.c winsup/mingw/profile/gmon.c winsup/mingw/profile/gmon.h winsup/mingw/profile/mcount.c winsup/mingw/profile/profil.c winsup/mingw/profile/profil.h winsup/mingw/profile/profile.h winsup/mingw/pseudo-reloc-list.c winsup/mingw/pseudo-reloc.c winsup/mingw/readme.txt winsup/mingw/samples/dirent/jamfile winsup/mingw/samples/dirent/test.c winsup/mingw/samples/dirent/wtest.c winsup/mingw/samples/dlltest/dll.c winsup/mingw/samples/dlltest/dll.def winsup/mingw/samples/dlltest/dll.h winsup/mingw/samples/dlltest/exe.c winsup/mingw/samples/dlltest/exe.exp winsup/mingw/samples/dlltest/expexe.c winsup/mingw/samples/dlltest/expexe.def winsup/mingw/samples/dlltest/jamfile winsup/mingw/samples/dlltest/loaddll.c winsup/mingw/samples/dlltest/loadexe.c winsup/mingw/samples/dlltest/readme.txt winsup/mingw/samples/dlltest/silly.cpp winsup/mingw/samples/dlltest/silly.def winsup/mingw/samples/dlltest/silly.exp winsup/mingw/samples/dlltest/silly.h winsup/mingw/samples/dlltest/sillydll.cpp winsup/mingw/samples/filehand/filehand.c winsup/mingw/samples/filehand/jamfile winsup/mingw/samples/filehand/junk.txt winsup/mingw/samples/fixargv/fixargv.c winsup/mingw/samples/fixargv/fixargv.h winsup/mingw/samples/fixargv/readme.txt winsup/mingw/samples/fmode/all.c winsup/mingw/samples/fmode/jamfile winsup/mingw/samples/fmode/readme.txt winsup/mingw/samples/fmode/test.c winsup/mingw/samples/fmode/test2.c winsup/mingw/samples/globbing/glob.c winsup/mingw/samples/globbing/jamfile winsup/mingw/samples/globbing/noglob.c winsup/mingw/samples/globbing/readme.txt winsup/mingw/samples/print/jamfile winsup/mingw/samples/print/prntest.c winsup/mingw/samples/seh/eh3.c winsup/mingw/samples/seh/exutil.c winsup/mingw/samples/seh/exutil.def winsup/mingw/samples/seh/exutil.h winsup/mingw/samples/seh/jamfile winsup/mingw/samples/seh/sehfix.c winsup/mingw/samples/seh/sehsub.c winsup/mingw/samples/seh/sehtest.c winsup/mingw/samples/simpledll/dll.c winsup/mingw/samples/simpledll/dll.cpp winsup/mingw/samples/simpledll/dll.def winsup/mingw/samples/simpledll/exe.c winsup/mingw/samples/simpledll/jamfile winsup/mingw/samples/simpledll/makedll.bat winsup/mingw/samples/test/jamfile winsup/mingw/samples/test/test.c winsup/mingw/samples/wintest/jamfile winsup/mingw/samples/wintest/test.c winsup/mingw/strcasecmp.c winsup/mingw/strncasecmp.c winsup/mingw/test_headers.c winsup/mingw/toascii.c winsup/mingw/txtmode.c winsup/mingw/wcscmpi.c winsup/testsuite/ChangeLog winsup/testsuite/Makefile.in winsup/testsuite/README winsup/testsuite/aclocal.m4 winsup/testsuite/config/default.exp winsup/testsuite/configure winsup/testsuite/configure.in winsup/testsuite/cygrun.c winsup/testsuite/libltp/include/dataascii.h winsup/testsuite/libltp/include/databin.h winsup/testsuite/libltp/include/file_lock.h winsup/testsuite/libltp/include/forker.h winsup/testsuite/libltp/include/open_flags.h winsup/testsuite/libltp/include/pattern.h winsup/testsuite/libltp/include/random_range.h winsup/testsuite/libltp/include/rmobj.h winsup/testsuite/libltp/include/search_path.h winsup/testsuite/libltp/include/str_to_bytes.h winsup/testsuite/libltp/include/string_to_tokens.h winsup/testsuite/libltp/include/test.h winsup/testsuite/libltp/include/tlibio.h winsup/testsuite/libltp/include/usctest.h winsup/testsuite/libltp/include/write_log.h winsup/testsuite/libltp/lib/dataascii.c winsup/testsuite/libltp/lib/databin.c winsup/testsuite/libltp/lib/datapid.c winsup/testsuite/libltp/lib/forker.c winsup/testsuite/libltp/lib/get_high_address.c winsup/testsuite/libltp/lib/libtestsuite.c winsup/testsuite/libltp/lib/open_flags.c winsup/testsuite/libltp/lib/parse_opts.c winsup/testsuite/libltp/lib/pattern.c winsup/testsuite/libltp/lib/rmobj.c winsup/testsuite/libltp/lib/search_path.c winsup/testsuite/libltp/lib/str_to_bytes.c winsup/testsuite/libltp/lib/string_to_tokens.c winsup/testsuite/libltp/lib/tst_res.c winsup/testsuite/libltp/lib/tst_sig.c winsup/testsuite/libltp/lib/tst_tmpdir.c winsup/testsuite/libltp/lib/write_log.c winsup/testsuite/winsup.api/checksignal.c winsup/testsuite/winsup.api/crlf.c winsup/testsuite/winsup.api/cygload.cc winsup/testsuite/winsup.api/cygload.exp winsup/testsuite/winsup.api/cygload.h winsup/testsuite/winsup.api/devdsp.c winsup/testsuite/winsup.api/devdsp_okay.h winsup/testsuite/winsup.api/devzero.c winsup/testsuite/winsup.api/iospeed.c winsup/testsuite/winsup.api/known_bugs.tcl winsup/testsuite/winsup.api/ltp/access01.c winsup/testsuite/winsup.api/ltp/access03.c winsup/testsuite/winsup.api/ltp/access04.c winsup/testsuite/winsup.api/ltp/access05.c winsup/testsuite/winsup.api/ltp/alarm01.c winsup/testsuite/winsup.api/ltp/alarm02.c winsup/testsuite/winsup.api/ltp/alarm03.c winsup/testsuite/winsup.api/ltp/alarm07.c winsup/testsuite/winsup.api/ltp/asyncio02.c winsup/testsuite/winsup.api/ltp/chdir02.c winsup/testsuite/winsup.api/ltp/chdir04.c winsup/testsuite/winsup.api/ltp/chmod01.c winsup/testsuite/winsup.api/ltp/chmod02.c winsup/testsuite/winsup.api/ltp/chown01.c winsup/testsuite/winsup.api/ltp/close01.c winsup/testsuite/winsup.api/ltp/close02.c winsup/testsuite/winsup.api/ltp/close08.c winsup/testsuite/winsup.api/ltp/creat01.c winsup/testsuite/winsup.api/ltp/creat03.c winsup/testsuite/winsup.api/ltp/creat09.c winsup/testsuite/winsup.api/ltp/dup01.c winsup/testsuite/winsup.api/ltp/dup02.c winsup/testsuite/winsup.api/ltp/dup03.c winsup/testsuite/winsup.api/ltp/dup04.c winsup/testsuite/winsup.api/ltp/dup05.c winsup/testsuite/winsup.api/ltp/execl01.c winsup/testsuite/winsup.api/ltp/execle01.c winsup/testsuite/winsup.api/ltp/execlp01.c winsup/testsuite/winsup.api/ltp/execv01.c winsup/testsuite/winsup.api/ltp/execve01.c winsup/testsuite/winsup.api/ltp/execvp01.c winsup/testsuite/winsup.api/ltp/exit01.c winsup/testsuite/winsup.api/ltp/exit02.c winsup/testsuite/winsup.api/ltp/fchdir01.c winsup/testsuite/winsup.api/ltp/fchdir02.c winsup/testsuite/winsup.api/ltp/fchmod01.c winsup/testsuite/winsup.api/ltp/fchown01.c winsup/testsuite/winsup.api/ltp/fcntl02.c winsup/testsuite/winsup.api/ltp/fcntl03.c winsup/testsuite/winsup.api/ltp/fcntl04.c winsup/testsuite/winsup.api/ltp/fcntl05.c winsup/testsuite/winsup.api/ltp/fcntl07.c winsup/testsuite/winsup.api/ltp/fcntl07B.c winsup/testsuite/winsup.api/ltp/fcntl08.c winsup/testsuite/winsup.api/ltp/fcntl09.c winsup/testsuite/winsup.api/ltp/fcntl10.c winsup/testsuite/winsup.api/ltp/fork01.c winsup/testsuite/winsup.api/ltp/fork02.c winsup/testsuite/winsup.api/ltp/fork03.c winsup/testsuite/winsup.api/ltp/fork04.c winsup/testsuite/winsup.api/ltp/fork06.c winsup/testsuite/winsup.api/ltp/fork07.c winsup/testsuite/winsup.api/ltp/fork09.c winsup/testsuite/winsup.api/ltp/fork10.c winsup/testsuite/winsup.api/ltp/fork11.c winsup/testsuite/winsup.api/ltp/fpathconf01.c winsup/testsuite/winsup.api/ltp/fstat01.c winsup/testsuite/winsup.api/ltp/fstat02.c winsup/testsuite/winsup.api/ltp/fstat03.c winsup/testsuite/winsup.api/ltp/fstat04.c winsup/testsuite/winsup.api/ltp/fsync01.c winsup/testsuite/winsup.api/ltp/ftruncate01.c winsup/testsuite/winsup.api/ltp/ftruncate02.c winsup/testsuite/winsup.api/ltp/ftruncate03.c winsup/testsuite/winsup.api/ltp/getegid01.c winsup/testsuite/winsup.api/ltp/geteuid01.c winsup/testsuite/winsup.api/ltp/getgid01.c winsup/testsuite/winsup.api/ltp/getgid02.c winsup/testsuite/winsup.api/ltp/getgid03.c winsup/testsuite/winsup.api/ltp/getgroups01.c winsup/testsuite/winsup.api/ltp/getgroups02.c winsup/testsuite/winsup.api/ltp/gethostid01.c winsup/testsuite/winsup.api/ltp/gethostname01.c winsup/testsuite/winsup.api/ltp/getpgid01.c winsup/testsuite/winsup.api/ltp/getpgid02.c winsup/testsuite/winsup.api/ltp/getpgrp01.c winsup/testsuite/winsup.api/ltp/getpid01.c winsup/testsuite/winsup.api/ltp/getpid02.c winsup/testsuite/winsup.api/ltp/getppid01.c winsup/testsuite/winsup.api/ltp/getppid02.c winsup/testsuite/winsup.api/ltp/getuid01.c winsup/testsuite/winsup.api/ltp/getuid02.c winsup/testsuite/winsup.api/ltp/getuid03.c winsup/testsuite/winsup.api/ltp/kill01.c winsup/testsuite/winsup.api/ltp/kill02.c winsup/testsuite/winsup.api/ltp/kill03.c winsup/testsuite/winsup.api/ltp/kill04.c winsup/testsuite/winsup.api/ltp/kill09.c winsup/testsuite/winsup.api/ltp/link02.c winsup/testsuite/winsup.api/ltp/link03.c winsup/testsuite/winsup.api/ltp/link04.c winsup/testsuite/winsup.api/ltp/link05.c winsup/testsuite/winsup.api/ltp/lseek01.c winsup/testsuite/winsup.api/ltp/lseek02.c winsup/testsuite/winsup.api/ltp/lseek03.c winsup/testsuite/winsup.api/ltp/lseek04.c winsup/testsuite/winsup.api/ltp/lseek05.c winsup/testsuite/winsup.api/ltp/lseek06.c winsup/testsuite/winsup.api/ltp/lseek07.c winsup/testsuite/winsup.api/ltp/lseek08.c winsup/testsuite/winsup.api/ltp/lseek09.c winsup/testsuite/winsup.api/ltp/lseek10.c winsup/testsuite/winsup.api/ltp/lstat02.c winsup/testsuite/winsup.api/ltp/mkdir01.c winsup/testsuite/winsup.api/ltp/mkdir08.c winsup/testsuite/winsup.api/ltp/mknod01.c winsup/testsuite/winsup.api/ltp/mmap001.c winsup/testsuite/winsup.api/ltp/mmap02.c winsup/testsuite/winsup.api/ltp/mmap03.c winsup/testsuite/winsup.api/ltp/mmap04.c winsup/testsuite/winsup.api/ltp/mmap05.c winsup/testsuite/winsup.api/ltp/mmap06.c winsup/testsuite/winsup.api/ltp/mmap07.c winsup/testsuite/winsup.api/ltp/mmap08.c winsup/testsuite/winsup.api/ltp/munmap01.c winsup/testsuite/winsup.api/ltp/munmap02.c winsup/testsuite/winsup.api/ltp/nice05.c winsup/testsuite/winsup.api/ltp/open02.c winsup/testsuite/winsup.api/ltp/open03.c winsup/testsuite/winsup.api/ltp/pathconf01.c winsup/testsuite/winsup.api/ltp/pause01.c winsup/testsuite/winsup.api/ltp/pipe01.c winsup/testsuite/winsup.api/ltp/pipe08.c winsup/testsuite/winsup.api/ltp/pipe09.c winsup/testsuite/winsup.api/ltp/pipe10.c winsup/testsuite/winsup.api/ltp/pipe11.c winsup/testsuite/winsup.api/ltp/poll01.c winsup/testsuite/winsup.api/ltp/read01.c winsup/testsuite/winsup.api/ltp/read04.c winsup/testsuite/winsup.api/ltp/readdir01.c winsup/testsuite/winsup.api/ltp/readlink01.c winsup/testsuite/winsup.api/ltp/readlink02.c winsup/testsuite/winsup.api/ltp/readlink03.c winsup/testsuite/winsup.api/ltp/rename01.c winsup/testsuite/winsup.api/ltp/rename02.c winsup/testsuite/winsup.api/ltp/rename08.c winsup/testsuite/winsup.api/ltp/rename10.c winsup/testsuite/winsup.api/ltp/rmdir01.c winsup/testsuite/winsup.api/ltp/rmdir04.c winsup/testsuite/winsup.api/ltp/rmdir05.c winsup/testsuite/winsup.api/ltp/sbrk01.c winsup/testsuite/winsup.api/ltp/select01.c winsup/testsuite/winsup.api/ltp/select02.c winsup/testsuite/winsup.api/ltp/select03.c winsup/testsuite/winsup.api/ltp/setgid01.c winsup/testsuite/winsup.api/ltp/setgroups01.c winsup/testsuite/winsup.api/ltp/setpgid01.c winsup/testsuite/winsup.api/ltp/setregid01.c winsup/testsuite/winsup.api/ltp/setreuid01.c winsup/testsuite/winsup.api/ltp/setuid01.c winsup/testsuite/winsup.api/ltp/setuid02.c winsup/testsuite/winsup.api/ltp/signal03.c winsup/testsuite/winsup.api/ltp/stat01.c winsup/testsuite/winsup.api/ltp/stat02.c winsup/testsuite/winsup.api/ltp/stat03.c winsup/testsuite/winsup.api/ltp/stat05.c winsup/testsuite/winsup.api/ltp/stat06.c winsup/testsuite/winsup.api/ltp/symlink01.c winsup/testsuite/winsup.api/ltp/symlink02.c winsup/testsuite/winsup.api/ltp/symlink03.c winsup/testsuite/winsup.api/ltp/symlink04.c winsup/testsuite/winsup.api/ltp/symlink05.c winsup/testsuite/winsup.api/ltp/sync01.c winsup/testsuite/winsup.api/ltp/sync02.c winsup/testsuite/winsup.api/ltp/time01.c winsup/testsuite/winsup.api/ltp/time02.c winsup/testsuite/winsup.api/ltp/times01.c winsup/testsuite/winsup.api/ltp/times02.c winsup/testsuite/winsup.api/ltp/times03.c winsup/testsuite/winsup.api/ltp/truncate01.c winsup/testsuite/winsup.api/ltp/truncate02.c winsup/testsuite/winsup.api/ltp/ulimit01.c winsup/testsuite/winsup.api/ltp/umask01.c winsup/testsuite/winsup.api/ltp/umask02.c winsup/testsuite/winsup.api/ltp/umask03.c winsup/testsuite/winsup.api/ltp/uname01.c winsup/testsuite/winsup.api/ltp/unlink05.c winsup/testsuite/winsup.api/ltp/unlink06.c winsup/testsuite/winsup.api/ltp/unlink07.c winsup/testsuite/winsup.api/ltp/unlink08.c winsup/testsuite/winsup.api/ltp/vfork01.c winsup/testsuite/winsup.api/ltp/wait02.c winsup/testsuite/winsup.api/ltp/wait401.c winsup/testsuite/winsup.api/ltp/wait402.c winsup/testsuite/winsup.api/ltp/write01.c winsup/testsuite/winsup.api/ltp/write02.c winsup/testsuite/winsup.api/ltp/write03.c winsup/testsuite/winsup.api/mmaptest01.c winsup/testsuite/winsup.api/mmaptest02.c winsup/testsuite/winsup.api/mmaptest03.c winsup/testsuite/winsup.api/mmaptest04.c winsup/testsuite/winsup.api/msgtest.c winsup/testsuite/winsup.api/nullgetcwd.c winsup/testsuite/winsup.api/pthread/cancel1.c winsup/testsuite/winsup.api/pthread/cancel10.c winsup/testsuite/winsup.api/pthread/cancel11.c winsup/testsuite/winsup.api/pthread/cancel12.c winsup/testsuite/winsup.api/pthread/cancel2.c winsup/testsuite/winsup.api/pthread/cancel3.c winsup/testsuite/winsup.api/pthread/cancel4.c winsup/testsuite/winsup.api/pthread/cancel5.c winsup/testsuite/winsup.api/pthread/cancel6.c winsup/testsuite/winsup.api/pthread/cancel7.c winsup/testsuite/winsup.api/pthread/cancel8.c winsup/testsuite/winsup.api/pthread/cancel9.c winsup/testsuite/winsup.api/pthread/cleanup2.c winsup/testsuite/winsup.api/pthread/cleanup3.c winsup/testsuite/winsup.api/pthread/condvar1.c winsup/testsuite/winsup.api/pthread/condvar2.c winsup/testsuite/winsup.api/pthread/condvar2_1.c winsup/testsuite/winsup.api/pthread/condvar3.c winsup/testsuite/winsup.api/pthread/condvar3_1.c winsup/testsuite/winsup.api/pthread/condvar3_2.c winsup/testsuite/winsup.api/pthread/condvar3_3.c winsup/testsuite/winsup.api/pthread/condvar4.c winsup/testsuite/winsup.api/pthread/condvar5.c winsup/testsuite/winsup.api/pthread/condvar6.c winsup/testsuite/winsup.api/pthread/condvar7.c winsup/testsuite/winsup.api/pthread/condvar8.c winsup/testsuite/winsup.api/pthread/condvar9.c winsup/testsuite/winsup.api/pthread/count1.c winsup/testsuite/winsup.api/pthread/create1.c winsup/testsuite/winsup.api/pthread/create2.c winsup/testsuite/winsup.api/pthread/equal1.c winsup/testsuite/winsup.api/pthread/exit1.c winsup/testsuite/winsup.api/pthread/exit2.c winsup/testsuite/winsup.api/pthread/exit3.c winsup/testsuite/winsup.api/pthread/inherit1.c winsup/testsuite/winsup.api/pthread/join0.c winsup/testsuite/winsup.api/pthread/join1.c winsup/testsuite/winsup.api/pthread/join2.c winsup/testsuite/winsup.api/pthread/mainthreadexits.c winsup/testsuite/winsup.api/pthread/mutex1.c winsup/testsuite/winsup.api/pthread/mutex1d.c winsup/testsuite/winsup.api/pthread/mutex1e.c winsup/testsuite/winsup.api/pthread/mutex1n.c winsup/testsuite/winsup.api/pthread/mutex1r.c winsup/testsuite/winsup.api/pthread/mutex2.c winsup/testsuite/winsup.api/pthread/mutex3.c winsup/testsuite/winsup.api/pthread/mutex4.c winsup/testsuite/winsup.api/pthread/mutex5.c winsup/testsuite/winsup.api/pthread/mutex6d.c winsup/testsuite/winsup.api/pthread/mutex6e.c winsup/testsuite/winsup.api/pthread/mutex6n.c winsup/testsuite/winsup.api/pthread/mutex6r.c winsup/testsuite/winsup.api/pthread/mutex7.c winsup/testsuite/winsup.api/pthread/mutex7d.c winsup/testsuite/winsup.api/pthread/mutex7e.c winsup/testsuite/winsup.api/pthread/mutex7n.c winsup/testsuite/winsup.api/pthread/mutex7r.c winsup/testsuite/winsup.api/pthread/mutex8e.c winsup/testsuite/winsup.api/pthread/mutex8n.c winsup/testsuite/winsup.api/pthread/mutex8r.c winsup/testsuite/winsup.api/pthread/once1.c winsup/testsuite/winsup.api/pthread/priority1.c winsup/testsuite/winsup.api/pthread/priority2.c winsup/testsuite/winsup.api/pthread/rwlock1.c winsup/testsuite/winsup.api/pthread/rwlock2.c winsup/testsuite/winsup.api/pthread/rwlock3.c winsup/testsuite/winsup.api/pthread/rwlock4.c winsup/testsuite/winsup.api/pthread/rwlock5.c winsup/testsuite/winsup.api/pthread/rwlock6.c winsup/testsuite/winsup.api/pthread/rwlock7.c winsup/testsuite/winsup.api/pthread/self1.c winsup/testsuite/winsup.api/pthread/self2.c winsup/testsuite/winsup.api/pthread/test.h winsup/testsuite/winsup.api/pthread/threadidafterfork.c winsup/testsuite/winsup.api/pthread/tsd1.c winsup/testsuite/winsup.api/resethand.c winsup/testsuite/winsup.api/samples/sample-fail.c winsup/testsuite/winsup.api/samples/sample-miscompile.c winsup/testsuite/winsup.api/samples/sample-pass.c winsup/testsuite/winsup.api/semtest.c winsup/testsuite/winsup.api/shmtest.c winsup/testsuite/winsup.api/sigchld.c winsup/testsuite/winsup.api/signal-into-win32-api.c winsup/testsuite/winsup.api/systemcall.c winsup/testsuite/winsup.api/user_malloc.c winsup/testsuite/winsup.api/waitpid.c winsup/testsuite/winsup.api/winsup.exp winsup/utils/COPYING.dumper winsup/utils/ChangeLog winsup/utils/ChangeLog-2000 winsup/utils/Makefile.in winsup/utils/aclocal.m4 winsup/utils/bloda.cc winsup/utils/configure winsup/utils/configure.in winsup/utils/cygcheck.cc winsup/utils/cygpath.cc winsup/utils/cygwin-console-helper.cc winsup/utils/dump_setup.cc winsup/utils/dumper.cc winsup/utils/dumper.h winsup/utils/getfacl.c winsup/utils/kill.cc winsup/utils/ldd.cc winsup/utils/ldh.cc winsup/utils/mingw winsup/utils/mkgroup.c winsup/utils/mkpasswd.c winsup/utils/module_info.cc winsup/utils/mount.cc winsup/utils/parse_pe.cc winsup/utils/passwd.c winsup/utils/path.cc winsup/utils/path.h winsup/utils/ps.cc winsup/utils/regtool.cc winsup/utils/setfacl.c winsup/utils/setmetamode.c winsup/utils/ssp.c winsup/utils/ssp.txt winsup/utils/strace.cc winsup/utils/testsuite.cc winsup/utils/testsuite.h winsup/utils/umount.cc winsup/utils/utils.sgml winsup/utils/wide_path.h winsup/w32api/CONTRIBUTIONS winsup/w32api/ChangeLog winsup/w32api/Makefile.in winsup/w32api/README.w32api winsup/w32api/TODO winsup/w32api/aclocal.m4 winsup/w32api/config.guess winsup/w32api/config.sub winsup/w32api/configure winsup/w32api/configure.in winsup/w32api/include/GL/gl.h winsup/w32api/include/GL/glext.h winsup/w32api/include/GL/glu.h winsup/w32api/include/accctrl.h winsup/w32api/include/aclapi.h winsup/w32api/include/aclui.h winsup/w32api/include/adsprop.h winsup/w32api/include/afxres.h winsup/w32api/include/amaudio.h winsup/w32api/include/amvideo.h winsup/w32api/include/audevcod.h winsup/w32api/include/aviriff.h winsup/w32api/include/aygshell.h winsup/w32api/include/basetsd.h winsup/w32api/include/basetyps.h winsup/w32api/include/bdatypes.h winsup/w32api/include/cderr.h winsup/w32api/include/cguid.h winsup/w32api/include/cmnquery.h winsup/w32api/include/comcat.h winsup/w32api/include/commctrl.h winsup/w32api/include/commdlg.h winsup/w32api/include/control.h winsup/w32api/include/cpl.h winsup/w32api/include/cplext.h winsup/w32api/include/custcntl.h winsup/w32api/include/dbt.h winsup/w32api/include/dde.h winsup/w32api/include/ddeml.h winsup/w32api/include/ddk/atm.h winsup/w32api/include/ddk/batclass.h winsup/w32api/include/ddk/cfg.h winsup/w32api/include/ddk/cfgmgr32.h winsup/w32api/include/ddk/d4drvif.h winsup/w32api/include/ddk/d4iface.h winsup/w32api/include/ddk/ddkmapi.h winsup/w32api/include/ddk/hidclass.h winsup/w32api/include/ddk/hidpi.h winsup/w32api/include/ddk/hidsdi.h winsup/w32api/include/ddk/hidusage.h winsup/w32api/include/ddk/kbdmou.h winsup/w32api/include/ddk/mcd.h winsup/w32api/include/ddk/miniport.h winsup/w32api/include/ddk/minitape.h winsup/w32api/include/ddk/mountdev.h winsup/w32api/include/ddk/mountmgr.h winsup/w32api/include/ddk/ndis.h winsup/w32api/include/ddk/ndisguid.h winsup/w32api/include/ddk/ndistapi.h winsup/w32api/include/ddk/ndiswan.h winsup/w32api/include/ddk/netevent.h winsup/w32api/include/ddk/netpnp.h winsup/w32api/include/ddk/newdev.h winsup/w32api/include/ddk/ntapi.h winsup/w32api/include/ddk/ntdd8042.h winsup/w32api/include/ddk/ntddbeep.h winsup/w32api/include/ddk/ntddcdrm.h winsup/w32api/include/ddk/ntddcdvd.h winsup/w32api/include/ddk/ntddchgr.h winsup/w32api/include/ddk/ntdddisk.h winsup/w32api/include/ddk/ntddk.h winsup/w32api/include/ddk/ntddkbd.h winsup/w32api/include/ddk/ntddmou.h winsup/w32api/include/ddk/ntddndis.h winsup/w32api/include/ddk/ntddpar.h winsup/w32api/include/ddk/ntddpcm.h winsup/w32api/include/ddk/ntddscsi.h winsup/w32api/include/ddk/ntddser.h winsup/w32api/include/ddk/ntddstor.h winsup/w32api/include/ddk/ntddtape.h winsup/w32api/include/ddk/ntddtdi.h winsup/w32api/include/ddk/ntddvdeo.h winsup/w32api/include/ddk/ntddvol.h winsup/w32api/include/ddk/ntifs.h winsup/w32api/include/ddk/ntpoapi.h winsup/w32api/include/ddk/ntstatus.h winsup/w32api/include/ddk/parallel.h winsup/w32api/include/ddk/pfhook.h winsup/w32api/include/ddk/poclass.h winsup/w32api/include/ddk/scsi.h winsup/w32api/include/ddk/scsiscan.h winsup/w32api/include/ddk/scsiwmi.h winsup/w32api/include/ddk/smbus.h winsup/w32api/include/ddk/srb.h winsup/w32api/include/ddk/storport.h winsup/w32api/include/ddk/tdi.h winsup/w32api/include/ddk/tdiinfo.h winsup/w32api/include/ddk/tdikrnl.h winsup/w32api/include/ddk/tdistat.h winsup/w32api/include/ddk/tvout.h winsup/w32api/include/ddk/upssvc.h winsup/w32api/include/ddk/usb.h winsup/w32api/include/ddk/usb100.h winsup/w32api/include/ddk/usbcamdi.h winsup/w32api/include/ddk/usbdi.h winsup/w32api/include/ddk/usbioctl.h winsup/w32api/include/ddk/usbiodef.h winsup/w32api/include/ddk/usbscan.h winsup/w32api/include/ddk/usbuser.h winsup/w32api/include/ddk/video.h winsup/w32api/include/ddk/videoagp.h winsup/w32api/include/ddk/win2k.h winsup/w32api/include/ddk/winddi.h winsup/w32api/include/ddk/winddk.h winsup/w32api/include/ddk/winnt4.h winsup/w32api/include/ddk/winxp.h winsup/w32api/include/ddk/ws2san.h winsup/w32api/include/ddk/xfilter.h winsup/w32api/include/devguid.h winsup/w32api/include/dhcpcsdk.h winsup/w32api/include/directx/d3d9.h winsup/w32api/include/directx/d3d9caps.h winsup/w32api/include/directx/d3d9types.h winsup/w32api/include/directx/dxerr8.h winsup/w32api/include/directx/dxerr9.h winsup/w32api/include/dlgs.h winsup/w32api/include/docobj.h winsup/w32api/include/dsadmin.h winsup/w32api/include/dsclient.h winsup/w32api/include/dsgetdc.h winsup/w32api/include/dshow.h winsup/w32api/include/dsquery.h winsup/w32api/include/dsrole.h winsup/w32api/include/dvdevcod.h winsup/w32api/include/dvdmedia.h winsup/w32api/include/edevdefs.h winsup/w32api/include/errorrep.h winsup/w32api/include/errors.h winsup/w32api/include/evcode.h winsup/w32api/include/exdisp.h winsup/w32api/include/exdispid.h winsup/w32api/include/fltdefs.h winsup/w32api/include/httpext.h winsup/w32api/include/icm.h winsup/w32api/include/idispids.h winsup/w32api/include/il21dec.h winsup/w32api/include/imagehlp.h winsup/w32api/include/imm.h winsup/w32api/include/initguid.h winsup/w32api/include/intshcut.h winsup/w32api/include/ipexport.h winsup/w32api/include/iphlpapi.h winsup/w32api/include/ipifcons.h winsup/w32api/include/ipinfoid.h winsup/w32api/include/iprtrmib.h winsup/w32api/include/iptypes.h winsup/w32api/include/ipxconst.h winsup/w32api/include/ipxrtdef.h winsup/w32api/include/ipxtfflt.h winsup/w32api/include/isguids.h winsup/w32api/include/ks.h winsup/w32api/include/ksmedia.h winsup/w32api/include/largeint.h winsup/w32api/include/lm.h winsup/w32api/include/lmaccess.h winsup/w32api/include/lmalert.h winsup/w32api/include/lmapibuf.h winsup/w32api/include/lmat.h winsup/w32api/include/lmaudit.h winsup/w32api/include/lmbrowsr.h winsup/w32api/include/lmchdev.h winsup/w32api/include/lmconfig.h winsup/w32api/include/lmcons.h winsup/w32api/include/lmerr.h winsup/w32api/include/lmerrlog.h winsup/w32api/include/lmmsg.h winsup/w32api/include/lmremutl.h winsup/w32api/include/lmrepl.h winsup/w32api/include/lmserver.h winsup/w32api/include/lmshare.h winsup/w32api/include/lmsname.h winsup/w32api/include/lmstats.h winsup/w32api/include/lmsvc.h winsup/w32api/include/lmuse.h winsup/w32api/include/lmuseflg.h winsup/w32api/include/lmwksta.h winsup/w32api/include/lzexpand.h winsup/w32api/include/mapi.h winsup/w32api/include/mciavi.h winsup/w32api/include/mcx.h winsup/w32api/include/mgm.h winsup/w32api/include/mgmtapi.h winsup/w32api/include/mlang.h winsup/w32api/include/mmreg.h winsup/w32api/include/mmsystem.h winsup/w32api/include/mpegtype.h winsup/w32api/include/mprapi.h winsup/w32api/include/mq.h winsup/w32api/include/msacm.h winsup/w32api/include/mshtml.h winsup/w32api/include/mswsock.h winsup/w32api/include/nb30.h winsup/w32api/include/nddeapi.h winsup/w32api/include/nspapi.h winsup/w32api/include/ntdef.h winsup/w32api/include/ntdll.h winsup/w32api/include/ntdsapi.h winsup/w32api/include/ntdsbcli.h winsup/w32api/include/ntldap.h winsup/w32api/include/ntsecapi.h winsup/w32api/include/ntsecpkg.h winsup/w32api/include/oaidl.h winsup/w32api/include/objbase.h winsup/w32api/include/objfwd.h winsup/w32api/include/objidl.h winsup/w32api/include/objsafe.h winsup/w32api/include/objsel.h winsup/w32api/include/ocidl.h winsup/w32api/include/odbcinst.h winsup/w32api/include/ole.h winsup/w32api/include/ole2.h winsup/w32api/include/ole2ver.h winsup/w32api/include/oleacc.h winsup/w32api/include/oleauto.h winsup/w32api/include/olectl.h winsup/w32api/include/olectlid.h winsup/w32api/include/oledlg.h winsup/w32api/include/oleidl.h winsup/w32api/include/pbt.h winsup/w32api/include/poppack.h winsup/w32api/include/powrprof.h winsup/w32api/include/prsht.h winsup/w32api/include/psapi.h winsup/w32api/include/pshpack1.h winsup/w32api/include/pshpack2.h winsup/w32api/include/pshpack4.h winsup/w32api/include/pshpack8.h winsup/w32api/include/qedit.h winsup/w32api/include/rapi.h winsup/w32api/include/ras.h winsup/w32api/include/rasdlg.h winsup/w32api/include/raserror.h winsup/w32api/include/rassapi.h winsup/w32api/include/reason.h winsup/w32api/include/regstr.h winsup/w32api/include/richedit.h winsup/w32api/include/richole.h winsup/w32api/include/routprot.h winsup/w32api/include/rpc.h winsup/w32api/include/rpcdce.h winsup/w32api/include/rpcdce2.h winsup/w32api/include/rpcdcep.h winsup/w32api/include/rpcndr.h winsup/w32api/include/rpcnsi.h winsup/w32api/include/rpcnsip.h winsup/w32api/include/rpcnterr.h winsup/w32api/include/rpcproxy.h winsup/w32api/include/rtutils.h winsup/w32api/include/schannel.h winsup/w32api/include/schnlsp.h winsup/w32api/include/scrnsave.h winsup/w32api/include/sddl.h winsup/w32api/include/secext.h winsup/w32api/include/security.h winsup/w32api/include/servprov.h winsup/w32api/include/setupapi.h winsup/w32api/include/shellapi.h winsup/w32api/include/shldisp.h winsup/w32api/include/shlguid.h winsup/w32api/include/shlobj.h winsup/w32api/include/shlwapi.h winsup/w32api/include/snmp.h winsup/w32api/include/specstrings.h winsup/w32api/include/sql.h winsup/w32api/include/sqlext.h winsup/w32api/include/sqltypes.h winsup/w32api/include/sqlucode.h winsup/w32api/include/sspi.h winsup/w32api/include/stm.h winsup/w32api/include/strmif.h winsup/w32api/include/subauth.h winsup/w32api/include/svcguid.h winsup/w32api/include/tlhelp32.h winsup/w32api/include/tmschema.h winsup/w32api/include/unknwn.h winsup/w32api/include/userenv.h winsup/w32api/include/usp10.h winsup/w32api/include/uxtheme.h winsup/w32api/include/vfw.h winsup/w32api/include/vidcap.h winsup/w32api/include/vmr9.h winsup/w32api/include/vptype.h winsup/w32api/include/w32api.h winsup/w32api/include/winable.h winsup/w32api/include/winbase.h winsup/w32api/include/winber.h winsup/w32api/include/wincon.h winsup/w32api/include/wincrypt.h winsup/w32api/include/windef.h winsup/w32api/include/windns.h winsup/w32api/include/windows.h winsup/w32api/include/windowsx.h winsup/w32api/include/winerror.h winsup/w32api/include/wingdi.h winsup/w32api/include/wininet.h winsup/w32api/include/winioctl.h winsup/w32api/include/winldap.h winsup/w32api/include/winnetwk.h winsup/w32api/include/winnls.h winsup/w32api/include/winnt.h winsup/w32api/include/winperf.h winsup/w32api/include/winreg.h winsup/w32api/include/winresrc.h winsup/w32api/include/winsnmp.h winsup/w32api/include/winsock.h winsup/w32api/include/winsock2.h winsup/w32api/include/winspool.h winsup/w32api/include/winsvc.h winsup/w32api/include/winuser.h winsup/w32api/include/winver.h winsup/w32api/include/ws2spi.h winsup/w32api/include/ws2tcpip.h winsup/w32api/include/wsahelp.h winsup/w32api/include/wsipx.h winsup/w32api/include/wsnetbs.h winsup/w32api/include/wtsapi32.h winsup/w32api/include/wtypes.h winsup/w32api/include/xprtdefs.h winsup/w32api/include/zmouse.h winsup/w32api/install-sh winsup/w32api/lib/Makefile.in winsup/w32api/lib/aclui.def winsup/w32api/lib/advapi32.def winsup/w32api/lib/ativscp-uuid.c winsup/w32api/lib/avicap32.def winsup/w32api/lib/avifil32.def winsup/w32api/lib/bthprops.def winsup/w32api/lib/cap.def winsup/w32api/lib/cguid-uuid.c winsup/w32api/lib/comcat-uuid.c winsup/w32api/lib/comctl32.def winsup/w32api/lib/comdlg32.def winsup/w32api/lib/crypt32.def winsup/w32api/lib/ctl3d32.def winsup/w32api/lib/ddk/Makefile.in winsup/w32api/lib/ddk/apcups.def winsup/w32api/lib/ddk/cfgmgr32.def winsup/w32api/lib/ddk/dxapi.def winsup/w32api/lib/ddk/hal.def winsup/w32api/lib/ddk/hid.def winsup/w32api/lib/ddk/hidparse.def winsup/w32api/lib/ddk/mcd.def winsup/w32api/lib/ddk/ndis.def winsup/w32api/lib/ddk/newdev.def winsup/w32api/lib/ddk/ntoskrnl.def winsup/w32api/lib/ddk/scsiport.def winsup/w32api/lib/ddk/tdi.def winsup/w32api/lib/ddk/usbcamd.def winsup/w32api/lib/ddk/usbcamd2.def winsup/w32api/lib/ddk/videoprt.def winsup/w32api/lib/ddk/win32k.def winsup/w32api/lib/devguid.c winsup/w32api/lib/dhcpcsvc.def winsup/w32api/lib/directx/Makefile.in winsup/w32api/lib/directx/d3d8.def winsup/w32api/lib/directx/d3d9.def winsup/w32api/lib/directx/d3dim.def winsup/w32api/lib/directx/d3drm.def winsup/w32api/lib/directx/d3dx8d.def winsup/w32api/lib/directx/d3dx9d.def winsup/w32api/lib/directx/d3dxof.def winsup/w32api/lib/directx/ddraw.def winsup/w32api/lib/directx/dinput.def winsup/w32api/lib/directx/dinput8.def winsup/w32api/lib/directx/dinput_joy.c winsup/w32api/lib/directx/dinput_joy2.c winsup/w32api/lib/directx/dinput_kbd.c winsup/w32api/lib/directx/dinput_mouse.c winsup/w32api/lib/directx/dinput_mouse2.c winsup/w32api/lib/directx/dinput_private.h winsup/w32api/lib/directx/dmoguids.c winsup/w32api/lib/directx/dplayx.def winsup/w32api/lib/directx/dpnaddr.def winsup/w32api/lib/directx/dpnet.def winsup/w32api/lib/directx/dpnlobby.def winsup/w32api/lib/directx/dpvoice.def winsup/w32api/lib/directx/dsetup.def winsup/w32api/lib/directx/dsound.def winsup/w32api/lib/directx/dxerr.c winsup/w32api/lib/directx/dxerr8.c winsup/w32api/lib/directx/dxerr8w.c winsup/w32api/lib/directx/dxerr9.c winsup/w32api/lib/directx/dxerr9w.c winsup/w32api/lib/directx/dxguid.c winsup/w32api/lib/directx/ksproxy.def winsup/w32api/lib/directx/ksuser.c winsup/w32api/lib/directx/ksuser.def winsup/w32api/lib/directx/msdmo.def winsup/w32api/lib/directx/strmiids.c winsup/w32api/lib/directx/test.c winsup/w32api/lib/dlcapi.def winsup/w32api/lib/dnsapi.def winsup/w32api/lib/docobj-uuid.c winsup/w32api/lib/exdisp-uuid.c winsup/w32api/lib/extras-uuid.c winsup/w32api/lib/faultrep.def winsup/w32api/lib/gdi32.def winsup/w32api/lib/glaux.def winsup/w32api/lib/glu32.def winsup/w32api/lib/hlguids-uuid.c winsup/w32api/lib/hlink-uuid.c winsup/w32api/lib/icmui.def winsup/w32api/lib/igmpagnt.def winsup/w32api/lib/imagehlp.def winsup/w32api/lib/imm32.def winsup/w32api/lib/iphlpapi.def winsup/w32api/lib/kernel32.def winsup/w32api/lib/largeint.c winsup/w32api/lib/lz32.def winsup/w32api/lib/mapi32.def winsup/w32api/lib/mfcuia32.def winsup/w32api/lib/mgmtapi.def winsup/w32api/lib/mlang-uuid.c winsup/w32api/lib/mpr.def winsup/w32api/lib/mprapi.def winsup/w32api/lib/mqrt.def winsup/w32api/lib/msacm32.def winsup/w32api/lib/mscms.def winsup/w32api/lib/mshtml-uuid.c winsup/w32api/lib/msimg32.def winsup/w32api/lib/msvcp60.def winsup/w32api/lib/msvfw32.def winsup/w32api/lib/mswsock.def winsup/w32api/lib/msxml-uuid.c winsup/w32api/lib/nddeapi.def winsup/w32api/lib/netapi32.def winsup/w32api/lib/ntdll.def winsup/w32api/lib/oaidl-uuid.c winsup/w32api/lib/objidl-uuid.c winsup/w32api/lib/objsafe-uuid.c winsup/w32api/lib/ocidl-uuid.c winsup/w32api/lib/odbc32.def winsup/w32api/lib/odbccp32.def winsup/w32api/lib/ole32.def winsup/w32api/lib/oleacc-uuid.c winsup/w32api/lib/oleacc.def winsup/w32api/lib/oleaut32.def winsup/w32api/lib/olecli32.def winsup/w32api/lib/olectlid-uuid.c winsup/w32api/lib/oledlg.def winsup/w32api/lib/oleidl-uuid.c winsup/w32api/lib/olepro32.def winsup/w32api/lib/olesvr32.def winsup/w32api/lib/opengl32.def winsup/w32api/lib/penwin32.def winsup/w32api/lib/pkpd32.def winsup/w32api/lib/power-uuid.c winsup/w32api/lib/powrprof.def winsup/w32api/lib/psapi.def winsup/w32api/lib/quartz.def winsup/w32api/lib/rapi.def winsup/w32api/lib/rasapi32.def winsup/w32api/lib/rasdlg.def winsup/w32api/lib/res.rc winsup/w32api/lib/rpcdce4.def winsup/w32api/lib/rpcns4.def winsup/w32api/lib/rpcrt4.def winsup/w32api/lib/rtm.def winsup/w32api/lib/rtutils.def winsup/w32api/lib/scrnsave.c winsup/w32api/lib/secur32.def winsup/w32api/lib/servprov-uuid.c winsup/w32api/lib/setupapi.def winsup/w32api/lib/shell32.c winsup/w32api/lib/shell32.def winsup/w32api/lib/shfolder.def winsup/w32api/lib/shlwapi.def winsup/w32api/lib/snmpapi.def winsup/w32api/lib/svrapi.def winsup/w32api/lib/tapi32.def winsup/w32api/lib/test.c winsup/w32api/lib/th32.def winsup/w32api/lib/thunk32.def winsup/w32api/lib/unknwn-uuid.c winsup/w32api/lib/url.def winsup/w32api/lib/urlmon-uuid.c winsup/w32api/lib/user32.def winsup/w32api/lib/userenv.def winsup/w32api/lib/usp10.def winsup/w32api/lib/uxtheme.def winsup/w32api/lib/vdmdbg.def winsup/w32api/lib/version.def winsup/w32api/lib/vfw32.mri winsup/w32api/lib/win32spl.def winsup/w32api/lib/wininet.def winsup/w32api/lib/winmm.def winsup/w32api/lib/winspool.def winsup/w32api/lib/winstrm.def winsup/w32api/lib/wldap32.def winsup/w32api/lib/wow32.def winsup/w32api/lib/ws2_32.c winsup/w32api/lib/ws2_32.def winsup/w32api/lib/wsnmp32.def winsup/w32api/lib/wsock32.def winsup/w32api/lib/wst.def winsup/w32api/lib/wtsapi32.def --- winsup/testsuite/ChangeLog | 771 ----- winsup/testsuite/Makefile.in | 176 - winsup/testsuite/README | 40 - winsup/testsuite/aclocal.m4 | 831 ----- winsup/testsuite/config/default.exp | 13 - winsup/testsuite/configure | 3399 -------------------- winsup/testsuite/configure.in | 19 - winsup/testsuite/cygrun.c | 69 - winsup/testsuite/libltp/include/dataascii.h | 65 - winsup/testsuite/libltp/include/databin.h | 44 - winsup/testsuite/libltp/include/file_lock.h | 40 - winsup/testsuite/libltp/include/forker.h | 63 - winsup/testsuite/libltp/include/open_flags.h | 73 - winsup/testsuite/libltp/include/pattern.h | 90 - winsup/testsuite/libltp/include/random_range.h | 45 - winsup/testsuite/libltp/include/rmobj.h | 12 - winsup/testsuite/libltp/include/search_path.h | 36 - winsup/testsuite/libltp/include/str_to_bytes.h | 39 - winsup/testsuite/libltp/include/string_to_tokens.h | 48 - winsup/testsuite/libltp/include/test.h | 232 -- winsup/testsuite/libltp/include/tlibio.h | 148 - winsup/testsuite/libltp/include/usctest.h | 319 -- winsup/testsuite/libltp/include/write_log.h | 169 - winsup/testsuite/libltp/lib/dataascii.c | 218 -- winsup/testsuite/libltp/lib/databin.c | 298 -- winsup/testsuite/libltp/lib/datapid.c | 374 --- winsup/testsuite/libltp/lib/forker.c | 286 -- winsup/testsuite/libltp/lib/get_high_address.c | 20 - winsup/testsuite/libltp/lib/libtestsuite.c | 70 - winsup/testsuite/libltp/lib/open_flags.c | 330 -- winsup/testsuite/libltp/lib/parse_opts.c | 876 ----- winsup/testsuite/libltp/lib/pattern.c | 168 - winsup/testsuite/libltp/lib/rmobj.c | 211 -- winsup/testsuite/libltp/lib/search_path.c | 249 -- winsup/testsuite/libltp/lib/str_to_bytes.c | 211 -- winsup/testsuite/libltp/lib/string_to_tokens.c | 109 - winsup/testsuite/libltp/lib/tst_res.c | 960 ------ winsup/testsuite/libltp/lib/tst_sig.c | 220 -- winsup/testsuite/libltp/lib/tst_tmpdir.c | 347 -- winsup/testsuite/libltp/lib/write_log.c | 468 --- winsup/testsuite/winsup.api/checksignal.c | 91 - winsup/testsuite/winsup.api/crlf.c | 527 --- winsup/testsuite/winsup.api/cygload.cc | 628 ---- winsup/testsuite/winsup.api/cygload.exp | 40 - winsup/testsuite/winsup.api/cygload.h | 158 - winsup/testsuite/winsup.api/devdsp.c | 783 ----- winsup/testsuite/winsup.api/devdsp_okay.h | 531 --- winsup/testsuite/winsup.api/devzero.c | 115 - winsup/testsuite/winsup.api/iospeed.c | 115 - winsup/testsuite/winsup.api/known_bugs.tcl | 4 - winsup/testsuite/winsup.api/ltp/access01.c | 300 -- winsup/testsuite/winsup.api/ltp/access03.c | 506 --- winsup/testsuite/winsup.api/ltp/access04.c | 241 -- winsup/testsuite/winsup.api/ltp/access05.c | 424 --- winsup/testsuite/winsup.api/ltp/alarm01.c | 226 -- winsup/testsuite/winsup.api/ltp/alarm02.c | 240 -- winsup/testsuite/winsup.api/ltp/alarm03.c | 229 -- winsup/testsuite/winsup.api/ltp/alarm07.c | 201 -- winsup/testsuite/winsup.api/ltp/asyncio02.c | 364 --- winsup/testsuite/winsup.api/ltp/chdir02.c | 219 -- winsup/testsuite/winsup.api/ltp/chdir04.c | 188 -- winsup/testsuite/winsup.api/ltp/chmod01.c | 230 -- winsup/testsuite/winsup.api/ltp/chmod02.c | 260 -- winsup/testsuite/winsup.api/ltp/chown01.c | 244 -- winsup/testsuite/winsup.api/ltp/close01.c | 201 -- winsup/testsuite/winsup.api/ltp/close02.c | 143 - winsup/testsuite/winsup.api/ltp/close08.c | 241 -- winsup/testsuite/winsup.api/ltp/creat01.c | 207 -- winsup/testsuite/winsup.api/ltp/creat03.c | 154 - winsup/testsuite/winsup.api/ltp/creat09.c | 246 -- winsup/testsuite/winsup.api/ltp/dup01.c | 261 -- winsup/testsuite/winsup.api/ltp/dup02.c | 246 -- winsup/testsuite/winsup.api/ltp/dup03.c | 291 -- winsup/testsuite/winsup.api/ltp/dup04.c | 297 -- winsup/testsuite/winsup.api/ltp/dup05.c | 266 -- winsup/testsuite/winsup.api/ltp/execl01.c | 258 -- winsup/testsuite/winsup.api/ltp/execle01.c | 257 -- winsup/testsuite/winsup.api/ltp/execlp01.c | 256 -- winsup/testsuite/winsup.api/ltp/execv01.c | 254 -- winsup/testsuite/winsup.api/ltp/execve01.c | 258 -- winsup/testsuite/winsup.api/ltp/execvp01.c | 257 -- winsup/testsuite/winsup.api/ltp/exit01.c | 165 - winsup/testsuite/winsup.api/ltp/exit02.c | 228 -- winsup/testsuite/winsup.api/ltp/fchdir01.c | 249 -- winsup/testsuite/winsup.api/ltp/fchdir02.c | 160 - winsup/testsuite/winsup.api/ltp/fchmod01.c | 241 -- winsup/testsuite/winsup.api/ltp/fchown01.c | 234 -- winsup/testsuite/winsup.api/ltp/fcntl02.c | 244 -- winsup/testsuite/winsup.api/ltp/fcntl03.c | 240 -- winsup/testsuite/winsup.api/ltp/fcntl04.c | 239 -- winsup/testsuite/winsup.api/ltp/fcntl05.c | 249 -- winsup/testsuite/winsup.api/ltp/fcntl07.c | 423 --- winsup/testsuite/winsup.api/ltp/fcntl07B.c | 422 --- winsup/testsuite/winsup.api/ltp/fcntl08.c | 250 -- winsup/testsuite/winsup.api/ltp/fcntl09.c | 278 -- winsup/testsuite/winsup.api/ltp/fcntl10.c | 284 -- winsup/testsuite/winsup.api/ltp/fork01.c | 316 -- winsup/testsuite/winsup.api/ltp/fork02.c | 139 - winsup/testsuite/winsup.api/ltp/fork03.c | 165 - winsup/testsuite/winsup.api/ltp/fork04.c | 403 --- winsup/testsuite/winsup.api/ltp/fork06.c | 153 - winsup/testsuite/winsup.api/ltp/fork07.c | 200 -- winsup/testsuite/winsup.api/ltp/fork09.c | 229 -- winsup/testsuite/winsup.api/ltp/fork10.c | 216 -- winsup/testsuite/winsup.api/ltp/fork11.c | 141 - winsup/testsuite/winsup.api/ltp/fpathconf01.c | 256 -- winsup/testsuite/winsup.api/ltp/fstat01.c | 237 -- winsup/testsuite/winsup.api/ltp/fstat02.c | 244 -- winsup/testsuite/winsup.api/ltp/fstat03.c | 189 -- winsup/testsuite/winsup.api/ltp/fstat04.c | 244 -- winsup/testsuite/winsup.api/ltp/fsync01.c | 248 -- winsup/testsuite/winsup.api/ltp/ftruncate01.c | 244 -- winsup/testsuite/winsup.api/ltp/ftruncate02.c | 313 -- winsup/testsuite/winsup.api/ltp/ftruncate03.c | 324 -- winsup/testsuite/winsup.api/ltp/getegid01.c | 226 -- winsup/testsuite/winsup.api/ltp/geteuid01.c | 226 -- winsup/testsuite/winsup.api/ltp/getgid01.c | 219 -- winsup/testsuite/winsup.api/ltp/getgid02.c | 159 - winsup/testsuite/winsup.api/ltp/getgid03.c | 158 - winsup/testsuite/winsup.api/ltp/getgroups01.c | 314 -- winsup/testsuite/winsup.api/ltp/getgroups02.c | 226 -- winsup/testsuite/winsup.api/ltp/gethostid01.c | 224 -- winsup/testsuite/winsup.api/ltp/gethostname01.c | 226 -- winsup/testsuite/winsup.api/ltp/getpgid01.c | 236 -- winsup/testsuite/winsup.api/ltp/getpgid02.c | 172 - winsup/testsuite/winsup.api/ltp/getpgrp01.c | 219 -- winsup/testsuite/winsup.api/ltp/getpid01.c | 217 -- winsup/testsuite/winsup.api/ltp/getpid02.c | 186 -- winsup/testsuite/winsup.api/ltp/getppid01.c | 219 -- winsup/testsuite/winsup.api/ltp/getppid02.c | 148 - winsup/testsuite/winsup.api/ltp/getuid01.c | 219 -- winsup/testsuite/winsup.api/ltp/getuid02.c | 137 - winsup/testsuite/winsup.api/ltp/getuid03.c | 138 - winsup/testsuite/winsup.api/ltp/kill01.c | 162 - winsup/testsuite/winsup.api/ltp/kill02.c | 857 ----- winsup/testsuite/winsup.api/ltp/kill03.c | 170 - winsup/testsuite/winsup.api/ltp/kill04.c | 181 -- winsup/testsuite/winsup.api/ltp/kill09.c | 258 -- winsup/testsuite/winsup.api/ltp/link02.c | 263 -- winsup/testsuite/winsup.api/ltp/link03.c | 330 -- winsup/testsuite/winsup.api/ltp/link04.c | 426 --- winsup/testsuite/winsup.api/ltp/link05.c | 351 -- winsup/testsuite/winsup.api/ltp/lseek01.c | 255 -- winsup/testsuite/winsup.api/ltp/lseek02.c | 242 -- winsup/testsuite/winsup.api/ltp/lseek03.c | 289 -- winsup/testsuite/winsup.api/ltp/lseek04.c | 256 -- winsup/testsuite/winsup.api/ltp/lseek05.c | 252 -- winsup/testsuite/winsup.api/ltp/lseek06.c | 235 -- winsup/testsuite/winsup.api/ltp/lseek07.c | 286 -- winsup/testsuite/winsup.api/ltp/lseek08.c | 240 -- winsup/testsuite/winsup.api/ltp/lseek09.c | 266 -- winsup/testsuite/winsup.api/ltp/lseek10.c | 344 -- winsup/testsuite/winsup.api/ltp/lstat02.c | 253 -- winsup/testsuite/winsup.api/ltp/mkdir01.c | 270 -- winsup/testsuite/winsup.api/ltp/mkdir08.c | 235 -- winsup/testsuite/winsup.api/ltp/mknod01.c | 275 -- winsup/testsuite/winsup.api/ltp/mmap001.c | 203 -- winsup/testsuite/winsup.api/ltp/mmap02.c | 291 -- winsup/testsuite/winsup.api/ltp/mmap03.c | 290 -- winsup/testsuite/winsup.api/ltp/mmap04.c | 291 -- winsup/testsuite/winsup.api/ltp/mmap05.c | 301 -- winsup/testsuite/winsup.api/ltp/mmap06.c | 234 -- winsup/testsuite/winsup.api/ltp/mmap07.c | 233 -- winsup/testsuite/winsup.api/ltp/mmap08.c | 234 -- winsup/testsuite/winsup.api/ltp/munmap01.c | 281 -- winsup/testsuite/winsup.api/ltp/munmap02.c | 306 -- winsup/testsuite/winsup.api/ltp/nice05.c | 219 -- winsup/testsuite/winsup.api/ltp/open02.c | 146 - winsup/testsuite/winsup.api/ltp/open03.c | 243 -- winsup/testsuite/winsup.api/ltp/pathconf01.c | 245 -- winsup/testsuite/winsup.api/ltp/pause01.c | 229 -- winsup/testsuite/winsup.api/ltp/pipe01.c | 156 - winsup/testsuite/winsup.api/ltp/pipe08.c | 158 - winsup/testsuite/winsup.api/ltp/pipe09.c | 230 -- winsup/testsuite/winsup.api/ltp/pipe10.c | 167 - winsup/testsuite/winsup.api/ltp/pipe11.c | 227 -- winsup/testsuite/winsup.api/ltp/poll01.c | 250 -- winsup/testsuite/winsup.api/ltp/read01.c | 280 -- winsup/testsuite/winsup.api/ltp/read04.c | 174 - winsup/testsuite/winsup.api/ltp/readdir01.c | 350 -- winsup/testsuite/winsup.api/ltp/readlink01.c | 229 -- winsup/testsuite/winsup.api/ltp/readlink02.c | 244 -- winsup/testsuite/winsup.api/ltp/readlink03.c | 360 --- winsup/testsuite/winsup.api/ltp/rename01.c | 263 -- winsup/testsuite/winsup.api/ltp/rename02.c | 251 -- winsup/testsuite/winsup.api/ltp/rename08.c | 205 -- winsup/testsuite/winsup.api/ltp/rename10.c | 203 -- winsup/testsuite/winsup.api/ltp/rmdir01.c | 189 -- winsup/testsuite/winsup.api/ltp/rmdir04.c | 236 -- winsup/testsuite/winsup.api/ltp/rmdir05.c | 447 --- winsup/testsuite/winsup.api/ltp/sbrk01.c | 279 -- winsup/testsuite/winsup.api/ltp/select01.c | 276 -- winsup/testsuite/winsup.api/ltp/select02.c | 268 -- winsup/testsuite/winsup.api/ltp/select03.c | 282 -- winsup/testsuite/winsup.api/ltp/setgid01.c | 219 -- winsup/testsuite/winsup.api/ltp/setgroups01.c | 228 -- winsup/testsuite/winsup.api/ltp/setpgid01.c | 238 -- winsup/testsuite/winsup.api/ltp/setregid01.c | 338 -- winsup/testsuite/winsup.api/ltp/setreuid01.c | 338 -- winsup/testsuite/winsup.api/ltp/setuid01.c | 225 -- winsup/testsuite/winsup.api/ltp/setuid02.c | 240 -- winsup/testsuite/winsup.api/ltp/signal03.c | 663 ---- winsup/testsuite/winsup.api/ltp/stat01.c | 267 -- winsup/testsuite/winsup.api/ltp/stat02.c | 276 -- winsup/testsuite/winsup.api/ltp/stat03.c | 391 --- winsup/testsuite/winsup.api/ltp/stat05.c | 241 -- winsup/testsuite/winsup.api/ltp/stat06.c | 377 --- winsup/testsuite/winsup.api/ltp/symlink01.c | 2032 ------------ winsup/testsuite/winsup.api/ltp/symlink02.c | 245 -- winsup/testsuite/winsup.api/ltp/symlink03.c | 404 --- winsup/testsuite/winsup.api/ltp/symlink04.c | 238 -- winsup/testsuite/winsup.api/ltp/symlink05.c | 222 -- winsup/testsuite/winsup.api/ltp/sync01.c | 216 -- winsup/testsuite/winsup.api/ltp/sync02.c | 238 -- winsup/testsuite/winsup.api/ltp/time01.c | 218 -- winsup/testsuite/winsup.api/ltp/time02.c | 182 -- winsup/testsuite/winsup.api/ltp/times01.c | 222 -- winsup/testsuite/winsup.api/ltp/times02.c | 136 - winsup/testsuite/winsup.api/ltp/times03.c | 247 -- winsup/testsuite/winsup.api/ltp/truncate01.c | 262 -- winsup/testsuite/winsup.api/ltp/truncate02.c | 335 -- winsup/testsuite/winsup.api/ltp/ulimit01.c | 273 -- winsup/testsuite/winsup.api/ltp/umask01.c | 220 -- winsup/testsuite/winsup.api/ltp/umask02.c | 135 - winsup/testsuite/winsup.api/ltp/umask03.c | 170 - winsup/testsuite/winsup.api/ltp/uname01.c | 221 -- winsup/testsuite/winsup.api/ltp/unlink05.c | 246 -- winsup/testsuite/winsup.api/ltp/unlink06.c | 254 -- winsup/testsuite/winsup.api/ltp/unlink07.c | 328 -- winsup/testsuite/winsup.api/ltp/unlink08.c | 432 --- winsup/testsuite/winsup.api/ltp/vfork01.c | 400 --- winsup/testsuite/winsup.api/ltp/wait02.c | 230 -- winsup/testsuite/winsup.api/ltp/wait401.c | 188 -- winsup/testsuite/winsup.api/ltp/wait402.c | 203 -- winsup/testsuite/winsup.api/ltp/write01.c | 250 -- winsup/testsuite/winsup.api/ltp/write02.c | 165 - winsup/testsuite/winsup.api/ltp/write03.c | 192 -- winsup/testsuite/winsup.api/mmaptest01.c | 176 - winsup/testsuite/winsup.api/mmaptest02.c | 190 -- winsup/testsuite/winsup.api/mmaptest03.c | 154 - winsup/testsuite/winsup.api/mmaptest04.c | 103 - winsup/testsuite/winsup.api/msgtest.c | 348 -- winsup/testsuite/winsup.api/nullgetcwd.c | 17 - winsup/testsuite/winsup.api/pthread/cancel1.c | 147 - winsup/testsuite/winsup.api/pthread/cancel10.c | 68 - winsup/testsuite/winsup.api/pthread/cancel11.c | 74 - winsup/testsuite/winsup.api/pthread/cancel12.c | 69 - winsup/testsuite/winsup.api/pthread/cancel2.c | 181 -- winsup/testsuite/winsup.api/pthread/cancel3.c | 166 - winsup/testsuite/winsup.api/pthread/cancel4.c | 172 - winsup/testsuite/winsup.api/pthread/cancel5.c | 165 - winsup/testsuite/winsup.api/pthread/cancel6.c | 62 - winsup/testsuite/winsup.api/pthread/cancel7.c | 71 - winsup/testsuite/winsup.api/pthread/cancel8.c | 71 - winsup/testsuite/winsup.api/pthread/cancel9.c | 81 - winsup/testsuite/winsup.api/pthread/cleanup2.c | 157 - winsup/testsuite/winsup.api/pthread/cleanup3.c | 160 - winsup/testsuite/winsup.api/pthread/condvar1.c | 65 - winsup/testsuite/winsup.api/pthread/condvar2.c | 80 - winsup/testsuite/winsup.api/pthread/condvar2_1.c | 107 - winsup/testsuite/winsup.api/pthread/condvar3.c | 115 - winsup/testsuite/winsup.api/pthread/condvar3_1.c | 145 - winsup/testsuite/winsup.api/pthread/condvar3_2.c | 139 - winsup/testsuite/winsup.api/pthread/condvar3_3.c | 100 - winsup/testsuite/winsup.api/pthread/condvar4.c | 137 - winsup/testsuite/winsup.api/pthread/condvar5.c | 136 - winsup/testsuite/winsup.api/pthread/condvar6.c | 209 -- winsup/testsuite/winsup.api/pthread/condvar7.c | 227 -- winsup/testsuite/winsup.api/pthread/condvar8.c | 221 -- winsup/testsuite/winsup.api/pthread/condvar9.c | 239 -- winsup/testsuite/winsup.api/pthread/count1.c | 62 - winsup/testsuite/winsup.api/pthread/create1.c | 34 - winsup/testsuite/winsup.api/pthread/create2.c | 74 - winsup/testsuite/winsup.api/pthread/equal1.c | 34 - winsup/testsuite/winsup.api/pthread/exit1.c | 18 - winsup/testsuite/winsup.api/pthread/exit2.c | 30 - winsup/testsuite/winsup.api/pthread/exit3.c | 34 - winsup/testsuite/winsup.api/pthread/inherit1.c | 99 - winsup/testsuite/winsup.api/pthread/join0.c | 40 - winsup/testsuite/winsup.api/pthread/join1.c | 51 - winsup/testsuite/winsup.api/pthread/join2.c | 41 - .../testsuite/winsup.api/pthread/mainthreadexits.c | 48 - winsup/testsuite/winsup.api/pthread/mutex1.c | 36 - winsup/testsuite/winsup.api/pthread/mutex1d.c | 42 - winsup/testsuite/winsup.api/pthread/mutex1e.c | 42 - winsup/testsuite/winsup.api/pthread/mutex1n.c | 42 - winsup/testsuite/winsup.api/pthread/mutex1r.c | 42 - winsup/testsuite/winsup.api/pthread/mutex2.c | 34 - winsup/testsuite/winsup.api/pthread/mutex3.c | 43 - winsup/testsuite/winsup.api/pthread/mutex4.c | 67 - winsup/testsuite/winsup.api/pthread/mutex5.c | 30 - winsup/testsuite/winsup.api/pthread/mutex6d.c | 71 - winsup/testsuite/winsup.api/pthread/mutex6e.c | 70 - winsup/testsuite/winsup.api/pthread/mutex6n.c | 72 - winsup/testsuite/winsup.api/pthread/mutex6r.c | 68 - winsup/testsuite/winsup.api/pthread/mutex7.c | 50 - winsup/testsuite/winsup.api/pthread/mutex7d.c | 51 - winsup/testsuite/winsup.api/pthread/mutex7e.c | 70 - winsup/testsuite/winsup.api/pthread/mutex7n.c | 61 - winsup/testsuite/winsup.api/pthread/mutex7r.c | 68 - winsup/testsuite/winsup.api/pthread/mutex8e.c | 35 - winsup/testsuite/winsup.api/pthread/mutex8n.c | 60 - winsup/testsuite/winsup.api/pthread/mutex8r.c | 37 - winsup/testsuite/winsup.api/pthread/once1.c | 45 - winsup/testsuite/winsup.api/pthread/priority1.c | 78 - winsup/testsuite/winsup.api/pthread/priority2.c | 80 - winsup/testsuite/winsup.api/pthread/rwlock1.c | 29 - winsup/testsuite/winsup.api/pthread/rwlock2.c | 34 - winsup/testsuite/winsup.api/pthread/rwlock3.c | 45 - winsup/testsuite/winsup.api/pthread/rwlock4.c | 44 - winsup/testsuite/winsup.api/pthread/rwlock5.c | 47 - winsup/testsuite/winsup.api/pthread/rwlock6.c | 69 - winsup/testsuite/winsup.api/pthread/rwlock7.c | 190 -- winsup/testsuite/winsup.api/pthread/self1.c | 26 - winsup/testsuite/winsup.api/pthread/self2.c | 46 - winsup/testsuite/winsup.api/pthread/test.h | 102 - .../winsup.api/pthread/threadidafterfork.c | 50 - winsup/testsuite/winsup.api/pthread/tsd1.c | 170 - winsup/testsuite/winsup.api/resethand.c | 36 - winsup/testsuite/winsup.api/samples/sample-fail.c | 5 - .../winsup.api/samples/sample-miscompile.c | 1 - winsup/testsuite/winsup.api/samples/sample-pass.c | 5 - winsup/testsuite/winsup.api/semtest.c | 348 -- winsup/testsuite/winsup.api/shmtest.c | 293 -- winsup/testsuite/winsup.api/sigchld.c | 22 - .../testsuite/winsup.api/signal-into-win32-api.c | 58 - winsup/testsuite/winsup.api/systemcall.c | 68 - winsup/testsuite/winsup.api/user_malloc.c | 216 -- winsup/testsuite/winsup.api/waitpid.c | 24 - winsup/testsuite/winsup.api/winsup.exp | 85 - 330 files changed, 72884 deletions(-) delete mode 100644 winsup/testsuite/ChangeLog delete mode 100644 winsup/testsuite/Makefile.in delete mode 100644 winsup/testsuite/README delete mode 100644 winsup/testsuite/aclocal.m4 delete mode 100644 winsup/testsuite/config/default.exp delete mode 100644 winsup/testsuite/configure delete mode 100755 winsup/testsuite/configure.in delete mode 100644 winsup/testsuite/cygrun.c delete mode 100644 winsup/testsuite/libltp/include/dataascii.h delete mode 100644 winsup/testsuite/libltp/include/databin.h delete mode 100644 winsup/testsuite/libltp/include/file_lock.h delete mode 100644 winsup/testsuite/libltp/include/forker.h delete mode 100644 winsup/testsuite/libltp/include/open_flags.h delete mode 100644 winsup/testsuite/libltp/include/pattern.h delete mode 100644 winsup/testsuite/libltp/include/random_range.h delete mode 100644 winsup/testsuite/libltp/include/rmobj.h delete mode 100644 winsup/testsuite/libltp/include/search_path.h delete mode 100644 winsup/testsuite/libltp/include/str_to_bytes.h delete mode 100644 winsup/testsuite/libltp/include/string_to_tokens.h delete mode 100644 winsup/testsuite/libltp/include/test.h delete mode 100644 winsup/testsuite/libltp/include/tlibio.h delete mode 100644 winsup/testsuite/libltp/include/usctest.h delete mode 100644 winsup/testsuite/libltp/include/write_log.h delete mode 100644 winsup/testsuite/libltp/lib/dataascii.c delete mode 100644 winsup/testsuite/libltp/lib/databin.c delete mode 100644 winsup/testsuite/libltp/lib/datapid.c delete mode 100644 winsup/testsuite/libltp/lib/forker.c delete mode 100644 winsup/testsuite/libltp/lib/get_high_address.c delete mode 100644 winsup/testsuite/libltp/lib/libtestsuite.c delete mode 100644 winsup/testsuite/libltp/lib/open_flags.c delete mode 100644 winsup/testsuite/libltp/lib/parse_opts.c delete mode 100644 winsup/testsuite/libltp/lib/pattern.c delete mode 100644 winsup/testsuite/libltp/lib/rmobj.c delete mode 100644 winsup/testsuite/libltp/lib/search_path.c delete mode 100644 winsup/testsuite/libltp/lib/str_to_bytes.c delete mode 100644 winsup/testsuite/libltp/lib/string_to_tokens.c delete mode 100644 winsup/testsuite/libltp/lib/tst_res.c delete mode 100644 winsup/testsuite/libltp/lib/tst_sig.c delete mode 100644 winsup/testsuite/libltp/lib/tst_tmpdir.c delete mode 100644 winsup/testsuite/libltp/lib/write_log.c delete mode 100644 winsup/testsuite/winsup.api/checksignal.c delete mode 100644 winsup/testsuite/winsup.api/crlf.c delete mode 100644 winsup/testsuite/winsup.api/cygload.cc delete mode 100644 winsup/testsuite/winsup.api/cygload.exp delete mode 100644 winsup/testsuite/winsup.api/cygload.h delete mode 100644 winsup/testsuite/winsup.api/devdsp.c delete mode 100644 winsup/testsuite/winsup.api/devdsp_okay.h delete mode 100644 winsup/testsuite/winsup.api/devzero.c delete mode 100644 winsup/testsuite/winsup.api/iospeed.c delete mode 100644 winsup/testsuite/winsup.api/known_bugs.tcl delete mode 100644 winsup/testsuite/winsup.api/ltp/access01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/access03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/access04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/access05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/alarm01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/alarm02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/alarm03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/alarm07.c delete mode 100644 winsup/testsuite/winsup.api/ltp/asyncio02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/chdir02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/chdir04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/chmod01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/chmod02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/chown01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/close01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/close02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/close08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/creat01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/creat03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/creat09.c delete mode 100644 winsup/testsuite/winsup.api/ltp/dup01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/dup02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/dup03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/dup04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/dup05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/execl01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/execle01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/execlp01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/execv01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/execve01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/execvp01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/exit01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/exit02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fchdir01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fchdir02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fchmod01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fchown01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl07.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl07B.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl09.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fcntl10.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork06.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork07.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork09.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork10.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fork11.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fpathconf01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fstat01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fstat02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fstat03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fstat04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/fsync01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/ftruncate01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/ftruncate02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/ftruncate03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getegid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/geteuid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getgid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getgid02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getgid03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getgroups01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getgroups02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/gethostid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/gethostname01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getpgid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getpgid02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getpgrp01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getpid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getpid02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getppid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getppid02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getuid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getuid02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/getuid03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/kill01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/kill02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/kill03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/kill04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/kill09.c delete mode 100644 winsup/testsuite/winsup.api/ltp/link02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/link03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/link04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/link05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek06.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek07.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek09.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lseek10.c delete mode 100644 winsup/testsuite/winsup.api/ltp/lstat02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mkdir01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mkdir08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mknod01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap001.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap06.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap07.c delete mode 100644 winsup/testsuite/winsup.api/ltp/mmap08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/munmap01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/munmap02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/nice05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/open02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/open03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pathconf01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pause01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pipe01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pipe08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pipe09.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pipe10.c delete mode 100644 winsup/testsuite/winsup.api/ltp/pipe11.c delete mode 100644 winsup/testsuite/winsup.api/ltp/poll01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/read01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/read04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/readdir01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/readlink01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/readlink02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/readlink03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rename01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rename02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rename08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rename10.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rmdir01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rmdir04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/rmdir05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/sbrk01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/select01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/select02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/select03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setgid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setgroups01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setpgid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setregid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setreuid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setuid01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/setuid02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/signal03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/stat01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/stat02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/stat03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/stat05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/stat06.c delete mode 100644 winsup/testsuite/winsup.api/ltp/symlink01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/symlink02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/symlink03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/symlink04.c delete mode 100644 winsup/testsuite/winsup.api/ltp/symlink05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/sync01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/sync02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/time01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/time02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/times01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/times02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/times03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/truncate01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/truncate02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/ulimit01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/umask01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/umask02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/umask03.c delete mode 100644 winsup/testsuite/winsup.api/ltp/uname01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/unlink05.c delete mode 100644 winsup/testsuite/winsup.api/ltp/unlink06.c delete mode 100644 winsup/testsuite/winsup.api/ltp/unlink07.c delete mode 100644 winsup/testsuite/winsup.api/ltp/unlink08.c delete mode 100644 winsup/testsuite/winsup.api/ltp/vfork01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/wait02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/wait401.c delete mode 100644 winsup/testsuite/winsup.api/ltp/wait402.c delete mode 100644 winsup/testsuite/winsup.api/ltp/write01.c delete mode 100644 winsup/testsuite/winsup.api/ltp/write02.c delete mode 100644 winsup/testsuite/winsup.api/ltp/write03.c delete mode 100644 winsup/testsuite/winsup.api/mmaptest01.c delete mode 100644 winsup/testsuite/winsup.api/mmaptest02.c delete mode 100644 winsup/testsuite/winsup.api/mmaptest03.c delete mode 100644 winsup/testsuite/winsup.api/mmaptest04.c delete mode 100644 winsup/testsuite/winsup.api/msgtest.c delete mode 100644 winsup/testsuite/winsup.api/nullgetcwd.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel10.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel11.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel12.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel4.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel5.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel6.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel7.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel8.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel9.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cleanup2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cleanup3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar2_1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar3_1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar3_2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar3_3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar4.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar5.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar6.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar7.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar8.c delete mode 100644 winsup/testsuite/winsup.api/pthread/condvar9.c delete mode 100644 winsup/testsuite/winsup.api/pthread/count1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/create1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/create2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/equal1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/exit1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/exit2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/exit3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/inherit1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/join0.c delete mode 100644 winsup/testsuite/winsup.api/pthread/join1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/join2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mainthreadexits.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex1d.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex1e.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex1n.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex1r.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex4.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex5.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex6d.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex6e.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex6n.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex6r.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex7.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex7d.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex7e.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex7n.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex7r.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex8e.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex8n.c delete mode 100644 winsup/testsuite/winsup.api/pthread/mutex8r.c delete mode 100644 winsup/testsuite/winsup.api/pthread/once1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/priority1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/priority2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock3.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock4.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock5.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock6.c delete mode 100644 winsup/testsuite/winsup.api/pthread/rwlock7.c delete mode 100644 winsup/testsuite/winsup.api/pthread/self1.c delete mode 100644 winsup/testsuite/winsup.api/pthread/self2.c delete mode 100644 winsup/testsuite/winsup.api/pthread/test.h delete mode 100644 winsup/testsuite/winsup.api/pthread/threadidafterfork.c delete mode 100644 winsup/testsuite/winsup.api/pthread/tsd1.c delete mode 100644 winsup/testsuite/winsup.api/resethand.c delete mode 100644 winsup/testsuite/winsup.api/samples/sample-fail.c delete mode 100644 winsup/testsuite/winsup.api/samples/sample-miscompile.c delete mode 100644 winsup/testsuite/winsup.api/samples/sample-pass.c delete mode 100644 winsup/testsuite/winsup.api/semtest.c delete mode 100644 winsup/testsuite/winsup.api/shmtest.c delete mode 100644 winsup/testsuite/winsup.api/sigchld.c delete mode 100755 winsup/testsuite/winsup.api/signal-into-win32-api.c delete mode 100644 winsup/testsuite/winsup.api/systemcall.c delete mode 100644 winsup/testsuite/winsup.api/user_malloc.c delete mode 100644 winsup/testsuite/winsup.api/waitpid.c delete mode 100644 winsup/testsuite/winsup.api/winsup.exp (limited to 'winsup/testsuite') diff --git a/winsup/testsuite/ChangeLog b/winsup/testsuite/ChangeLog deleted file mode 100644 index 47ab35952..000000000 --- a/winsup/testsuite/ChangeLog +++ /dev/null @@ -1,771 +0,0 @@ -2009-11-01 Christopher Faylor - - * Makefile.in: Use utils mingw front-end to generate non-cygwin binary. - -2008-11-26 Christopher Faylor - - * Revert erroneous checkin. - -2006-07-23 Christopher Faylor - - * Makefile.in: Update copyright. Remove unused stuff. - -2006-07-17 Christopher Faylor - - * Makefile.in: Simplify a little. - -2006-06-12 Pierre Humblet Pierre.Humblet@ieee.org - - * winsup.api/user_malloc.c: New file. - -2006-05-30 Christopher Faylor - - * winsup.api/cygload.h: Increase padding to 32768. - -2006-05-24 Christopher Faylor - - * configure.in: Update to newer autoconf. - (thanks to Steve Ellcey) - * configure: Regenerate. - * aclocal.m4: New file. - -2006-03-23 Christopher Faylor - - * winsup.api/checksignal.c (main): Add test for siginterrupt. - -2006-01-02 Christopher Faylor - - * cygload/README: Delete. - * cygload/cygload.cc: Move to winsup.api. Add comments from README. - * cygload/cygload.h: Move to winsup.api. - * cygload/cygload.exp: Move to winsup.api. - * Makefile.in: Remove cygload. - * winsup.api/winsup.exp: If a .exp file is detected, run it rather than - using standard compile. - - * winsup.api/resethand.c (main): Use printf to print status or expect - thinks something is wrong. - -2006-01-01 Christopher Faylor - - * winsup.api/resethand.c (main): Remove core dump flag from exit - status. - -2006-01-01 Christopher Faylor - - * winsup.api/resethand.c (main): Coerce argument to pointer to stop gcc - complaint. - -2006-01-01 Christopher Faylor - - * winsup.api/resethand.c: Use SIGSEGV for the signal to test. - -2006-01-01 Christopher Faylor - - * winsup.api/resethand.c: New file. - -2005-12-11 Christopher Faylor - - * winsup.api/ltp/dup03.c (cleanup): Fix longstanding off-by-one error - when setting array element to -1. - -2005-06-11 Christopher Faylor - - * winsup.api/pthread/cancel2.c: Use explicit initializer for mutex. - * winsup.api/pthread/mutex4.c (main): Ditto. - * winsup.api/pthread/mutex5.c: Reflect change in cygwin default mutex type. - * winsup.api/pthread/mutex6d.c: Ditto. - -2005-06-10 Christopher Faylor - - * winsup.api/winsup.exp: Remove (temporarily?) -nostdinc from build - since it causes compile failures with gcc 3.4.4. - -2005-06-06 Christopher Faylor - - * cygload/cygload.exp: .cpp -> .cc. - -2005-06-06 Max Kaehn - - * Makefile.in: Test cygload. - * cygload: New directory. - * cygload/README: New file. - * cygload/Makefile: Ditto. - * cygload/cygload.h: Ditto. - * cygload/cygload.cc: Ditto. - * cygload/cygload.exp: Ditto. - -2005-05-17 Brian Dessent - - * winsup.api/signal-into-win32-api.c (main): Use 'NULL' instead of '0' - in argument list to avoid compiler warning with gcc4. - * winsup.api/ltp/execle01.c (main): Ditto. - * winsup.api/ltp/execlp01.c (main): Ditto. - * winsup.api/ltp/fcntl07.c (do_exec): Ditto. - * winsup.api/ltp/fcntl07B.c (do_exec): Ditto. - -2005-02-10 Christopher Faylor - - * winsup.api/known_bugs.tcl: Remove dup05, fcntl07B, lseek04, select03, - unlink06. - * winsup.api/mmaptest03.c: Make a little more verbose so that it is - easier to figure out where something failed. - -2005-01-09 Christopher Faylor - - * cygrun.c (main): Fix exit code so that it reflects UNIX style. - * winsup.api/ltp/fork04.c (setup): Accommodate change in putenv - declaration. - -2004-08-24 Corinna Vinschen - - * winsup.api/mmaptest01.c (main): Accomodate 9x memory usage. - -2004-08-24 Corinna Vinschen - - * winsup.api/ltp/symlink01.c (do_link): Print inode numbers using %llu - format specifier. - -2004-08-17 Gerd Spalink - Pierre Humblet - - * devdsp.c: Outputs the names of the main test functions. - (forkrectest): Expect child success. - (forkplaytest): Ditto. - (syncwithchild): Output the child status and the desired value. - (sinegenw): Reduce volume of the beep. - (sinegenb): Ditto. - (dup_test): New test. - -2004-04-13 Gerd Spalink - - * winsup.api/devdsp.c (forkrectest): Move synchronization with child - so that test passes also under high CPU load. - (forkplaytest): Ditto. - (abortplaytest): New function to test ioctl code SNDCTL_DSP_RESET. - -2004-04-04 Gerd Spalink - - * winsup.api/devdsp.c (ioctltest): Add 2 tests for ioctl codes - SNDCTL_DSP_CHANNELS and SNDCTL_DSP_GETCAPS. - -2004-03-24 Gerd Spalink - - * winsup.api/devdsp.c: New file, testing fhandler_dev_dsp code. - * winsup.api/devdsp_okay.h: Ditto. - -2004-03-06 Christopher Faylor - - * winsup.api/known_bugs.tcl: Remove mknod01 since mknod now works. - * winsup.api/ltp/mknod01.c: Remove root check when running on cygwin. - -2004-03-04 Thomas Pfaff - - * winsup.api/pthread/mutex8e.c: New testcase. - * winsup.api/pthread/mutex8n.c: Ditto. - * winsup.api/pthread/mutex8r.c: Ditto. - -2003-12-23 Christopher Faylor - - * winsup.api/pthread/rwlock7.c (main): Don't assume that result of rand - operation is non-zero. - -2003-12-01 Corinna Vinschen - - * winsup.api/known_bugs.tcl: Remove fcntl09 and fcntl10. These - tests had a compatibility bug. - * winsup.api/ltp/fcntl09.c: Don't use F_RDLCK | F_WRLCK but only - F_WRLCK to set a write lock. - * winsup.api/ltp/fcntl10.c: Ditto. - -2003-11-25 Christopher Faylor - - * winsup.api/known_bugs.tcl: Remove lseek10 since mknod now works. - -2003-11-20 Corinna Vinschen - - * winsup.api/msgtest.c (main): Revert to use the SIGSYS signal handler. - * winsup.api/semtest.c (main): Ditto. - * winsup.api/shmtest.c (main): Ditto. - -2003-11-19 Corinna Vinschen - - * winsup.api/msgtest.c: New file derived from FreeBSD, testing - XSI Message Queue support. - * winsup.api/semtest.c: Ditto, testing XSI Semaphore support. - * winsup.api/shmtest.c: Ditto, testing XSI Shared Memory support. - -2003-07-06 Christopher Faylor - - * winsup.api/known_bugs.tcl: Remove gethostid01 from list of known - bugs. - -2003-07-06 Christopher Faylor - - * Makefile.in: Remove .dat files when cleaning. - -2003-07-06 Christopher Faylor - - * Makefile.in: Remove .d files when cleaning. - -2003-05-09 Corinna Vinschen - - * libltp/include/test.h: Remove gethostid declaration. - -2003-04-08 Thomas Pfaff - - * winsup.api/pthread/condvar9.c: Fix test. - -2003-03-27 Thomas Pfaff - - * winsup.api/pthread/rwlock1.c: Remove pthreads-win32 header. - * winsup.api/pthread/rwlock2.c: Ditto. - * winsup.api/pthread/rwlock3.c: Ditto. - * winsup.api/pthread/rwlock4.c: Ditto. - * winsup.api/pthread/rwlock5.c: Ditto. - * winsup.api/pthread/rwlock6.c: Ditto. - -2003-03-27 Brian Ford - - * winsup.api/pthread/condvar7.c (mythread): Cast - pthread_mutex_unlock argument of pthread_cleanup_push - to void *, preventing a compiler warning / testsuite failure. - * winsup.api/pthread/condvar9.c (mythread): Likewise. - * winsup.api/pthread/rwlock7.c (main): Use ftime instead of - _ftime. - -2003-03-18 Thomas Pfaff - - * winsup.api/pthread/rwlock1.c: New test. - * winsup.api/pthread/rwlock2.c: Ditto. - * winsup.api/pthread/rwlock3.c: Ditto. - * winsup.api/pthread/rwlock4.c: Ditto. - * winsup.api/pthread/rwlock5.c: Ditto. - * winsup.api/pthread/rwlock6.c: Ditto. - * winsup.api/pthread/rwlock7.c: Ditto. - -2003-03-18 Thomas Pfaff - - * winsup.api/pthread/condvar7.c: New test. - * winsup.api/pthread/condvar9.c: Ditto. - -2003-03-18 Thomas Pfaff - - * winsup.api/pthread/mutex1n.c: New test. - * winsup.api/pthread/mutex6n.c: Ditto. - * winsup.api/pthread/mutex7n.c: Ditto. - -2003-03-09 Christopher Faylor - - * winsup.api/winsup.exp: Use -nostdinc when compiling. - * Makefile.in: Specifically search compiler include directory since it - is now stripped via -nostdinc. - -2003-03-09 Corinna Vinschen - - * winsup.api/ltp/fork10.c (main): Remove non-portable declaration - of lseek. - -2003-03-09 Christopher Faylor - - * Makefile.in: Use "cygwin0" rather than "new-cygwin" to denote - in-build-tree version of library or dll. - * config/default.exp: Ditto. - * winsup.api/winsup.exp: Ditto. - -2003-03-07 Corinna Vinschen - - * winsup.api/known_bugs.tcl: Remove fsync01, setregid01 and setreuid01 - from list of known bugs. - -2003-02-19 Vaclav Haisman - - * winsup.api/crlf.c: Fix C signed/unsigned compare warning. - * winsup.api/mmaptest01.c: Ditto. - * winsup.api/ltp/chmod01.c: Ditto. - * winsup.api/ltp/fork04.c: Ditto. - * winsup.api/ltp/lseek03.c: Ditto. - * winsup.api/ltp/lseek06.c: Ditto. - * winsup.api/ltp/lseek07.c: Ditto. - * winsup.api/ltp/lseek08.c: Ditto. - * winsup.api/ltp/mmap001.c: Ditto. - * winsup.api/ltp/mmap02.c: Ditto. - * winsup.api/ltp/mmap03.c: Ditto. - * winsup.api/ltp/mmap04.c: Ditto. - * winsup.api/ltp/mmap05.c: Ditto. - * winsup.api/ltp/mmap06.c: Ditto. - * winsup.api/ltp/mmap07.c: Ditto. - * winsup.api/ltp/mmap08.c: Ditto. - * winsup.api/ltp/pipe11.c: Ditto. - * winsup.api/ltp/poll01.c: Ditto. - * winsup.api/ltp/sync02.c: Ditto. - * winsup.api/ltp/times03.c: Ditto. - * winsup.api/ltp/umask03.c: Ditto. - * winsup.api/ltp/getpgid01.c: Remove unused obsolete include. - * winsup.api/ltp/getpgid02.c: Ditto. - -2003-02-08 Christopher Faylor - - * winsup.api/winsup.exp (ws_spawn): Tweak slightly to work with tcl - 8.4.1. - -2003-02-07 Christopher Faylor - - * libltp/lib/parse_opts.c: Deal with C warnings. - * winsup.api/pthread/cancel12.c: Ditto. - * winsup.api/winsup.exp: Don't use -g3. - -2003-02-04 Thomas Pfaff - - * winsup.api/pthread/cancel11.c: New test. - * winsup.api/pthread/cancel12.c: Ditto. - -2003-01-23 Christopher Faylor - - * Makefile.in: Don't filter out -g. Actually pass correct CFLAGS to - site.exp. - * winsup.api/winsup.exp: Use -g flag from CFLAGS. - -2003-01-23 Christopher Faylor - - * Makefile.in: Turn off all optimizations. - * libltp/lib/parse_opts.c (TEST_VALID_ENO): Move define outside of - conditional. - (TEST_ERRNO): Ditto. - (btime): Ditto. - (etime): Ditto. - (tmptime): Ditto. - -2003-01-23 Christopher Faylor - - * libltp/include/usctest.h: Add externs to some variables that need it. - * winsup.api/ltp/mmap05.c (main): Make file_content volatile to avoid - optimization glitch. - -2003-01-23 Christopher Faylor - - * winsup.api/mmaptest03.c (main): Mark variables as volatile to avoid - optimization induced problems. - -2003-01-23 Christopher Faylor - - * Makefile (check): Add cygrun.exe dependency. - -2003-01-23 Christopher Faylor - - Perform more C warning fixup on all C source files and headers. - -2003-01-23 Christopher Faylor - - * libltp/include/test.h: Fix C warnings. - * winsup.api/checksignal.c: Ditto. - * winsup.api/crlf.c: Ditto. - * winsup.api/devzero.c: Ditto. - * winsup.api/iospeed.c: Ditto. - * winsup.api/mmaptest01.c: Ditto. - * winsup.api/mmaptest02.c: Ditto. - * winsup.api/mmaptest03.c: Ditto. - * winsup.api/mmaptest04.c: Ditto. - * winsup.api/nullgetcwd.c: Ditto. - * winsup.api/sigchld.c: Ditto. - * winsup.api/signal-into-win32-api.c: Ditto. - * winsup.api/systemcall.c: Ditto. - * winsup.api/waitpid.c: Ditto. - * winsup.api/pthread/mainthreadexits.c: Ditto. - * winsup.api/pthread/test.h: Ditto. - * winsup.api/pthread/threadidafterfork.c: Ditto. - - * Makefile.in: Remove cygrun.exe from RUNTIME since it is built here - now. - -2003-01-23 Christopher Faylor - - * Makefile.in: Use ALL_CFLAGS to build test programs so that correct - libraries and other options are used. - -2003-01-22 Corinna Vinschen - - * cygrun.c: Move here from ../cygwin. - * Makefile.in: Build cygrun.exe. - * winsup.api/winsup.exp: Expect cygrun.exe in $rootme. - -2003-01-21 Christopher Faylor - - * Makefile.in: Find tcl library in the right place. - -2003-01-21 Thomas Pfaff - - * winsup.api/pthread/cancel9.c: Make child pid static global. - (main): Wait in mainthread until child process has terminated. - -2003-01-14 Thomas Pfaff - - * winsup.api/pthread/cancel10.c: New test. - -2003-01-14 Thomas Pfaff - - * winsup.api/pthread/cancel9.c: New test. - -2003-01-14 Thomas Pfaff - - * winsup.api/pthread/cancel7.c: New test. - * winsup.api/pthread/cancel8.c: Ditto. - -2003-01-14 Thomas Pfaff - - * winsup.api/pthread/cancel6.c: New test. - -2003-01-09 Thomas Pfaff - - * winsup.api/pthread/mutex1d.c: New test. Port from pthreads-win32 - project. - * winsup.api/pthread/mutex1e.c: Ditto. - * winsup.api/pthread/mutex4.c: Ditto. - * winsup.api/pthread/mutex5.c: Ditto. - * winsup.api/pthread/mutex6d.c: Ditto. - * winsup.api/pthread/mutex6e.c: Ditto. - * winsup.api/pthread/mutex7.c: Ditto. - * winsup.api/pthread/mutex7d.c: Ditto. - * winsup.api/pthread/mutex7e.c: Ditto. - * winsup.api/pthread/mutex7r.c: Ditto. - -2002-11-25 Robert Collins - - * readme: Document running portions of the test suite (Thanks Egor!). - * winsup.api/pthread/mainthreadexits.c: New file, derived from - Thomas Pfaff's test cases. - * winsup.api/pthread/threadidafterfork.c: Ditto. - -2002-08-25 Christopher Faylor - - * Makefile.in (RUNTEST): Use Makefile's srcdir and bupdir* macros, - where appropriate. - * winsup.api/winsup.exp: Use -nodefaultlibs when linking executable to - avoid potentially linking installed dll. - -2002-07-06 Christopher Faylor - - * testsuite/winsup.api/winsup.exp: Add -mwin32 to gcc flags so - windows.h will be found. - -2002-07-04 Egor Duda - - * winsup.api/pthread/cancel1.c: New test. Port from pthreads-win32 - project. - * winsup.api/pthread/cancel2.c: Ditto. - * winsup.api/pthread/cancel3.c: Ditto. - * winsup.api/pthread/cancel4.c: Ditto. - * winsup.api/pthread/cancel5.c: Ditto. - -2002-07-03 Christopher Faylor - - * Makefile.in: Eliminate unneeded Makefile recreation rule. - -2002-02-27 Christopher Faylor - - * winsup.api/systemcall.c (main): Ensure that stdin is redirected. - -2001-11-18 Egor Duda - - * winsup.api/pthread/condvar3_1.c: Fix debugging output. - -2001-11-15 Egor Duda - - * winsup.api/pthread/: New directory. Ports of pthread functionality - tests from pthreads-win32 project. - * winsup.api/pthread/test.h: Commmon declaraions for pthread tests. - * winsup.api/pthread/cleanup2.c: New test. - * winsup.api/pthread/cleanup3.c: Ditto. - * winsup.api/pthread/condvar1.c: Ditto. - * winsup.api/pthread/condvar2.c: Ditto. - * winsup.api/pthread/condvar2_1.c: Ditto. - * winsup.api/pthread/condvar3.c: Ditto. - * winsup.api/pthread/condvar3_1.c: Ditto. - * winsup.api/pthread/condvar3_2.c: Ditto. - * winsup.api/pthread/condvar3_3.c: Ditto. - * winsup.api/pthread/condvar4.c: Ditto. - * winsup.api/pthread/condvar5.c: Ditto. - * winsup.api/pthread/condvar6.c: Ditto. - * winsup.api/pthread/condvar8.c: Ditto. - * winsup.api/pthread/count1.c: Ditto. - * winsup.api/pthread/create1.c: Ditto. - * winsup.api/pthread/create2.c: Ditto. - * winsup.api/pthread/equal1.c: Ditto. - * winsup.api/pthread/exit1.c: Ditto. - * winsup.api/pthread/exit2.c: Ditto. - * winsup.api/pthread/exit3.c: Ditto. - * winsup.api/pthread/inherit1.c: Ditto. - * winsup.api/pthread/join0.c: Ditto. - * winsup.api/pthread/join1.c: Ditto. - * winsup.api/pthread/join2.c: Ditto. - * winsup.api/pthread/mutex1.c: Ditto. - * winsup.api/pthread/mutex1r.c: Ditto. - * winsup.api/pthread/mutex2.c: Ditto. - * winsup.api/pthread/mutex3.c: Ditto. - * winsup.api/pthread/mutex6r.c: Ditto. - * winsup.api/pthread/once1.c: Ditto. - * winsup.api/pthread/priority1.c: Ditto. - * winsup.api/pthread/priority2.c: Ditto. - * winsup.api/pthread/self1.c: Ditto. - * winsup.api/pthread/self2.c: Ditto. - * winsup.api/pthread/tsd1.c: Ditto. - -2001-11-08 Corinna Vinschen - - * checksignal.c: New testcase. - -2001-11-04 Christopher Faylor - - * Makefile.in: Oops. Revert previous change. Add Makefile/Makefile.in - dependency. - -2001-11-04 Christopher Faylor - - * Makefile.in: Add check target. - -2001-11-02 Egor Duda - - * libltp/lib/forker.c: Include proper header to avoid compiler - warning. - -2001-10-29 Egor Duda - - * winsup.api/ltp/stat03.c: Supress compiler warning. - -2001-10-29 Egor Duda - - * winsup.api/signal-into-win32-api.c: Supress compiler warning. - -Mon Oct 8 14:15:00 2001 Corinna Vinschen - - * winsup.api/mmaptest01.c: Add several tests on mmaps. Use libltp. - * winsup.api/winsup.exp: Link all tests agains libltp. - -Fri Oct 5 11:15:55 2001 Christopher Faylor - - * winsup.api/nullgetcwd.c: New file. Check that NULL first argument to - getcwd works. - -Thu Oct 4 22:47:51 2001 Christopher Faylor - - * winsup.api/systemcall.c (main): Change some messages for clarity. - -Thu Oct 4 22:19:39 2001 Christopher Faylor - - * winsup.api/systemcall.c: New file. Check for system call problems. - -2001-09-20 Egor Duda - - * libltp/lib/get_high_address.c (get_high_address): Get inaccessible - address more robustly. - * winsup.api/ltp/stat06.c (high_address_setup): Use generic function - from ltp library to obtain inaccessible address. - -2001-09-15 Egor Duda - - * winsup.api/ltp/sbrk01.c (main): Force output at startup to - make sure that stdio file buffer get allocated. - * winsup.api/ltp/stat06.c (high_address_setup): On cygwin, area - after sbrk(0) may be available, use 0xffff0000 as "high address". - * winsup.api/ltp/symlink01.c: Perform all tests. Mark those tests that - don't work on cygwin with '-1'. Close open files so that temporary - directory can be deleted on exit. - * winsup.api/ltp/vfork01.c: New test. - -2001-09-13 Egor Duda - - * winsup.api/winsup.exp: Run only selected test if environment - variable CYGWIN_TESTSUITE_TESTS is set. Use its value as regular - expression to filter test names. - * winsup.api/ltp/symlink01.c (creat_path_max): Provide explicit - buffer to getcwd to conform to standards and avoid memory leak. - (do_chdir): Ditto. - -2001-09-13 Egor Duda - - * libltp/lib/tst_sig.c: Pass SIGSEGV to application to consider - whether it's expected or not. - * winsup.api/known_bugs.tcl: lseek10 is known to fail because mknod - is not implemented. - * winsup.api/ltp/rename02.c: Fix formatting. - * libltp/lib/libtestsuite.c: New file. - * winsup.api/signal-into-win32-api.c: New test. - * winsup.api/ltp/access04.c: Ditto. - * winsup.api/ltp/access05.c: Ditto. - * winsup.api/ltp/alarm07.c: Ditto. - * winsup.api/ltp/chdir04.c: Ditto. - * winsup.api/ltp/chmod01.c: Ditto. - * winsup.api/ltp/close01.c: Ditto. - * winsup.api/ltp/close02.c: Ditto. - * winsup.api/ltp/creat01.c: Ditto. - * winsup.api/ltp/creat03.c: Ditto. - * winsup.api/ltp/exit01.c: Ditto. - * winsup.api/ltp/exit02.c: Ditto. - * winsup.api/ltp/fchdir01.c: Ditto. - * winsup.api/ltp/fchdir02.c: Ditto. - * winsup.api/ltp/fork02.c: Ditto. - * winsup.api/ltp/fork03.c: Ditto. - * winsup.api/ltp/fork06.c: Ditto. - * winsup.api/ltp/fork07.c: Ditto. - * winsup.api/ltp/fork09.c: Ditto. - * winsup.api/ltp/fork10.c: Ditto. - * winsup.api/ltp/fork11.c: Ditto. - * winsup.api/ltp/fstat02.c: Ditto. - * winsup.api/ltp/fstat03.c: Ditto. - * winsup.api/ltp/fstat04.c: Ditto. - * winsup.api/ltp/ftruncate01.c: Ditto. - * winsup.api/ltp/ftruncate02.c: Ditto. - * winsup.api/ltp/ftruncate03.c: Ditto. - * winsup.api/ltp/getgid02.c: Ditto. - * winsup.api/ltp/getgid03.c: Ditto. - * winsup.api/ltp/getpgid01.c: Ditto. - * winsup.api/ltp/getpgid02.c: Ditto. - * winsup.api/ltp/getpid02.c: Ditto. - * winsup.api/ltp/getppid02.c: Ditto. - * winsup.api/ltp/getuid02.c: Ditto. - * winsup.api/ltp/getuid03.c: Ditto. - * winsup.api/ltp/kill01.c: Ditto. - * winsup.api/ltp/kill02.c: Ditto. - * winsup.api/ltp/kill03.c: Ditto. - * winsup.api/ltp/kill04.c: Ditto. - * winsup.api/ltp/lseek06.c: Ditto. - * winsup.api/ltp/lseek07.c: Ditto. - * winsup.api/ltp/lseek08.c: Ditto. - * winsup.api/ltp/lseek09.c: Ditto. - * winsup.api/ltp/lseek10.c: Ditto. - * winsup.api/ltp/mmap02.c: Ditto. - * winsup.api/ltp/mmap03.c: Ditto. - * winsup.api/ltp/mmap04.c: Ditto. - * winsup.api/ltp/mmap05.c: Ditto. - * winsup.api/ltp/mmap06.c: Ditto. - * winsup.api/ltp/mmap07.c: Ditto. - * winsup.api/ltp/mmap08.c: Ditto. - * winsup.api/ltp/munmap01.c: Ditto. - * winsup.api/ltp/munmap02.c: Ditto. - * winsup.api/ltp/open02.c: Ditto. - * winsup.api/ltp/pipe01.c: Ditto. - * winsup.api/ltp/pipe08.c: Ditto. - * winsup.api/ltp/pipe09.c: Ditto. - * winsup.api/ltp/pipe10.c: Ditto. - * winsup.api/ltp/pipe11.c: Ditto. - * winsup.api/ltp/poll01.c: Ditto. - * winsup.api/ltp/read04.c: Ditto. - * winsup.api/ltp/readlink01.c: Ditto. - * winsup.api/ltp/readlink03.c: Ditto. - * winsup.api/ltp/rename01.c: Ditto. - * winsup.api/ltp/rename08.c: Ditto. - * winsup.api/ltp/rename10.c: Ditto. - * winsup.api/ltp/rmdir01.c: Ditto. - * winsup.api/ltp/stat01.c: Ditto. - * winsup.api/ltp/stat02.c: Ditto. - * winsup.api/ltp/stat03.c: Ditto. - * winsup.api/ltp/symlink03.c: Ditto. - * winsup.api/ltp/symlink04.c: Ditto. - * winsup.api/ltp/symlink05.c: Ditto. - * winsup.api/ltp/sync02.c: Ditto. - * winsup.api/ltp/time02.c: Ditto. - * winsup.api/ltp/times02.c: Ditto. - * winsup.api/ltp/times03.c: Ditto. - * winsup.api/ltp/truncate01.c: Ditto. - * winsup.api/ltp/truncate02.c: Ditto. - * winsup.api/ltp/umask02.c: Ditto. - * winsup.api/ltp/umask03.c: Ditto. - * winsup.api/ltp/wait401.c: Ditto. - * winsup.api/ltp/wait402.c: Ditto. - * winsup.api/ltp/write02.c: Ditto. - * winsup.api/ltp/write03.c: Ditto. - -2001-09-09 Egor Duda - - * winsup.api/ltp/dup03.c: New test. - * winsup.api/ltp/lseek03.c: Ditto. - * winsup.api/ltp/mmap001.c: Ditto. - * winsup.api/ltp/read01.c: Ditto. - * winsup.api/ltp/readdir01.c: Ditto. - * winsup.api/ltp/rmdir05.c: Ditto. - * winsup.api/ltp/sbrk01.c: Ditto. - * winsup.api/ltp/select02.c: Ditto. - * winsup.api/ltp/select03.c: Ditto. - * winsup.api/ltp/signal03.c: Ditto. - * winsup.api/ltp/stat06.c: Ditto. - * winsup.api/ltp/unlink08.c: Ditto. - * winsup.api/known_bugs.tcl: Update to reflect new test's known - failures. - * winsup.api/winsup.exp: Don't delete executable in case of - unexpected pass, as well as in case of unexpected failure. - * README: Update paragraph about expected failures. - -2001-05-21 Corinna Vinschen - - * winsup.api/mmaptest01.c: Add log output. - * winsup.api/mmaptest02.c: Write log output to stdout. - * winsup.api/mmaptest03.c: Ditto. - -2001-05-15 Corinna Vinschen - - * winsup.api/winsup.exp: Force linking all tests against binmode.o. - -2001-04-27 Corinna Vinschen - - * winsup.api/mmaptest04.c: Take care for binmode explicitely. - -2001-04-19 Corinna Vinschen - - * winsup.api/mmaptest02.c: New test. - * winsup.api/mmaptest03.c: Ditto. - * winsup.api/mmaptest04.c: Ditto. - -2001-04-03 Corinna Vinschen - - * winsup.api/mmaptest01.c: New test. - -2001-03-10 Egor Duda - - * winsup.api/ltp/access01.c: Avoid compilation error if X_OK - isn't declared as a constant. - -2001-03-09 Egor Duda - - * config/default.exp: Remove unneeded debugging output. - * Makefile.in: Use correct path to find dejagnu in local tree. - -2000-09-06 Egor Duda - - Add 'const' qualifiers where needed to avoid compiler warnings. - * libltp/lib/tst_sig.c (tst_sig): Don't attempt to cleanup on - fatal errors. - * libltp/lib/parse_opts.c (parse_opts): Initialize allocated - string to prevent heap corruption. - -2000-09-04 Egor Duda - - * Makefile.in: Always add libltp headers directory to headers - search path. - -2000-09-02 Egor Duda - - * moved here everything from cygwin/testsuite/ - * configure.in: New file - * configure: New file, generated from configure.in - with autoconf 2.13 - * Makefile.in: New file - * libltp/: New directory. Contains a support library - and headers for tests in winsup.api/ltp/ - * config/default.exp: Print value of CYGWIN environment - variable when test completed - * winsup.api/samples/xf-sample-fail.c renamed to - winsup.api/samples/sample-fail.c - * winsup.api/samples/xf-sample-miscompile.c renamed to - winsup.api/samples/sample-miscompile.c - * winsup.api/known_bugs.tcl: New file. - * winsup.api/winsup.exp: Xfail test if its name is in - list from known_bugs.tcl - * winsup.api/winsup.exp: Don't stop if compiled test executable - can't be deleted - * winsup.api/winsup.exp: If in verbose mode, write test output - to .log - * winsup.api/ltp/: New directory. Contains cygwin port of testsuite - from Linux Testing Project - * winsup.api/sigchld.c: New file. Test if process recieves SIGCHLD - signal when its child terminates. - * winsup.api/waitpid.c: New file. Test if waitpid function works diff --git a/winsup/testsuite/Makefile.in b/winsup/testsuite/Makefile.in deleted file mode 100644 index f47ddcb55..000000000 --- a/winsup/testsuite/Makefile.in +++ /dev/null @@ -1,176 +0,0 @@ -# Makefile.in for Cygwin's testsuite. -# Copyright 2000, 2001, 2002, 2003, 2005, 2006, 2009 Red Hat, Inc. -# -# This file is part of Cygwin. -# -# This software is a copyrighted work licensed under the terms of the -# Cygwin license. Please consult the file "CYGWIN_LICENSE" for -# details. - -# This makefile requires GNU make. - -SHELL:=@SHELL@ -srcdir:=@srcdir@ -objdir:=. -libltp_srcdir=$(srcdir)/libltp - -VPATH:=$(srcdir):$(libltp_srcdir)/lib - -target_alias:=@target_alias@ -build_alias:=@build_alias@ -host_alias:=@host_alias@ - -DESTDIR= -prefix:=${DESTDIR}@prefix@ - -program_transform_name:=@program_transform_name@ -exec_prefix:=${DESTDIR}@exec_prefix@ -bindir:=${DESTDIR}@bindir@ -libdir:=${DESTDIR}@libdir@ -ifeq ($(target_alias),$(host_alias)) -ifeq ($(build_alias),$(host_alias)) -tooldir:=$(exec_prefix) -else -tooldir:=$(exec_prefix)/$(target_alias) -endif -else -tooldir:=$(exec_prefix)/$(target_alias) -endif -datadir:=${DESTDIR}@datadir@ -infodir:=${DESTDIR}@infodir@ -includedir:=${DESTDIR}@includedir@ - -TESTSUP_INCLUDES:=-I$(libltp_srcdir)/include - -# -# --enable options from configure -# - -CC:=@CC@ -# FIXME: Which is it, CC or CC_FOR_TARGET? -CC_FOR_TARGET:=$(CC) -ifneq (,$(CFLAGS)) - override CFLAGS+= -MD $(TESTSUP_INCLUDES) -else - CFLAGS:=@CFLAGS@ -MD $(TESTSUP_INCLUDES) -endif - -AR:=@AR@ -AR_FLAGS:=qv -MINGW_FE:=$(dir ${srcdir})/utils/mingw - -# -# Include common definitions for winsup directory -# -include $(srcdir)/../Makefile.common - -override CC:=$(CC) $(GCC_INCLUDE) -export CC - -RUNTESTFLAGS = - -ifdef VERBOSE - RUNTESTFLAGS = -v -endif - -RUNTIME=$(cygwin_build)/cygwin0.dll $(cygwin_build)/libcygwin0.a - -TESTSUP_LIB_NAME:=libltp.a -TESTSUP_OFILES:=${sort ${addsuffix .o,${basename ${notdir ${wildcard $(libltp_srcdir)/lib/*.c}}}}} - -override ALL_CFLAGS:=${filter-out -O%,$(ALL_CFLAGS)} -override COMPILE_CC:=${filter-out -O%,$(COMPILE_CC)} -override CFLAGS:=${filter-out -O%,$(CFLAGS)} -export CFLAGS - -.PHONY: all force dll_ofiles install all_target install_target install_host - -.SUFFIXES: -.SUFFIXES: .c .cc .def .a .o .d - -all: $(TESTSUP_LIB_NAME) - -force: - -install: - -install_host: - -clean: - -rm -f *.o *.dll *.a *.exp junk *.bak *.base *.exe testsuite/* *.d *.dat - -maintainer-clean realclean: clean - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -rm -fr configure - -# Rule to build libltp.a - -$(TESTSUP_LIB_NAME): $(TESTSUP_OFILES) - $(AR) rcv temp.a $(TESTSUP_OFILES) - mv temp.a $(TESTSUP_LIB_NAME) - -$(RUNTIME) : $(cygwin_build)/Makefile - @$(MAKE) --no-print-dir -C $(@D) $(@F) - -# Rule to make stub library used by "make check" - -# - -# These targets are for the dejagnu testsuites. The file site.exp -# contains global variables that all the testsuites will use. - -# Set to $(target_alias)/ for cross. -target_subdir = @target_subdir@ - -site.exp: ./config.status Makefile - @echo "Making a new config file..." - -@rm -f ./tmp? - @touch site.exp - -@mv site.exp site.bak - @echo "## these variables are automatically generated by make ##" > ./tmp0 - @echo "# Do not edit here. If you wish to override these values" >> ./tmp0 - @echo "# add them to the last section" >> ./tmp0 - @echo "set rootme \"`pwd`\"" >> ./tmp0 - @echo "set runtime_root \"\$$rootme/../cygwin\"" >> ./tmp0 - @echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0 - @echo "set host_triplet $(host_canonical)" >> ./tmp0 - @echo "set build_triplet $(build_canonical)" >> ./tmp0 - @echo "set target_triplet $(target)" >> ./tmp0 - @echo "set target_alias $(target_alias)" >> ./tmp0 - @echo "set CC \"$(CC)\"" >> ./tmp0 -# CFLAGS is set even though it's empty to show we reserve the right to set it. - @echo "set CFLAGS \"$(ALL_CFLAGS)\"" >> ./tmp0 - echo "set tmpdir $(objdir)/testsuite" >> ./tmp0 - @echo "set ltp_includes \"$(libltp_srcdir)/include\"" >> ./tmp0 - @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0 - @cat ./tmp0 > site.exp - @cat site.bak | sed \ - -e '1,/^## All variables above are.*##/ d' >> site.exp - -@rm -f ./tmp? - -testsuite/site.exp: site.exp - if [ -d testsuite ]; then \ - true; \ - else \ - mkdir testsuite; \ - fi - rm -rf testsuite/site.exp - cp site.exp testsuite/site.exp - -# Note: we set the PATH so that we can pick up cygwin0.dll - -check: $(TESTSUP_LIB_NAME) $(RUNTIME) cygrun.exe testsuite/site.exp - cd testsuite; \ - export EXPECT=expect ; \ - if [ -f $(bupdir2)/expect/expect ] ; then \ - TCL_LIBRARY=`cd .. ; cd ${srcdir}/../../tcl/library ; pwd` ; \ - export TCL_LIBRARY ; fi ; \ - PATH=$(bupdir)/cygwin:$${PATH} ;\ - runtest --tool winsup $(RUNTESTFLAGS) ;\ - -cygrun.o: cygrun.c - ${MINGW_FE} $(CC) $(MINGW_CFLAGS) -o $@ -c $< - -cygrun.exe : cygrun.o - ${MINGW_FE} $(CC) ${MINGW_LDFLAGS} -o $@ $< diff --git a/winsup/testsuite/README b/winsup/testsuite/README deleted file mode 100644 index 2f6749bb8..000000000 --- a/winsup/testsuite/README +++ /dev/null @@ -1,40 +0,0 @@ -1999-12-23 DJ Delorie - -Here are some notes about adding and using this testsuite. - -First, all the programs are linked with libcygwin0.a, which is just -like libcygwin.a, except that it wants cygwin0.dll, not -cygwin1.dll. The testsuite adds the winsup build directory to the -PATH so that cygwin0.dll can be found by windows during testing. - -Because we'll probably run into complaints about using two DLLs, we -run cygrun.exe for each test. All this does is run the test with -CreateProcess() so that we don't attempt to do the special code for -when a cygwin program calls another cygwin program, as this might be a -"multiple cygwins" problem. - -Any test that needs to test command line args or redirection needs to -run such a child program itself, as the testsuite will not do any -arguments or redirection for it. Same for fork, signals, etc. - -The testsuite/winsup.api subdirectory is for testing the API to -cygwin1.dll ONLY. Create other subdirs under testsuite/ for other -classes of testing. - -Tests in winsup.api/*.c or winsup.api/*/*.c (only one subdirectory -level is allowed) either compile, run, and exit(0) or they fail. -Either abort or exit with a non-zero code to indicate failure. Don't -print anything to the screen if you can avoid it (except for failure -reasons, of course). One .c file per test, no compile options are -allowed (we're testing the api, not the compiler). - -Tests whose filename is mentioned in known-bugs.tcl will be *expected* -to fail, and will "fail" if they compile, run, and return zero. - -"make check" will only work if you run it *on* an NT machine. -Cross-checking is not supported. - -To test a subset of the test-suite, use -$ make check CYGWIN_TESTSUITE_TESTS=regexp - - diff --git a/winsup/testsuite/aclocal.m4 b/winsup/testsuite/aclocal.m4 deleted file mode 100644 index 177c0134b..000000000 --- a/winsup/testsuite/aclocal.m4 +++ /dev/null @@ -1,831 +0,0 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p6 - -dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -# lib-prefix.m4 serial 4 (gettext-0.14.2) -dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) - -# lib-link.m4 serial 6 (gettext-0.14.3) -dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -AC_PREREQ(2.50) - -dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -dnl augments the CPPFLAGS variable. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - ac_cv_lib[]Name[]_libs="$LIB[]NAME" - ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" - ac_cv_lib[]Name[]_cppflags="$INC[]NAME" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the - dnl results of this search when this library appears as a dependency. - HAVE_LIB[]NAME=yes - undefine([Name]) - undefine([NAME]) -]) - -dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) -dnl searches for libname and the libraries corresponding to explicit and -dnl implicit dependencies, together with the specified include files and -dnl the ability to compile and link the specified testcode. If found, it -dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and -dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and -dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - - dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - - dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, - dnl because if the user has installed lib[]Name and not disabled its use - dnl via --without-lib[]Name-prefix, he wants to use it. - ac_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - - AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ - ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIB[]NAME" - AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) - LIBS="$ac_save_LIBS" - ]) - if test "$ac_cv_lib[]Name" = yes; then - HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) - AC_MSG_CHECKING([how to link with lib[]$1]) - AC_MSG_RESULT([$LIB[]NAME]) - else - HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need - dnl $INC[]NAME either. - CPPFLAGS="$ac_save_CPPFLAGS" - LIB[]NAME= - LTLIB[]NAME= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - undefine([Name]) - undefine([NAME]) -]) - -dnl Determine the platform dependent parameters needed to use rpath: -dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, -dnl hardcode_direct, hardcode_minus_L. -AC_DEFUN([AC_LIB_RPATH], -[ - dnl Tell automake >= 1.10 to complain if config.rpath is missing. - m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE(rpath, - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib$1-prefix], -[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib - --without-lib$1-prefix don't search for lib$1 in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) - -# lib-ld.m4 serial 3 (gettext-0.13) -dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. - -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(acl_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; - *) - test "$with_gnu_ld" != yes && break ;; - esac - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_LIB_PROG_LD_GNU -]) - diff --git a/winsup/testsuite/config/default.exp b/winsup/testsuite/config/default.exp deleted file mode 100644 index 3936979a6..000000000 --- a/winsup/testsuite/config/default.exp +++ /dev/null @@ -1,13 +0,0 @@ -proc winsup_version {} { - global env - global rootme - clone_output "\n[exec grep ^%%% $rootme/../cygwin/cygwin0.dll]\n" - if { [info exists env(CYGWIN)] } { - clone_output "CYGWIN=$env(CYGWIN)\n" - } else { - clone_output "CYGWIN=\n" - } -} - -proc winsup_exit {} { -} diff --git a/winsup/testsuite/configure b/winsup/testsuite/configure deleted file mode 100644 index 4d97f3f1a..000000000 --- a/winsup/testsuite/configure +++ /dev/null @@ -1,3399 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59. -# -# Copyright (C) 2003 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_unique_file="Makefile.in" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP AR ac_ct_AR LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd "$ac_popdir" - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF - -Copyright (C) 2003 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -echo "${ECHO_T}$ac_ct_AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - AR=$ac_ct_AR -else - AR="$ac_cv_prog_AR" -fi - - - ac_config_files="$ac_config_files Makefile" -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then we branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g -t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g -t quote -d -: quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g -s,\[,\\&,g -s,\],\\&,g -s,\$,$$,g -p -_ACEOF -# We use echo to avoid assuming a particular line-breaking character. -# The extra dot is to prevent the shell from consuming trailing -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed - - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by $as_me, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to ." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - - - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@CPP@,$CPP,;t t -s,@AR@,$AR,;t t -s,@ac_ct_AR@,$ac_ct_AR,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - diff --git a/winsup/testsuite/configure.in b/winsup/testsuite/configure.in deleted file mode 100755 index 37190f9d9..000000000 --- a/winsup/testsuite/configure.in +++ /dev/null @@ -1,19 +0,0 @@ -dnl Autoconf configure script for Cygwin's testsuite. -dnl Copyright 2000 Red Hat, Inc. -dnl -dnl This file is part of Cygwin. -dnl -dnl This software is a copyrighted work licensed under the terms of the -dnl Cygwin license. Please consult the file "CYGWIN_LICENSE" for -dnl details. -dnl -dnl Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59) -AC_INIT(Makefile.in) - -AC_PROG_CC -AC_PROG_CPP -AC_CHECK_TOOL(AR,ar) - -AC_OUTPUT(Makefile) diff --git a/winsup/testsuite/cygrun.c b/winsup/testsuite/cygrun.c deleted file mode 100644 index 60330ca33..000000000 --- a/winsup/testsuite/cygrun.c +++ /dev/null @@ -1,69 +0,0 @@ -/* cygrun.c: testsuite support program - - Copyright 1999, 2000, 2001, 2002 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -/* This program is intended to be used only by the testsuite. It runs - programs without using the cygwin api, so that the just-built dll - can be tested without interference from the currently installed - dll. */ - -#include -#include -#include - -int -main (int argc, char **argv) -{ - STARTUPINFO sa; - PROCESS_INFORMATION pi; - DWORD ec = 1; - char *p; - - if (argc < 2) - { - fprintf (stderr, "Usage: cygrun [program]\n"); - exit (0); - } - - SetEnvironmentVariable ("CYGWIN_TESTING", "1"); - if ((p = getenv ("CYGWIN")) == NULL || (strstr (p, "ntsec") == NULL)) - { - char buf[4096]; - if (!p) - { - p = buf; - p[0] = '\0'; - } - else - { - strcpy (buf, p); - strcat (buf, " "); - } - strcat(buf, "ntsec"); - SetEnvironmentVariable ("CYGWIN", buf); - } - - memset (&sa, 0, sizeof (sa)); - memset (&pi, 0, sizeof (pi)); - if (!CreateProcess (0, argv[1], 0, 0, 1, 0, 0, 0, &sa, &pi)) - { - fprintf (stderr, "CreateProcess %s failed\n", argv[1]); - exit (1); - } - - WaitForSingleObject (pi.hProcess, INFINITE); - - GetExitCodeProcess (pi.hProcess, &ec); - - CloseHandle (pi.hProcess); - CloseHandle (pi.hThread); - if (ec > 0xff) - ec >>= 8; - return ec; -} diff --git a/winsup/testsuite/libltp/include/dataascii.h b/winsup/testsuite/libltp/include/dataascii.h deleted file mode 100644 index cd75245e4..000000000 --- a/winsup/testsuite/libltp/include/dataascii.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _DATAASCII_H_ -#define _DATAASCII_H_ - -/*********************************************************************** - * int dataasciigen(listofchars, buffer, size, offset) - * - * This function fills buffer with ascii characters. - * The ascii characters are obtained from listofchars or the CHARS array - * if listofchars is NULL. - * Each char is selected by an index. The index is the remainder - * of count divided by the array size. - * This method allows more than one process to write to a location - * in a file without corrupting it for another process' point of view. - * - * The return value will be the number of character written in buffer - * (size). - * - ***********************************************************************/ -int dataasciigen(char *, char *, int, int); - -/*********************************************************************** - * int dataasciichk(listofchars, buffer, size, count, errmsg) - * - * This function checks the contents of a buffer produced by - * dataasciigen. - * - * return values: - * >= 0 : error at character count - * < 0 : no error - ***********************************************************************/ - -int dataasciichk(char *, char *, int, int, char**); - -#endif diff --git a/winsup/testsuite/libltp/include/databin.h b/winsup/testsuite/libltp/include/databin.h deleted file mode 100644 index b71fbc0c1..000000000 --- a/winsup/testsuite/libltp/include/databin.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _DATABIN_H_ -#define _DATABIN_H_ - -/******************************************************************************* -* NAME -* databingen - fill a buffer with a data pattern -* -* SYNOPSIS -* (void) databingen(mode, buffer, bsize, offset) -* int mode; -* char *buffer; -* int bsize; -* int offset; -* -* DESCRIPTION -* datagen fills the buffer pointed to by 'buffer' with 'bsize' bytes -* of data of the form indicated by 'mode'. -* All modes (expect r -random) are file offset based. -* This allows more than process to do writing to the file without -* corrupting it if the same modes were used. -* They data modes to choose from, these are: -* -* 'a' - writes an alternating bit pattern (i.e. 0x5555555...) -* -* 'c' - writes a checkerboard pattern (i.e. 0xff00ff00ff00...) -* -* 'C' - writes counting pattern (i.e. 0 - 07, 0 - 07, ...); -* -* 'o' - writes all bits set (i.e. 0xffffffffffffff...) -* -* 'z' - writes all bits cleared (i.e. 0x000000000...); -* -* 'r' - writes random integers -* -* RETURN VALUE -* None -* -*******************************************************************************/ - -void databingen( int mode, unsigned char *buffer, int bsize, int offset ); - -void databinchedk( int mode, unsigned char *buffer, int bsize, int offset, char **errmsg); - -#endif diff --git a/winsup/testsuite/libltp/include/file_lock.h b/winsup/testsuite/libltp/include/file_lock.h deleted file mode 100644 index 8c9a94835..000000000 --- a/winsup/testsuite/libltp/include/file_lock.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _FILE_LOCK_H_ -#define _FILE_LOCK_H_ - -extern char Fl_syscall_str[128]; - -int file_lock( int , int, char ** ); -int record_lock( int , int , int , int , char ** ); - -#endif /* _FILE_LOCK_H_ */ diff --git a/winsup/testsuite/libltp/include/forker.h b/winsup/testsuite/libltp/include/forker.h deleted file mode 100644 index effd5d66e..000000000 --- a/winsup/testsuite/libltp/include/forker.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _FORKER_H_ -#define _FORKER_H_ - -#define FORKER_MAX_PIDS 4098 - -extern int Forker_pids[FORKER_MAX_PIDS]; /* holds pids of forked processes */ -extern int Forker_npids; /* number of entries in Forker_pids */ - -/* - * This function will fork and the parent will exit zero and - * the child will return. This will orphan the returning process - * putting it in the background. - */ -int background( char * ); - -/* - * Forker will fork ncopies-1 copies of self. - * - * arg 1: Number of copies of the process to be running after return. - * This value minus one is the number of forks performed. - * arg 2: mode: 0 - all children are first generation descendents. - * 1 - each subsequent child is a descendent of another - * descendent, resulting in only one direct descendent of the - * parent and each other child is a child of another child in - * relation to the parent. - * arg 3: prefix: string to preceed any error messages. A value of NULL - * results in no error messages on failure. - * returns: returns to parent the number of children forked. - */ -int forker( int , int , char * ); - -#endif /* _FORKER_H_ */ diff --git a/winsup/testsuite/libltp/include/open_flags.h b/winsup/testsuite/libltp/include/open_flags.h deleted file mode 100644 index 87fe6ff1d..000000000 --- a/winsup/testsuite/libltp/include/open_flags.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _OPEN_FLAGS_H_ -#define _OPEN_FLAGS_H_ - -/*********************************************************************** - * This function attempts to convert open flag bits into human readable - * symbols (i.e. O_TRUNC). If there are more than one symbol, - * the string will be placed as a separator between symbols. - * Commonly used separators would be a comma "," or pipe "|". - * If is one and not all bits can be converted to - * symbols, the "UNKNOWN" symbol will be added to return string. - * - * Return Value - * openflags2symbols will return the indentified symbols. - * If no symbols are recognized the return value will be a empty - * string or the "UNKNOWN" symbol. - * - * Limitations - * Currently (05/96) all known symbols are coded into openflags2symbols. - * If new open flags are added this code will have to updated - * to know about them or they will not be recognized. - * - * The Open_symbols must be large enough to hold all possible symbols - * for a given system. - * - ***********************************************************************/ -char *openflags2symbols( int, char *, int ); - -/*********************************************************************** - * This function will take a string of comma separated open flags symbols - * and translate them into an open flag bitmask. - * If any symbol is not valid, -1 is returned. On this error condition - * the badname pointer is updated if not NULL. badname will point - * to the beginning location of where the invalid symbol was found. - * string will be returned unchanged. - * - * A signal received while parsing string could cause the string to - * contain a NULL character in the middle of it. - * - ***********************************************************************/ -int parse_open_flags( char *, char ** ); - -#endif diff --git a/winsup/testsuite/libltp/include/pattern.h b/winsup/testsuite/libltp/include/pattern.h deleted file mode 100644 index 74f841cae..000000000 --- a/winsup/testsuite/libltp/include/pattern.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _PATTERN_H_ -#define _PATTERN_H_ - -/* - * pattern_check(buf, buflen, pat, patlen, patshift) - * - * Check a buffer of length buflen against repeated occurrances of - * a pattern whose length is patlen. Patshift can be used to rotate - * the pattern by patshift bytes to the left. - * - * Patshift may be greater than patlen, the pattern will be rotated by - * (patshift % patshift) bytes. - * - * pattern_check returns -1 if the buffer does not contain repeated - * occurrances of the indicated pattern (shifted by patshift). - * - * The algorithm used to check the buffer relies on the fact that buf is - * supposed to be repeated copies of pattern. The basic algorithm is - * to validate the first patlen bytes of buf against the pat argument - * passed in - then validate the next patlen bytes against the 1st patlen - * bytes - the next (2*patlen) bytes against the 1st (2*pathen) bytes, and - * so on. This algorithm only works when the assumption of a buffer full - * of repeated copies of a pattern holds, and gives MUCH better results - * then walking the buffer byte by byte. - * - * Performance wise, It appears to be about 5% slower than doing a straight - * memcmp of 2 buffers, but the big win is that it does not require a - * 2nd comparison buffer, only the pattern. - */ -int pattern_check( char * , int , char * , int , int ); - -/* - * pattern_fill(buf, buflen, pat, patlen, patshift) - * - * Fill a buffer of length buflen with repeated occurrances of - * a pattern whose length is patlen. Patshift can be used to rotate - * the pattern by patshift bytes to the left. - * - * Patshift may be greater than patlen, the pattern will be rotated by - * (patshift % patlen) bytes. - * - * If buflen is not a multiple of patlen, a partial pattern will be written - * in the last part of the buffer. This implies that a buffer which is - * shorter than the pattern length will receive only a partial pattern ... - * - * pattern_fill always returns 0 - no validation of arguments is done. - * - * The algorithm used to fill the buffer relies on the fact that buf is - * supposed to be repeated copies of pattern. The basic algorithm is - * to fill the first patlen bytes of buf with the pat argument - * passed in - then copy the next patlen bytes with the 1st patlen - * bytes - the next (2*patlen) bytes with the 1st (2*pathen) bytes, and - * so on. This algorithm only works when the assumption of a buffer full - * of repeated copies of a pattern holds, and gives MUCH better results - * then filling the buffer 1 byte at a time. - */ -int pattern_fill( char * , int , char * , int , int ); - -#endif diff --git a/winsup/testsuite/libltp/include/random_range.h b/winsup/testsuite/libltp/include/random_range.h deleted file mode 100644 index d3e1cceb8..000000000 --- a/winsup/testsuite/libltp/include/random_range.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _RANDOM_RANGE_H_ -#define _RANDOM_RANGE_H_ - -int parse_ranges ( char *, int, int, int, int (*)(), char **, char ** ); -int range_min ( char *, int ); -int range_max ( char *, int ); -int range_mult ( char *, int ); -long random_range ( int, int, int, char ** ); -long random_rangel ( long, long, long, char ** ); -long long random_rangell ( long long, long long, long long, char ** ); -void random_range_seed( long ); -long random_bit ( long ); - -#endif diff --git a/winsup/testsuite/libltp/include/rmobj.h b/winsup/testsuite/libltp/include/rmobj.h deleted file mode 100644 index 4808ca258..000000000 --- a/winsup/testsuite/libltp/include/rmobj.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _RMOBJ_H_ -#define _RMOBJ_H_ - -/* - * rmobj() - Remove the specified object. If the specified object is a - * directory, recursively remove everything inside of it. If - * there are any problems, set errmsg (if it is not NULL) and - * return -1. Otherwise return 0. - */ -int rmobj( char *object , char **errmesg ); - -#endif diff --git a/winsup/testsuite/libltp/include/search_path.h b/winsup/testsuite/libltp/include/search_path.h deleted file mode 100644 index 58b7a36d2..000000000 --- a/winsup/testsuite/libltp/include/search_path.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - - -int search_path(const char *cmd, const char *res_path, int access_mode, int fullpath); diff --git a/winsup/testsuite/libltp/include/str_to_bytes.h b/winsup/testsuite/libltp/include/str_to_bytes.h deleted file mode 100644 index 100d37df5..000000000 --- a/winsup/testsuite/libltp/include/str_to_bytes.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _STR_TO_BYTES_ -#define _STR_TO_BYTES_ - -int str_to_bytes ( char * ); -long str_to_lbytes ( char * ); -long long str_to_llbytes( char * ); - -#endif diff --git a/winsup/testsuite/libltp/include/string_to_tokens.h b/winsup/testsuite/libltp/include/string_to_tokens.h deleted file mode 100644 index 9c0935ec5..000000000 --- a/winsup/testsuite/libltp/include/string_to_tokens.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _STRING_TO_TOKENS_H_ -#define _STRING_TO_TOKENS_H_ - -/* - * string_to_tokens() - * - * This function parses the string 'arg_string', placing pointers to - * the 'separator' separated tokens into the elements of 'arg_array'. - * The array is terminated with a null pointer. - * - * NOTE: This function uses strtok() to parse 'arg_string', and thus - * physically alters 'arg_string' by placing null characters where the - * separators originally were. - */ -int string_to_tokens(char *, char **, int, char *); - -#endif diff --git a/winsup/testsuite/libltp/include/test.h b/winsup/testsuite/libltp/include/test.h deleted file mode 100644 index 8cffea4cb..000000000 --- a/winsup/testsuite/libltp/include/test.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - *. - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - -#ifndef __TEST_H__ -#define __TEST_H__ - -#define execve execve_foo -#define execv execv_foo -#define execvp execvp_foo -#include -#include -#include -#include -#include -#undef execvp -#undef execv -#undef execve - -int execve(const char *, const char * const [], char * const *); -int execv(const char *, const char * const []); -int execvp(const char *, const char * const []); - -/* CGF: Avoid compilation warnings for undefined functions */ -extern int setregid (gid_t, gid_t); -int setreuid (uid_t, uid_t); - -#define TPASS 0 /* Test passed flag */ -#define TFAIL 1 /* Test failed flag */ -#define TBROK 2 /* Test broken flag */ -#define TWARN 4 /* Test warning flag */ -#define TRETR 8 /* Test retire flag */ -#define TINFO 16 /* Test information flag */ -#define TCONF 32 /* Test not appropriate for configuration flag */ - -/* - * To determine if you are on a Umk or Unicos system, - * use sysconf(_SC_CRAY_SYSTEM). But since _SC_CRAY_SYSTEM - * is not defined until 90, it will be define here if not already - * defined. - * if ( sysconf(_SC_CRAY_SYSTEM) == 1 ) - * on UMK - * else # returned 0 or -1 - * on Unicos - * This is only being done on CRAY systems. - */ -#ifdef CRAY -#ifndef _SC_CRAY_SYSTEM -#define _SC_CRAY_SYSTEM 140 -#endif /* ! _SC_CRAY_SYSTEM */ -#endif /* CRAY */ - -/* - * Ensure that NUMSIGS is defined. - * It should be defined in signal.h or sys/signal.h on - * UNICOS/mk and IRIX systems. On UNICOS systems, - * it is not defined, thus it is being set to UNICOS's NSIG. - * Note: IRIX's NSIG (signals are 1-(NSIG-1)) - * is not same meaning as UNICOS/UMK's NSIG (signals 1-NSIG) - */ -#ifndef NUMSIGS -#define NUMSIGS NSIG -#endif - - -/* defines for unexpected signal setup routine (set_usig.c) */ -#define FORK 1 /* SIGCLD is to be ignored */ -#define NOFORK 0 /* SIGCLD is to be caught */ -#define DEF_HANDLER 0 /* tells set_usig() to use default signal handler */ - -/* - * The following defines are used to control tst_res and t_result reporting. - */ - -#define TOUTPUT "TOUTPUT" /* The name of the environment variable */ - /* that can be set to one of the following */ - /* strings to control tst_res output */ - /* If not set, TOUT_VERBOSE_S is assumed */ - -#define TOUT_VERBOSE_S "VERBOSE" /* All test cases reported */ -#define TOUT_CONDENSE_S "CONDENSE" /* ranges are used where identical messages*/ - /* occur for sequential test cases */ -#define TOUT_NOPASS_S "NOPASS" /* No pass test cases are reported */ -#define TOUT_DISCARD_S "DISCARD" /* No output is reported */ - -#define TST_NOBUF "TST_NOBUF" /* The name of the environment variable */ - /* that can be set to control whether or not */ - /* tst_res will buffer output into 4096 byte */ - /* blocks of output */ - /* If not set, buffer is done. If set, no */ - /* internal buffering will be done in tst_res */ - /* t_result does not have internal buffering */ - -/* - * The following defines are used to control tst_tmpdir, tst_wildcard and t_mkchdir - */ - -#define TDIRECTORY "TDIRECTORY" /* The name of the environment variable */ - /* that if is set, the value (directory) */ - /* is used by all tests as their working */ - /* directory. tst_rmdir and t_rmdir will */ - /* not attempt to clean up. */ - /* This environment variable should only */ - /* be set when doing system testing since */ - /* tests will collide and break and fail */ - /* because of setting it. */ - -#define TEMPDIR "/tmp" /* This is the default temporary directory. */ - /* The environment variable TMPDIR is */ - /* used prior to this valid by tempnam(3). */ - /* To control the base location of the */ - /* temporary directory, set the TMPDIR */ - /* environment variable to desired path */ - -/* - * The following contains support for error message passing. - * See test_error.c for details. - */ -#define TST_ERR_MESG_SIZE 1023 /* max size of error message */ -#define TST_ERR_FILE_SIZE 511 /* max size of module name used by compiler */ -#define TST_ERR_FUNC_SIZE 127 /* max size of func name */ - -typedef struct { - int te_line; /* line where last error was reported. Use */ - /* "__LINE__" and let compiler do the rest */ - int te_level; /* If set, will prevent current stored */ - /* error to not be overwritten */ - char te_func[TST_ERR_FUNC_SIZE+1]; /* name of function of last error */ - /* Name of function or NULL */ - char te_file[TST_ERR_FILE_SIZE+1]; /* module of last error. Use */ - /* "__FILE__" and let compiler do the rest */ - char te_mesg[TST_ERR_MESG_SIZE+1]; /* string of last error */ - -} _TST_ERROR; - -extern _TST_ERROR Tst_error; /* defined in test_error.c */ -#if __STDC__ -extern void tst_set_error(char *file, int line, char *func, char *fmt, ...); -#else -extern void tst_set_error(); -#endif -extern void tst_clear_error(); - - -/* - * The following define contains the name of an environmental variable - * that can be used to specify the number of iterations. - * It is supported in parse_opts.c and USC_setup.c. - */ -#define USC_ITERATION_ENV "USC_ITERATIONS" - -/* - * The following define contains the name of an environmental variable - * that can be used to specify to iteration until desired time - * in floating point seconds has gone by. - * Supported in USC_setup.c. - */ -#define USC_LOOP_WALLTIME "USC_LOOP_WALLTIME" - -/* - * The following define contains the name of an environmental variable - * that can be used to specify that no functional checks are wanted. - * It is supported in parse_opts.c and USC_setup.c. - */ -#define USC_NO_FUNC_CHECK "USC_NO_FUNC_CHECK" - -/* - * The following define contains the name of an environmental variable - * that can be used to specify the delay between each loop iteration. - * The value is in seconds (fractional numbers are allowed). - * It is supported in parse_opts.c. - */ -#define USC_LOOP_DELAY "USC_LOOP_DELAY" - -/* - * The following prototypes are needed to remove compile errors - * on IRIX systems when compiled with -n32 and -64. - */ -extern void tst_res(int ttype, const char *fname, const char *arg_fmt, ...); -extern void tst_resm(int ttype, const char *arg_fmt, ...); -extern void tst_brk(int ttype, char *fname, void (*func)(), - const char *arg_fmt, ...); -extern void tst_brkloop(int ttype, char *fname, void (*func)(), - const char *arg_fmt, ...); -extern void tst_brkm(int ttype, void (*func)(), const char *arg_fmt, ...); -extern void tst_brkloopm(int ttype, void (*func)(), const char *arg_fmt, ...); - -extern int tst_environ(); -extern void tst_exit() __attribute__ ((noreturn)); -extern void tst_flush(); - -/* prototypes for the t_res.c functions */ -extern void t_result(char *tcid, int tnum, int ttype, char *tmesg); -extern void tt_exit(); -extern int t_environ(); -extern void t_breakum(char *tcid, int total, int typ, char *msg, void (*fnc)()); - -extern void tst_sig(int fork_flag, void (*handler)(), void (*cleanup)()); -extern void tst_tmpdir(); -extern void tst_rmdir(); - -#endif /* end of __TEST_H__ */ diff --git a/winsup/testsuite/libltp/include/tlibio.h b/winsup/testsuite/libltp/include/tlibio.h deleted file mode 100644 index ac0d5705c..000000000 --- a/winsup/testsuite/libltp/include/tlibio.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -#define LIO_IO_SYNC 00001 /* read/write */ -#define LIO_IO_ASYNC 00002 /* reada/writea/aio_write/aio_read */ -#define LIO_IO_SLISTIO 00004 /* single stride sync listio */ -#define LIO_IO_ALISTIO 00010 /* single stride async listio */ -#define LIO_IO_SYNCV 00020 /* single-buffer readv/writev */ -#define LIO_IO_SYNCP 00040 /* pread/pwrite */ - -#ifdef sgi -#define LIO_IO_ATYPES 00077 /* all io types */ -#define LIO_IO_TYPES 00061 /* all io types, non-async */ -#endif /* sgi */ -#ifdef linux -#define LIO_IO_TYPES 00021 /* all io types */ -#endif /* linux */ -#ifdef CRAY -#define LIO_IO_TYPES 00017 /* all io types */ -#endif /* CRAY */ - -#define LIO_WAIT_NONE 00010000 /* return asap -- use with care */ -#define LIO_WAIT_ACTIVE 00020000 /* spin looking at iosw fields, or EINPROGRESS */ -#define LIO_WAIT_RECALL 00040000 /* call recall(2)/aio_suspend(3) */ -#define LIO_WAIT_SIGPAUSE 00100000 /* call pause */ -#define LIO_WAIT_SIGACTIVE 00200000 /* spin waiting for signal */ -#ifdef sgi -#define LIO_WAIT_CBSUSPEND 00400000 /* aio_suspend waiting for callback */ -#define LIO_WAIT_SIGSUSPEND 01000000 /* aio_suspend waiting for signal */ -#define LIO_WAIT_ATYPES 01760000 /* all async wait types, except nowait */ -#define LIO_WAIT_TYPES 00020000 /* all sync wait types (sorta) */ -#endif /* sgi */ -#ifdef linux -#define LIO_WAIT_TYPES 00300000 /* all wait types, except nowait */ -#endif /* linux */ -#ifdef CRAY -#define LIO_WAIT_TYPES 00360000 /* all wait types, except nowait */ -#endif /* CRAY */ - -/* meta wait io */ -/* 00 000 0000 */ - -#ifdef sgi -/* all callback wait types */ -#define LIO_WAIT_CBTYPES (LIO_WAIT_CBSUSPEND) -/* all signal wait types */ -#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE|LIO_WAIT_SIGSUSPEND) -/* all aio_{read,write} or lio_listio */ -#define LIO_IO_ASYNC_TYPES (LIO_IO_ASYNC|LIO_IO_SLISTIO|LIO_IO_ALISTIO) -#endif /* sgi */ -#ifdef linux -/* all signal wait types */ -#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE) -#endif /* linux */ -#ifdef CRAY -/* all signal wait types */ -#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE) -#endif /* CRAY */ - -/* - * This bit provides a way to randomly pick an io type and wait method. - * lio_read_buffer() and lio_write_buffer() functions will call - * lio_random_methods() with the given method. - */ -#define LIO_RANDOM 010000000 - -/* - * This bit provides a way for the programmer to use async i/o with - * signals and to use their own signal handler. By default, - * the signal will only be given to the system call if the wait - * method is LIO_WAIT_SIGPAUSE or LIO_WAIT_SIGACTIVE. - * Whenever these wait methods are used, libio signal handler - * will be used. - */ -#define LIO_USE_SIGNAL 020000000 - -/* - * prototypes/structures for functions in the libio.c module. See comments - * in that module, or man page entries for information on the individual - * functions. - */ - -int stride_bounds(int offset, int stride, int nstrides, - int bytes_per_stride, int *min_byte, int *max_byte); - -int lio_set_debug(int level); -int lio_parse_io_arg1(char *string); -void lio_help1(char *prefex); -int lio_parse_io_arg2(char *string, char **badtoken); -void lio_help2(char *prefex); -int lio_write_buffer(int fd, int method, char *buffer, int size, - int sig, char **errmsg, long wrd); - -int lio_read_buffer(int fd, int method, char *buffer, int size, - int sig, char **errmsg, long wrd); -int lio_random_methods(long mask); - -#if CRAY -#include -int lio_wait4asyncio(int method, int fd, struct iosw **statptr); -int lio_check_asyncio(char *io_type, int size, struct iosw *status); -#endif /* CRAY */ -#ifdef sgi -#include -int lio_wait4asyncio(int method, int fd, aiocb_t *aiocbp); -int lio_check_asyncio(char *io_type, int size, aiocb_t *aiocbp, int method); -#endif /* sgi */ - -/* - * Define the structure that contains the infomation that is used - * by the parsing and help functions. - */ -struct lio_info_type { - char *token; - int bits; - char *desc; -}; - - diff --git a/winsup/testsuite/libltp/include/usctest.h b/winsup/testsuite/libltp/include/usctest.h deleted file mode 100644 index 6a095db1c..000000000 --- a/winsup/testsuite/libltp/include/usctest.h +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - -/********************************************************** - * - * IRIX/Linux Feature Test and Evaluation - Silicon Graphics, Inc. - * - * FUNCTION NAME : usctest.h - * - * FUNCTION TITLE : System Call Test Macros - * - * SYNOPSIS: - * See DESCRIPTION below. - * - * AUTHOR : William Roske - * - * INITIAL RELEASE : UNICOS 7.0 - * - * DESCRIPTION - * TEST(SCALL) - calls a system call - * TEST_VOID(SCALL) - same as TEST() but for syscalls with no return value. - * TEST_CLEANUP - print the log of errno return counts if STD_ERRNO_LOG - * is set. - * TEST_PAUSEF(HAND) - Pause for SIGUSR1 if the pause flag is set. - * Use "hand" as the interrupt handling function - * TEST_PAUSE - Pause for SIGUSR1 if the pause flag is set. - * Use internal function to do nothing on signal and go on. - * TEST_LOOPING(COUNTER) - Conditional to check if test should - * loop. Evaluates to TRUE (1) or FALSE (0). - * TEST_ERROR_LOG(eno) - log that this errno was received, - * if STD_ERRNO_LOG is set. - * TEST_EXP_ENOS(array) - set the bits in TEST_VALID_ENO array at - * positions specified in integer "array" - * - * RETURN VALUE - * TEST(SCALL) - Global Variables set: - * int TEST_RETURN=return code from SCALL - * int TEST_ERRNO=value of errno at return from SCALL - * TEST_VOID(SCALL) - Global Variables set: - * int TEST_ERRNO=value of errno at return from SCALL - * TEST_CLEANUP - None. - * TEST_PAUSEF(HAND) - None. - * TEST_PAUSE - None. - * TEST_LOOPING(COUNTER) - True if COUNTER < STD_LOOP_COUNT or - * STD_INFINITE is set. - * TEST_ERROR_LOG(eno) - None - * TEST_EXP_ENOS(array) - None - * - * KNOWN BUGS - * If you use the TEST_PAUSE or TEST_LOOPING macros, you must - * link in parse_opts.o, which contains the code for those functions. - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#ifndef __USCTEST_H__ -#define __USCTEST_H__ 1 - -#ifndef _SC_CLK_TCK -#include -#endif - -#include - -/* - * Ensure that PATH_MAX is defined - */ -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - -#ifndef CRAY -#ifndef BSIZE -#define BSIZE BBSIZE -#endif -#endif - -/*********************************************************************** - * Define option_t structure type. - * Entries in this struct are used by the parse_opts routine - * to indicate valid options and return option arguments - ***********************************************************************/ -typedef struct { - const char *option; /* Valid option string (one option only) like "a:" */ - int *flag; /* pointer to location to set true if option given */ - char **arg; /* pointer to location to place argument, if needed */ -} option_t; - -/*********************************************************************** - * The following globals are defined in parse_opts.c but must be - * externed here because they are used in the macros defined below. - ***********************************************************************/ -extern int STD_FUNCTIONAL_TEST, /* turned off by -f to not do functional test */ - STD_TIMING_ON, /* turned on by -t to print timing stats */ - STD_PAUSE, /* turned on by -p to pause before loop */ - STD_INFINITE, /* turned on by -c0 to loop forever */ - STD_LOOP_COUNT, /* changed by -cn to set loop count to n */ - STD_ERRNO_LOG, /* turned on by -e to log errnos returned */ - STD_ERRNO_LIST[], /* counts of errnos returned. indexed by errno */ - STD_COPIES, - STD_argind; - -extern float STD_LOOP_DURATION, /* wall clock time to iterate */ - STD_LOOP_DELAY; /* delay time after each iteration */ - -#define USC_MAX_ERRNO 2000 - -/********************************************************************** - * Prototype for parse_opts routine - **********************************************************************/ -extern const char *parse_opts(int ac, char **av, option_t *user_optarr, void (*uhf)()); - - -/* - * define a structure - */ -struct usc_errno_t { - int flag; -}; - -/*********************************************************************** - **** - **** - **** - **********************************************************************/ -#ifdef _USC_LIB_ - -extern int TEST_RETURN; -extern int TEST_ERRNO; - -#else -/*********************************************************************** - * Global array of bit masks to indicate errnos that are expected. - * Bits set by TEST_EXP_ENOS() macro and used by TEST_CLEANUP() macro. - ***********************************************************************/ -extern struct usc_errno_t TEST_VALID_ENO[USC_MAX_ERRNO]; - -/*********************************************************************** - * Globals for returning the return code and errno from the system call - * test macros. - ***********************************************************************/ -extern int TEST_RETURN; -extern int TEST_ERRNO; - -/*********************************************************************** - * temporary variables for determining max and min times in TEST macro - ***********************************************************************/ -extern long btime, etime, tmptime; - -#endif /* _USC_LIB_ */ - -/*********************************************************************** - * structure for timing accumulator and counters - ***********************************************************************/ -struct tblock { - long tb_max; - long tb_min; - long tb_total; - long tb_count; -}; - -/*********************************************************************** - * The following globals are externed here so that they are accessable - * in the macros that follow. - ***********************************************************************/ -extern struct tblock tblock; -extern void STD_go(); -extern int (*_TMP_FUNC)(void); -extern void STD_opts_help(); - - -/*********************************************************************** - * TEST: calls a system call - * - * parameters: - * SCALL = system call and parameters to execute - * - ***********************************************************************/ -#define TEST(SCALL) TEST_RETURN = (unsigned) SCALL; TEST_ERRNO=errno; - -/*********************************************************************** - * TEST_VOID: calls a system call - * - * parameters: - * SCALL = system call and parameters to execute - * - * Note: This is IDENTICAL to the TEST() macro except that it is intended - * for use with syscalls returning no values (void syscall()). The - * Typecasting nothing (void) into an unsigned integer causes compilation - * errors. - * - ***********************************************************************/ -#define TEST_VOID(SCALL) SCALL; TEST_ERRNO=errno; - -/*********************************************************************** - * TEST_CLEANUP: print system call timing stats and errno log entries - * to stdout if STD_TIMING_ON and STD_ERRNO_LOG are set, respectively. - * Do NOT print ANY information if no system calls logged. - * - * parameters: - * none - * - ***********************************************************************/ -#define TEST_CLEANUP \ -if ( STD_ERRNO_LOG ) { \ - for (tmptime=0; tmptime--> - * --> - * - * The maximum length of this record is defined by the WLOG_REC_MAX_SIZE - * record. Note that the 2-byte record length forces this to be - * <= 64k bytes. - * - * Note that there is lots of bit-masking done here. The w_pathlen, - * w_hostlen, and w_patternlen fields MUST have enough bits to hold - * WLOG_MAX_PATH, WLOG_MAX_HOST, and WLOG_MAX_PATTERN bytes respectivly. - */ - -struct wlog_rec_disk { -#ifdef CRAY - uint w_offset : 44; /* file offset */ - uint w_extra0 : 20; /* EXTRA BITS IN WORD 0 */ -#else - uint w_offset : 32; /* file offset */ - uint w_extra0 : 32; /* EXTRA BITS IN WORD 0 */ -#endif - - uint w_nbytes : 32; /* # bytes written */ - uint w_oflags : 32; /* low-order open() flags */ - - uint w_pid : 17; /* pid doing the write */ - uint w_pathlen : 7; /* length of file path */ - uint w_patternlen: 6; /* length of pattern */ - uint w_hostlen : 4; /* length of host */ - uint w_done : 1; /* 1 if io confirmed done */ - uint w_async : 1; /* 1 if async write (writea) */ - uint w_extra2 : 28; /* EXTRA BITS IN WORD 2 */ -}; - -/* - * write log file datatype. wlog_open() initializes this structure - * which is then passed around to the various wlog_xxx routines. - */ - -struct wlog_file { - int w_afd; /* append fd */ - int w_rfd; /* random-access fd */ - char w_file[1024]; /* name of the write_log */ -}; - -/* - * return value defines for the user-supplied function to - * wlog_scan_backward(). - */ - -#define WLOG_STOP_SCAN 0 -#define WLOG_CONTINUE_SCAN 1 - -/* - * wlog prototypes - */ - -#if __STDC__ -extern int wlog_open(struct wlog_file *wfile, int trunc, int mode); -extern int wlog_close(struct wlog_file *wfile); -extern int wlog_record_write(struct wlog_file *wfile, - struct wlog_rec *wrec, long offset); -extern int wlog_scan_backward(struct wlog_file *wfile, int nrecs, - int (*func)(struct wlog_rec *rec), - long data); -#else -int wlog_open(); -int wlog_close(); -int wlog_record_write(); -int wlog_scan_backward(); -#endif - -extern char Wlog_Error_String[]; - -#endif /* _WRITE_LOG_H_ */ - diff --git a/winsup/testsuite/libltp/lib/dataascii.c b/winsup/testsuite/libltp/lib/dataascii.c deleted file mode 100644 index 5bc201852..000000000 --- a/winsup/testsuite/libltp/lib/dataascii.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#include -#include -#include "dataascii.h" - -#define CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghjiklmnopqrstuvwxyz\n" -#define CHARS_SIZE sizeof(CHARS) - -#ifdef UNIT_TEST -#include /* malloc */ -#endif - -static char Errmsg[80]; - -int -dataasciigen(listofchars, buffer, bsize, offset) -char *listofchars; /* a null terminated list of characters */ -char *buffer; -int bsize; -int offset; -{ - int cnt; - int total; - int ind; /* index into CHARS array */ - char *chr; - int chars_size; - const char *charlist; - - chr=buffer; - total=offset+bsize; - - if ( listofchars == NULL ) { - charlist=CHARS; - chars_size=CHARS_SIZE; - } - else { - charlist=listofchars; - chars_size=strlen(listofchars); - } - - for(cnt=offset; cnt -#include -#include /* memset */ -#include /* rand */ -#include "databin.h" - -#if UNIT_TEST -#include -#endif - -static char Errmsg[80]; - -void -databingen (mode, buffer, bsize, offset) -int mode; /* either a, c, r, o, z or C */ -unsigned char *buffer; /* buffer pointer */ -int bsize; /* size of buffer */ -int offset; /* offset into the file where buffer starts */ -{ -int ind; - - switch (mode) - { - default: - case 'a': /* alternating bit pattern */ - memset(buffer,0x55,bsize); - break; - - case 'c': /* checkerboard pattern */ - memset(buffer,0xf0,bsize); - break; - - case 'C': /* */ - for (ind=0;ind< bsize;ind++) { - buffer[ind] = ((offset+ind)%8 & 0177); - } - break; - - case 'o': - memset(buffer,0xff,bsize); - break; - - case 'z': - memset(buffer,0x0,bsize); - break; - - case 'r': /* random */ - for (ind=0;ind< bsize;ind++) { - buffer[ind] = (rand () & 0177) | 0100; - } - } -} - -/*********************************************************************** - * - * return values: - * >= 0 : error at byte offset into the file, offset+buffer[0-(bsize-1)] - * < 0 : no error - ***********************************************************************/ -int -databinchk(mode, buffer, bsize, offset, errmsg) -int mode; /* either a, c, r, z, o, or C */ -unsigned char *buffer; /* buffer pointer */ -int bsize; /* size of buffer */ -int offset; /* offset into the file where buffer starts */ -char **errmsg; -{ - int cnt; - unsigned char *chr; - int total; - long expbits; - long actbits; - - chr=buffer; - total=bsize; - - if ( errmsg != NULL ) { - *errmsg = Errmsg; - } - - switch (mode) - { - default: - case 'a': /* alternating bit pattern */ - expbits=0x55; - break; - - case 'c': /* checkerboard pattern */ - expbits=0xf0; - break; - - case 'C': /* counting pattern */ - for (cnt=0;cnt< bsize;cnt++) { - expbits = ((offset+cnt)%8 & 0177); - - if ( buffer[cnt] != expbits ) { - sprintf(Errmsg, - "data mismatch at offset %d, exp:%#lo, act:%#o", - offset+cnt, expbits, buffer[cnt]); - return offset+cnt; - } - } - sprintf(Errmsg, "all %d bytes match desired pattern", bsize); - return -1; - - case 'o': - expbits=0xff; - break; - - case 'z': - expbits=0; - break; - - case 'r': - return -1; /* no check can be done for random */ - } - - for (cnt=0; cnt< word-offset in file (same #) >< pid > - -1234567890123456789012345678901234567890123456789012345678901234 -________________________________________________________________ -< pid >< offset in file of this word >< pid > - - -8 bits to a bytes == character - NBPW 8 -************/ - -#include -#include -#ifdef UNIT_TEST -#include -#include -#endif - -static char Errmsg[80]; - -#define LOWER16BITS(X) (X & 0177777) -#define LOWER32BITS(X) (X & 0xffffffff) - -/*** -#define HIGHBITS(WRD, bits) ( (-1 << (64-bits)) & WRD) -#define LOWBITS(WRD, bits) ( (-1 >> (64-bits)) & WRD) -****/ - -#define NBPBYTE 8 /* number bits per byte */ - -#ifndef DEBUG -#define DEBUG 0 -#endif - -/*********************************************************************** - * - * - * 1 2 3 4 5 6 7 8 9 10 11 12 13 14 14 15 bytes - * 1234567890123456789012345678901234567890123456789012345678901234 bits - * ________________________________________________________________ 1 word - * < pid >< offset in file of this word >< pid > - * - * the words are put together where offset zero is the start. - * thus, offset 16 is the start of the second full word - * Thus, offset 8 is in middle of word 1 - ***********************************************************************/ -int -datapidgen(pid, buffer, bsize, offset) -int pid; -char *buffer; -int bsize; -int offset; -{ -#if CRAY - - int cnt; - int tmp; - char *chr; - long *wptr; - long word; - int woff; /* file offset for the word */ - int boff; /* buffer offset or index */ - int num_full_words; - - num_full_words = bsize/NBPW; - boff = 0; - - if ( cnt=(offset % NBPW) ) { /* partial word */ - - woff = offset - cnt; -#if DEBUG -printf("partial at beginning, cnt = %d, woff = %d\n", cnt, woff); -#endif - - word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid)); - - chr = (char *)&word; - - for (tmp=0; tmp minus one copies - * of the current process. There are two modes in how the forks - * will be done. Mode 0 (default) will have all new processes - * be childern of the parent process. Using Mode 1, - * the parent process will have one child and that child will - * fork the next process, if necessary, and on and on. - * The forker function will return the number of successful - * forks. This value will be different for the parent and each child. - * Using mode 0, the parent will get the total number of successful - * forks. Using mode 1, the newest child will get the total number - * of forks. The parent will get a return value of 1. - * - * The forker function also updates the global variables - * Forker_pids[] and Forker_npids. The Forker_pids array will - * be updated to contain the pid of each new process. The - * Forker_npids variable contains the number of entries - * in Forker_pids. Note, not all processes will have - * access to all pids via Forker_pids. If using mode 0, only the - * parent process and the last process will have all information. - * If using mode 1, only the last child process will have all information. - * - * If the prefix parameter is not NULL and the fork system call fails, - * a error message will be printed to stderr. The error message - * the be preceeded with prefix string. If prefix is NULL, - * no error message is printed. - * - * SPECIAL REQUIREMENTS - * None. - * - * UPDATE HISTORY - * This should contain the description, author, and date of any - * "interesting" modifications (i.e. info should helpful in - * maintaining/enhancing this module). - * username description - * ---------------------------------------------------------------- - * rrl This functions will first written during - * the SFS testing days, 1993. - * - * BUGS/LIMITATIONS - * The child pids are stored in the fixed array, Forker_pids. - * The array only has space for 4098 pids. Only the first - * 4098 pids will be stored in the array. - * - **************************************************************/ - -#include -#include -#include /* fork, getpid, sleep */ -#include -#include -#include "forker.h" - -extern int errno; - -int Forker_pids[FORKER_MAX_PIDS]; /* holds pids of forked processes */ -int Forker_npids=0; /* number of entries in Forker_pids */ - -/*********************************************************************** - * - * This function will fork and the parent will exit zero and - * the child will return. This will orphan the returning process - * putting it in the background. - * - * Return Value - * 0 : if fork did not fail - * !0 : if fork failed, the return value will be the errno. - ***********************************************************************/ -int -background(prefix) -char *prefix; -{ - switch (fork()) { - case -1: - if ( prefix != NULL ) - fprintf(stderr, "%s: In %s background(), fork() failed, errno:%d %s\n", - prefix, __FILE__, errno, strerror(errno)); - exit(errno); - - case 0: /* child process */ - break; - - default: - exit(0); - } - - return 0; - -} /* end of background */ - -/*********************************************************************** - * Forker will fork ncopies-1 copies of self. - * - ***********************************************************************/ -int -forker(ncopies, mode, prefix) -int ncopies; -int mode; /* 0 - all childern of parent, 1 - only 1 direct child */ -char *prefix; /* if ! NULL, an message will be printed to stderr */ - /* if fork fails. The prefix (program name) will */ - /* preceed the message */ -{ - int cnt; - int pid; - static int ind = 0; - - Forker_pids[ind]=0; - - for ( cnt=1; cnt < ncopies; cnt++ ) { - - switch ( mode ) { - case 1 : /* only 1 direct child */ - if ( (pid = fork()) == -1 ) { - if ( prefix != NULL ) - fprintf(stderr, "%s: %s,forker(): fork() failed, errno:%d %s\n", - prefix, __FILE__, errno, strerror(errno)); - return 0; - } - Forker_npids++; - - switch (pid ) { - case 0: /* child - continues the forking */ - - if ( Forker_npids < FORKER_MAX_PIDS ) - Forker_pids[Forker_npids-1]=getpid(); - break; - - default: /* parent - stop the forking */ - if ( Forker_npids < FORKER_MAX_PIDS ) - Forker_pids[Forker_npids-1]=pid; - return cnt-1; - } - - break; - - default : /* all new processes are childern of parent */ - if ( (pid = fork()) == -1 ) { - if ( prefix != NULL ) - fprintf(stderr, "%s: %s,forker(): fork() failed, errno:%d %s\n", - prefix, __FILE__, errno, strerror(errno)); - return cnt-1; - } - Forker_npids++; - - switch (pid ) { - case 0: /* child - stops the forking */ - if ( Forker_npids < FORKER_MAX_PIDS ) - Forker_pids[Forker_npids-1]=getpid(); - return cnt; - - default: /* parent - continues the forking */ - if ( Forker_npids < FORKER_MAX_PIDS ) - Forker_pids[Forker_npids-1]=pid; - break; - } - break; - } - } - - if ( Forker_npids < FORKER_MAX_PIDS ) - Forker_pids[Forker_npids]=0; - return cnt-1; - -} /* end of forker */ - - -#if UNIT_TEST - -/* - * The following is a unit test main for the background and forker - * functions. - */ - -int -main(argc, argv) -int argc; -char **argv; -{ - int ncopies=1; - int mode=0; - int ret; - int ind; - - if ( argc == 1 ) { - printf("Usage: %s ncopies [mode]\n", argv[0]); - exit(1); - } - - if ( sscanf(argv[1], "%i", &ncopies) != 1 ) { - printf("%s: ncopies argument must be integer\n", argv[0]); - exit(1); - } - - if ( argc == 3 ) - if ( sscanf(argv[2], "%i", &mode) != 1 ) { - printf("%s: mode argument must be integer\n", argv[0]); - exit(1); - } - - printf("Starting Pid = %d\n", getpid()); - ret=background(argv[0]); - printf("After background() ret:%d, pid = %d\n", ret, getpid()); - - ret=forker(ncopies, mode, argv[0]); - - printf("forker(%d, %d, %s) ret:%d, pid = %d, sleeping 30 seconds.\n", - ncopies, mode, argv[0], ret, getpid()); - - printf("%d My version of Forker_pids[], Forker_npids = %d\n", - getpid(), Forker_npids); - - for (ind=0; ind -#ifdef __CYGWIN__ -#include -#endif - -char * -get_high_address() -{ -#ifdef __CYGWIN__ - return VirtualAlloc (NULL, 4096, MEM_COMMIT, PAGE_NOACCESS) + 2048; -#else - return (char *)sbrk(0) + 16384; -#endif -} diff --git a/winsup/testsuite/libltp/lib/libtestsuite.c b/winsup/testsuite/libltp/lib/libtestsuite.c deleted file mode 100644 index e741d25f6..000000000 --- a/winsup/testsuite/libltp/lib/libtestsuite.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * libtestsuite.c - * - * DESCRIPTION - * file containing generic routines which are used by some of the LTP - * testsuite tests. Currently, the following routines are present in - * this library: - * - * my_getpwnam(), do_file_setup() - * - */ -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -struct passwd * -my_getpwnam(char *name) -{ - struct passwd *saved_pwent; - struct passwd *pwent; - - if ((pwent = getpwnam(name)) == NULL) { - perror("getpwnam"); - tst_brkm(TBROK, NULL, "getpwnam() failed"); - } - saved_pwent = (struct passwd *)malloc(sizeof(struct passwd)); - - *saved_pwent = *pwent; - - return(saved_pwent); -} - -void -do_file_setup(char *fname) -{ - int fd; - - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_resm(TBROK, "open(%s, O_RDWR|O_CREAT,0700) Failed, " - "errno=%d : %s", fname, errno, strerror(errno)); - } - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed on file create, errno=%d : " - "%s", fname, errno, strerror(errno)); - } -} diff --git a/winsup/testsuite/libltp/lib/open_flags.c b/winsup/testsuite/libltp/lib/open_flags.c deleted file mode 100644 index 3105955d4..000000000 --- a/winsup/testsuite/libltp/lib/open_flags.c +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/************************************************************** - * - * OS Testing - Silicon Graphics, Inc. - * - * FUNCTION NAME : parse_open_flags - * openflags2symbols - * - * FUNCTION TITLE : converts open flag symbols into bitmask - * converts open flag bitmask into symbols - * - * SYNOPSIS: - * int parse_open_flags(symbols, badname) - * char *symbols; - * char **badname; - * - * char *openflags2symbols(openflags, sep, mode) - * int openflags; - * char *sep; - * int mode; - * - * AUTHOR : Richard Logan - * - * CO-PILOT(s) : Dean Roehrich - * - * INITIAL RELEASE : UNICOS 8.0 - * - * DESIGN DESCRIPTION - * The parse_open_flags function can be used to convert - * a list of comma separated open(2) flag symbols (i.e. O_TRUNC) - * into the bitmask that can be used by open(2). - * If a symbol is unknown and is not NULL, - * will updated to point that symbol in . - * Parse_open_flags will return -1 on this error. - * Otherwise parse_open_flags will return the open flag bitmask. - * If parse_open_flags returns, will left unchanged. - * - * The openflags2symbols function attempts to convert open flag - * bits into human readable symbols (i.e. O_TRUNC). If there - * are more than one symbol, the string will be placed as - * a separator between symbols. Commonly used separators would - * be a comma "," or pipe "|". If is one and not all - * bits can be converted to symbols, the "UNKNOWN" - * symbol will be added to return string. - * Openflags2symbols will return the indentified symbols. - * If no symbols are recognized the return value will be a empty - * string or the "UNKNOWN" symbol. - * - * SPECIAL REQUIREMENTS - * None. - * - * UPDATE HISTORY - * This should contain the description, author, and date of any - * "interesting" modifications (i.e. info should helpful in - * maintaining/enhancing this module). - * username description - * ---------------------------------------------------------------- - * rrl This code was first created during the beginning - * of the SFS testing days. I think that was in 1993. - * This code was updated in 05/96. - * (05/96) openflags2symbols was written. - * - * BUGS/LIMITATIONS - * Currently (05/96) all known symbols are coded into openflags2symbols. - * If new open flags are added this code will have to updated - * to know about them or they will not be recognized. - * - **************************************************************/ - -#include -#include -#include -#include -#include /* strcat */ -#include "open_flags.h" - -#define UNKNOWN_SYMBOL "UNKNOWN" - -static char Open_symbols[512]; /* space for openflags2symbols return value */ - -struct open_flag_t { - const char *symbol; - int flag; -}; - -static struct open_flag_t Open_flags[] = { - { "O_RDONLY", O_RDONLY }, - { "O_WRONLY", O_WRONLY }, - { "O_RDWR", O_RDWR }, - { "O_SYNC", O_SYNC }, - { "O_CREAT", O_CREAT }, - { "O_TRUNC", O_TRUNC }, - { "O_EXCL", O_EXCL }, - { "O_APPEND", O_APPEND }, - { "O_NONBLOCK", O_NONBLOCK }, -#if O_NOCTTY - { "O_NOCTTY", O_NOCTTY }, -#endif -#if O_DSYNC - { "O_DSYNC", O_DSYNC }, -#endif -#if O_RSYNC - { "O_RSYNC", O_RSYNC }, -#endif -#if O_ASYNC - { "O_ASYNC", O_ASYNC }, -#endif -#if O_PTYIGN - { "O_PTYIGN", O_PTYIGN }, -#endif -#if O_NDELAY - { "O_NDELAY", O_NDELAY }, -#endif -#if O_RAW - { "O_RAW", O_RAW }, -#endif -#ifdef O_SSD - { "O_SSD", O_SSD }, -#endif -#if O_BIG - { "O_BIG", O_BIG }, -#endif -#if O_PLACE - { "O_PLACE", O_PLACE }, -#endif -#if O_RESTART - { "O_RESTART", O_RESTART }, -#endif -#if O_SFSXOP - { "O_SFSXOP", O_SFSXOP }, -#endif -#if O_SFS_DEFER_TM - { "O_SFS_DEFER_TM", O_SFS_DEFER_TM }, -#endif -#if O_WELLFORMED - { "O_WELLFORMED", O_WELLFORMED }, -#endif -#if O_LDRAW - { "O_LDRAW", O_LDRAW }, -#endif -#if O_T3D - { "O_T3D", O_T3D }, -#endif /* O_T3D */ -#if O_PARALLEL - { "O_PARALLEL", O_PARALLEL }, - { "O_FSA", O_PARALLEL|O_WELLFORMED|O_RAW }, /* short cut */ -#endif /* O_PARALLEL */ -#ifdef O_LARGEFILE - { "O_LARGEFILE", O_LARGEFILE }, -#endif -#ifdef O_DIRECT - { "O_DIRECT", O_DIRECT }, -#endif -#ifdef O_PRIV - { "O_PRIV", O_PRIV }, -#endif - -}; - -int -parse_open_flags(char *string, char **badname) -{ - int bits = 0; - char *name; - char *cc; - char savecc; - int found; - int ind; - - name=string; - cc=name; - - while ( 1 ) { - - for(; ((*cc != ',') && (*cc != '\0')); cc++); - savecc = *cc; - *cc = '\0'; - - found = 0; - - for(ind=0; ind < sizeof(Open_flags)/sizeof(struct open_flag_t); ind++) { - if ( strcmp(name, Open_flags[ind].symbol) == 0 ) { - bits |= Open_flags[ind].flag; - found=1; - break; - } - } - - *cc = savecc; /* restore string */ - - if ( found == 0 ) { /* invalid name */ - if ( badname != NULL ) - *badname = name; - return -1; - } - - if ( savecc == '\0' ) - break; - - name = ++cc; - - } /* end while */ - - return bits; - -} /* end of parse_open_flags */ - - -char * -openflags2symbols(int openflags, char *sep, int mode) -{ - int ind; - int size; - int bits = openflags; - int havesome=0; - - Open_symbols[0]='\0'; - - size=sizeof(Open_flags)/sizeof(struct open_flag_t); - - /* - * Deal with special case of O_RDONLY. If O_WRONLY nor O_RDWR - * bits are not set, assume O_RDONLY. - */ - - if ( (bits & (O_WRONLY | O_RDWR)) == 0 ) { - strcat(Open_symbols, "O_RDONLY"); - havesome=1; - } - - /* - * Loop through all but O_RDONLY elments of Open_flags - */ - for(ind=1; ind < size; ind++) { - - if ( (bits & Open_flags[ind].flag) == Open_flags[ind].flag ) { - if ( havesome ) - strcat(Open_symbols, sep); - - strcat(Open_symbols, Open_flags[ind].symbol); - havesome++; - - /* remove flag bits from bits */ - bits = bits & (~Open_flags[ind].flag); - } - } - - /* - * If not all bits were identified and mode was equal to 1, - * added UNKNOWN_SYMBOL to return string - */ - if ( bits && mode == 1 ) { /* not all bits were identified */ - if ( havesome ) - strcat(Open_symbols, sep); - strcat(Open_symbols, UNKNOWN_SYMBOL); - } - - return Open_symbols; - -} /* end of openflags2symbols */ - - -#ifdef UNIT_TEST - -/* - * The following code provides a UNIT test main for - * parse_open_flags and openflags2symbols functions. - */ - -int -main(argc, argv) -int argc; -char **argv; -{ - int bits; - int ret; - char *err; - - if (argc == 1 ) { - printf("Usage: %s openflagsbits\n\t%s symbols\n", argv[0], argv[0]); - exit(1); - } - - if ( sscanf(argv[1], "%i", &bits) == 1 ) { - printf("openflags2symbols(%#o, \",\", 1) returned %s\n", - bits, openflags2symbols(bits, ",", 1)); - - } else { - ret=parse_open_flags(argv[1], &err); - if ( ret == -1 ) - printf("parse_open_flags(%s, &err) returned -1, err = %s\n", - argv[0], err); - else - printf("parse_open_flags(%s, &err) returned %#o\n", argv[0], ret); - } - - exit(0); -} - -#endif /* end of UNIT_TEST */ diff --git a/winsup/testsuite/libltp/lib/parse_opts.c b/winsup/testsuite/libltp/lib/parse_opts.c deleted file mode 100644 index 4a8058938..000000000 --- a/winsup/testsuite/libltp/lib/parse_opts.c +++ /dev/null @@ -1,876 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - -/********************************************************** - * - * OS Testing - Silicon Graphics, Inc. - * - * FUNCTION NAME : parse_opts - * - * FUNCTION TITLE : parse standard & user options for system call tests - * - * SYNOPSIS: - * #include "usctest.h" - * - * char *parse_opts(ac, av, user_optarr, uhf) - * int ac; - * char **av; - * option_t user_optarr[]; - * void (*uhf)(); - * - * AUTHOR : William Roske/Richard Logan - * - * INITIAL RELEASE : UNICOS 7.0 - * - * DESCRIPTION - * The parse_opts library routine takes that argc and argv parameters - * recevied by main() and an array of structures defining user options. - * It parses the command line setting flag and argument locations - * associated with the options. It uses getopt to do the actual cmd line - * parsing. uhf() is a function to print user define help - * - * This module contains the functions usc_global_setup_hook and - * usc_test_looping, which are called by marcos defined in usctest.h. - * - * RETURN VALUE - * parse_opts returns a pointer to an error message if an error occurs. - * This pointer is (char *)NULL if parsing is successful. - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ -#include -#include -#include -#include -#include -#include - -#ifdef __CYGWIN__ -#include -#endif - - -#if UNIT_TEST -#include -#endif /* UNIT_TEST */ - -#include "test.h" -#define _USC_LIB_ 1 /* indicates we are the library to the usctest.h include */ -#include "usctest.h" - -#ifndef USC_COPIES -#define USC_COPIES "USC_COPIES" -#endif - -#ifndef UNIT_TEST -#define UNIT_TEST 0 -#endif - -#ifndef DEBUG -#define DEBUG 0 -#endif - -/* - * Code from usctest.h that not part of this file since we are the library. - */ - -struct usc_errno_t TEST_VALID_ENO[USC_MAX_ERRNO]; - - /*********************************************************************** - * Globals for returning the return code and errno from the system call - * test macros. - ***********************************************************************/ -int TEST_RETURN; -int TEST_ERRNO; - - /*********************************************************************** - * temporary variables for determining max and min times in TEST macro - ***********************************************************************/ -long btime, etime, tmptime; - -/* The timing information block. */ -struct tblock tblock={0,((long) -1)>>1,0,0}; - - -/* Define flags and args for standard options */ -int STD_FUNCTIONAL_TEST=1, /* flag indicating to do functional testing code */ - STD_TIMING_ON=0, /* flag indicating to print timing stats */ - STD_PAUSE=0, /* flag indicating to pause before actual start, */ - /* for contention mode */ - STD_INFINITE=0, /* flag indciating to loop forever */ - STD_LOOP_COUNT=1, /* number of iterations */ - STD_COPIES=1, /* number of copies */ - STD_ERRNO_LOG=0; /* flag indicating to do errno logging */ - -float STD_LOOP_DURATION=0.0, /* duration value in fractional seconds */ - STD_LOOP_DELAY=0.0; /* loop delay value in fractional seconds */ - - -char **STD_opt_arr = NULL; /* array of option strings */ -int STD_nopts=0, /* number of elements in STD_opt_arr */ - STD_argind=1; /* argv index to next argv element */ - /* (first argument) */ - /* To getopt users, it is like optind */ - -/* - * The following variables are to support system testing additions. - */ -static int STD_TP_barrier=0; /* flag to do barrier in TEST_PAUSE */ - /* 2 - wait_barrier(), 3 - set_barrier(), * - barrier() */ -static int STD_LP_barrier=0; /* flag to do barrier in TEST_LOOPING */ - /* 2 - wait_barrier(), 3 - set_barrier(), * - barrier() */ -static int STD_TP_shmem_sz=0; /* shmalloc this many words per pe in TEST_PAUSE */ -static int STD_LD_shmem=0; /* flag to do shmem_puts and shmem_gets during delay */ -static int STD_LP_shmem=0; /* flag to do shmem_puts and gets during TEST_LOOPING */ -static int STD_LD_recfun=0; /* do recressive function calls in loop delay */ -static int STD_LP_recfun=0; /* do recressive function calls in TEST_LOOPING */ -static int STD_TP_sbrk=0; /* do sbrk in TEST_PAUSE */ -static int STD_LP_sbrk=0; /* do sbrk in TEST_LOOPING */ -static char *STD_start_break=0; /* original sbrk size */ -static int Debug=0; - -struct std_option_t { - const char *optstr; - const char *help; - char *flag; - char **arg; -} std_options[] = { - { "c:", " -c n Run n copies concurrently\n", NULL, NULL}, - { "e" , " -e Turn on errno logging\n", NULL, NULL}, - { "f" , " -f Turn off functional testing\n", NULL, NULL}, - { "h" , " -h Show this help screen\n", NULL, NULL}, - { "i:", " -i n Execute test n times\n", NULL, NULL}, - { "I:", " -I x Execute test for x seconds\n", NULL, NULL}, - { "p" , " -p Pause for SIGUSR1 before starting\n", NULL, NULL}, - { "P:", " -P x Pause for x seconds between iterations\n", NULL, NULL}, - { "t" , " -t Turn on syscall timing\n", NULL, NULL}, - {NULL, NULL, NULL, NULL}}; - -void print_help(void (*user_help)()); - -/* - * Structure for usc_recressive_func argument - */ -struct usc_bigstack_t { - char space[4096]; -}; - -static struct usc_bigstack_t *STD_bigstack=NULL; - -/* - * Counter of errnos returned (-e option). Indexed by errno. - * Make the array USC_MAX_ERRNO long. That is the first Fortran - * Lib errno. No syscall should return an errno that high. - */ -int STD_ERRNO_LIST[USC_MAX_ERRNO]; - -/* define the string length for Mesg and Mesg2 strings */ -#define STRLEN 2048 - -static char Mesg2[STRLEN]; /* holds possible return string */ -static void usc_recressive_func(); - -/* - * Define bits for options that might have env variable default - */ -#define OPT_iteration 01 -#define OPT_nofunccheck 02 -#define OPT_duration 04 -#define OPT_delay 010 -#define OPT_copies 020 - - -/********************************************************************** - * parse_opts: - **********************************************************************/ -const char * -parse_opts(int ac, char **av, option_t *user_optarr, void (*uhf)()) -{ - int found; /* flag to indicate that an option specified was */ - /* found in the user's list */ - int k; /* scratch integer for returns and short time usage */ - float ftmp; /* tmp float for parsing env variables */ - char *ptr; /* used in getting env variables */ - int options=0; /* no options specified */ - int optstrlen, i; - char *optionstr; - int opt; /* return of getopt */ - - /* - * If not the first time this function is called, release the old STD_opt_arr - * vector. - */ - - if ( STD_opt_arr != NULL ) { - free(STD_opt_arr); - STD_opt_arr=NULL; - } - /* Calculate how much space we need for the option string */ - optstrlen = 0; - for (i = 0; std_options[i].optstr; ++i) - optstrlen += strlen(std_options[i].optstr); - if (user_optarr) - for (i = 0; user_optarr[i].option; ++i) { - if (strlen(user_optarr[i].option) > 2) - return "parse_opts: ERROR - Only short options are allowed"; - optstrlen += strlen(user_optarr[i].option); - } - optstrlen += 1; - - /* Create the option string for getopt */ - optionstr = (char *)malloc(optstrlen); - if (!optionstr) - return "parse_opts: ERROR - Could not allocate memory for optionstr"; - - optionstr[0] = '\0'; - - for (i = 0; std_options[i].optstr; ++i) - strcat(optionstr, std_options[i].optstr); - if (user_optarr) - for (i = 0; user_optarr[i].option; ++i) - /* only add the option if it wasn't there already */ - if (strchr(optionstr, user_optarr[i].option[0]) == NULL) - strcat(optionstr, user_optarr[i].option); - -#if DEBUG > 1 - printf("STD_nopts = %d\n", STD_nopts); -#endif - - /* - * Loop through av parsing options. - */ - while ( (opt = getopt(ac, av, optionstr)) > 0) { - - STD_argind = optind; -#if DEBUG > 0 - printf("parse_opts: getopt returned '%c'\n", opt); -#endif - - switch (opt) { - case '?': /* Unknown option */ - return "Unknown option"; - break; - case ':': /* Missing Arg */ - return "Missing argument"; - break; - case 'i': /* Iterations */ - options |= OPT_iteration; - STD_LOOP_COUNT = atoi(optarg); - if (STD_LOOP_COUNT == 0) STD_INFINITE = 1; - break; - case 'P': /* Delay between iterations */ - options |= OPT_delay; - STD_LOOP_DELAY = atof(optarg); - break; - case 'I': /* Time duration */ - options |= OPT_duration; - STD_LOOP_DURATION = atof(optarg); - if ( STD_LOOP_DURATION == 0.0 ) STD_INFINITE=1; - break; - case 'c': /* Copies */ - options |= OPT_copies; - STD_COPIES = atoi(optarg); - break; - case 'f': /* Functional testing */ - STD_FUNCTIONAL_TEST = 0; - break; - case 'p': /* Pause for SIGUSR1 */ - STD_PAUSE = 1; - break; - case 't': /* syscall timing */ - STD_TIMING_ON = 1; - break; - case 'e': /* errno loggin */ - STD_ERRNO_LOG = 1; - break; - case 'h': /* Help */ - print_help(uhf); - exit(0); - break; - default: - - /* Check all the user specified options */ - found=0; - for(i = 0; user_optarr[i].option; ++i) { - - if (opt == user_optarr[i].option[0]) { - /* Yup, This is a user option, set the flag and look for argument */ - if ( user_optarr[i].flag ) { - *user_optarr[i].flag=1; - } - found++; - - /* save the argument at the user's location */ - if ( user_optarr[i].option[strlen(user_optarr[i].option)-1] == ':' ) { - *user_optarr[i].arg=optarg; - } - break; /* option found - break out of the for loop */ - } - } - /* This condition "should never happen". SO CHECK FOR IT!!!! */ - if ( ! found ) { - sprintf(Mesg2, - "parse_opts: ERROR - option:\"%c\" NOT FOUND... INTERNAL ERROR", opt); - return(Mesg2); - } - } - - } /* end of while */ - - STD_argind = optind; - - /* - * Turn on debug - */ - if ( (ptr=getenv("USC_DEBUG")) != NULL ) { - Debug=1; - printf("env USC_DEBUG is defined, turning on debug\n"); - } - if ( (ptr=getenv("USC_VERBOSE")) != NULL ) { - Debug=1; - printf("env USC_VERBOSE is defined, turning on debug\n"); - } - - /* - * If the USC_ITERATION_ENV environmental variable is set to - * a number, use that number as iteration count (same as -c option). - * The -c option with arg will be used even if this env var is set. - */ - if ( !(options & OPT_iteration) && (ptr=getenv(USC_ITERATION_ENV)) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1) { - if ( k == 0 ) { /* if arg is 0, set infinite loop flag */ - STD_INFINITE=1; - if ( Debug ) - printf("Using env %s, set STD_INFINITE to 1\n", - USC_ITERATION_ENV); - } else { /* else, set the loop count to the arguement */ - STD_LOOP_COUNT=k; - if ( Debug ) - printf("Using env %s, set STD_LOOP_COUNT to %d\n", - USC_ITERATION_ENV, k); - } - } - } - - /* - * If the USC_NO_FUNC_CHECK environmental variable is set, we'll - * unset the STD_FUNCTIONAL_TEST variable. - */ - if ( !(options & OPT_nofunccheck) && (ptr=getenv(USC_NO_FUNC_CHECK)) != NULL ) { - STD_FUNCTIONAL_TEST=0; /* Turn off functional testing */ - if ( Debug ) - printf("Using env %s, set STD_FUNCTIONAL_TEST to 0\n", - USC_NO_FUNC_CHECK); - } - - /* - * If the USC_LOOP_WALLTIME environmental variable is set, - * use that number as duration (same as -I option). - * The -I option with arg will be used even if this env var is set. - */ - - if ( !(options & OPT_duration) && (ptr=getenv(USC_LOOP_WALLTIME)) != NULL ) { - if ( sscanf(ptr, "%f", &ftmp) == 1 && ftmp >= 0.0 ) { - STD_LOOP_DURATION=ftmp; - if ( Debug ) - printf("Using env %s, set STD_LOOP_DURATION to %f\n", - USC_LOOP_WALLTIME, ftmp); - if ( STD_LOOP_DURATION == 0.0 ) { /* if arg is 0, set infinite loop flag */ - STD_INFINITE=1; - if ( Debug ) - printf("Using env %s, set STD_INFINITE to 1\n", USC_LOOP_WALLTIME); - } - } - } - if ( !(options & OPT_duration) && (ptr=getenv("USC_DURATION")) != NULL ) { - if ( sscanf(ptr, "%f", &ftmp) == 1 && ftmp >= 0.0 ) { - STD_LOOP_DURATION=ftmp; - if ( Debug ) - printf("Using env USC_DURATION, set STD_LOOP_DURATION to %f\n", ftmp); - if ( STD_LOOP_DURATION == 0.0 ) { /* if arg is 0, set infinite loop flag */ - STD_INFINITE=1; - if ( Debug ) - printf("Using env USC_DURATION, set STD_INFINITE to 1\n"); - } - } - } - /* - * If the USC_LOOP_DELAY environmental variable is set, - * use that number as delay in factional seconds (same as -P option). - * The -P option with arg will be used even if this env var is set. - */ - if ( !(options & OPT_delay) && (ptr=getenv(USC_LOOP_DELAY)) != NULL ) { - if ( sscanf(ptr, "%f", &ftmp) == 1 && ftmp >= 0.0 ) { - STD_LOOP_DELAY=ftmp; - if ( Debug ) - printf("Using env %s, set STD_LOOP_DELAY = %f\n", - USC_LOOP_DELAY, ftmp); - } - } - - /* - * If the USC_COPIES environmental variable is set, - * use that number as copies (same as -c option). - * The -c option with arg will be used even if this env var is set. - */ - if ( !(options & OPT_copies) && (ptr=getenv(USC_COPIES)) != NULL ) { - if ( sscanf(ptr, "%d", &STD_COPIES) == 1 && STD_COPIES >= 0 ) { - if ( Debug ) - printf("Using env %s, set STD_COPIES = %d\n", - USC_COPIES, STD_COPIES); - } - } - - /* - * The following are special system testing envs to turn on special - * hooks in the code. - */ - if ( (ptr=getenv("USC_TP_BARRIER")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_TP_barrier=k; - } - else - STD_TP_barrier=1; - if ( Debug ) - printf("using env USC_TP_BARRIER, Set STD_TP_barrier to %d\n", - STD_TP_barrier); - } - - if ( (ptr=getenv("USC_LP_BARRIER")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_LP_barrier=k; - } - else - STD_LP_barrier=1; - if ( Debug ) - printf("using env USC_LP_BARRIER, Set STD_LP_barrier to %d\n", - STD_LP_barrier); - } - - if ( (ptr=getenv("USC_TP_SHMEM")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_TP_shmem_sz=k; - if ( Debug ) - printf("Using env USC_TP_SHMEM, Set STD_TP_shmem_sz to %d\n", - STD_TP_shmem_sz); - } - } - - if ( (ptr=getenv("USC_LP_SHMEM")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_LP_shmem=k; - if ( Debug ) - printf("Using env USC_LP_SHMEM, Set STD_LP_shmem to %d\n", - STD_LP_shmem); - } - } - - if ( (ptr=getenv("USC_LD_SHMEM")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_LD_shmem=k; - if ( Debug ) - printf("Using env USC_LD_SHMEM, Set STD_LD_shmem to %d\n", - STD_LD_shmem); - } - } - - if ( (ptr=getenv("USC_TP_SBRK")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_TP_sbrk=k; - if ( Debug ) - printf("Using env USC_TP_SBRK, Set STD_TP_sbrk to %d\n", - STD_TP_sbrk); - } - } - - if ( (ptr=getenv("USC_LP_SBRK")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_LP_sbrk=k; - if ( Debug ) - printf("Using env USC_LP_SBRK, Set STD_LP_sbrk to %d\n", - STD_LP_sbrk); - } - } - - if ( (ptr=getenv("USC_LP_RECFUN")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_LP_recfun=k; - if ( STD_bigstack != (struct usc_bigstack_t *)NULL ) - STD_bigstack=(struct usc_bigstack_t *) - malloc(sizeof(struct usc_bigstack_t)); - if ( Debug ) - printf("Using env USC_LP_RECFUN, Set STD_LP_recfun to %d\n", - STD_LP_recfun); - } - } - - if ( (ptr=getenv("USC_LD_RECFUN")) != NULL ) { - if ( sscanf(ptr, "%i", &k) == 1 && k >= 0 ) { - STD_LD_recfun=k; - if ( STD_bigstack != (struct usc_bigstack_t *)NULL ) - STD_bigstack=(struct usc_bigstack_t *) - malloc(sizeof(struct usc_bigstack_t)); - if ( Debug ) - printf("Using env USC_LD_RECFUN, Set STD_LD_recfun to %d\n", - STD_LD_recfun); - } - } - -#if UNIT_TEST - printf("The following variables after option and env parsing:\n"); - printf("STD_FUNCTIONAL_TEST = %d\n", STD_FUNCTIONAL_TEST); - printf("STD_LOOP_DURATION = %f\n", STD_LOOP_DURATION); - printf("STD_LOOP_DELAY = %f\n", STD_LOOP_DELAY); - printf("STD_COPIES = %d\n", STD_COPIES); - printf("STD_LOOP_COUNT = %d\n", STD_LOOP_COUNT); - printf("STD_INFINITE = %d\n", STD_INFINITE); - printf("STD_TIMING_ON = %d\n", STD_TIMING_ON); - printf("STD_ERRNO_LOG = %d\n", STD_ERRNO_LOG); - printf("STD_PAUSE = %d\n", STD_PAUSE); -#endif - - return((char *) NULL); - -} /* end of parse_opts */ - -/********************************************************************* - * print_help() - print help message and user help message - *********************************************************************/ -void print_help(void (*user_help)()) -{ - STD_opts_help(); - - if (user_help) user_help(); -} - -/********************************************************************* - * STD_opts_help() - return a help string for the STD_OPTIONS. - *********************************************************************/ -void -STD_opts_help() -{ - int i; - - for(i = 0; std_options[i].optstr; ++i) { - if (std_options[i].help) - printf(std_options[i].help); - } -} - -/* - * routine to goto when we get the SIGUSR1 for STD_PAUSE - */ -void STD_go(int sig) -{ - return; -} - -/*********************************************************************** - * This function will do desired end of global setup test - * hooks. - * Currently it will only do a pause waiting for sigusr1 if - * STD_PAUSE is set. - * - ***********************************************************************/ -int -usc_global_setup_hook() -{ - int cnt; - /* temp variable to store old signal action to be restored after pause */ - int (*_TMP_FUNC)(void); - - /* - * Fork STD_COPIES-1 copies. - */ - for(cnt=1;cnt -#include "pattern.h" - -/* - * The routines in this module are used to fill/check a data buffer - * with/against a known pattern. - */ - -int -pattern_check(buf, buflen, pat, patlen, patshift) -char *buf; -int buflen; -char *pat; -int patlen; -int patshift; -{ - int nb, ncmp, nleft; - char *cp; - - if (patlen) - patshift = patshift % patlen; - - cp = buf; - nleft = buflen; - - /* - * The following 2 blocks of code are to compare the first patlen - * bytes of buf. We need 2 checks if patshift is > 0 since we - * must check the last (patlen - patshift) bytes, and then the - * first (patshift) bytes. - */ - - nb = patlen - patshift; - if (nleft < nb) { - return (memcmp(cp, pat + patshift, nleft) ? -1 : 0); - } else { - if (memcmp(cp, pat + patshift, nb)) - return -1; - - nleft -= nb; - cp += nb; - } - - if (patshift > 0) { - nb = patshift; - if (nleft < nb) { - return (memcmp(cp, pat, nleft) ? -1 : 0); - } else { - if (memcmp(cp, pat, nb)) - return -1; - - nleft -= nb; - cp += nb; - } - } - - /* - * Now, verify the rest of the buffer using the algorithm described - * in the function header. - */ - - ncmp = cp - buf; - while (ncmp < buflen) { - nb = (ncmp < nleft) ? ncmp : nleft; - if (memcmp(buf, cp, nb)) - return -1; - - cp += nb; - ncmp += nb; - nleft -= nb; - } - - return 0; -} - -int -pattern_fill(buf, buflen, pat, patlen, patshift) -char *buf; -int buflen; -char *pat; -int patlen; -int patshift; -{ - int trans, ncopied, nleft; - char *cp; - - if (patlen) - patshift = patshift % patlen; - - cp = buf; - nleft = buflen; - - /* - * The following 2 blocks of code are to fill the first patlen - * bytes of buf. We need 2 sections if patshift is > 0 since we - * must first copy the last (patlen - patshift) bytes into buf[0]..., - * and then the first (patshift) bytes of pattern following them. - */ - - trans = patlen - patshift; - if (nleft < trans) { - memcpy(cp, pat + patshift, nleft); - return 0; - } else { - memcpy(cp, pat + patshift, trans); - nleft -= trans; - cp += trans; - } - - if (patshift > 0) { - trans = patshift; - if (nleft < trans) { - memcpy(cp, pat, nleft); - return 0; - } else { - memcpy(cp, pat, trans); - nleft -= trans; - cp += trans; - } - } - - /* - * Now, fill the rest of the buffer using the algorithm described - * in the function header comment. - */ - - ncopied = cp - buf; - while (ncopied < buflen) { - trans = (ncopied < nleft) ? ncopied : nleft; - memcpy(cp, buf, trans); - cp += trans; - ncopied += trans; - nleft -= trans; - } - - return(0); -} diff --git a/winsup/testsuite/libltp/lib/rmobj.c b/winsup/testsuite/libltp/lib/rmobj.c deleted file mode 100644 index 63122c446..000000000 --- a/winsup/testsuite/libltp/lib/rmobj.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - -/********************************************************** - * - * OS Testing - Silicon Graphics, Inc. - * - * FUNCTION NAME : rmobj() - * - * FUNCTION TITLE : Remove an object - * - * SYNOPSIS: - * int rmobj(char *obj, char **errmsg) - * - * AUTHOR : Kent Rogers - * - * INITIAL RELEASE : UNICOS 7.0 - * - * USER DESCRIPTION - * This routine will remove the specified object. If the specified - * object is a directory, it will recursively remove the directory - * and everything underneath it. It assumes that it has privilege - * to remove everything that it tries to remove. If rmobj() encounters - * any problems, and errmsg is not NULL, errmsg is set to point to a - * string explaining the error. - * - * DETAILED DESCRIPTION - * Allocate space for the directory and its contents - * Open the directory to get access to what is in it - * Loop through the objects in the directory: - * If the object is not "." or "..": - * Determine the file type by calling lstat() - * If the object is not a directory: - * Remove the object with unlink() - * Else: - * Call rmobj(object) to remove the object's contents - * Determine the link count on object by calling lstat() - * If the link count >= 3: - * Remove the directory with unlink() - * Else - * Remove the directory with rmdir() - * Close the directory and free the pointers - * - * RETURN VALUE - * If there are any problems, rmobj() will set errmsg (if it was not - * NULL) and return -1. Otherwise it will return 0. - * - ************************************************************/ -#include /* for errno */ -#include /* for NULL */ -#include /* for malloc() */ -#include /* for string function */ -#include /* for PATH_MAX */ -#include /* for opendir(), readdir(), closedir(), stat() */ -#include /* for [l]stat() */ -#include /* for opendir(), readdir(), closedir() */ -#include /* for rmdir(), unlink() */ -#include "rmobj.h" - -#define SYSERR strerror(errno) - -int -rmobj(char *obj, char **errmsg) -{ - int ret_val = 0; /* return value from this routine */ - DIR *dir; /* pointer to a directory */ - struct dirent *dir_ent; /* pointer to directory entries */ - char dirobj[PATH_MAX]; /* object inside directory to modify */ - struct stat statbuf; /* used to hold stat information */ - static char err_msg[1024]; /* error message */ - - /* Determine the file type */ - if ( lstat(obj, &statbuf) < 0 ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "lstat(%s) failed; errno=%d: %s", - obj, errno, SYSERR); - *errmsg = err_msg; - } - return -1; - } - - /* Take appropriate action, depending on the file type */ - if ( (statbuf.st_mode & S_IFMT) == S_IFDIR ) { - /* object is a directory */ - - /* Do NOT perform the request if the directory is "/" */ - if ( !strcmp(obj, "/") ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "Cannot remove /"); - *errmsg = err_msg; - } - return -1; - } - - /* Open the directory to get access to what is in it */ - if ( (dir = opendir(obj)) == NULL ) { - if ( rmdir(obj) != 0 ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "rmdir(%s) failed; errno=%d: %s", - obj, errno, SYSERR); - *errmsg = err_msg; - } - return -1; - } else { - return 0; - } - } - - /* Loop through the entries in the directory, removing each one */ - for ( dir_ent = (struct dirent *)readdir(dir); - dir_ent != NULL; - dir_ent = (struct dirent *)readdir(dir)) { - - /* Don't remove "." or ".." */ - if ( !strcmp(dir_ent->d_name, ".") || !strcmp(dir_ent->d_name, "..") ) - continue; - - /* Recursively call this routine to remove the current entry */ - sprintf(dirobj, "%s/%s", obj, dir_ent->d_name); - if ( rmobj(dirobj, errmsg) != 0 ) - ret_val = -1; - } - - /* Close the directory */ - closedir(dir); - - /* If there were problems removing an entry, don't attempt to - remove the directory itself */ - if ( ret_val == -1 ) - return -1; - - /* Get the link count, now that all the entries have been removed */ - if ( lstat(obj, &statbuf) < 0 ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "lstat(%s) failed; errno=%d: %s", - obj, errno, SYSERR); - *errmsg = err_msg; - } - return -1; - } - - /* Remove the directory itself */ - if ( statbuf.st_nlink >= 3 ) { - /* The directory is linked; unlink() must be used */ - if ( unlink(obj) < 0 ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "unlink(%s) failed; errno=%d: %s", - obj, errno, SYSERR); - *errmsg = err_msg; - } - return -1; - } - } else { - /* The directory is not linked; rmdir() can be used */ - if ( rmdir(obj) < 0 ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "rmdir(%s) failed; errno=%d: %s", - obj, errno, SYSERR); - *errmsg = err_msg; - } - return -1; - } - } - } else { - /* object is not a directory; just use unlink() */ - if ( unlink(obj) < 0 ) { - if ( errmsg != NULL ) { - sprintf(err_msg, "unlink(%s) failed; errno=%d: %s", - obj, errno, SYSERR); - *errmsg = err_msg; - } - return -1; - } - } /* if obj is a directory */ - - /* - * Everything must have went ok. - */ - return 0; -} /* rmobj() */ diff --git a/winsup/testsuite/libltp/lib/search_path.c b/winsup/testsuite/libltp/lib/search_path.c deleted file mode 100644 index 775c7b1a6..000000000 --- a/winsup/testsuite/libltp/lib/search_path.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * (C) COPYRIGHT CRAY RESEARCH, INC. - * UNPUBLISHED PROPRIETARY INFORMATION. - * ALL RIGHTS RESERVED. - */ -/********************************************************** - * - * UNICOS Feature Test and Evaluation - Cray Research, Inc. - * - * FUNCTION NAME : search_path - * - * FUNCTION TITLE : search PATH locations for desired filename - * - * SYNOPSIS: - * int search_path(cmd, res_path, access_mode, fullpath) - * char *cmd; - * char *res_path; - * int access_mode; - * int fullpath; - * - * AUTHOR : Richard Logan - * - * INITIAL RELEASE : UNICOS 7.0 - * - * DESCRIPTION - * Search_path will walk through PATH and attempt to find "cmd". If cmd is - * a full or relative path, it is checked but PATH locations are not scanned. - * search_path will put the resulting path in res_path. It is assumed - * that res_path points to a string that is at least PATH_MAX - * (or MAXPATHLEN on the suns) in size. Access_mode is just as is - * says, the mode to be used on access to determine if cmd can be found. - * If fullpath is set, res_path will contain the full path to cmd. - * If it is not set, res_path may or may not contain the full path to cmd. - * If fullpath is not set, the path in PATH prepended to cmd is used, - * which could be a relative path. If fullpath is set, the current - * directory is prepended to path/cmd before access is called. - * If cmd is found, search_path will return 0. If cmd cannot be - * found, 1 is returned. If an error has occurred, -1 is returned - * and an error mesg is placed in res_path. - * If the length of path/cmd is larger then PATH_MAX, then that path - * location is skipped. - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include - -extern int errno; - -struct stat stbuf; - -#ifndef AS_CMD -#define AS_CMD 0 -#endif - -/* - * Make sure PATH_MAX is defined. Define it to MAXPATHLEN, if set. Otherwise - * set it to 1024. - */ -#ifndef PATH_MAX -#ifndef MAXPATHLEN -#define PATH_MAX 1024 -#else /* MAXPATHLEN */ -#define PATH_MAX MAXPATHLEN -#endif /* MAXPATHLEN */ -#endif /* PATH_MAX */ - - -#if AS_CMD -main(argc, argv) -int argc; -char **argv; -{ - char path[PATH_MAX]; - int ind; - - if (argc <= 1 ) { - printf("missing argument\n"); - exit(1); - } - - for(ind=1;ind < argc; ind++) { - if ( search_path(argv[ind], path, F_OK, 0) < 0 ) { - printf("ERROR: %s\n", path); - } - else { - printf("path of %s is %s\n", argv[ind], path); - } - } - -} - -#endif - -/* - */ -int -search_path(cmd, res_path, access_mode, fullpath) -const char *cmd; /* The requested filename */ -char *res_path; /* The resulting path or error mesg */ -int access_mode; /* the mode used by access(2) */ -int fullpath; /* if set, cwd will be prepended to all non-full paths */ -{ - char *cp; /* used to scan PATH for directories */ - int ret; /* return value from access */ - char *pathenv; - char tmppath[PATH_MAX]; - char curpath[PATH_MAX]; - char *path; - int lastpath; - int toolong=0; - -#if DEBUG -printf("search_path: cmd = %s, access_mode = %d, fullpath = %d\n", cmd, access_mode, fullpath); -#endif - - /* - * full or relative path was given - */ - if ( (cmd[0] == '/') || ( (cp=strchr(cmd, '/')) != NULL )) { - if ( access(cmd, access_mode) == 0 ) { - - if ( cmd[0] != '/' ) { /* relative path */ - if ( getcwd(curpath, PATH_MAX) == NULL ) { - strcpy(res_path, curpath); - return -1; - } - if ( (strlen(curpath) + strlen(cmd) + 1) > (size_t)PATH_MAX ) { - sprintf(res_path, "cmd (as relative path) and cwd is longer than %d", - PATH_MAX); - return -1; - } - sprintf(res_path, "%s/%s", curpath, cmd); - } - else - strcpy(res_path, cmd); - return 0; - } - else { - sprintf(res_path, "file %s not found", cmd); - return -1; - } - } - - /* get the PATH variable */ - if ( (pathenv=getenv("PATH")) == NULL) { - /* no path to scan, return */ - sprintf(res_path, "Unable to get PATH env. variable"); - return -1; - } - - /* - * walk through each path in PATH. - * Each path in PATH is placed in tmppath. - * pathenv cannot be modified since it will affect PATH. - * If a signal came in while we have modified the PATH - * memory, we could create a problem for the caller. - */ - - curpath[0]='\0'; - - cp = pathenv; - path = pathenv; - lastpath = 0; - for (;;) { - - if ( lastpath ) - break; - - if ( cp != pathenv ) - path = ++cp; /* already set on first iteration */ - - /* find end of current path */ - - for (; ((*cp != ':') && (*cp != '\0')); cp++); - - /* - * copy path to tmppath so it can be NULL terminated - * and so we do not modify path memory. - */ - strncpy(tmppath, path, (cp-path) ); - tmppath[cp-path]='\0'; -#if DEBUG -printf("search_path: tmppath = %s\n", tmppath); -#endif - - if ( *cp == '\0' ) - lastpath=1; /* this is the last path entry */ - - /* Check lengths so not to overflow res_path */ - if ( strlen(tmppath) + strlen(cmd) + 2 > (size_t)PATH_MAX ) { - toolong++; - continue; - } - - sprintf(res_path, "%s/%s", tmppath, cmd); -#if DEBUG -printf("search_path: res_path = '%s'\n", res_path); -#endif - - - /* if the path is not full at this point, prepend the current - * path to get the full path. - * Note: this could not be wise to do when under a protected - * directory. - */ - - if ( fullpath && res_path[0] != '/' ) { /* not a full path */ - if ( curpath[0] == '\0' ) { - if ( getcwd(curpath, PATH_MAX) == NULL ) { - strcpy(res_path, curpath); - return -1; - } - } - if ( (strlen(curpath) + strlen(res_path) + 2) > (size_t)PATH_MAX ) { - toolong++; - continue; - } - sprintf(tmppath, "%s/%s", curpath, res_path); - strcpy(res_path, tmppath); -#if DEBUG -printf("search_path: full res_path= '%s'\n", res_path); -#endif - - } - - - if ( (ret=access(res_path, access_mode)) == 0 ) { -#if DEBUG -printf("search_path: found res_path = %s\n", res_path); -#endif - return 0; - } - } - - /* return failure */ - if ( toolong ) - sprintf(res_path, - "Unable to find file, %d path/file strings were too long", toolong); - else - strcpy(res_path, "Unable to find file"); - return 1; /* not found */ -} - diff --git a/winsup/testsuite/libltp/lib/str_to_bytes.c b/winsup/testsuite/libltp/lib/str_to_bytes.c deleted file mode 100644 index beecb71b6..000000000 --- a/winsup/testsuite/libltp/lib/str_to_bytes.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#include -#include -#include "str_to_bytes.h" - -/**************************************************************************** - * str_to_bytes(s) - * - * Computes the number of bytes described by string s. s is assumed to be - * a base 10 positive (ie. >= 0) number followed by an optional single - * character multiplier. The following multipliers are supported: - * - * char mult - * ----------------- - * b BSIZE or BBSIZE - * k 1024 bytes - * K 1024 * sizeof(long) - * m 2^20 (1048576) - * M 2^20 (1048576 * sizeof(long) - * g 2^30 (1073741824) - * G 2^30 (1073741824) * sizeof(long) - * - * for instance, "1k" and "1024" would both cause str_to_bytes to return 1024. - * - * Returns -1 if mult is an invalid character, or if the integer portion of - * s is not a positive integer. - * - ****************************************************************************/ - -#if CRAY -#define B_MULT BSIZE /* block size */ -#elif sgi -#define B_MULT BBSIZE /* block size */ -#elif linux -#define B_MULT DEV_BSIZE /* block size */ -#elif __CYGWIN__ -#include -#define B_MULT S_BLKSIZE /* block size */ -#endif - - -#define K_MULT 1024 /* Kilo or 2^10 */ -#define M_MULT 1048576 /* Mega or 2^20 */ -#define G_MULT 1073741824 /* Giga or 2^30 */ -#define T_MULT 1099511627776 /* tera or 2^40 */ - -int -str_to_bytes(s) -char *s; -{ - char mult, junk; - int nconv; - float num; - - nconv = sscanf(s, "%f%c%c", &num, &mult, &junk); - if (nconv == 0 || nconv == 3 ) - return -1; - - if (nconv == 1) - return num; - - switch (mult) { - case 'b': - return (int)(num * (float)B_MULT); - case 'k': - return (int)(num * (float)K_MULT); - case 'K': - return (int)((num * (float)K_MULT) * sizeof(long)); - case 'm': - return (int)(num * (float)M_MULT); - case 'M': - return (int)((num * (float)M_MULT) * sizeof(long)); - case 'g': - return (int)(num * (float)G_MULT); - case 'G': - return (int)((num * (float)G_MULT) * sizeof(long)); - default: - return -1; - } -} - -long -str_to_lbytes(s) -char *s; -{ - char mult, junk; - long nconv; - float num; - - nconv = sscanf(s, "%f%c%c", &num, &mult, &junk); - if (nconv == 0 || nconv == 3 ) - return -1; - - if (nconv == 1) - return (long)num; - - switch (mult) { - case 'b': - return (long)(num * (float)B_MULT); - case 'k': - return (long)(num * (float)K_MULT); - case 'K': - return (long)((num * (float)K_MULT) * sizeof(long)); - case 'm': - return (long)(num * (float)M_MULT); - case 'M': - return (long)((num * (float)M_MULT) * sizeof(long)); - case 'g': - return (long)(num * (float)G_MULT); - case 'G': - return (long)((num * (float)G_MULT) * sizeof(long)); - default: - return -1; - } -} - -/* - * Force 64 bits number when compiled as 32 IRIX binary. - * This allows for a number bigger than 2G. - */ - -long long -str_to_llbytes(s) -char *s; -{ - char mult, junk; - long nconv; - double num; - - nconv = sscanf(s, "%lf%c%c", &num, &mult, &junk); - if (nconv == 0 || nconv == 3 ) - return -1; - - if (nconv == 1) - return (long long)num; - - switch (mult) { - case 'b': - return (long long)(num * (float)B_MULT); - case 'k': - return (long long)(num * (float)K_MULT); - case 'K': - return (long long)((num * (float)K_MULT) * sizeof(long long)); - case 'm': - return (long long)(num * (float)M_MULT); - case 'M': - return (long long)((num * (float)M_MULT) * sizeof(long long)); - case 'g': - return (long long)(num * (float)G_MULT); - case 'G': - return (long long)((num * (float)G_MULT) * sizeof(long long)); - default: - return -1; - } -} - -#ifdef UNIT_TEST - -main(int argc, char **argv) -{ - int ind; - - if (argc == 1 ) { - fprintf(stderr, "missing str_to_bytes() parameteres\n"); - exit(1); - } - - for (ind=1; ind -#include /* for string functions */ -#include "string_to_tokens.h" - -int -string_to_tokens(char *arg_string, char *arg_array[], int array_size, char *separator) -{ - int num_toks = 0; /* number of tokens found */ - char *strtok(); - - if ( arg_array == NULL || array_size <= 1 || separator == NULL ) - return -1; - - /* - * Use strtok() to parse 'arg_string', placing pointers to the - * individual tokens into the elements of 'arg_array'. - */ - if ( (arg_array[num_toks] = strtok(arg_string, separator)) == NULL ) { - return 0; - } - - for (num_toks=1;num_toks -#include /* for varargs stuff */ -#include "test.h" /* for output display mode & result type */ - /* defines */ - -/* - * Define some useful macros. - */ -#define VERBOSE 1 /* flag values for the T_mode variable */ -#define CONDENSE 2 -#define NOPASS 3 -#define DISCARD 4 - -#define MAXMESG 80 /* max length of internal messages */ -#define USERMESG 2048 /* max length of user message */ -#define TRUE 1 -#define FALSE 0 - -/* - * EXPAND_VAR_ARGS - Expand the variable portion (arg_fmt) of a result - * message into the specified string. - */ -#define EXPAND_VAR_ARGS(arg_fmt, str) { \ - va_list ap; /* varargs mechanism */ \ - \ - if ( arg_fmt != NULL ) { \ - if ( Expand_varargs == TRUE ) { \ - va_start(ap, arg_fmt); \ - vsprintf(str, arg_fmt, ap); \ - va_end(ap); \ - Expand_varargs = FALSE; \ - } else { \ - strcpy(str, arg_fmt); \ - } \ - } else { \ - str[0] = '\0'; \ - } \ -} /* EXPAND_VAR_ARGS() */ - -/* - * Define local function prototypes. - */ -static void check_env(); -static void tst_condense(int tnum, int ttype, char *tmesg); -static void tst_print(char *tcid, int tnum, int trange, int ttype, const char *tmesg); -static void cat_file(const char *filename); - - -/* - * Define some static/global variables. - */ -static FILE *T_out = NULL; /* tst_res() output file descriptor */ -static const char *File; /* file whose contents is part of result */ -static int T_exitval = 0; /* exit value used by tst_exit() */ -static int T_mode = VERBOSE; /* flag indicating print mode: VERBOSE, */ - /* CONDENSE, NOPASS, DISCARD */ - -static int Expand_varargs = TRUE; /* if TRUE, expand varargs stuff */ -static char Warn_mesg[MAXMESG]; /* holds warning messages */ - -/* - * These are used for condensing output when NOT in verbose mode. - */ -static int Buffered = FALSE; /* TRUE if condensed output is currently */ - /* buffered (i.e. not yet printed) */ -static char *Last_tcid; /* previous test case id */ -static int Last_num; /* previous test case number */ -static int Last_type; /* previous test result type */ -static char *Last_mesg; /* previous test result message */ - - -/* - * These globals may be externed by the test. - */ -int Tst_count = 0; /* current count of test cases executed; NOTE: */ - /* Tst_count may be externed by other programs */ -int Tst_lptotal = 0; /* tst_brkloop() external */ -int Tst_lpstart = 0; /* tst_brkloop() external */ -int Tst_range = 1; /* for specifying multiple results */ -int Tst_nobuf = 1; /* this is a no-op; buffering is never done, but */ - /* this will stay for compatibility reasons */ - -/* - * These globals must be defined in the test. - */ -extern char *TCID; /* Test case identifier from the test source */ -extern int TST_TOTAL; /* Total number of test cases from the test */ - /* source */ - -/* - * This global is used by the temp. dir. maintenance functions, - * tst_tmpdir()/tst_rmdir(), tst_wildcard()/tst_tr_rmdir(). It is the - * name of the directory created (if any). It is defined here, so that - * it only has to be declared once and can then be referenced from more - * than one module. Also, since the temp. dir. maintenance functions - * rely on the tst_res.c package this seemed like a reasonable place. - */ -char *TESTDIR = NULL; - -/* - * tst_res() - Main result reporting function. Handle test information - * appropriately depending on output display mode. Call - * tst_condense() or tst_print() to actually print results. - * All result functions (tst_resm(), tst_brk(), etc.) - * eventually get here to print the results. - */ -void -tst_res(int ttype, const char *fname, const char *arg_fmt, ...) -{ - int i; - char tmesg[USERMESG]; /* expanded message */ - -#if DEBUG - printf("IN tst_res; Tst_count = %d; Tst_range = %d\n", - Tst_count, Tst_range); fflush(stdout); -#endif - - /* - * Expand the arg_fmt string into tmesg, if necessary. - */ - EXPAND_VAR_ARGS(arg_fmt, tmesg); - - /* - * Save the test result type by ORing ttype into the current exit - * value (used by tst_exit()). - */ - T_exitval |= ttype; - - /* - * Unless T_out has already been set by tst_environ(), make tst_res() - * output go to standard output. - */ - if ( T_out == NULL ) - T_out = stdout; - - /* - * Check TOUTPUT environment variable (if first time) and set T_mode - * flag. - */ - check_env(); - - /* - * A negative or NULL range is invalid. - */ - if ( Tst_range <= 0 ) { - Tst_range = 1; - tst_print(TCID, 0, 1, TWARN, - "tst_res(): Tst_range must be positive"); - } - - /* - * If a filename was specified, set 'File' if it exists. - */ - if ( fname != NULL && access(fname, F_OK) == 0 ) - File = fname; - - /* - * Set the test case number and print the results, depending on the - * display type. - */ - if ( ttype == TWARN || ttype == TINFO ) { - /* - * Handle WARN and INFO results (test case number is 0). - */ - if ( Tst_range > 1 ) { - tst_print(TCID, 0, 1, TWARN, - "tst_res(): Range not valid for TINFO or TWARN types"); - } - tst_print(TCID, 0, 1, ttype, tmesg); - } else { - /* - * Handle all other types of results other than WARN and INFO. - */ - if ( Tst_count < 0 ) - tst_print(TCID, 0, 1, TWARN, - "tst_res(): Tst_count < 0 is not valid"); - - /* - * Process each display type. - */ - switch ( T_mode ) { - case DISCARD: - /* do not print any results */ - break; - - case NOPASS: /* passing result types are filtered by tst_print() */ - case CONDENSE: - tst_condense(Tst_count + 1, ttype, tmesg); - break; - - default: /* VERBOSE */ - for ( i = 1 ; i <= Tst_range ; i++ ) - tst_print(TCID, Tst_count + i, Tst_range, ttype, tmesg); - break; - } /* end switch() */ - - /* - * Increment Tst_count. - */ - Tst_count += Tst_range; - } /* if ( ttype == TWARN || ttype == TINFO ) */ - - /* - * Reset some values. - */ - Tst_range = 1; - Expand_varargs = TRUE; -} /* tst_res() */ - - -/* - * tst_condense() - Handle test cases in CONDENSE or NOPASS mode (i.e. - * buffer the current result and print the last result - * if different than the current). If a file was - * specified, print the current result and do not - * buffer it. - */ -static void -tst_condense(int tnum, int ttype, char *tmesg) -{ - const char *file; - -#if DEBUG - printf("IN tst_condense: tcid = %s, tnum = %d, ttype = %d, tmesg = %s\n", - TCID, tnum, ttype, tmesg); - fflush(stdout); -#endif - - /* - * If this result is the same as the previous result, return. - */ - if ( Buffered == TRUE ) { - if ( strcmp(Last_tcid, TCID) == 0 && Last_type == ttype && - strcmp(Last_mesg, tmesg) == 0 && File == NULL ) - return; - - /* - * This result is different from the previous result. First, - * print the previous result. - */ - file = File; - File = NULL; - tst_print(Last_tcid, Last_num, tnum - Last_num, Last_type, - Last_mesg); - free(Last_tcid); - free(Last_mesg); - File = file; - } /* if ( Buffered == TRUE ) */ - - /* - * If a file was specified, print the current result since we have no - * way of retaining the file contents for comparing with future - * results. Otherwise, buffer the current result info for next time. - */ - if ( File != NULL ) { - tst_print(TCID, tnum, Tst_range, ttype, tmesg); - Buffered = FALSE; - } else { - Last_tcid = (char *)malloc(strlen(TCID) + 1); - strcpy(Last_tcid, TCID); - Last_num = tnum; - Last_type = ttype; - Last_mesg = (char *)malloc(strlen(tmesg) + 1); - strcpy(Last_mesg, tmesg); - Buffered = TRUE; - } -} /* tst_condense() */ - - -/* - * tst_flush() - Print any messages pending because of CONDENSE mode, - * and flush T_out. - */ -void -tst_flush() -{ -#if DEBUG - printf("IN tst_flush\n"); - fflush(stdout); -#endif - - /* - * Print out last line if in CONDENSE or NOPASS mode. - */ - if ( Buffered == TRUE && (T_mode == CONDENSE || T_mode == NOPASS) ) { - tst_print(Last_tcid, Last_num, Tst_count - Last_num + 1, - Last_type, Last_mesg); - Buffered = FALSE; - } - fflush(T_out); -} /* tst_flush() */ - - -/* - * tst_print() - Actually print a line or range of lines to the output - * stream. - */ -static void -tst_print(char *tcid, int tnum, int trange, int ttype, const char *tmesg) -{ - char type[5]; - -#if DEBUG - printf("IN tst_print: tnum = %d, trange = %d, ttype = %d, tmesg = %s\n", - tnum, trange, ttype, tmesg); - fflush(stdout); -#endif - - /* - * Save the test result type by ORing ttype into the current exit - * value (used by tst_exit()). This is already done in tst_res(), but - * is also done here to catch internal warnings. For internal warnings, - * tst_print() is called directly with a case of TWARN. - */ - T_exitval |= ttype; - - /* - * If output mode is DISCARD, or if the output mode is NOPASS and - * this result is not one of FAIL, BROK, or WARN, just return. This - * check is necessary even though we check for DISCARD mode inside of - * tst_res(), since occasionally we get to this point without going - * through tst_res() (e.g. internal TWARN messages). - */ - if ( T_mode == DISCARD || (T_mode == NOPASS && ttype != TFAIL && - ttype != TBROK && ttype != TWARN) ) - return; - - /* - * Fill in the type string according to ttype. - */ - switch ( ttype ) { - case TPASS: - strcpy(type, "PASS"); - break; - case TFAIL: - strcpy(type, "FAIL"); - break; - case TBROK: - strcpy(type, "BROK"); - break; - case TRETR: - strcpy(type, "RETR"); - break; - case TCONF: - strcpy(type, "CONF"); - break; - case TWARN: - strcpy(type, "WARN"); - break; - case TINFO: - strcpy(type, "INFO"); - break; - default: - strcpy(type, "????"); - break; - } /* switch ( ttype ) */ - - /* - * Build the result line and print it. - */ - if ( T_mode == VERBOSE ) { - fprintf(T_out, "%-8s %4d %s : %s\n", tcid, tnum, type, tmesg); - } else { - /* condense results if a range is specified */ - if ( trange > 1 ) - fprintf(T_out, "%-8s %4d-%-4d %s : %s\n", - tcid, tnum, tnum + trange - 1, type, tmesg); - else - fprintf(T_out, "%-8s %4d %s : %s\n", - tcid, tnum, type, tmesg); - } - - /* - * If tst_res() was called with a file, append file contents to the - * end of last printed result. - */ - if ( File != NULL ) - cat_file(File); - File = NULL; -} /* tst_print() */ - - -/* - * check_env() - Check the value of the environment variable TOUTPUT and - * set the global variable T_mode. The TOUTPUT environment - * variable should be set to "VERBOSE", "CONDENSE", - * "NOPASS", or "DISCARD". If TOUTPUT does not exist or - * is not set to a valid value, the default is "VERBOSE". - */ -static void -check_env() -{ - static int first_time = 1; - char *value; /* value of TOUTPUT environment variable */ - -#if DEBUG - printf("IN check_env\n"); - fflush(stdout); -#endif - - if ( !first_time ) - return; - - first_time = 0; - - if ( (value = getenv(TOUTPUT)) == NULL ) { - /* TOUTPUT not defined, use default */ - T_mode = VERBOSE; - } else if ( strcmp(value, TOUT_CONDENSE_S) == 0 ) { - T_mode = CONDENSE; - } else if ( strcmp(value, TOUT_NOPASS_S) == 0 ) { - T_mode = NOPASS; - } else if ( strcmp(value, TOUT_DISCARD_S) == 0 ) { - T_mode = DISCARD; - } else { - /* default */ - T_mode = VERBOSE; - } - - return; -} /* check_env() */ - - -/* - * tst_exit() - Call exit() with the value T_exitval, set up by - * tst_res(). T_exitval has a bit set for most of the - * result types that were seen (including TPASS, TFAIL, - * TBROK, TWARN, TCONF). Also, print the last result (if - * necessary) before exiting. - */ -void -tst_exit() -{ -#if DEBUG - printf("IN tst_exit\n"); fflush(stdout); - fflush(stdout); -#endif - - /* - * Call tst_flush() flush any ouput in the buffer or the last - * result not printed because of CONDENSE mode. - */ - tst_flush(); - - /* - * Mask out TRETR, TINFO, and TCONF results from the exit status. - */ - exit(T_exitval & ~(TRETR | TINFO | TCONF)); -} /* tst_exit() */ - - -/* - * tst_environ() - Preserve the tst_res() output location, despite any - * changes to stdout. - */ -int -tst_environ() -{ - FILE *fdopen(); - - if ( (T_out = fdopen(dup(fileno(stdout)), "w")) == NULL ) - return(-1); - else - return(0); -} /* tst_environ() */ - - -/* - * tst_brk() - Fail or break current test case, and break the remaining - * tests cases. - */ -void -tst_brk(int ttype, char *fname, void (*func)(), const char *arg_fmt, ...) -{ - char tmesg[USERMESG]; /* expanded message */ - -#if DEBUG - printf("IN tst_brk\n"); fflush(stdout); - fflush(stdout); -#endif - - /* - * Expand the arg_fmt string into tmesg, if necessary. - */ - EXPAND_VAR_ARGS(arg_fmt, tmesg); - - /* - * Only FAIL, BROK, CONF, and RETR are supported by tst_brk(). - */ - if ( ttype != TFAIL && ttype != TBROK && ttype != TCONF && - ttype != TRETR ) { - sprintf(Warn_mesg, "tst_brk(): Invalid Type: %d. Using TBROK", - ttype); - tst_print(TCID, 0, 1, TWARN, Warn_mesg); - ttype = TBROK; - } - - /* - * Print the first result, if necessary. - */ - if ( Tst_count < TST_TOTAL ) - tst_res(ttype, fname, tmesg); - - /* - * Determine the number of results left to report. - */ - Tst_range = TST_TOTAL - Tst_count; - - /* - * Print the rest of the results, if necessary. - */ - if ( Tst_range > 0 ) { - if ( ttype == TCONF ) - tst_res(ttype, NULL, - "Remaining cases not appropriate for configuration"); - else if ( ttype == TRETR ) - tst_res(ttype, NULL, "Remaining cases retired"); - else - tst_res(TBROK, NULL, "Remaining cases broken"); - } else { - Tst_range = 1; - Expand_varargs = TRUE; - } /* if ( Tst_range > 0 ) */ - - /* - * If no cleanup function was specified, just return to the caller. - * Otherwise call the specified function. If specified function - * returns, call tst_exit(). - */ - if ( func != NULL ) { - (*func)(); - tst_exit(); - } - - return; -} /* tst_brk() */ - - -/* - * tst_brkloop() - Fail or break current test case, and break the - * remaining test cases within test case loop. - */ -void -tst_brkloop(int ttype, char *fname, void (*func)(), const char *arg_fmt, ...) -{ - char tmesg[USERMESG]; /* expanded message */ - -#if DEBUG - printf("IN tst_brkloop\n"); fflush(stdout); - fflush(stdout); -#endif - - /* - * Expand the arg_fmt string into tmesg. - */ - EXPAND_VAR_ARGS(arg_fmt, tmesg); - - /* - * Verify that Tst_lpstart & Tst_lptotal are valid. - */ - if ( Tst_lpstart < 0 || Tst_lptotal < 0 ) { - tst_print(TCID, 0, 1, TWARN, - "tst_brkloop(): Tst_lpstart & Tst_lptotal must both be assigned non-negative values"); - Expand_varargs = TRUE; - return; - } - - /* - * Only FAIL, BROK, CONF, and RETR are supported by tst_brkloop(). - */ - if ( ttype != TFAIL && ttype != TBROK && ttype != TCONF && - ttype != TRETR ) { - sprintf(Warn_mesg, - "tst_brkloop(): Invalid Type: %d. Using TBROK", - ttype); - tst_print(TCID, 0, 1, TWARN, Warn_mesg); - ttype = TBROK; - } - - /* - * Print the first result, if necessary. - */ - if ( Tst_count < Tst_lpstart + Tst_lptotal ) - tst_res(ttype, fname, tmesg); - - /* - * Determine the number of results left to report. - */ - Tst_range = Tst_lptotal + Tst_lpstart - Tst_count; - - /* - * Print the rest of the results, if necessary. - */ - if ( Tst_range > 0 ) { - if ( ttype == TCONF ) - tst_res(ttype, NULL, - "Remaining cases in loop not appropriate for configuration"); - else if ( ttype == TRETR ) - tst_res(ttype, NULL, "Remaining cases in loop retired"); - else - tst_res(TBROK, NULL, "Remaining cases in loop broken"); - } else { - Tst_range = 1; - Expand_varargs = TRUE; - } /* if ( Tst_range > 0 ) */ - - /* - * If a cleanup function was specified, call it. - */ - if ( func != NULL ) - (*func)(); -} /* tst_brkloop() */ - - -/* - * tst_resm() - Interface to tst_res(), with no filename. - */ -void -tst_resm(int ttype, const char *arg_fmt, ...) -{ - char tmesg[USERMESG]; /* expanded message */ - -#if DEBUG - printf("IN tst_resm\n"); fflush(stdout); - fflush(stdout); -#endif - - /* - * Expand the arg_fmt string into tmesg. - */ - EXPAND_VAR_ARGS(arg_fmt, tmesg); - - /* - * Call tst_res with a null filename argument. - */ - tst_res(ttype, NULL, tmesg); -} /* tst_resm() */ - - -/* - * tst_brkm() - Interface to tst_brk(), with no filename. - */ -void -tst_brkm(int ttype, void (*func)(), const char *arg_fmt, ...) -{ - char tmesg[USERMESG]; /* expanded message */ - -#if DEBUG - printf("IN tst_brkm\n"); fflush(stdout); - fflush(stdout); -#endif - - /* - * Expand the arg_fmt string into tmesg. - */ - EXPAND_VAR_ARGS(arg_fmt, tmesg); - - /* - * Call tst_brk with a null filename argument. - */ - tst_brk(ttype, NULL, func, tmesg); -} /* tst_brkm() */ - - -/* - * tst_brkloopm() - Interface to tst_brkloop(), with no filename. - */ -void -tst_brkloopm(int ttype, void (*func)(), const char *arg_fmt, ...) -{ - char tmesg[USERMESG]; /* expanded message */ - -#if DEBUG - printf("IN tst_brkloopm\n"); - fflush(stdout); -#endif - - /* - * Expand the arg_fmt string into tmesg. - */ - EXPAND_VAR_ARGS(arg_fmt, tmesg); - - /* - * Call tst_brkloop with a null filename argument. - */ - tst_brkloop(ttype, NULL, func, tmesg); -} /* tst_brkloopm() */ - - -/* - * cat_file() - Print the contents of a file to standard out. - */ -static void -cat_file(const char *filename) -{ - FILE *fp; /* file pointer */ - int b_read; /* number of bytes read with read() */ - int b_written; /* number of bytes written with write() */ - char buffer[BUFSIZ]; /* read/write buffer; BUFSIZ defined in */ - /* stdio.h */ - -#if DEBUG - printf("IN cat_file\n"); fflush(stdout); -#endif - - /* - * Open the file for reading. - */ - if ( (fp = fopen(filename, "r")) == NULL ) { - sprintf(Warn_mesg, - "tst_res(): fopen(%s, \"r\") failed; errno = %d: %s", - filename, errno, strerror(errno)); - tst_print(TCID, 0, 1, TWARN, Warn_mesg); - return; - } /* if ( fopen(filename, "r") == -1 ) */ - - /* - * While something to read, continue to read blocks. - * From fread(3) man page: - * If an error occurs, or the end-of-file is reached, the return - * value is zero. - */ - errno = 0; - while ( (b_read = fread((void *)buffer, 1, BUFSIZ, fp)) != (size_t)0 ) { - /* - * Write what was read to the result output stream. - */ - if ( (b_written = fwrite((void *)buffer, 1, b_read, T_out)) != - b_read ) { - sprintf(Warn_mesg, - "tst_res(): While trying to cat \"%s\", fwrite() wrote only %d of %d bytes", - filename, b_written, b_read); - tst_print(TCID, 0, 1, TWARN, Warn_mesg); - break; - } /* if ( b_written != b_read ) */ - } /* while ( fread() != 0 ) */ - - /* - * Check for an fread() error. - */ - if ( !feof(fp) ) { - sprintf(Warn_mesg, - "tst_res(): While trying to cat \"%s\", fread() failed, errno = %d: %s", - filename, errno, strerror(errno)); - tst_print(TCID, 0, 1, TWARN, Warn_mesg); - } /* if ( !feof() ) */ - - /* - * Close the file. - */ - if ( fclose(fp) == EOF ) { - sprintf(Warn_mesg, - "tst_res(): While trying to cat \"%s\", fclose() failed, errno = %d: %s", - filename, errno, strerror(errno)); - tst_print(TCID, 0, 1, TWARN, Warn_mesg); - } /* if ( fclose(fp) == EOF ) */ -} /* cat_file() */ - - - -#ifdef UNIT_TEST -/**************************************************************************** - * Unit test code: Takes input from stdin and can make the following - * calls: tst_res(), tst_resm(), tst_brk(), tst_brkm(), - * tst_flush_buf(), tst_exit(). - ****************************************************************************/ -int TST_TOTAL = 10; -char *TCID = "TESTTCID"; - -#define RES "tst_res.c UNIT TEST message; ttype = %d; contents of \"%s\":" -#define RESM "tst_res.c UNIT TEST message; ttype = %d" - -main() -{ - int ttype; - int range; - char *chrptr; - char chr; - char fname[MAXMESG]; - - printf("UNIT TEST of tst_res.c. Options for ttype:\n\ - -1 : call tst_exit()\n\ - -2 : call tst_flush()\n\ - -3 : call tst_brk()\n\ - -4 : call tst_brkloop()\n\ - -5 : call tst_res() with a range\n\ - 0 : call tst_res(TPASS, ...)\n\ - 1 : call tst_res(TFAIL, ...)\n\ - 2 : call tst_res(TBROK, ...)\n\ - 4 : call tst_res(TWARN, ...)\n\ - 8 : call tst_res(TRETR, ...)\n\ - 16 : call tst_res(TINFO, ...)\n\ - 32 : call tst_res(TCONF, ...)\n\n"); - - while ( 1 ) { - printf("Enter ttype (-5,-4,-3,-2,-1,0,1,2,4,8,16,32): "); - (void) scanf("%d%c", &ttype, &chr); - - - switch ( ttype ) { - case -1: - tst_exit(); - break; - - case -2: - tst_flush(); - break; - - case -3: - printf("Enter the current type (1=FAIL, 2=BROK, 8=RETR, 32=CONF): "); - (void) scanf("%d%c", &ttype, &chr); - printf("Enter file name ( for none): "); - gets(fname); - if ( strcmp(fname, "") == 0 ) - tst_brkm(ttype, tst_exit, RESM, ttype); - else - tst_brk(ttype, fname, tst_exit, RES, ttype, fname); - break; - - case -4: - printf("Enter the size of the loop: "); - (void) scanf("%d%c", &range, &chr); - Tst_lpstart = Tst_count; - Tst_lptotal = range; - printf("Enter the current type (1=FAIL, 2=BROK, 8=RETR, 32=CONF): "); - (void) scanf("%d%c", &ttype, &chr); - printf("Enter file name ( for none): "); - gets(fname); - if ( strcmp(fname, "") == 0 ) - tst_brkloopm(ttype, NULL, RESM, ttype); - else - tst_brkloop(ttype, fname, NULL, RES, ttype, fname); - break; - - case -5: - printf("Enter the size of the range: "); - (void) scanf("%d%c", &Tst_range, &chr); - printf("Enter the current type (0,1,2,4,8,16,32): "); - (void) scanf("%d%c", &ttype, &chr); - /* fall through to tst_res() call */ - - default: - printf("Enter file name ( for none): "); - gets(fname); - if ( strcmp(fname, "") == 0 ) - tst_resm(ttype, RESM, ttype); - else - tst_res(ttype, fname, RES, ttype, fname); - break; - } /* switch() */ - } /* while() */ -} -#endif /* UNIT_TEST */ diff --git a/winsup/testsuite/libltp/lib/tst_sig.c b/winsup/testsuite/libltp/lib/tst_sig.c deleted file mode 100644 index f5b64b666..000000000 --- a/winsup/testsuite/libltp/lib/tst_sig.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - -/***************************************************************************** - OS Testing - Silicon Graphics, Inc. - - FUNCTION IDENTIFIER : tst_sig Set up for unexpected signals. - - AUTHOR : David D. Fenner - - CO-PILOT : Bill Roske - - DATE STARTED : 06/06/90 - - This module may be linked with c-modules requiring unexpected - signal handling. The parameters to tst_sig are as follows: - - fork_flag - set to FORK or NOFORK depending upon whether the - calling program executes a fork() system call. It - is normally the case that the calling program treats - SIGCLD as an expected signal if fork() is being used. - - handler - a pointer to the unexpected signal handler to - be executed after an unexpected signal has been - detected. If handler is set to DEF_HANDLER, a - default handler is used. This routine should be - declared as function returning an int. - - cleanup - a pointer to a cleanup routine to be executed - by the unexpected signal handler before tst_exit is - called. This parameter is set to NULL if no cleanup - routine is required. An external variable, T_cleanup - is set so that other user-defined handlers have - access to the cleanup routine. This routine should be - declared as returning type void. - -***************************************************************************/ - -#ifndef CRAY -#define _BSD_SIGNALS 1 /* Specify that we are using BSD signal interface */ -#endif - -#include -#include -#include -#include "test.h" - -#define MAXMESG 150 /* size of mesg string sent to tst_res */ - -void (*T_cleanup)(); /* pointer to cleanup function */ - -extern int errno; -static void def_handler(); /* default signal handler */ - -/**************************************************************************** - * tst_sig() : set-up to catch unexpected signals. fork_flag is set to NOFORK - * if SIGCLD is to be an "unexpected signal", otherwise it is set to - * FORK. cleanup points to a cleanup routine to be executed before - * tst_exit is called (cleanup is set to NULL if no cleanup is desired). - * handler is a pointer to the signal handling routine (if handler is - * set to NULL, a default handler is used). - ***************************************************************************/ - -void -tst_sig(int fork_flag, void (*handler)(), void (*cleanup)()) -{ - char mesg[MAXMESG]; /* message buffer for tst_res */ - int sig; - - /* - * save T_cleanup and handler function pointers - */ - T_cleanup = cleanup; /* used by default handler */ - - if (handler == DEF_HANDLER) { - /* use default handler */ - handler = def_handler; - } - - /* - * now loop through all signals and set the handlers - */ - - for (sig = 1; sig < NSIG; sig++) { - /* - * SIGKILL is never unexpected. - * SIGCLD is only unexpected when - * no forking is being done. - * SIGINFO is used for file quotas and should be expected - */ - - switch (sig) { - case SIGKILL: - case SIGSTOP: - case SIGCONT: -#ifdef CRAY - case SIGINFO: - case SIGRECOVERY: /* allow chkpnt/restart */ -#endif /* CRAY */ - -#ifdef SIGSWAP - case SIGSWAP: -#endif /* SIGSWAP */ - -#ifdef SIGCKPT - case SIGCKPT: -#endif -#ifdef SIGRESTART - case SIGRESTART: -#endif - /* - * pthread-private signals SIGPTINTR and SIGPTRESCHED. - * Setting a handler for these signals is disallowed when - * the binary is linked against libpthread. - */ -#ifdef SIGPTINTR - case SIGPTINTR: -#endif /* SIGPTINTR */ -#ifdef SIGPTRESCHED - case SIGPTRESCHED: -#endif /* SIGPTRESCHED */ -#ifdef __CYGWIN__ - case SIGILL: - case SIGTRAP: - case SIGABRT: - case SIGEMT: - case SIGFPE: - case SIGBUS: -#endif - break; - - case SIGCLD: - if ( fork_flag == FORK ) - continue; - - default: - if (signal(sig, handler) == SIG_ERR) { - (void) sprintf(mesg, - "signal() failed for signal %d. error:%d %s.", - sig, errno, strerror(errno)); - tst_resm(TWARN, mesg); - } - break; - } -#ifdef __sgi - /* On irix (07/96), signal() fails when signo is 33 or higher */ - if ( sig+1 >= 33 ) - break; -#endif /* __sgi */ - - } /* endfor */ -} - - - -/**************************************************************************** - * def_handler() : default signal handler that is invoked when - * an unexpected signal is caught. - ***************************************************************************/ - -static void -def_handler(int sig) -{ - char mesg[MAXMESG]; /* holds tst_res message */ - - /* first reset trap for this signal (except SIGCLD - its weird) */ - if ((sig != SIGCLD) && (sig != SIGSTOP) && (sig != SIGCONT)) { - if (signal(sig, def_handler) == SIG_ERR) { - (void) sprintf(mesg, - "def_handler: signal() failed for signal %d. error:%d %s.", - sig, errno, strerror(errno)); - tst_resm(TWARN, mesg); - } - } - - (void) sprintf(mesg, "Unexpected signal %d received.", sig); - - /* - * Break remaining test cases, do any cleanup, then exit - */ - tst_brkm(TBROK, 0, mesg); - - /* now cleanup and exit */ - if (T_cleanup) { - (*T_cleanup)(); - } - - tst_exit(); -} diff --git a/winsup/testsuite/libltp/lib/tst_tmpdir.c b/winsup/testsuite/libltp/lib/tst_tmpdir.c deleted file mode 100644 index cd9d9c8b8..000000000 --- a/winsup/testsuite/libltp/lib/tst_tmpdir.c +++ /dev/null @@ -1,347 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -/* $Id$ */ - -/********************************************************** - * - * OS Testing - Silicon Graphics, Inc. - * - * FUNCTION NAME : tst_tmpdir, tst_rmdir - * - * FUNCTION TITLE : Create/remove a testing temp dir - * - * SYNOPSIS: - * void tst_tmpdir(); - * void tst_rmdir(); - * - * AUTHOR : Dave Fenner - * - * INITIAL RELEASE : UNICOS 8.0 - * - * DESCRIPTION - * tst_tmpdir() is used to create a unique, temporary testing - * directory, and make it the current working directory. - * tst_rmdir() is used to remove the directory created by - * tst_tmpdir(). - * - * Setting the env variable "TDIRECTORY" will override the creation - * of a new temp dir. The directory specified by TDIRECTORY will - * be used as the temporary directory, and no removal will be done - * in tst_rmdir(). - * - * RETURN VALUE - * Neither tst_tmpdir() or tst_rmdir() has a return value. - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ -#include -#include /* for mkdir() */ -#include /* for mkdir() */ -#include "test.h" -#include "rmobj.h" - -/* - * Define some useful macros. - */ -#define PREFIX_SIZE 4 -#define STRING_SIZE 256 -#define DIR_MODE 0777 /* mode of tmp dir that will be created */ - -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - -/* - * Define function prototypes. - */ -static void tmpdir_cleanup(); - -/* - * Define global variables. - */ -extern char *TCID; /* defined/initialized in main() */ -extern int TST_TOTAL; /* defined/initialized in main() */ -extern char *TESTDIR; /* the directory created; defined in */ - /* tst_res.c */ - -/* - * tst_tmpdir() - Create a unique temporary directory and chdir() to it. - * It expects the caller to have defined/initialized the - * TCID/TST_TOTAL global variables. The TESTDIR global - * variable will be set to the directory that gets used - * as the testing directory. - * - * NOTE: This function must be called BEFORE any activity - * that would require CLEANUP. If tst_tmpdir() fails, it - * cleans up afer itself and calls tst_exit() (i.e. does - * not return). - */ -#undef FN_NAME -#define FN_NAME "tst_tmpdir()" - -void -tst_tmpdir() -{ - char prefix[PREFIX_SIZE]; /* first three characters from TCID */ - int no_cleanup = 0; /* !0 means TDIRECTORY env var was set */ - - /* - * If the TDIRECTORY env variable is not set, a temp dir will be - * created. - */ - if ( (TESTDIR = getenv(TDIRECTORY)) == NULL ) { - /* - * Create a unique name based on the first three characters of the - * TCID. The last byte in "prefix" is for the null. - */ - strncpy(prefix, TCID, PREFIX_SIZE - 1); - prefix[PREFIX_SIZE-1] = '\0'; - if ( (TESTDIR = tempnam(TEMPDIR, prefix)) == NULL ) - tst_brkm(TBROK, tmpdir_cleanup, "%s: tempnam(%s, %s) failed", - FN_NAME, TEMPDIR, prefix); - - /* - * Create the temporary directory. - */ - if ( mkdir(TESTDIR, DIR_MODE) == -1 ) - tst_brkm(TBROK, tmpdir_cleanup, - "%s: mkdir(%s, %#o) failed; errno = %d: %s", - FN_NAME, TESTDIR, DIR_MODE, errno, strerror(errno)); - - /* - * Change the group on this temporary directory to be that of the - * gid of the person running the tests. - */ - if ( chown(TESTDIR, -1, getgid()) == -1 ) - tst_brkm(TBROK, tmpdir_cleanup, - "chown(%s, -1, %d) failed; errno = %d: %s", - TESTDIR, getgid(), errno, strerror(errno)); - } else { - /* - * The TDIRECTORY env. variable is set, so no temp dir is created. - * Also, no clean up will be done via tst_rmdir(). - */ - no_cleanup++; -#if UNIT_TEST - printf("TDIRECTORY env var is set\n"); -#endif - } - -#if UNIT_TEST - printf("TESTDIR = %s\n", TESTDIR); -#endif - - /* - * Change to the temporary directory. If the chdir() fails, issue - * TBROK messages for all test cases, attempt to remove the - * directory (if it was created), and exit. If the removal also - * fails, also issue a TWARN message. - */ - if ( chdir(TESTDIR) == -1 ) { - tst_brkm(TBROK, NULL, "%s: chdir(%s) failed; errno = %d: %s", - FN_NAME, TESTDIR, errno, strerror(errno) ); - - /* Try to remove the directory */ - if ( !no_cleanup && rmdir(TESTDIR) == -1 ) - tst_resm(TWARN, "%s: rmdir(%s) failed; errno = %d: %s", - FN_NAME, TESTDIR, errno, strerror(errno) ); - - tmpdir_cleanup(); - } - -#if UNIT_TEST - printf("CWD is %s\n", getcwd((char *)NULL, PATH_MAX)); -#endif - - /* - * If we made through all this stuff, return. - */ - return; -} /* tst_tmpdir() */ - - -/* - * - * tst_rmdir() - Recursively remove the temporary directory created by - * tst_tmpdir(). This function is intended ONLY as a - * companion to tst_tmpdir(). If the TDIRECTORY - * environment variable is set, no cleanup will be - * attempted. - */ -#undef FN_NAME -#define FN_NAME "tst_rmdir()" - -void -tst_rmdir() -{ - char *errmsg; - char *tdirectory; - char current_dir[PATH_MAX]; /* current working directory */ - char parent_dir[PATH_MAX]; /* directory above TESTDIR */ - char *basename; /* basename of the TESTDIR */ - - /* - * If the TDIRECTORY env variable is set, this indicates that no - * temp dir was created by tst_tmpdir(). Thus no cleanup will be - * necessary. - */ - if ( (tdirectory = getenv(TDIRECTORY)) != NULL ) { -#if UNIT_TEST - printf("\"TDIRECORY\" env variable is set; no cleanup was performed\n"); -#endif - return; - } - - /* - * Check that TESTDIR is not NULL. - */ - if ( TESTDIR == NULL ) { - tst_resm(TWARN, "%s: TESTDIR was NULL; no removal attempted", - FN_NAME); - return; - } - - /* - * Check that the value of TESTDIR is not "*" or "/". These could - * have disastrous effects in a test run by root. - */ - if ( strcmp(TESTDIR, "/") == 0 ) { - tst_resm(TWARN, - "%s: Recursive remove of root directory not attempted", - FN_NAME); - return; - } - - if ( strchr(TESTDIR, '*') != NULL ) { - tst_resm(TWARN, "%s: Recursive remove of '*' not attempted", - FN_NAME); - return; - } - - /* - * Get the directory name of TESTDIR. If TESTDIR is a relative path, - * get full path. - */ - if ( TESTDIR[0] != '/' ) { - if ( getcwd(current_dir,PATH_MAX) == NULL ) - strcpy(parent_dir, TESTDIR); - else - sprintf(parent_dir, "%s/%s", current_dir, TESTDIR); - } else { - strcpy(parent_dir, TESTDIR); - } - if ( (basename = strrchr(parent_dir, '/')) != NULL ) { - *basename='\0'; /* terminate at end of parent_dir */ - } - - /* - * Change directory to parent_dir (The dir above TESTDIR). - */ - if ( chdir(parent_dir) != 0 ) - tst_resm(TWARN, - "%s: chdir(%s) failed; errno = %d: %s\nAttempting to remove temp dir anyway", - FN_NAME, parent_dir, errno, strerror(errno)); - - /* - * Attempt to remove the "TESTDIR" directory, using rmobj(). - */ - if ( rmobj(TESTDIR, &errmsg) == -1 ) - tst_resm(TWARN, "%s: rmobj(%s) failed: %s", - FN_NAME, TESTDIR, errmsg); - - return; -} /* tst_rmdir() */ - - -/* - * tmpdir_cleanup() - This function is used when tst_tmpdir() - * encounters an error, and must cleanup and exit. - * It prints a warning message via tst_resm(), and - * then calls tst_exit(). - */ -#undef FN_NAME -#define FN_NAME "tst_tmpdir()" - -static void -tmpdir_cleanup() -{ - /* - * Print a warning message and call tst_exit() to exit the test. - */ - tst_resm(TWARN, "%s: No user cleanup function called before exiting", - FN_NAME); - tst_exit(); -} /* tmpdir_cleanup() */ - - -#ifdef UNIT_TEST -/**************************************************************************** - * Unit test code: Takes input from stdin and can make the following - * calls: tst_tmpdir(), tst_rmdir(). - ****************************************************************************/ -int TST_TOTAL = 10; -char *TCID = "TESTTCID"; - -main() -{ - int option; - char *chrptr; - - printf("UNIT TEST of tst_tmpdir.c. Options to try:\n\ - -1 : call tst_exit()\n\ - 0 : call tst_tmpdir()\n\ - 1 : call tst_rmdir()\n\n"); - - while ( 1 ) { - printf("Enter options (-1, 0, 1): "); - (void) scanf("%d%c", &option, &chrptr); - - switch ( option ) { - case -1: - tst_exit(); - break; - - case 0: - tst_tmpdir(); - break; - - case 1: - tst_rmdir(); - break; - } /* switch() */ - } /* while() */ -} -#endif /* UNIT_TEST */ diff --git a/winsup/testsuite/libltp/lib/write_log.c b/winsup/testsuite/libltp/lib/write_log.c deleted file mode 100644 index 316dfe79b..000000000 --- a/winsup/testsuite/libltp/lib/write_log.c +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* - * This module contains code for logging writes to files, and for - * perusing the resultant logfile. The main intent of all this is - * to provide a 'write history' of a file which can be examined to - * judge the state of a file (ie. whether it is corrupted or not) based - * on the write activity. - * - * The main abstractions available to the user are the wlog_file, and - * the wlog_rec. A wlog_file is a handle encapsulating a write logfile. - * It is initialized with the wlog_open() function. This handle is - * then passed to the various wlog_xxx() functions to provide transparent - * access to the write logfile. - * - * The wlog_rec datatype is a structure which contains all the information - * about a file write. Examples include the file name, offset, length, - * pattern, etc. In addition there is a bit which is cleared/set based - * on whether or not the write has been confirmed as complete. This - * allows the write logfile to contain information on writes which have - * been initiated, but not yet completed (as in async io). - * - * There is also a function to scan a write logfile in reverse order. - * - * NOTE: For target file analysis based on a write logfile, the - * assumption is made that the file being written to is - * locked from simultaneous access, so that the order of - * write completion is predictable. This is an issue when - * more than 1 process is trying to write data to the same - * target file simultaneously. - * - * The history file created is a collection of variable length records - * described by scruct wlog_rec_disk in write_log.h. See that module for - * the layout of the data on disk. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "write_log.h" - -#ifndef BSIZE -#ifdef linux -#define BSIZE DEV_BSIZE -#else -#ifdef __CYGWIN__ -#define BSIZE S_BLKSIZE -#else -#define BSIZE BBSIZE -#endif -#endif -#endif - -#ifndef PATH_MAX -#define PATH_MAX 255 -/*#define PATH_MAX pathconf("/", _PC_PATH_MAX)*/ -#endif - -char Wlog_Error_String[256]; - -#if __STDC__ -static int wlog_rec_pack(struct wlog_rec *wrec, char *buf, int flag); -static int wlog_rec_unpack(struct wlog_rec *wrec, char *buf); -#else -static int wlog_rec_pack(); -static int wlog_rec_unpack(); -#endif - -/* - * Initialize a write logfile. wfile is a wlog_file structure that has - * the w_file field filled in. The rest of the information in the - * structure is initialized by the routine. - * - * The trunc flag is used to indicate whether or not the logfile should - * be truncated if it currently exists. If it is non-zero, the file will - * be truncated, otherwise it will be appended to. - * - * The mode argument is the [absolute] mode which the file will be - * given if it does not exist. This mode is not affected by your process - * umask. - */ - -int -wlog_open(wfile, trunc, mode) -struct wlog_file *wfile; -int trunc; -int mode; -{ - int omask, oflags; - - if (trunc) - trunc = O_TRUNC; - - omask = umask(0); - - /* - * Open 1 file descriptor as O_APPEND - */ - - oflags = O_WRONLY | O_APPEND | O_CREAT | trunc; - wfile->w_afd = - open(wfile->w_file, oflags, mode); - umask(omask); - - if (wfile->w_afd == -1) { - sprintf(Wlog_Error_String, - "Could not open write_log - open(%s, %#o, %#o) failed: %s\n", - wfile->w_file, oflags, mode, strerror(errno)); - return -1; - } - - /* - * Open the next fd as a random access descriptor - */ - - oflags = O_RDWR; - if ((wfile->w_rfd = open(wfile->w_file, oflags)) == -1) { - sprintf(Wlog_Error_String, - "Could not open write log - open(%s, %#o) failed: %s\n", - wfile->w_file, oflags, strerror(errno)); - close(wfile->w_afd); - wfile->w_afd = -1; - return -1; - } - - return 0; -} - -/* - * Release all resources associated with a wlog_file structure allocated - * with the wlog_open() call. - */ - -int -wlog_close(wfile) -struct wlog_file *wfile; -{ - close(wfile->w_afd); - close(wfile->w_rfd); - return 0; -} - -/* - * Write a wlog_rec structure to a write logfile. Offset is used to - * control where the record will be written. If offset is < 0, the - * record will be appended to the end of the logfile. Otherwise, the - * record which exists at the indicated offset will be overlayed. This - * is so that we can record writes which are outstanding (with the w_done - * bit in wrec cleared), but not completed, and then later update the - * logfile when the write request completes (as with async io). When - * offset is >= 0, only the fixed length portion of the record is - * rewritten. See text in write_log.h for details on the format of an - * on-disk record. - * - * The return value of the function is the byte offset in the logfile - * where the record begins. - * - * Note: It is the callers responsibility to make sure that the offset - * parameter 'points' to a valid record location when a record is to be - * overlayed. This is guarenteed by saving the return value of a previous - * call to wlog_record_write() which wrote the record to be overlayed. - * - * Note2: The on-disk version of the wlog_rec is MUCH different than - * the user version. Don't expect to od the logfile and see data formatted - * as it is in the wlog_rec structure. Considerable data packing takes - * place before the record is written. - */ - -int -wlog_record_write(wfile, wrec, offset) -struct wlog_file *wfile; -struct wlog_rec *wrec; -long offset; -{ - int reclen; - char wbuf[WLOG_REC_MAX_SIZE + 2]; - - /* - * If offset is -1, we append the record at the end of file - * - * Otherwise, we overlay wrec at the file offset indicated and assume - * that the caller passed us the correct offset. We do not record the - * fname in this case. - */ - - reclen = wlog_rec_pack(wrec, wbuf, (offset < 0)); - - if (offset < 0) { - /* - * Since we're writing a complete new record, we must also tack - * its length onto the end so that wlog_scan_backward() will work. - * Length is asumed to fit into 2 bytes. - */ - - wbuf[reclen] = reclen / 256; - wbuf[reclen+1] = reclen % 256; - reclen += 2; - - write(wfile->w_afd, wbuf, reclen); - offset = lseek(wfile->w_afd, 0, SEEK_CUR) - reclen; - } else { - lseek(wfile->w_rfd, offset, SEEK_SET); - write(wfile->w_rfd, wbuf, reclen); - } - - return offset; -} - -/* - * Function to scan a logfile in reverse order. Wfile is a valid - * wlog_file structure initialized by wlog_open(). nrecs is the number - * of records to scan (all records are scanned if nrecs is 0). func is - * a user-supplied function to call for each record found. The function - * will be passed a single parameter - a wlog_rec structure . - */ - -int -wlog_scan_backward(wfile, nrecs, func, data) -struct wlog_file *wfile; -int nrecs; -int (*func)(); -long data; -{ - int fd, leftover, nbytes, offset, recnum, reclen, rval; - char buf[BSIZE*32], *bufend, *cp, *bufstart; - char albuf[WLOG_REC_MAX_SIZE]; - struct wlog_rec wrec; - - fd = wfile->w_rfd; - - /* - * Move to EOF. offset will always hold the current file offset - */ - - lseek(fd, 0, SEEK_END); - offset = lseek(fd, 0, SEEK_CUR); - - bufend = buf + sizeof(buf); - bufstart = buf; - - recnum = 0; - leftover = 0; - while ((!nrecs || recnum < nrecs) && offset > 0) { - /* - * Check for beginning of file - if there aren't enough bytes - * remaining to fill buf, adjust bufstart. - */ - - if (offset + leftover < sizeof(buf)) { - bufstart = bufend - (offset + leftover); - offset = 0; - } else { - offset -= sizeof(buf) - leftover; - } - - /* - * Move to the proper file offset, and read into buf - */ - - lseek(fd, offset, SEEK_SET); - nbytes = read(fd, bufstart, bufend - bufstart - leftover); - - if (nbytes == -1) { - sprintf(Wlog_Error_String, - "Could not read history file at offset %d - read(%d, %#o, %d) failed: %s\n", - offset, fd, (int)bufstart, - bufend - bufstart - leftover, strerror(errno)); - return -1; - } - - cp = bufend; - leftover = 0; - - while (cp >= bufstart) { - - /* - * If cp-bufstart is not large enough to hold a piece - * of record length information, copy remainder to end - * of buf and continue reading the file. - */ - - if (cp - bufstart < 2) { - leftover = cp - bufstart; - memcpy(bufend - leftover, bufstart, leftover); - break; - } - - /* - * Extract the record length. We must do it this way - * instead of casting cp to an int because cp might - * not be word aligned. - */ - - reclen = (*(cp-2) * 256) + *(cp -1); - - /* - * If cp-bufstart isn't large enough to hold a - * complete record, plus the length information, copy - * the leftover bytes to the end of buf and continue - * reading. - */ - - if (cp - bufstart < reclen + 2) { - leftover = cp - bufstart; - memcpy(bufend - leftover, bufstart, leftover); - break; - } - - /* - * Adjust cp to point at the start of the record. - * Copy the record into wbuf so that it is word - * aligned and pass the record to the user supplied - * function. - */ - - cp -= reclen + 2; - memcpy(albuf, cp, reclen); - - wlog_rec_unpack(&wrec, albuf); - - /* - * Call the user supplied function - - * stop if instructed to. - */ - - if ((rval = (*func)(&wrec, data)) == WLOG_STOP_SCAN) { - break; - } - - recnum++; - - if (nrecs && recnum >= nrecs) - break; - } - } - - return 0; -} - -/* - * The following 2 routines are used to pack and unpack the user - * visible wlog_rec structure to/from a character buffer which is - * stored or read from the write logfile. Any changes to either of - * these routines must be reflected in the other. - */ - -static int -wlog_rec_pack(wrec, buf, flag) -struct wlog_rec *wrec; -char *buf; -int flag; -{ - char *file, *host, *pattern; - struct wlog_rec_disk *wrecd; - - wrecd = (struct wlog_rec_disk *)buf; - - wrecd->w_pid = (uint)wrec->w_pid; - wrecd->w_offset = (uint)wrec->w_offset; - wrecd->w_nbytes = (uint)wrec->w_nbytes; - wrecd->w_oflags = (uint)wrec->w_oflags; - wrecd->w_done = (uint)wrec->w_done; - wrecd->w_async = (uint)wrec->w_async; - - wrecd->w_pathlen = (wrec->w_pathlen > 0) ? (uint)wrec->w_pathlen : 0; - wrecd->w_hostlen = (wrec->w_hostlen > 0) ? (uint)wrec->w_hostlen : 0; - wrecd->w_patternlen = (wrec->w_patternlen > 0) ? (uint)wrec->w_patternlen : 0; - - /* - * If flag is true, we should also pack the variable length parts - * of the wlog_rec. By default, we only pack the fixed length - * parts. - */ - - if (flag) { - file = buf + sizeof(struct wlog_rec_disk); - host = file + wrecd->w_pathlen; - pattern = host + wrecd->w_hostlen; - - if (wrecd->w_pathlen > 0) - memcpy(file, wrec->w_path, wrecd->w_pathlen); - - if (wrecd->w_hostlen > 0) - memcpy(host, wrec->w_host, wrecd->w_hostlen); - - if (wrecd->w_patternlen > 0) - memcpy(pattern, wrec->w_pattern, wrecd->w_patternlen); - - return (sizeof(struct wlog_rec_disk) + - wrecd->w_pathlen + wrecd->w_hostlen + wrecd->w_patternlen); - } else { - return sizeof(struct wlog_rec_disk); - } -} - -static int -wlog_rec_unpack(wrec, buf) -struct wlog_rec *wrec; -char *buf; -{ - char *file, *host, *pattern; - struct wlog_rec_disk *wrecd; - - bzero((char *)wrec, sizeof(struct wlog_rec)); - wrecd = (struct wlog_rec_disk *)buf; - - wrec->w_pid = wrecd->w_pid; - wrec->w_offset = wrecd->w_offset; - wrec->w_nbytes = wrecd->w_nbytes; - wrec->w_oflags = wrecd->w_oflags; - wrec->w_hostlen = wrecd->w_hostlen; - wrec->w_pathlen = wrecd->w_pathlen; - wrec->w_patternlen = wrecd->w_patternlen; - wrec->w_done = wrecd->w_done; - wrec->w_async = wrecd->w_async; - - if (wrec->w_pathlen > 0) { - file = buf + sizeof(struct wlog_rec_disk); - memcpy(wrec->w_path, file, wrec->w_pathlen); - } - - if (wrec->w_hostlen > 0) { - host = buf + sizeof(struct wlog_rec_disk) + wrec->w_pathlen; - memcpy(wrec->w_host, host, wrec->w_hostlen); - } - - if (wrec->w_patternlen > 0) { - pattern = buf + sizeof(struct wlog_rec_disk) + - wrec->w_pathlen + wrec->w_hostlen; - memcpy(wrec->w_pattern, pattern, wrec->w_patternlen); - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/checksignal.c b/winsup/testsuite/winsup.api/checksignal.c deleted file mode 100644 index 47dc2f6a0..000000000 --- a/winsup/testsuite/winsup.api/checksignal.c +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID = "checksignal"; /* Test program identifier. */ -int TST_TOTAL = 3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -void -sig_handler (int signo) -{ - errno = EINVAL; -} - -int -main () -{ - int n, ret; - int fds[2]; - char buf[10]; - struct sigaction act; - int i; - - Tst_count = 0; - - /* Reset SA_RESTART flag. */ - while ((ret = sigaction (SIGALRM, NULL, &act)) == EINTR) - ; - if (ret) - tst_brk (TBROK, NULL, NULL, "Get signal action structure"); - act.sa_flags &= ~SA_RESTART; - while ((ret = sigaction (SIGALRM, &act, NULL)) == EINTR) - ; - if (ret) - tst_brk (TBROK, NULL, NULL, "Reset SA_RESTART"); - - for (i = 0; i < 2; i++) - { - if (pipe (fds) < 0) - tst_brk (TBROK, NULL, NULL, "Create pipe"); - /* Set signal handler using signal(2) call... */ - if (signal (SIGALRM, sig_handler) < 0) - tst_brk (TBROK, NULL, NULL, "Call signal() to install signal handler"); - /* ...and check if signal(2) sets SA_RESTART again. */ - while ((ret = sigaction (SIGALRM, NULL, &act)) == EINTR) - ; - if (ret) - tst_brk (TBROK, NULL, NULL, "Get signal action structure"); - tst_resm (act.sa_flags & SA_RESTART ? TPASS : TFAIL, - "signal() sets SA_RESTART"); - - const char *msg1, *msg2; - if (i == 1) - { - siginterrupt (SIGALRM, 1); - msg1 = "Reset SA_RESTART via siginterrupt"; - msg2 = "Set EINTR on interrupted read() call via siginterrupt"; - } - else - { - /* Reset SA_RESTART flag again. */ - act.sa_handler = sig_handler; - act.sa_flags &= ~SA_RESTART; - while ((ret = sigaction (SIGALRM, &act, NULL)) == EINTR) - ; - msg1 = "Reset SA_RESTART via sigaction"; - msg2 = "Set EINTR on interrupted read() call via sigaction"; - } - if (ret) - tst_brk (TBROK, NULL, NULL, msg1); - - /* Start timer to force a SIGALRM. */ - alarm (1); - - /* Call read(2) to check if the EINTR errno is correctly preserved, - even if the signal handler routine changes errno. */ - n = read(fds[0], buf, 10); - tst_resm (n < 0 && errno == EINTR ? TPASS : TFAIL, msg2); - close (fds[0]); - close (fds[1]); - } - - /* Check if another errno is correctly returned (here EBADF). */ - n = read(fds[0], buf, 10); - tst_resm (n < 0 && errno == EBADF ? TPASS : TFAIL, - "Set EBADF on closed file descriptor"); - - tst_exit (); -} diff --git a/winsup/testsuite/winsup.api/crlf.c b/winsup/testsuite/winsup.api/crlf.c deleted file mode 100644 index ea79122f0..000000000 --- a/winsup/testsuite/winsup.api/crlf.c +++ /dev/null @@ -1,527 +0,0 @@ -typedef enum { - Nop=100000, /* ; do nothing */ - New1, /* ; reset and begin new test */ - Open, /* ; open test file */ - Read, /* [askfor] [get] ; read bytes into buffer */ - Write, /* [expect] [bytestream] ; write to file (expect 0 = ignore)*/ - Compare, /* [bytestream] ; compare buffer to given bytes */ - Verify, /* [bytestream] ; compare file to given bytes */ - Seek, /* [offset] [whence] ; seek in file */ - Tell, /* [offset] ; compare file positions */ - BufSize, /* [size] ; change the stdio buffer size */ - Flush, /* ; flush the stdio stream */ - Text, /* ; switch file to text mode */ - Binary, /* ; switch file to binary mode */ - Rep, /* [count] ; repeat 'R' bytes (used in bytestream) */ - Fill, /* [posn] ; fill 'F' until given byte position */ - Start, /* ; for Seek */ - Current, /* ; for Seek */ - End, /* ; for Seek, or end of byte stream */ - Max } Opcode; - -#define New New1,__LINE__ - -/* Byte streams are just inserted into the command stream, and must - end in an End code. */ - -int commands[] = { -#ifndef __DJGPP__ - New, - Write, 1605, Rep, 1600, 'h', 'e', 'l', 'l', 'o', End, - Tell, 1605, - - Open, - BufSize, 16, - Read, 1605, 1605, - Compare, Rep, 1600, 'h', 'e', 'l', 'l', 'o', End, - Tell, 1605, - Flush, - Tell, 1605, - Seek, 1000, Start, - Tell, 1000, - - New, - Text, - Write, 2, 'x', 10, End, - Verify, 'x', 13, 10, End, - - New, - Binary, - Write, 2, 'x', 10, End, - Verify, 'x', 10, End, - - BufSize, 16, - - New, - Binary, - Write, 0, Fill, 15, 13, 10, 'x', End, - Text, Open, - Read, 17, 17, - Compare, Fill, 15, 10, 'x', End, - Tell, 18, - - New, - Binary, - Write, 0, Fill, 14, 13, 10, 'x', End, - Text, Open, - Read, 16, 16, - Compare, Fill, 14, 10, 'x', End, - Tell, 17, - - New, - Binary, - Write, 0, 13, 10, 'a', 'b', End, - Text, Open, - Read, 2, 2, - Compare, 10, 'a', End, - Tell, 3, - - New, - Binary, - Write, 0, 10, 'a', 'b', End, - Text, Open, - Read, 2, 2, - Compare, 10, 'a', End, - Tell, 2, - - New, - Binary, - Write, 0, 13, 'a', 'b', End, - Text, Open, - Read, 2, 2, - Compare, 13, 'a', End, - Tell, 2, - - New, - Binary, - Write, 0, 13, 13, 10, 'a', End, - Text, Open, - Read, 2, 2, - Compare, 13, 10, End, - Tell, 3, - - New, - Binary, - Write, 0, 13, 10, 'a', 13, End, - Text, Open, - Read, 2, 2, - Compare, 10, 'a', End, - Tell, 3, - - New, - Binary, - Write, 0, 13, 10, 'a', 10, End, - Text, Open, - Read, 2, 2, - Compare, 10, 'a', End, - Tell, 3, - - New, - Binary, - Write, 0, 13, 13, 13, 10, 'a', 10, 10, 10, End, - Text, Open, - Read, 4, 4, - Compare, 13, 13, 10, 'a', End, - Tell, 5, -#endif - - New, - Binary, - Write, 0, 13, 13, 13, 10, 'a', 'b', 13, 10, 13, 10, End, - Text, Open, - Read, 4, 4, - Compare, 13, 13, 10, 'a', End, - Tell, 5, - - }; - -/*==========================================================================*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef O_BINARY -#define O_BINARY 0 -#endif -#ifndef O_TEXT -#define O_TEXT 0 -#endif - -int errors = 0; - -#define num_commands (int)(sizeof(commands)/sizeof(commands[0])) - -int pc; -int askfor, get, expect, count, posn, whence, size; - -typedef struct { - unsigned char *bytes; - int max, count; -} Buffer; - -Buffer rw_buf={0,0,0}, cmp_buf={0,0,0}, vfy_buf={0,0,0}; - -void -expand_buf(Buffer *buf, int len) -{ - if (buf->max < len) - { - buf->max = len+20; - if (buf->bytes) - buf->bytes = (unsigned char *)realloc(buf->bytes, buf->max); - else - buf->bytes = (unsigned char *)malloc(buf->max); - } -} - -void -get_bytestream(Buffer *buf) -{ - int tpc; - int len = 0, rep, byte; - unsigned char *bp; - - for (tpc = pc+1; tpc < num_commands && commands[tpc] != End; tpc++) - { - switch (commands[tpc]) - { - case Rep: - len += commands[tpc+1]; - tpc ++; - break; - case Fill: - if (len < commands[tpc+1]) - len = commands[tpc+1]; - tpc ++; - break; - default: - len ++; - break; - } - } - - expand_buf(buf, len); - - len = 0; - bp = buf->bytes; - - for (tpc = pc+1; tpc < num_commands && commands[tpc] != End; tpc++) - { - switch (commands[tpc]) - { - case Rep: - rep = commands[++tpc]; - byte = 'R'; - while (rep--) *bp++ = byte; - break; - case Fill: - rep = commands[++tpc]; - byte = 'F'; - while (bp-buf->bytes < rep) *bp++ = byte; - break; - default: - *bp++ = commands[tpc]; - break; - } - } - buf->count = bp - buf->bytes; - pc = tpc; -} - -char dataname[] = "crlf.dat"; - -int verbose=0; -void -v(char *fmt, ...) -{ - va_list ap; - if (!verbose) return; - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); - va_end(ap); - printf("\n"); -} - -void -vp(const char *fmt, ...) -{ - va_list ap; - if (!verbose) return; - printf("%08x: ", pc); - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); - va_end(ap); - printf("\n"); -} - -void -errorq(int use_errno, const char *fmt, ...) -{ - va_list ap; - fprintf(stderr, "crlf: Error at pc=%d: ", pc); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "\n"); - if (use_errno) - perror("The error was"); - errors++; -} - -void -error(int use_errno, const char *fmt, ...) -{ - va_list ap; - fprintf(stderr, "crlf: Error at pc=%d: ", pc); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "\n"); - if (use_errno) - perror("The error was"); - fprintf(stderr, "FAIL\n"); - exit(1); -} - -void -display_buf(const char *which, Buffer *buf, int ofs) -{ - int i; - fprintf(stderr, "%s %04x:", which, ofs); - for (i=0; i<8; i++) - if (i+ofs < buf->count) - { - unsigned char b = buf->bytes[i+ofs]; - fprintf(stderr, " %02x", b); - if (isgraph(b)) - fprintf(stderr, " %c ", b); - else - fprintf(stderr, " . "/*, b*/); - } - fprintf(stderr, "\n"); -} - -void -compare_bufs(const char *name, Buffer *actual, Buffer *expected) -{ - int i, got_one=0; - for (i=0; icount && icount; i++) - if (actual->bytes[i] != expected->bytes[i]) - { - errorq(0, "%s: byte mismatch at offset 0x%x", name, i); - got_one = 1; - break; - } - if (!got_one) - { - if (actual->count < expected->count) - errorq(0, "%s: too few bytes (0x%x vs 0x%x)", name, - actual->count, expected->count); - else if (actual->count > expected->count) - errorq(0, "%s: too many bytes (0x%x vs 0x%x)", name, - actual->count, expected->count); - else - return; - } - - i -= 4; - if (i<0) i = 0; - display_buf("Actual ", actual, i); - display_buf("Expected", expected, i); -} - -int -main(int argc, char **argv) -{ - const char *readmode = "rb"; - const char *writemode = "wb"; - FILE *file = 0; - int i; - struct stat st; - const char *str = ""; - - while (argc > 1 && argv[1][0] == '-') - { - if (strcmp(argv[1], "-v") == 0) - verbose++; - argc--; - argv++; - } - - size = 0; - - for (pc=0; pc - - This software is a copyrighted work licensed under the terms of the - Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. - - Note that dynamically linking to cygwin1.dll automatically places your code - under the GPL unless you purchase a Cygwin Contract with Red Hat, Inc. - See http://www.redhat.com/software/cygwin/ for more information. - - cygload demonstrates how to dynamically load cygwin1.dll. The default - build uses MinGW to compile it; the Makefile also shows how to build - it using the Microsoft compiler. - - By default, the program will silently test basic functionality: - * Making space on the stack for cygtls - * Loading and initializing cygwin1.dll - * Path translation - * Error handling - * Signal handling - - Options for this program: - -v Verbose output. Normal operation is entirely silent, - save for errors. - -testinterrupts Pauses the program for 30 seconds so you can demonstrate - that it handles ^C properly. - -cygwin Name of DLL to load. Defaults to "cygwin1.dll". */ - -#include "cygload.h" -#include -#include -#include -#include // for ENOENT -#include -#include - -using std::cout; -using std::cerr; -using std::endl; -using std::string; - -cygwin::padding *cygwin::padding::_main = NULL; -DWORD cygwin::padding::_mainTID = 0; - -// A few cygwin constants. -static const int SIGHUP = 1; -static const int SIGINT = 2; -static const int SIGTERM = 15; // Cygwin won't deliver this one to us; - // expect unadorned "kill" to just kill - // your process. -static const int SIGSTOP = 17; // Cygwin insists on delivering SIGSTOP to - // the main thread. If your main thread - // is not interruptible, you'll miss the - // signal and ignore the request to suspend. -static const int SIGTSTP = 18; // ^Z on a tty. -static const int SIGCONT = 19; // Resume a stopped process. -static const int SIGUSR1 = 30; -static const int SIGUSR2 = 31; - -// Using *out instead of cout. In verbose mode, out == &cout. -static std::ostream *out = NULL; - -cygwin::padding::padding () -{ - _main = this; - _mainTID = GetCurrentThreadId (); - - _end = _padding + sizeof (_padding); - char *stackbase; -#ifdef __GNUC__ - __asm__ ( - "movl %%fs:4, %0" - :"=r"(stackbase) - ); -#else - __asm - { - mov eax, fs:[4]; - mov stackbase, eax; - } -#endif - _stackbase = stackbase; - - // We've gotten as close as we can to the top of the stack. Even - // subverting the entry point, though, still doesn't get us there-- I'm - // getting 64 bytes in use before the entry point. So we back up the data - // there and restore it when the destructor is called: - if ((_stackbase - _end) != 0) - { - size_t delta = (_stackbase - _end); - - _backup.resize (delta); - - memcpy (&(_backup[0]), _end, delta); - } -} - -cygwin::padding::~padding () -{ - _main = NULL; - - if (_backup.size ()) - { - memcpy (_end, &(_backup[0]), _backup.size ()); - } -} - -void -cygwin::padding::check () -{ - if (_main == NULL) - throw std::runtime_error ("No padding declared!"); - if (_mainTID != GetCurrentThreadId ()) - throw std::runtime_error ("You need to initialize cygwin::connector " - "in the same thread in which you declared the " - "padding."); - - if (_main->_backup.size ()) - *out << "Warning! Stack base is " - << static_cast(_main->_stackbase) - << ". padding ends at " << static_cast(_main->_end) - << ". Delta is " << (_main->_stackbase - _main->_end) - << ". Stack variables could be overwritten!" << endl; -} - -cygwin::connector::connector (const char *dll) -{ - // This will throw if padding is not in place. - padding::check (); - - *out << "Loading " << dll << "..." << endl; - - // This should call init.cc:dll_entry() with DLL_PROCESS_ATTACH, - // which calls dll_crt0_0(). - if ((_library = LoadLibrary (dll)) == NULL) - throw windows_error ("LoadLibrary", dll); - - *out << "Initializing cygwin..." << endl; - - // This calls dcrt0.cc:cygwin_dll_init(), which calls dll_crt0_1(), - // which will, among other things: - // * spawn the cygwin signal handling thread from sigproc_init() - // * initialize the thread-local storage for this thread and overwrite - // the first 4K of the stack - void (*cyginit) (); - get_symbol ("cygwin_dll_init", cyginit); - (*cyginit) (); - - *out << "Loading symbols..." << endl; - - // Pick up the function pointers for the basic infrastructure. - get_symbol ("__errno", _errno); - get_symbol ("strerror", _strerror); - get_symbol ("cygwin_conv_to_full_posix_path", _conv_to_full_posix_path); - get_symbol ("cygwin_conv_to_full_win32_path", _conv_to_full_win32_path); - - // Note that you need to be running an interruptible cygwin function if - // you want to receive signals. You can use the standard signal() - // mechanism if you're willing to have your main thread spend all its time - // in interruptible cygwin functions like sleep(). Christopher Faylor - // cautions that this solution "could be slightly racy": if a second - // signal comes in before the first one is done processing, the thread - // won't be back in sigwait() to catch it. - *out << "Spawning signal handling thread..." << endl; - - _waiting_for_signals = true; - _signal_thread_done = false; - InitializeCriticalSection (&_thread_mutex); - - DWORD tid; - - _signal_thread = CreateThread (NULL, // Default security. - 32768, // Adjust the stack size as - // appropriate for what your signal - // handler needs in order to run, and - // then add 4K for cygtls. - &signal_thread, // Function to call - this, // Context - 0, // Flags - &tid); // Thread ID - - if (_signal_thread == NULL) - throw windows_error ("CreateThread", "signal_thread"); -} - -cygwin::connector::~connector () -{ - try - { - // First, shut down signal handling. - int (*raze) (int); - int (*pthread_join) (void *, void **); - - get_symbol ("raise", raze); - get_symbol ("pthread_join", pthread_join); - - // Tell the listener to shut down... - _waiting_for_signals = false; - int err = 0; - EnterCriticalSection (&_thread_mutex); - if (!_signal_thread_done) - err = raze (SIGUSR2); - LeaveCriticalSection (&_thread_mutex); - if (err) - cerr << error (this, "raise", "SIGUSR2").what () << endl; - // ...and get the thread to join. - if (!CloseHandle (_signal_thread)) - throw windows_error ("CloseHandle", "signal_thread"); - - // This should call init.cc:dll_entry() with DLL_PROCESS_DETACH. - if (!FreeLibrary (_library)) - throw windows_error ("FreeLibrary", "cygwin1.dll"); - } - catch (std::exception &x) - { - cerr << x.what () << endl; - } -} - -DWORD WINAPI -cygwin::connector::signal_thread (void *param) -{ - connector *that = reinterpret_cast < connector * > (param); - - try - { - that->await_signal (); - } - catch (std::exception &x) - { - cerr << "signal_thread caught " << x.what () << endl; - return 0; - } - return 0; -} - -void -cygwin::connector::await_signal () -{ - // Wait for signals. - unsigned long sigset[32]; - int sig; - int (*empty) (void *); - int (*add) (void *, int); - int (*wait) (void *, int *); - - get_symbol ("sigemptyset", empty); - get_symbol ("sigaddset", add); - get_symbol ("sigwait", wait); - - empty (sigset); - add (sigset, SIGHUP); - add (sigset, SIGINT); -// add (sigset, SIGSTOP); -// add (sigset, SIGTSTP); // I can't get this to suspend properly, so - // I'll leave it up to chance that the main - // thread is interruptible. - add (sigset, SIGUSR1); - add (sigset, SIGUSR2); - - while (_waiting_for_signals) - { - int err = wait (sigset, &sig); - if (err) - cerr << error (this, "sigwait").what () << endl; - else - *out << "Received signal " << sig << "." << endl; - switch (sig) - { - case SIGUSR2: - if (!_waiting_for_signals) - { - // SIGUSR2 is how ~connector wakes this thread - goto done; - } - break; - default: - break; - } - handle_signals (sig); - } -done: - EnterCriticalSection (&_thread_mutex); - _signal_thread_done = true; - LeaveCriticalSection (&_thread_mutex); - - *out << "await_signal done." << endl; -} - -cygwin::connector::signal_handler * -cygwin::connector::set_handler (int signal, signal_handler *handler) -{ - signal_handler *retval = _signal_handlers[signal]; - - if (handler == NULL) - _signal_handlers.erase (signal); - else - _signal_handlers[signal] = handler; - - return retval; -} - -void -cygwin::connector::handle_signals (int sig) -{ - callback_list::iterator h = _signal_handlers.find (sig); - - if (h != _signal_handlers.end ()) - { - try - { - signal_handler *handler = h->second; - (*handler) (sig); - return; - } - catch (std::exception &x) - { - cerr << "cygwin::connector::handle_signals caught " - << x.what () << "!" << endl; - return; - } - } - - cerr << "No handler for signal " << sig << "!" << endl; -} - -int -cygwin::connector::err_no () const -{ - int *e = (*_errno) (); - if (e == NULL) - { - return -1; - } - return *e; -} - -string -cygwin::connector::str_error (int err_no) const -{ - string retval; - - const char *s = (*_strerror) (err_no); - if (s != NULL) - { - retval = s; - } - else - { - std::ostringstream o; - o << "Unexpected errno " << err_no; - retval = o.str (); - } - - return retval; -} - -string -cygwin::connector::unix_path (const string &windows) const -{ - char buf[MAX_PATH]; - - _conv_to_full_posix_path (windows.c_str (), buf); - - return string (buf); -} - -string -cygwin::connector::win_path (const string &unix) const -{ - char buf[MAX_PATH]; - - _conv_to_full_win32_path (unix.c_str (), buf); - - return string (buf); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -string -cygwin::error::format (cygwin::connector *c, - int err_no, const char *message, const char *detail) -{ - std::ostringstream ret; - - ret << message; - if (detail) - { - ret << "(" << detail << ")"; - } - ret << ": " << c->str_error (err_no); - - return ret.str (); -} - -string -windows_error::format (DWORD error, const char *message, const char *detail) -{ - std::ostringstream ret; - char buf[512]; - DWORD bytes; - - ret << message; - if (detail) - ret << "(" << detail << ")"; - ret << ": "; - - bytes = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, 0, error, - MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), - buf, sizeof (buf), 0); - - if (bytes == 0) - ret << "Unexpected Windows error " << error; - else - { - // Remove trailing whitespace - char *p = buf + bytes - 1; - while (isspace (*p)) - *p-- = '\0'; - ret << buf << " (" << error << ")"; - } - - return ret.str (); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -extern "C" int mainCRTStartup (); - -// This just pushes 4K onto the stack, backs up the original stack, and -// jumps into the regular startup code. This avoids having to worry about -// backing up argc and argv. -extern "C" int __stdcall -cygloadCRTStartup () -{ - cygwin::padding padding; - return mainCRTStartup (); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -static void -hangup (int sig) -{ - cout << "Hangup (" << sig << ")." << endl; -} - -static void -interrupt (int sig) -{ - cerr << "Interrupt (" << sig << ")!" << endl; - exit (0); -} - -static int caught = false; - -static void -catch_signal (int) -{ - *out << "Signals are working." << endl; - caught = true; -} - -int -main (int argc, char *argv[]) -{ - // If you do not want to use cygloadCRTStartup() as an entry point, - // uncomment this line, but be sure to have *everything* you want - // from the stack below it backed up before you call the - // constructor for cygwin::connector. - //cygwin::padding padding; - - std::ostringstream output; - bool verbose = false, testinterrupts = false; - const char *dll = "cygwin1.dll"; - - out = &output; - - for (int i = 1; i < argc; ++i) - { - string arg = string (argv[i]); - - if (arg == "-v") - { - verbose = true; - out = &cout; - } - else if (arg == "-testinterrupts") - testinterrupts = true; - else if (arg == "-cygwin") - { - if (i+1 >= argc) - { - cerr << "Need to supply an argument with -cygwin." << endl; - return 255; - } - dll = argv[++i]; - } - } - - - try - { - *out << "Connecting to cygwin..." << endl; - cygwin::connector cygwin (dll); - *out << "Successfully connected." << endl; - - string result = cygwin.str_error (ENOENT); - - if (result != "No such file or directory") - { - cerr << "strerror(ENOENT) returned \"" - << result - << "\" instead of \"No such file or directory\"!" - << endl; - return 1; - } - else if (verbose) - { - *out << "strerror(ENOENT) = " << result << endl; - } - - // Path conversion: from cygwin to Windows... - result = cygwin.win_path ("/usr"); - struct _stat statbuf; - if (::_stat (result.c_str (), &statbuf) < 0) - { - cerr << "stat(\"" << result << "\") failed!" << endl; - return 2; - } - else if (verbose) - { - *out << "/usr == " << result << endl; - } - - // ...and back: - char buf[MAX_PATH], scratch[256]; - GetSystemDirectory (buf, sizeof(buf)); - int (*cygstat) (const char *, void *); - cygwin.get_symbol ("stat", cygstat); - - if (cygstat (buf, scratch) < 0) - { - cerr << "cygwin stat(\"" << buf << "\") failed!" << endl; - return 3; - } - else if (verbose) - { - *out << buf << " == " << cygwin.unix_path(buf) << endl; - } - - // Test error handling. This should output - // "open(/potrzebie/furshlugginer): No such file or directory" - { - int (*cygopen) (const char *, int); - cygwin.get_symbol ("open", cygopen); - - if (cygopen ("/potrzebie/furshlugginer", 0 /* O_RDONLY */ ) < 0) - { - int err = cygwin.err_no (); - if (err != ENOENT) - { - cerr << "cygwin open(\"/potrzebie/furshlugginer\", " - "O_RDONLY): expected to fail with ENOENT, got " - << err << "!" << endl; - return 4; - } - if (verbose) - *out << cygwin::error (&cygwin, "open", - "/potrzebie/furshlugginer").what () - << endl; - } - else - { - cerr << "/potrzebie/furshlugginer should not exist!" - << endl; - return 5; - } - } - - // And signal handling: - std::pointer_to_unary_function < int , void > h1 (&hangup); - std::pointer_to_unary_function < int , void > h2 (&interrupt); - std::pointer_to_unary_function < int , void > h3 (&catch_signal); - cygwin.set_handler (SIGHUP, &h1); - cygwin.set_handler (SIGINT, &h2); - cygwin.set_handler (SIGUSR1, &h3); - - // Make sure the signal handler thread has had time to start... - Sleep (100); - // Send a test signal to set "caught" to true... - int (*raze) (int); - cygwin.get_symbol ("raise", raze); - raze (SIGUSR1); - // And give the thread time to wait for the shutdown signal. - Sleep (100); - - if (testinterrupts) - { - // This is a worst case scenario for testing interrupts: the - // main thread is in a long-duration Windows API call. This - // makes the main thread uninterruptible; cygwin will retry - // 20 times, with a low_priority_sleep(0) between each try. - cout << "Sleeping for 30 seconds, waiting for a signal..." << endl; - Sleep (30000); - cout << "Done waiting." << endl; - } - } - catch (std::exception &x) - { - cerr << x.what () << endl; - return 2; - } - - if (caught) - return 0; - else - { - cerr << "Never received SIGUSR1." << endl; - return 1; - } -} diff --git a/winsup/testsuite/winsup.api/cygload.exp b/winsup/testsuite/winsup.api/cygload.exp deleted file mode 100644 index a07a549f9..000000000 --- a/winsup/testsuite/winsup.api/cygload.exp +++ /dev/null @@ -1,40 +0,0 @@ -source "site.exp" - -if { ! [isnative] } { - verbose "skipping cygload because it's not native \"$target_triplet\" != \"$build_triplet\"" - return -} - -proc ws_spawn {cmd args} { - global rv - verbose "running $cmd\n" - set rv {} - # First item in rv is the return code, second item is the message - lappend rv [catch "exec $cmd" message] $message - verbose send "catchCode = $rv\n" -} - -ws_spawn "gcc -mno-cygwin $srcdir/$subdir/cygload.cc -o mingw-cygload.exe -lstdc++ -Wl,-e,_cygloadCRTStartup@0" - -if { $rv != {0 {}} } { - verbose -log "$rv" - fail "cygload (compile)" -} else { - if { $verbose } { - set redirect_output "./mingw-cygwin.log" - } else { - set redirect_output /dev/null - } - set windows_runtime_root [exec cygpath -m $runtime_root] - ws_spawn "./mingw-cygload.exe -cygwin $windows_runtime_root/cygwin0.dll > $redirect_output" - if { $rv != {0 {}} } { - verbose -log "cygload: $rv" - fail "cygload (execute)" - } else { - pass "cygload" - } - catch { file delete "mingw-cygload.exe" } err - if { $err != "" } { - note "error deleting mingw-cygload.exe: $err" - } -} diff --git a/winsup/testsuite/winsup.api/cygload.h b/winsup/testsuite/winsup.api/cygload.h deleted file mode 100644 index c7c562093..000000000 --- a/winsup/testsuite/winsup.api/cygload.h +++ /dev/null @@ -1,158 +0,0 @@ -// cygload.h -*- C++ -*- -// -// Copyright 2005, Red Hat, Inc. -// -// Written by Max Kaehn -// -// This software is a copyrighted work licensed under the terms of the -// Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. -// -// Note that dynamically linking to cygwin1.dll automatically places your code -// under the GPL unless you purchase a Cygwin Contract with Red Hat, Inc. -// See http://www.redhat.com/software/cygwin/ for more information. - -// This program has large numbers of progress messages so as to provide -// maximum information about crash locations for anyone without access to -// a Microsoft debugger. - - -// This file contains the basic infrastructure for connecting an MSVC -// process to Cygwin. - -#ifndef __CYGLOAD_H__ -#define __CYGLOAD_H__ - -#include // for GetProcAddress() -#include // for pointer_to_unary_function -#include // for runtime_error -#include -#include -#include - -// Convert GetLastError() to a human-readable STL exception. -class windows_error : public std::runtime_error -{ -public: - windows_error (const char *message, const char *detail = NULL) - : runtime_error (format (GetLastError (), message, detail)) { } - windows_error(DWORD error, const char *message, const char *detail = NULL) - : runtime_error (format (error, message, detail)) { } - - static std::string format (DWORD error, const char *message, - const char *detail); -}; - -namespace cygwin -{ - - // Cygwin keeps important thread-local information at the top of the - // stack. Its DllMain-equivalent will do the right thing for any threads - // you spawn, but you need to declare one of these as the very first thing - // in your main() function so horrible things won't happen when cygwin - // overwrites your stack. This will back up the data that will be - // overwritten and restore it when the destructor is called. - class padding { - public: - padding (); - ~padding (); - - // Verifies that padding has been declared. - static void check (); - - private: - std::vector< char > _backup; - char *_stackbase, *_end; - - // gdb reports sizeof(_cygtls) == 3964 at the time of this writing. - // This is at the end of the object so it'll be toward the bottom - // of the stack when it gets declared. - char _padding[32768]; - - static padding *_main; - static DWORD _mainTID; - }; - - // This hooks your application up to cygwin: it loads cygwin1.dll, - // initializes it properly, grabs some important symbols, and - // spawns a thread to let you receive signals from cygwin. - class connector { - public: - connector (const char *dll = "cygwin1.dll"); - ~connector (); - - // A wrapper around GetProcAddress() for fetching symbols from the - // cygwin DLL. Can throw windows_error. - template < class T > void get_symbol (const char *name, T &fn) const; - - // Wrappers for errno() and strerror(). - int err_no () const; - std::string str_error (int) const; - - // Converting between the worlds of Windows and Cygwin. - std::string unix_path (const std::string &windows) const; - std::string win_path (const std::string &unix) const; - - private: - HMODULE _library; - - int *(*_errno) (); - const char *(*_strerror) (int); - void (*_conv_to_full_posix_path) (const char *, char *); - void (*_conv_to_full_win32_path) (const char *, char *); - - public: - // The constructor will automatically hook you up for receiving - // cygwin signals. Just specify a signal and pass in a signal_handler. - typedef std::pointer_to_unary_function signal_handler; - signal_handler *set_handler (int signal, signal_handler *); - - private: - // Cygwin signals can only be received in threads that are calling - // interruptible functions or otherwise ready to intercept signals, so - // we spawn a thread that does nothing but call sigwait(). - - // This is the entry point: - static DWORD WINAPI signal_thread (void *); - // It runs this: - void await_signal (); - // And will execute this on receipt of any signal for which it's - // registered: - void handle_signals (int); - - HANDLE _signal_thread; - bool _waiting_for_signals, _signal_thread_done; - CRITICAL_SECTION _thread_mutex; - - typedef std::map< int, signal_handler * > callback_list; - callback_list _signal_handlers; - }; - - template void connector::get_symbol (const char *name, - T &symbol) const - { - FARPROC retval = NULL; - - retval = GetProcAddress (_library, name); - - if (retval == NULL) - throw windows_error ("GetProcAddress", name); - - symbol = reinterpret_cast < T > (retval); - } - - // cygwin::error converts errno to a human-readable exception. - class error : public std::runtime_error - { - public: - error (connector *c, const char *function, const char *detail = NULL) - : runtime_error (format (c, c->err_no (), function, detail)) { } - error (connector *c, int err_no, const char *function, - const char *detail = NULL) - : runtime_error (format (c, err_no, function, detail)) { } - - static std::string format(connector *c, int err_no, - const char *message, const char *detail); - }; -} - -#endif // __CYGLOAD_H__ diff --git a/winsup/testsuite/winsup.api/devdsp.c b/winsup/testsuite/winsup.api/devdsp.c deleted file mode 100644 index d5ed65365..000000000 --- a/winsup/testsuite/winsup.api/devdsp.c +++ /dev/null @@ -1,783 +0,0 @@ -/* devdsp.c: Device tests for /dev/dsp - - Copyright 2004 Red Hat, Inc - - Written by Gerd Spalink (Gerd.Spalink@t-online.de) - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -/* Conventions used here: - We use the libltp framework - 1. Any unexpected behaviour leads to an exit with nonzero exit status - 2. Unexpected behaviour from /dev/dsp results in an exit status of TFAIL - 3. Unexpected behaviour from OS (malloc, fork, waitpid...) result - in an exit status of TBROK */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "test.h" /* use libltp framework */ - -/* Controls if a child can open the device after the parent */ -#define CHILD_EXPECT 0 /* 0 or 1 */ - -static const char wavfile_okay[] = - { -#include "devdsp_okay.h" /* a sound sample */ - }; - -/* Globals required by libltp */ -const char *TCID = "devdsp"; /* set test case identifier */ -int TST_TOTAL = 37; - -/* Prototypes */ -void sinegen (void *wave, int rate, int bits, int len, int stride); -void sinegenw (int freq, int samprate, short *value, int len, int stride); -void sinegenb (int freq, int samprate, unsigned char *value, int len, - int stride); -void playtest (int fd, int rate, int stereo, int bits); -void rectest (int fd, int rate, int stereo, int bits); -void rwtest (int fd, int rate, int stereo, int bits); -void setpars (int fd, int rate, int stereo, int bits); -void forkplaytest (void); -void forkrectest (void); -void recordingtest (void); -void playbacktest (void); -void monitortest (void); -void ioctltest (void); -void abortplaytest (void); -void playwavtest (void); -void syncwithchild (pid_t pid, int expected_exit_status); -void cleanup (void); -void dup_test (void); - -static int expect_child_failure = 0; - -/* Sampling rates we want to test */ -static const int rates[] = { 44100, 22050, 8000 }; - -/* Combinations of stereo/bits we want to test */ -struct sb -{ - int stereo; - int bits; -}; -static const struct sb sblut[] = { {0, 8}, {0, 16}, {1, 8}, {1, 16} }; - -int -main (int argc, char *argv[]) -{ - /* tst_brkm(TBROK, cleanup, "see if it breaks all right"); */ - ioctltest (); - playbacktest (); - recordingtest (); - monitortest (); - forkplaytest (); - forkrectest (); - abortplaytest (); - playwavtest (); - dup_test (); - tst_exit (); - /* NOTREACHED */ - return 0; -} - -/* test some extra ioctls */ -void -ioctltest (void) -{ - int audio1; - int ioctl_par; - int channels; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - audio1 = open ("/dev/dsp", O_WRONLY); - if (audio1 < 0) - { - tst_brkm (TFAIL, cleanup, "open W: %s", strerror (errno)); - } - setpars (audio1, 44100, 1, 16); - - channels = ioctl_par = 1; - while (ioctl (audio1, SNDCTL_DSP_CHANNELS, &ioctl_par) == 0) - { - channels++; - ioctl_par = channels; - } - if (channels == ioctl_par) - tst_resm (TFAIL, "Max channels=%d failed", ioctl_par); - else - tst_resm (TPASS, "Max channels=%d failed, OK=%d", channels, ioctl_par); - - /* Note: block size may depend on parameters */ - if (ioctl (audio1, SNDCTL_DSP_GETBLKSIZE, &ioctl_par) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl GETBLKSIZE: %s", strerror (errno)); - } - tst_resm (TPASS, "ioctl get buffer size=%d", ioctl_par); - if (ioctl (audio1, SNDCTL_DSP_GETFMTS, &ioctl_par) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl GETFMTS: %s", strerror (errno)); - } - tst_resm (TPASS, "ioctl get formats=%08x", ioctl_par); - if (ioctl (audio1, SNDCTL_DSP_GETCAPS, &ioctl_par) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl GETCAPS: %s", strerror (errno)); - } - tst_resm (TPASS, "ioctl get caps=%08x", ioctl_par); - if (close (audio1) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } -} - -/* test write / play */ -void -playbacktest (void) -{ - int audio1, audio2; - int rate, k; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - audio1 = open ("/dev/dsp", O_WRONLY); - if (audio1 < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp W: %s", - strerror (errno)); - } - audio2 = open ("/dev/dsp", O_WRONLY); - if (audio2 >= 0) - { - tst_brkm (TFAIL, cleanup, - "Second open /dev/dsp W succeeded, but is expected to fail"); - } - else if (errno != EBUSY) - { - tst_brkm (TFAIL, cleanup, "Expected EBUSY here, exit: %s", - strerror (errno)); - } - for (rate = 0; rate < sizeof (rates) / sizeof (int); rate++) - for (k = 0; k < sizeof (sblut) / sizeof (struct sb); k++) - { - playtest (audio1, rates[rate], sblut[k].stereo, sblut[k].bits); - tst_resm (TPASS, "Play bits=%2d stereo=%d rate=%5d", - sblut[k].bits, sblut[k].stereo, rates[rate]); - } - if (close (audio1) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } -} - -/* test read / record */ -void -recordingtest (void) -{ - int audio1, audio2; - int rate, k; - - /* test read / record */ - tst_resm (TINFO, "Running %s", __FUNCTION__); - audio1 = open ("/dev/dsp", O_RDONLY); - if (audio1 < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp R: %s", - strerror (errno)); - } - audio2 = open ("/dev/dsp", O_RDONLY); - if (audio2 >= 0) - { - tst_brkm (TFAIL, cleanup, - "Second open /dev/dsp R succeeded, but is expected to fail"); - } - else if (errno != EBUSY) - { - tst_brkm (TFAIL, cleanup, "Expected EBUSY here, exit: %s", - strerror (errno)); - } - for (rate = 0; rate < sizeof (rates) / sizeof (int); rate++) - for (k = 0; k < sizeof (sblut) / sizeof (struct sb); k++) - { - rectest (audio1, rates[rate], sblut[k].stereo, sblut[k].bits); - tst_resm (TPASS, "Record bits=%2d stereo=%d rate=%5d", - sblut[k].bits, sblut[k].stereo, rates[rate]); - } - if (close (audio1) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } -} - -/* simultaneous read/write */ -void -monitortest (void) -{ - int fd; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - fd = open ("/dev/dsp", O_RDWR); - if (fd < 0) - { - tst_brkm (TFAIL, cleanup, "open RW: %s", strerror (errno)); - } - rwtest (fd, 44100, 1, 16); - tst_resm (TPASS, "Record+Play rate=44100, stereo, 16 bits"); - if (close (fd) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } -} - -void -forkrectest (void) -{ - int pid; - int fd; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - fd = open ("/dev/dsp", O_RDONLY); - if (fd < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp R: %s", - strerror (errno)); - } - pid = fork (); - if (pid < 0) - { - tst_brkm (TBROK, cleanup, "Fork failed: %s", strerror (errno)); - } - if (pid) - { - tst_resm (TINFO, "forked, child PID=%d", pid); - syncwithchild (pid, 0); - tst_resm (TINFO, "parent records.."); - rectest (fd, 22050, 1, 16); - tst_resm (TINFO, "parent done"); - } - else - { /* child */ - tst_resm (TINFO, "child records.."); - rectest (fd, 44100, 1, 16); - tst_resm (TINFO, "child done"); - fflush (stdout); - exit (0); /* implicit close */ - } - tst_resm (TPASS, "child records after fork"); - /* fork again, but now we have done a read before, - * so the child is expected to fail - */ - pid = fork (); - if (pid < 0) - { - tst_brkm (TBROK, cleanup, "Fork failed: %s", strerror (errno)); - } - if (pid) - { - tst_resm (TINFO, "forked, child PID=%d", pid); - syncwithchild (pid, CHILD_EXPECT?TFAIL:0); /* expecting error exit */ - tst_resm (TINFO, "parent records again .."); - rectest (fd, 22050, 1, 16); - tst_resm (TINFO, "parent done"); - } - else - { /* child */ - expect_child_failure = CHILD_EXPECT; - tst_resm (TINFO, "child trying to record %s", - CHILD_EXPECT?"(should fail)..":""); - rectest (fd, 44100, 1, 16); - /* NOTREACHED */ - tst_resm (TINFO, "child done"); - fflush (stdout); - exit (0); /* implicit close */ - } - if (close (fd) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - tst_resm (TPASS, "child tries to record while parent is already recording"); -} - -void -forkplaytest (void) -{ - int pid; - int fd; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - fd = open ("/dev/dsp", O_WRONLY); - if (fd < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp R: %s", - strerror (errno)); - } - pid = fork (); - if (pid < 0) - { - tst_brkm (TBROK, cleanup, "Fork failed: %s", strerror (errno)); - } - if (pid) - { - tst_resm (TINFO, "forked, child PID=%d", pid); - syncwithchild (pid, 0); - tst_resm (TINFO, "parent plays.."); - playtest (fd, 22050, 0, 8); - tst_resm (TINFO, "parent done"); - } - else - { /* child */ - tst_resm (TINFO, "child plays.."); - playtest (fd, 44100, 1, 16); - tst_resm (TINFO, "child done"); - fflush (stdout); - exit (0); /* implicit close */ - } - tst_resm (TPASS, "child plays after fork"); - /* fork again, but now we have done a write before, - * so the child is expected to fail - */ - pid = fork (); - if (pid < 0) - { - tst_brkm (TBROK, cleanup, "Fork failed"); - } - if (pid) - { - tst_resm (TINFO, "forked, child PID=%d", pid); - syncwithchild (pid, CHILD_EXPECT?TFAIL:0); /* expected failure */ - tst_resm (TINFO, "parent plays again.."); - playtest (fd, 22050, 0, 8); - tst_resm (TINFO, "parent done"); - } - else - { /* child */ - expect_child_failure = CHILD_EXPECT; - tst_resm (TINFO, "child trying to play %s", - CHILD_EXPECT?"(should fail)..":""); - playtest (fd, 44100, 1, 16); - /* NOTREACHED */ - tst_resm (TINFO, "child done"); - fflush (stdout); - exit (0); /* implicit close */ - } - if (close (fd) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - tst_resm (TPASS, "child tries to play while parent is already playing"); -} - -void -playtest (int fd, int rate, int stereo, int bits) -{ /* Play sine waves, always 0.25 sec */ - void *wave; - int n, c, b; - int size; - if (stereo) - c = 2; - else - c = 1; - if (bits == 8) - b = 1; - else - b = 2; - size = rate / 4 * c * b; - - wave = malloc (size); - if (wave == NULL) - { - tst_brkm (TBROK, cleanup, "Malloc failed, exit"); - } - setpars (fd, rate, stereo, bits); - sinegen (wave, rate, bits, rate / 4, c); - - if ((n = write (fd, wave, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "write: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Wrote %d, expected %d; exit", n, size); - } - free (wave); -} - -void -rectest (int fd, int rate, int stereo, int bits) -{ - void *wave; - int n, c, b; - int size; - if (stereo) - c = 2; - else - c = 1; - if (bits == 8) - b = 1; - else - b = 2; - size = rate / 4 * c * b; - - wave = malloc (size); - if (wave == NULL) - { - tst_brkm (TBROK, cleanup, "Malloc failed, exit"); - } - setpars (fd, rate, stereo, bits); - if ((n = read (fd, wave, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "read: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Read n=%d (%d expected); exit", n, size); - } - if ((n = read (fd, wave, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "read: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Read n=%d (%d expected); exit", n, size); - } - free (wave); -} - -void -rwtest (int fd, int rate, int stereo, int bits) -{ - int pid; - void *wave; - int n, c, b; - int size; - if (stereo) - c = 2; - else - c = 1; - if (bits == 8) - b = 1; - else - b = 2; - size = rate / 4 * c * b; - - wave = malloc (size); - if (wave == NULL) - { - tst_brkm (TBROK, cleanup, "Malloc failed, exit"); - } - setpars (fd, rate, stereo, bits); - pid = fork (); - if (pid < 0) - { - tst_brkm (TBROK, cleanup, "Fork failed: %s", strerror (errno)); - } - if (pid) - { - tst_resm (TINFO, "forked, child PID=%d parent records", pid); - if ((n = read (fd, wave, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "read: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Read n=%d (%d expected)", n, size); - } - free (wave); - syncwithchild (pid, 0); - } - else - { /* child */ - tst_resm (TINFO, "child plays"); - sinegen (wave, rate, bits, rate / 4, c); - if ((n = write (fd, wave, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "child write: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "child write n=%d OK (%d expected)", n, - size); - } - free (wave); - exit (0); - } -} - -void -setpars (int fd, int rate, int stereo, int bits) -{ - int ioctl_par = 0; - - if (ioctl (fd, SNDCTL_DSP_SAMPLESIZE, &bits) < 0) - { - if (expect_child_failure) - { /* Note: Don't print this to stderr because we expect failures here - * for the some cases after fork() - */ - tst_resm (TINFO, "ioctl SNDCTL_DSP_SAMPLESIZE: %s", - strerror (errno)); - exit (TFAIL); - } - else - { - tst_brkm (TFAIL, cleanup, "ioctl SNDCTL_DSP_SAMPLESIZE: %s", - strerror (errno)); - } - } - if (ioctl (fd, SNDCTL_DSP_STEREO, &stereo) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl SNDCTL_DSP_STEREO: %s", - strerror (errno)); - } - if (ioctl (fd, SNDCTL_DSP_SPEED, &rate) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl SNDCTL_DSP_SPEED: %s", - strerror (errno)); - } - if (ioctl (fd, SNDCTL_DSP_SYNC, &ioctl_par) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl SNDCTL_DSP_SYNC: %s", - strerror (errno)); - } -} - -void -syncwithchild (pid_t pid, int expected_exit_status) -{ - int status; - - if (waitpid (pid, &status, 0) != pid) - { - tst_brkm (TBROK, cleanup, "Wait for child: %s", strerror (errno)); - } - if (!WIFEXITED (status)) - { - tst_brkm (TBROK, cleanup, "Child had abnormal exit"); - } - if (WEXITSTATUS (status) != expected_exit_status) - { - tst_brkm (TFAIL, cleanup, "Child had exit status %d != %d", - WEXITSTATUS (status), expected_exit_status); - } -} - -void -sinegen (void *wave, int rate, int bits, int len, int stride) -{ - if (bits == 8) - { - sinegenb (1000, rate, (unsigned char *) wave, len, stride); - if (stride == 2) - sinegenb (800, rate, (unsigned char *) wave + 1, len, stride); - } - else - { - sinegenw (1000, rate, (short *) wave, len, stride); - if (stride == 2) - sinegenw (800, rate, (short *) wave + 1, len, stride); - } -} - -void -sinegenw (int freq, int samprate, short *value, int len, int stride) -{ - double phase, incr; - - phase = 0.0; - incr = M_PI * 2.0 * (double) freq / (double) samprate; - while (len-- > 0) - { - *value = (short) floor (0.5 + 6553 * sin (phase)); - value += stride; - phase += incr; - } -} - -void -sinegenb (int freq, int samprate, unsigned char *value, int len, int stride) -{ - double phase, incr; - - phase = 0.0; - incr = M_PI * 2.0 * (double) freq / (double) samprate; - while (len-- > 0) - { - *value = (unsigned char) floor (128.5 + 26 * sin (phase)); - value += stride; - phase += incr; - } -} - -void -abortplaytest (void) -{ - int audio; - int size = sizeof (wavfile_okay); - int n; - int ioctl_par = 0; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - audio = open ("/dev/dsp", O_WRONLY); - if (audio < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp W: %s", - strerror (errno)); - } - if ((n = write (audio, wavfile_okay, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "write: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Wrote %d, expected %d; exit", n, size); - } - if (ioctl (audio, SNDCTL_DSP_RESET, &ioctl_par) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl DSP_RESET: %s", strerror (errno)); - } - if (close (audio) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - tst_resm (TPASS, "Playwav + ioctl DSP_RESET=%d", ioctl_par); -} - -void -playwavtest (void) -{ - int audio; - int size = sizeof (wavfile_okay); - int n; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - audio = open ("/dev/dsp", O_WRONLY); - if (audio < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp W: %s", - strerror (errno)); - } - if ((n = write (audio, wavfile_okay, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "write: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Wrote %d, expected %d; exit", n, size); - } - if (close (audio) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - tst_resm (TPASS, "Set parameters from wave file header"); -} - -void dup_test (void) -{ - int audio, fd, n; - int bits1, bits2; - int size = sizeof (wavfile_okay); - int header = 44; - const char *okay = wavfile_okay + header; - - tst_resm (TINFO, "Running %s", __FUNCTION__); - audio = open ("/dev/dsp", O_WRONLY); - if (audio < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp W: %s", - strerror (errno)); - } - /* write header once to set parameters correctly */ - n = write (audio, wavfile_okay, header); - if (n != header) - { - tst_brkm (TFAIL, cleanup, "Wrote %d, expected %d; exit", n, header); - } - size = size - header; - /* dup / close */ - for (fd = audio+1; fd <= audio+5; fd++) - if (dup2 (fd-1, fd) != -1) - { - if (fd-2 >= audio) - if (close (fd-2) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - if ((n = write (fd, okay, size)) < 0) - { - tst_brkm (TFAIL, cleanup, "write: %s", strerror (errno)); - } - if (n != size) - { - tst_brkm (TFAIL, cleanup, "Wrote %d, expected %d; exit", n, size); - } - } - else - tst_brkm (TFAIL, cleanup, "dup: %s", strerror (errno)); - - for (fd = audio+4; fd <= audio+5; fd++) - if (close (fd) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - tst_resm (TPASS, "Write to duped fd"); - - audio = open ("/dev/dsp", O_WRONLY); - if (audio < 0) - { - tst_brkm (TFAIL, cleanup, "Error open /dev/dsp W: %s", - strerror (errno)); - } - fd = audio + 1; - if (dup2 (audio, fd) == -1) - { - tst_brkm (TFAIL, cleanup, "dup: %s", strerror (errno)); - } - bits1 = AFMT_U8; - if (ioctl (audio, SNDCTL_DSP_SAMPLESIZE, &bits1) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl: %s", strerror (errno)); - } - bits1 = AFMT_S16_LE; - if (ioctl (fd, SNDCTL_DSP_SAMPLESIZE, &bits1) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl: %s", strerror (errno)); - } - bits1 = AFMT_QUERY; - if (ioctl (audio, SNDCTL_DSP_SAMPLESIZE, &bits1) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl: %s", strerror (errno)); - } - bits2 = AFMT_QUERY; - if (ioctl (fd, SNDCTL_DSP_SAMPLESIZE, &bits2) < 0) - { - tst_brkm (TFAIL, cleanup, "ioctl: %s", strerror (errno)); - } - if (bits1 != AFMT_S16_LE || bits2 != AFMT_S16_LE) - { - tst_brkm (TFAIL, cleanup, "Inconsistent state of duped fd: %d %d %d", - AFMT_S16_LE,bits1,bits2); - } - if (close (audio) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - if (close (fd) < 0) - { - tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno)); - } - tst_resm (TPASS, "Parameter change to duped fd"); -} -void -cleanup (void) -{ -} diff --git a/winsup/testsuite/winsup.api/devdsp_okay.h b/winsup/testsuite/winsup.api/devdsp_okay.h deleted file mode 100644 index 0fefa635c..000000000 --- a/winsup/testsuite/winsup.api/devdsp_okay.h +++ /dev/null @@ -1,531 +0,0 @@ -/* This is the decimal representation of a wave file. - It contains the spoken word "okay" sampled at 11025 Hz - and 8 bit resolution. */ - 82, 73, 70, 70, 108, 30, 0, 0, 87, 65, 86, 69, 102, 109, 116, 32, 16, 0, 0, - 0, 1, 0, 1, 0, 17, 43, 0, 0, 17, 43, 0, 0, 1, 0, 8, 0, 100, 97, 116, 97, - 72, 30, 0, 0, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 115, 114, 114, 115, 115, - 115, 117, 117, 117, 116, 115, 115, 115, 115, 116, 116, 116, 118, 116, 115, - 115, 115, 115, 115, 116, 116, 116, 117, 116, 116, 115, 116, 116, 116, 116, - 117, 116, 116, 117, 116, 115, 116, 116, 116, 117, 117, 117, 116, 116, 117, - 116, 116, 116, 117, 117, 117, 117, 116, 116, 116, 118, 117, 117, 117, 117, - 116, 116, 116, 116, 116, 116, 117, 117, 117, 117, 116, 116, 116, 116, 116, - 116, 116, 117, 116, 116, 116, 115, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 115, 115, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 117, 117, 117, 117, 117, 117, 117, 117, 117, 118, 119, 118, 118, 118, - 118, 119, 119, 119, 119, 119, 120, 120, 120, 120, 121, 120, 120, 120, 120, - 121, 121, 120, 119, 118, 116, 115, 114, 115, 114, 113, 112, 112, 111, 112, - 113, 114, 116, 116, 117, 117, 117, 116, 115, 115, 115, 115, 116, 115, 115, - 114, 114, 114, 114, 114, 114, 114, 116, 115, 115, 115, 114, 114, 113, 113, - 114, 115, 115, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, - 115, 115, 115, 115, 116, 116, 116, 118, 117, 117, 117, 117, 117, 118, 118, - 119, 119, 119, 120, 120, 120, 120, 120, 120, 121, 121, 121, 120, 119, 118, - 117, 117, 117, 116, 117, 116, 116, 115, 115, 115, 115, 115, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 114, 113, 113, 113, 113, - 113, 113, 113, 115, 114, 113, 113, 113, 113, 114, 114, 114, 115, 114, 114, - 114, 114, 114, 114, 114, 115, 116, 115, 115, 115, 115, 114, 114, 115, 115, - 115, 117, 116, 116, 116, 116, 116, 116, 117, 117, 118, 118, 119, 118, 118, - 118, 118, 119, 120, 120, 121, 121, 122, 122, 123, 124, 125, 126, 127, 126, - 126, 126, 126, 127, -127, 124, 114, 102, 94, 89, 94, 102, 109, 115, 120, - 124, 123, 122, 121, 117, 116, 121, 124, 125, 124, 120, 114, 109, 107, 105, - 104, 108, 111, 115, 118, 120, 118, 116, 114, 114, 116, 117, 119, 120, 119, - 118, 116, 113, 112, 111, 113, 117, 120, 122, 122, 121, 118, 115, 114, 113, - 112, 113, 114, 113, 114, 114, 112, 111, 110, 110, 113, 116, 118, 119, 120, - 119, 116, 115, 114, 112, 111, 114, 114, 115, 115, 113, 110, 109, 110, 113, - 115, 118, 120, 120, 119, 119, 116, 114, 112, 112, 113, 114, 115, 115, 114, - 115, 114, 114, 115, 117, 117, 118, 119, 119, 118, 117, 116, 115, 115, 116, - 116, 118, 119, 119, 119, 118, 118, 118, 119, 120, 121, 122, 123, 123, 123, - 122, 122, 124, 122, 121, 119, 118, 117, 115, 115, 115, 115, 116, 117, 118, - 118, 119, 117, 112, 110, 110, 110, 111, 117, 118, 118, 118, 119, 118, 116, - 115, 114, 114, 116, 118, 118, 116, 116, 115, 113, 112, 113, 113, 114, 117, - 117, 117, 117, 115, 113, 112, 111, 108, 108, 110, 111, 113, 115, 116, 115, - 115, 116, 116, 114, 115, 115, 114, 115, 114, 112, 111, 113, 112, 113, 115, - 116, 117, 118, 118, 117, 116, 117, 115, 115, 116, 117, 117, 118, 118, 119, - 119, 119, 120, 122, 122, 124, 125, 126, -128, -127, -126, -124, -121, - -117, -112, -113, -123, 121, 108, 91, 75, 75, 84, 91, 103, 119, 127, -128, - -126, -127, 124, 120, 122, 121, 123, 127, 126, 120, 114, 110, 104, 99, - 101, 104, 107, 114, 120, 123, 123, 122, 119, 116, 116, 117, 116, 117, 118, - 117, 115, 113, 111, 110, 111, 113, 116, 120, 123, 124, 123, 121, 118, 115, - 113, 112, 112, 112, 114, 113, 112, 110, 107, 107, 107, 110, 112, 116, 119, - 120, 119, 118, 115, 113, 110, 110, 111, 112, 113, 114, 114, 116, 115, 114, - 115, 116, 117, 118, 119, 119, 118, 117, 116, 115, 113, 114, 114, 115, 117, - 119, 119, 120, 120, 120, 121, 122, 123, 123, 125, 127, -128, -127, -126, - -126, -124, -121, -120, -119, -123, 124, 113, 101, 90, 81, 81, 87, 96, - 108, 121, 127, -127, -125, -125, 126, 122, 121, 120, 120, 122, 121, 118, - 114, 110, 106, 103, 102, 104, 106, 112, 117, 120, 122, 123, 122, 119, 117, - 117, 116, 115, 116, 116, 115, 115, 114, 113, 113, 113, 115, 117, 119, 120, - 120, 120, 118, 114, 112, 110, 108, 108, 108, 109, 110, 112, 111, 112, 112, - 112, 112, 112, 114, 117, 117, 118, 117, 115, 113, 112, 111, 111, 113, 114, - 116, 118, 119, 119, 118, 118, 118, 117, 117, 117, 118, 117, 118, 118, 118, - 119, 119, 120, 121, 122, 124, 126, 127, -128, -127, -124, -122, -120, - -117, -115, -117, -125, 119, 102, 85, 77, 76, 83, 91, 103, 115, 124, -125, - -122, -126, 124, 121, 119, 119, 121, 122, 121, 118, 117, 114, 109, 106, - 103, 102, 107, 112, 117, 119, 122, 122, 120, 119, 117, 114, 112, 114, 114, - 115, 116, 115, 114, 114, 114, 114, 116, 116, 118, 119, 120, 121, 119, 116, - 113, 109, 108, 107, 107, 109, 111, 112, 113, 114, 115, 113, 112, 112, 112, - 113, 114, 115, 116, 115, 114, 113, 113, 113, 113, 113, 114, 117, 117, 118, - 118, 117, 117, 117, 116, 116, 117, 117, 118, 119, 118, 118, 118, 118, 119, - 120, 121, 122, 124, 126, -128, -127, -125, -124, -123, -120, -117, -114, - -115, -123, 119, 102, 84, 76, 76, 80, 90, 102, 115, 125, -124, -120, -125, - 124, 121, 119, 119, 120, 121, 121, 120, 119, 117, 110, 105, 101, 101, 104, - 110, 114, 118, 121, 123, 122, 120, 118, 115, 113, 114, 116, 116, 117, 117, - 115, 115, 114, 114, 113, 114, 117, 118, 120, 120, 119, 117, 114, 111, 109, - 107, 107, 107, 109, 112, 115, 115, 115, 115, 115, 114, 113, 113, 113, 113, - 114, 114, 114, 114, 113, 113, 113, 114, 116, 117, 118, 119, 119, 120, 118, - 118, 117, 116, 117, 117, 118, 118, 118, 119, 119, 120, 121, 121, 121, 123, - 124, 125, 126, -128, -127, -124, -121, -118, -116, -112, -114, -123, 118, - 99, 81, 75, 77, 82, 92, 104, 114, 125, -123, -122, -128, 123, 120, 118, - 119, 121, 121, 120, 121, 121, 117, 112, 107, 102, 102, 105, 110, 114, 118, - 121, 124, 123, 121, 118, 114, 113, 113, 113, 115, 116, 116, 117, 117, 116, - 115, 115, 115, 115, 116, 118, 119, 118, 118, 115, 112, 110, 107, 106, 107, - 110, 112, 115, 117, 118, 117, 117, 115, 113, 112, 112, 111, 112, 113, 113, - 113, 114, 114, 116, 115, 116, 117, 118, 119, 119, 118, 118, 117, 116, 115, - 116, 116, 117, 118, 119, 121, 120, 120, 121, 121, 121, 121, 121, 122, 123, - 125, 125, 126, -127, -124, -122, -119, -117, -115, -117, -123, 120, 102, - 88, 81, 80, 85, 92, 100, 110, 120, -127, -125, 127, 123, 121, 120, 121, - 122, 121, 121, 123, 122, 119, 114, 109, 104, 103, 104, 107, 110, 114, 117, - 119, 121, 121, 119, 117, 114, 114, 114, 116, 117, 117, 117, 118, 118, 117, - 115, 113, 113, 113, 115, 116, 117, 116, 114, 113, 110, 109, 109, 110, 111, - 113, 116, 117, 117, 116, 115, 112, 111, 110, 109, 112, 113, 115, 117, 118, - 117, 117, 116, 115, 114, 115, 115, 116, 118, 119, 120, 120, 120, 118, 117, - 116, 116, 116, 118, 118, 120, 121, 122, 122, 122, 120, 120, 120, 121, 123, - 125, 127, -126, -123, -121, -120, -119, -118, -120, -128, 115, 101, 91, - 87, 86, 89, 94, 100, 109, 117, 123, 125, 123, 121, 119, 119, 120, 121, - 120, 121, 122, 122, 121, 117, 112, 107, 105, 106, 106, 108, 111, 113, 117, - 119, 119, 118, 117, 114, 113, 114, 115, 116, 117, 118, 119, 120, 118, 117, - 114, 112, 112, 113, 113, 114, 114, 114, 114, 112, 111, 110, 110, 110, 111, - 113, 114, 115, 115, 115, 113, 112, 111, 110, 111, 111, 113, 115, 116, 117, - 117, 117, 116, 115, 115, 113, 114, 115, 116, 118, 119, 120, 120, 119, 118, - 118, 117, 116, 117, 118, 119, 120, 121, 121, 121, 121, 121, 121, 121, 122, - 123, 125, 127, -128, -126, -124, -122, -120, -120, -126, 119, 108, 101, - 93, 91, 93, 93, 97, 105, 112, 117, 120, 120, 118, 117, 118, 118, 117, 118, - 120, 122, 123, 123, 121, 116, 114, 110, 108, 107, 107, 108, 110, 114, 116, - 117, 117, 116, 115, 114, 114, 114, 115, 117, 117, 119, 120, 120, 119, 118, - 116, 115, 114, 113, 113, 112, 112, 112, 111, 111, 111, 111, 112, 112, 113, - 113, 115, 116, 116, 116, 115, 115, 113, 113, 113, 113, 114, 115, 116, 117, - 117, 117, 116, 116, 115, 116, 116, 116, 117, 118, 119, 120, 120, 120, 119, - 119, 118, 118, 117, 117, 118, 119, 119, 120, 121, 121, 122, 123, 121, 121, - 121, 122, 123, 125, 127, -127, -126, -125, -124, -127, 122, 115, 109, 103, - 100, 101, 100, 102, 105, 109, 114, 115, 115, 115, 113, 113, 114, 114, 115, - 117, 120, 121, 122, 123, 121, 118, 116, 113, 112, 111, 111, 111, 112, 114, - 115, 116, 116, 115, 114, 113, 114, 113, 113, 114, 115, 117, 120, 121, 121, - 120, 119, 118, 117, 115, 113, 113, 113, 113, 114, 114, 113, 113, 111, 111, - 111, 111, 112, 112, 114, 116, 116, 117, 116, 116, 115, 115, 114, 114, 114, - 116, 116, 117, 118, 118, 118, 118, 117, 117, 116, 116, 116, 118, 118, 119, - 119, 118, 118, 118, 117, 117, 117, 117, 117, 119, 119, 119, 120, 120, 120, - 120, 120, 119, 119, 119, 119, 120, 120, 120, 121, 120, 120, 120, 120, 120, - 120, 119, 118, 117, 115, 114, 113, 113, 112, 112, 112, 112, 113, 113, 113, - 114, 113, 113, 113, 113, 113, 114, 115, 116, 118, 117, 117, 117, 116, 116, - 116, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 117, 116, 117, 117, 117, 117, 117, 117, 117, 116, 116, 117, 116, 115, 115, - 115, 115, 115, 115, 115, 114, 115, 114, 114, 114, 114, 114, 115, 115, 116, - 117, 116, 116, 116, 116, 116, 116, 116, 116, 117, 117, 118, 117, 117, 117, - 116, 116, 116, 116, 116, 117, 117, 118, 118, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 118, 117, 117, 117, 116, 116, 116, 116, 116, 117, 117, - 118, 117, 117, 117, 117, 116, 117, 117, 117, 117, 117, 117, 118, 117, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 115, 115, - 115, 115, 115, 116, 114, 114, 115, 115, 115, 115, 116, 116, 116, 117, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 117, 117, 117, - 118, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 117, 115, 115, - 116, 116, 116, 117, 117, 117, 117, 117, 118, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 117, 117, 116, - 117, 116, 116, 116, 117, 117, 117, 117, 117, 117, 117, 118, 117, 117, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 117, 117, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 118, 117, 117, 117, 116, 116, 116, 116, 116, 115, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, - 115, 115, 116, 116, 117, 117, 117, 117, 117, 118, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 117, 117, - 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 117, 117, 116, 116, 116, 116, 116, 115, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 115, 115, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 117, 117, 117, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 117, 116, 117, 117, 117, 117, 117, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 117, 117, 116, 116, 116, 117, 116, 116, 116, - 116, 116, 116, 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 117, 117, 116, 116, 117, 118, 117, 117, 117, 117, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 117, 117, - 117, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, - 114, 108, 108, 118, 125, -126, 123, 98, 95, 109, 117, 124, 127, 123, 118, - 109, 103, 113, 125, -127, 120, 108, 106, 112, 115, 112, 110, 112, 111, - 112, 112, 116, 120, 120, 118, 114, 113, 120, 122, 119, 116, 115, 115, 117, - 117, 116, 115, 115, 115, 112, 107, 109, 119, 121, 120, 118, 114, 117, 120, - 118, 119, 119, 117, 119, 116, 113, 119, 120, 117, 114, 112, 114, 117, 117, - 116, 113, 114, 118, 117, 117, 119, 121, 118, 113, 114, 116, 116, 118, 116, - 114, 113, 111, 112, 117, 118, 121, 119, 117, 117, 113, 110, 114, 117, 119, - 117, 114, 113, 113, 114, 115, 115, 117, 117, 114, 114, 116, 119, 121, 119, - 115, 116, 117, 117, 120, 122, 121, 115, 109, 112, 117, 117, 116, 115, 116, - 117, 113, 113, 116, 118, 118, 115, 115, 118, 120, 120, 120, 118, 119, 120, - 119, 119, 118, 119, 119, 117, 116, 117, 118, 119, 116, 115, 117, 118, 118, - 118, 118, 118, 119, 119, 120, 120, 121, 120, 118, 118, 119, 119, 119, 118, - 118, 117, 116, 117, 117, 118, 118, 117, 116, 117, 116, 117, 119, 118, 117, - 116, 118, 120, 117, 117, 119, 120, 119, 118, 118, 118, 119, 118, 117, 116, - 119, 118, 117, 116, 117, 118, 118, 117, 116, 117, 118, 117, 116, 116, 117, - 118, 117, 115, 116, 118, 119, 117, 117, 119, 117, 117, 116, 117, 118, 118, - 117, 116, 116, 117, 117, 117, 116, 116, 116, 117, 116, 115, 116, 116, 116, - 118, 117, 116, 116, 117, 117, 117, 117, 117, 116, 115, 116, 116, 117, 118, - 116, 114, 115, 115, 116, 116, 117, 117, 115, 115, 116, 116, 118, 118, 117, - 117, 116, 116, 117, 117, 118, 117, 116, 116, 115, 115, 115, 115, 116, 118, - 116, 115, 115, 116, 116, 116, 116, 117, 117, 117, 118, 117, 117, 117, 117, - 116, 116, 116, 117, 115, 115, 114, 114, 115, 115, 115, 116, 115, 114, 114, - 117, 116, 116, 115, 115, 115, 116, 116, 116, 116, 116, 115, 116, 116, 116, - 116, 115, 115, 115, 116, 115, 115, 115, 116, 116, 116, 116, 115, 115, 116, - 116, 117, 116, 116, 116, 117, 117, 116, 116, 116, 117, 117, 118, 117, 117, - 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 117, - 118, 118, 117, 118, 117, 117, 117, 117, 117, 118, 117, 117, 116, 115, 117, - 117, 117, 116, 115, 116, 117, 117, 117, 117, 117, 117, 116, 117, 117, 117, - 116, 115, 115, 116, 117, 118, 116, 116, 118, 117, 116, 117, 117, 117, 116, - 116, 116, 117, 116, 117, 115, 115, 116, 117, 117, 116, 115, 115, 117, 118, - 119, 117, 116, 116, 115, 116, 117, 117, 116, 115, 115, 117, 117, 117, 115, - 115, 115, 115, 114, 115, 116, 116, 115, 116, 116, 116, 116, 115, 116, 116, - 116, 116, 115, 116, 116, 116, 116, 115, 116, 117, 116, 117, 118, 116, 116, - 116, 116, 116, 117, 117, 117, 117, 118, 118, 117, 118, 118, 117, 116, 117, - 117, 118, 118, 117, 115, 117, 118, 118, 118, 117, 115, 115, 117, 118, 117, - 116, 116, 114, 115, 117, 117, 117, 116, 115, 116, 116, 116, 117, 116, 116, - 115, 115, 115, 115, 116, 115, 114, 116, 115, 115, 115, 114, 113, 113, 113, - 113, 114, 113, 112, 111, 113, 114, 113, 113, 114, 112, 113, 113, 113, 114, - 113, 113, 113, 114, 114, 114, 114, 114, 114, 115, 115, 116, 117, 116, 116, - 116, 117, 117, 117, 117, 117, 117, 118, 118, 120, 120, 121, 120, 120, 122, - 123, 123, 125, 126, 127, -128, -128, -126, -124, -121, -117, -112, -113, - -127, 106, 94, 105, 117, 114, 106, 94, 85, 89, 105, 116, 121, 118, 109, - 106, 116, 127, -126, 127, 121, 116, 115, 117, 117, 117, 116, 112, 103, 99, - 106, 110, 111, 108, 103, 104, 109, 112, 115, 116, 114, 111, 110, 113, 116, - 118, 116, 112, 110, 111, 112, 112, 114, 115, 113, 111, 111, 113, 116, 118, - 116, 115, 115, 117, 119, 120, 120, 120, 121, 122, 125, -126, -121, -119, - -116, -111, -107, -100, -101, -111, 110, 73, 90, 124, 119, 96, 82, 71, 71, - 95, 119, -127, 126, 114, 103, 115, -117, -108, -116, -126, 123, 119, 116, - 114, 116, 118, 112, 101, 91, 93, 103, 112, 113, 107, 108, 111, 114, 120, - 125, 124, 119, 111, 110, 116, 120, 117, 112, 107, 106, 108, 112, 112, 114, - 114, 110, 107, 110, 115, 118, 117, 114, 111, 110, 112, 114, 116, 116, 114, - 110, 110, 113, 117, 118, 116, 113, 114, 117, 118, 119, 120, 122, 123, 122, - 124, -127, -124, -122, -117, -114, -112, -110, -103, -96, -116, 80, 53, - 97, -125, 112, 89, 77, 65, 73, 107, -121, -114, -123, 113, 104, 127, -104, - -103, -117, -127, 124, 115, 106, 105, 113, 117, 108, 91, 80, 86, 103, 114, - 112, 110, 111, 111, 113, 122, -127, -128, 120, 113, 110, 114, 117, 115, - 112, 109, 106, 105, 105, 109, 116, 116, 109, 105, 108, 115, 119, 120, 117, - 114, 112, 114, 118, 122, 124, 120, 117, 118, 121, 125, -128, -127, -124, - -121, -116, -108, -93, -75, -73, -120, 57, 40, 106, -108, 120, 81, 62, 48, - 59, 104, -106, -99, -123, 106, 100, -128, -96, -92, -107, -120, 127, 108, - 93, 100, 118, 123, 105, 79, 69, 82, 106, 119, 118, 116, 117, 116, 118, - 127, -121, -123, 121, 111, 108, 110, 110, 111, 111, 109, 105, 101, 102, - 112, 121, 122, 112, 105, 111, 120, 123, 120, 115, 112, 108, 110, 114, 115, - 113, 111, 109, 111, 115, 119, 122, 122, 120, 120, 120, 125, -124, -119, - -117, -118, -114, -105, -88, -73, -79, 120, 40, 37, 115, -106, 109, 69, - 57, 51, 67, 119, -95, -97, -125, 108, 110, -118, -92, -93, -109, -122, - 120, 97, 84, 95, 118, 121, 98, 72, 68, 88, 110, 123, 124, 123, 123, 119, - 115, 125, -119, -125, 116, 106, 103, 104, 106, 110, 114, 111, 103, 99, - 105, 120, -127, 123, 111, 105, 111, 118, 120, 118, 114, 109, 106, 110, - 116, 122, 122, 118, 114, 117, 121, 126, -126, -124, -123, -122, -119, - -106, -88, -68, -59, -99, 61, 9, 75, -100, -117, 80, 54, 47, 46, 87, -103, - -78, -104, 115, 104, 124, -100, -85, -95, -114, -127, 105, 76, 77, 110, - -127, 111, 76, 60, 73, 101, 122, -127, -126, -128, 122, 116, 123, -120, - -116, 124, 107, 99, 98, 99, 105, 114, 112, 104, 96, 100, 115, -126, -126, - 118, 108, 107, 116, 122, 121, 117, 111, 103, 103, 110, 116, 119, 117, 113, - 112, 114, 118, 126, -126, 126, 123, 125, -126, -114, -104, -96, -88, -76, - -72, -119, 48, 20, 94, -102, 120, 67, 50, 48, 60, 109, -94, -84, -115, - 114, 111, -122, -94, -87, -104, -120, 120, 94, 71, 81, 115, 126, 100, 64, - 58, 83, 118, -122, -126, 125, 125, 121, 117, 127, -118, -125, 111, 97, 94, - 99, 101, 106, 110, 109, 103, 101, 108, 122, -126, 126, 113, 107, 112, 117, - 117, 115, 114, 112, 108, 106, 112, 121, 123, 118, 115, 117, 120, 124, - -126, -122, -119, -118, -113, -100, -81, -57, -59, -123, 30, 11, 103, -96, - 115, 62, 48, 42, 50, 108, -85, -76, -112, 114, 112, -121, -92, -85, -100, - -117, 119, 85, 63, 80, 117, 126, 99, 66, 60, 82, 115, -121, -120, -121, - -124, 120, 112, 123, -119, -123, 113, 96, 90, 92, 98, 108, 115, 113, 104, - 102, 109, 124, -121, -127, 113, 105, 110, 116, 116, 114, 112, 109, 106, - 107, 114, 121, 123, 119, 116, 116, 119, 124, -125, -122, -124, -123, -118, - -107, -90, -67, -56, -80, 87, 7, 42, -117, -104, 91, 53, 46, 44, 72, -117, - -74, -89, -126, 111, 118, -113, -89, -90, -107, -124, 104, 68, 64, 98, - -127, 118, 84, 59, 68, 102, -124, -119, -121, -121, 126, 113, 114, -127, - -119, 124, 101, 88, 91, 96, 104, 114, 116, 109, 103, 104, 118, -122, -122, - 117, 103, 105, 115, 120, 118, 115, 113, 108, 104, 109, 120, 124, 122, 117, - 114, 117, 124, -124, -121, -118, -117, -113, -103, -83, -60, -52, -107, - 44, 4, 87, -98, 125, 70, 50, 45, 49, 99, -96, -77, -103, 123, 112, 126, - -102, -88, -100, -113, 124, 87, 58, 76, 118, -127, 102, 71, 65, 85, 119, - -121, -121, -118, -121, 120, 111, 119, -123, -126, 110, 92, 88, 92, 98, - 109, 117, 113, 106, 104, 113, -128, -119, -128, 111, 104, 109, 115, 119, - 119, 116, 110, 102, 103, 116, 126, 124, 117, 113, 115, 120, 125, -125, - -120, -120, -119, -115, -103, -81, -59, -57, -105, 50, 7, 84, -101, -126, - 76, 51, 40, 49, 101, -94, -80, -103, 125, 113, 124, -106, -92, -100, -112, - 124, 85, 58, 76, 116, -125, 106, 74, 63, 85, 120, -119, -118, -120, -126, - 118, 112, 120, -125, -128, 109, 91, 87, 93, 99, 110, 117, 113, 106, 104, - 114, -127, -120, 126, 110, 103, 109, 116, 119, 117, 113, 109, 102, 105, - 117, 126, 123, 115, 111, 114, 121, 127, -124, -123, -125, -124, -116, - -104, -88, -70, -55, -77, 91, 9, 45, -118, -108, 94, 59, 43, 42, 77, -116, - -79, -91, -123, 111, 116, -114, -93, -99, -110, -124, 98, 63, 65, 105, - -125, 117, 84, 65, 79, 111, -122, -118, -121, -125, 123, 112, 114, 127, - -126, 114, 94, 88, 90, 97, 105, 114, 115, 110, 105, 110, 124, -121, -125, - 115, 105, 108, 115, 117, 114, 112, 110, 104, 103, 112, 123, 125, 118, 113, - 113, 117, 125, -126, -125, -127, 127, -125, -115, -101, -88, -76, -68, - -80, 107, 24, 42, -128, -109, 97, 59, 47, 48, 79, -122, -89, -97, -124, - 115, 118, -114, -97, -102, -115, -127, 102, 71, 72, 103, 127, 117, 88, 68, - 81, 113, -121, -122, -127, -128, 122, 115, 116, 123, 125, 114, 98, 91, 94, - 100, 106, 111, 111, 108, 105, 113, 125, -125, 126, 114, 108, 111, 117, - 118, 114, 110, 108, 104, 105, 112, 118, 120, 117, 114, 113, 118, 125, - -128, 127, 124, 122, 125, -122, -111, -104, -100, -92, -79, -73, -101, 75, - 26, 82, -115, 122, 74, 55, 51, 67, 108, -110, -100, -111, -128, 117, -126, - -105, -102, -115, -125, 118, 92, 77, 87, 113, 122, 103, 79, 75, 101, -126, - -119, 127, 121, 123, 122, 118, 119, 124, 118, 102, 91, 93, 101, 106, 106, - 107, 109, 111, 114, 121, -128, 127, 119, 111, 111, 115, 116, 112, 109, - 108, 108, 106, 106, 112, 120, 121, 117, 114, 117, 122, 125, 126, 124, 124, - 126, -127, -122, -115, -110, -108, -100, -87, -77, -87, 108, 40, 60, 127, - -123, 89, 65, 60, 65, 92, -127, -107, -105, -121, 116, 119, -117, -106, - -112, -121, 123, 101, 83, 85, 108, 123, 110, 88, 80, 97, 121, -125, 126, - 119, 121, 123, 120, 119, 121, 118, 107, 96, 94, 101, 106, 106, 105, 108, - 111, 114, 120, 123, 125, 123, 116, 111, 111, 114, 113, 109, 108, 106, 105, - 108, 114, 119, 120, 116, 114, 119, 124, 126, 124, 122, 121, 123, 125, - -128, -123, -119, -116, -114, -105, -94, -86, -86, -109, 86, 49, 90, -124, - 117, 83, 64, 60, 76, 111, -118, -110, -118, 121, 114, -127, -108, -107, - -120, 125, 113, 98, 94, 102, 116, 115, 99, 87, 90, 107, 126, -127, 119, - 115, 120, 123, 122, 121, 118, 112, 103, 98, 100, 107, 111, 107, 103, 104, - 110, 119, 124, 123, 119, 116, 111, 111, 115, 117, 112, 108, 106, 106, 108, - 114, 117, 118, 116, 115, 117, 121, 124, 124, 121, 117, 118, 123, 125, 126, - -128, -125, -123, -118, -109, -99, -92, -91, -98, -113, 97, 59, 90, -126, - 118, 82, 61, 63, 84, 116, -122, -121, -127, 117, 115, -123, -106, -108, - -124, 119, 111, 105, 103, 106, 114, 113, 99, 89, 91, 107, 126, -127, 116, - 109, 115, 124, 125, 123, 117, 108, 104, 103, 106, 110, 111, 107, 105, 106, - 108, 113, 119, 121, 118, 113, 109, 112, 118, 120, 117, 109, 105, 108, 112, - 116, 117, 116, 113, 110, 112, 118, 122, 120, 118, 117, 117, 119, 122, 125, - 126, 125, 126, -124, -119, -115, -110, -104, -103, -100, -99, -103, 124, - 76, 74, 109, 118, 96, 77, 69, 76, 100, 121, -127, -123, 127, 116, 123, - -116, -113, -120, 126, 118, 113, 107, 104, 108, 113, 108, 97, 93, 100, - 115, 125, 119, 111, 114, 118, 121, 122, 119, 112, 108, 105, 106, 111, 111, - 108, 107, 107, 109, 113, 118, 117, 116, 115, 113, 112, 116, 117, 114, 111, - 108, 109, 110, 111, 113, 113, 113, 114, 113, 115, 118, 121, 120, 117, 117, - 119, 122, 124, 124, 121, 121, 125, -125, -120, -117, -118, -114, -104, - -98, -100, -103, -110, 117, 80, 80, 110, 113, 95, 79, 68, 78, 102, 121, - -126, -123, 126, 117, 123, -118, -111, -118, 125, 114, 111, 110, 109, 110, - 112, 105, 98, 96, 102, 115, 122, 117, 109, 111, 120, 123, 120, 115, 110, - 110, 109, 110, 112, 111, 107, 107, 111, 113, 116, 116, 115, 113, 113, 113, - 111, 112, 113, 111, 107, 107, 108, 111, 114, 113, 113, 114, 117, 120, 119, - 118, 117, 116, 116, 118, 118, 117, 116, 117, 119, 121, 124, 126, -128, - -124, -122, -122, -119, -111, -102, -102, -106, -110, -114, 125, 91, 82, - 104, 112, 95, 79, 73, 83, 103, 117, 123, 125, 124, 119, 122, -120, -113, - -121, 122, 116, 117, 118, 114, 108, 107, 107, 100, 97, 101, 109, 116, 114, - 107, 110, 119, 125, 124, 119, 115, 113, 113, 114, 114, 115, 112, 108, 107, - 109, 112, 114, 110, 108, 110, 110, 110, 112, 115, 114, 111, 109, 111, 115, - 116, 114, 112, 113, 113, 115, 116, 116, 115, 115, 115, 115, 118, 121, 119, - 118, 117, 118, 120, 123, 125, 125, 125, -128, -124, -119, -115, -111, - -107, -108, -108, -106, -105, -122, 93, 75, 100, 116, 100, 80, 74, 79, 95, - 112, 120, 127, -128, 119, 118, -123, -110, -114, -128, 118, 116, 117, 114, - 108, 108, 107, 103, 97, 99, 107, 116, 116, 110, 110, 119, 125, 125, 122, - 118, 114, 114, 113, 114, 116, 113, 105, 103, 108, 114, 116, 111, 107, 107, - 111, 114, 115, 115, 113, 112, 112, 111, 114, 116, 114, 112, 112, 113, 115, - 116, 117, 116, 116, 115, 114, 116, 118, 118, 117, 117, 116, 119, 122, 123, - 124, 124, 126, -128, -124, -120, -118, -117, -113, -110, -108, -107, -107, - -116, 112, 82, 91, 115, 110, 89, 78, 76, 87, 105, 117, 121, 126, 121, 115, - 125, -115, -113, -124, 122, 116, 118, 120, 116, 111, 109, 104, 99, 99, - 106, 113, 115, 110, 107, 112, 122, 126, 124, 119, 115, 114, 116, 117, 118, - 114, 108, 105, 109, 113, 115, 112, 107, 107, 109, 112, 114, 114, 112, 110, - 110, 113, 116, 118, 116, 112, 111, 113, 117, 118, 116, 115, 112, 112, 114, - 115, 116, 116, 114, 114, 117, 118, 120, 121, 122, 121, 122, 124, -128, - -125, -124, -124, -121, -117, -114, -112, -110, -108, -108, -117, 110, 81, - 92, 117, 112, 89, 79, 76, 87, 106, 117, 122, 124, 118, 111, 124, -112, - -110, -123, 121, 116, 119, 122, 118, 113, 108, 102, 98, 99, 106, 112, 114, - 108, 105, 111, 121, 125, 124, 120, 116, 115, 116, 117, 119, 118, 112, 106, - 107, 109, 111, 112, 111, 109, 109, 109, 110, 113, 116, 114, 113, 112, 113, - 114, 115, 113, 113, 113, 113, 114, 114, 115, 114, 114, 114, 114, 114, 116, - 117, 117, 117, 117, 117, 119, 121, 122, 121, 121, 124, 127, -125, -123, - -123, -120, -115, -112, -111, -109, -108, -112, 119, 87, 90, 116, 116, 94, - 81, 78, 87, 103, 113, 118, 121, 117, 112, 120, -118, -112, -123, 121, 117, - 120, 123, 121, 114, 109, 106, 101, 100, 105, 111, 113, 107, 103, 109, 119, - 124, 122, 119, 116, 116, 119, 120, 120, 118, 113, 108, 109, 113, 114, 113, - 107, 104, 107, 111, 113, 112, 112, 109, 110, 113, 116, 116, 115, 113, 111, - 112, 114, 116, 115, 113, 111, 112, 113, 116, 115, 115, 115, 114, 114, 116, - 118, 119, 119, 119, 119, 122, 123, 125, 127, -126, -124, -122, -120, -115, - -112, -111, -109, -107, -112, 117, 84, 91, 119, 118, 93, 78, 78, 87, 103, - 112, 117, 120, 116, 112, 120, -118, -112, -122, 120, 117, 122, 125, 121, - 114, 110, 107, 103, 102, 104, 110, 112, 107, 104, 110, 119, 123, 121, 118, - 117, 118, 118, 119, 120, 119, 114, 110, 111, 112, 114, 114, 109, 107, 107, - 110, 110, 112, 113, 111, 109, 111, 113, 116, 116, 114, 113, 114, 115, 116, - 116, 114, 113, 113, 113, 114, 114, 114, 114, 114, 114, 116, 120, 120, 119, - 119, 120, 122, 125, 127, -128, -126, -124, -123, -120, -115, -113, -113, - -110, -107, -112, 117, 86, 94, 122, 119, 93, 79, 81, 89, 103, 112, 116, - 118, 115, 110, 119, -117, -111, -123, 120, 117, 123, -128, 124, 115, 110, - 107, 104, 104, 106, 110, 110, 104, 103, 109, 119, 122, 119, 116, 117, 119, - 119, 120, 121, 119, 114, 112, 112, 114, 115, 113, 108, 106, 109, 110, 110, - 110, 110, 109, 110, 113, 114, 115, 115, 114, 114, 115, 116, 116, 116, 115, - 112, 113, 115, 115, 114, 114, 113, 114, 117, 117, 117, 117, 118, 119, 121, - 123, 124, 125, 126, -128, -125, -122, -120, -118, -118, -116, -112, -108, - -108, -128, 95, 88, 115, 125, 103, 84, 81, 86, 99, 111, 114, 117, 115, - 109, 113, -124, -112, -120, 121, 116, 121, -128, 127, 119, 112, 108, 106, - 103, 106, 110, 110, 106, 104, 106, 116, 122, 119, 116, 116, 117, 119, 120, - 122, 119, 115, 112, 111, 114, 116, 114, 108, 105, 106, 111, 113, 111, 109, - 108, 111, 113, 116, 116, 115, 113, 112, 114, 117, 118, 115, 113, 112, 114, - 115, 116, 114, 114, 115, 114, 116, 117, 118, 118, 118, 118, 120, 122, 123, - 124, 125, 126, -127, -124, -122, -119, -117, -116, -114, -111, -109, -121, - 101, 86, 112, 126, 107, 89, 82, 86, 98, 107, 111, 115, 116, 110, 110, 127, - -116, -120, 122, 115, 120, -128, -128, 121, 113, 110, 109, 107, 107, 109, - 111, 107, 103, 106, 115, 120, 117, 113, 115, 117, 119, 120, 119, 119, 116, - 113, 113, 115, 116, 115, 110, 106, 108, 111, 111, 110, 110, 109, 109, 112, - 115, 116, 116, 114, 114, 114, 116, 117, 116, 114, 112, 113, 115, 115, 115, - 114, 114, 114, 115, 117, 117, 118, 118, 119, 120, 122, 121, 122, 125, 126, - 127, -127, -125, -123, -120, -120, -117, -113, -110, -112, 126, 97, 94, - 119, 124, 103, 87, 83, 89, 101, 109, 111, 114, 114, 108, 114, -126, -117, - -124, 120, 116, 123, -127, 126, 118, 113, 111, 108, 108, 109, 109, 109, - 107, 104, 107, 116, 118, 115, 114, 115, 117, 118, 119, 118, 118, 115, 114, - 113, 114, 115, 113, 110, 108, 110, 114, 112, 110, 110, 111, 113, 114, 114, - 115, 114, 114, 114, 115, 116, 116, 115, 114, 114, 117, 117, 115, 114, 114, - 115, 116, 116, 116, 116, 118, 117, 119, 120, 121, 122, 123, 125, 127, - -126, -125, -123, -119, -118, -117, -114, -113, -113, 125, 96, 95, 121, - 123, 101, 88, 86, 92, 104, 109, 111, 114, 113, 108, 115, -126, -118, -126, - 118, 115, 123, -127, 126, 118, 113, 110, 110, 109, 110, 110, 110, 107, - 105, 108, 116, 118, 115, 113, 114, 117, 119, 119, 118, 119, 116, 114, 115, - 116, 117, 115, 111, 109, 113, 114, 112, 110, 108, 109, 111, 113, 114, 113, - 113, 114, 114, 115, 117, 116, 116, 116, 114, 115, 115, 114, 114, 114, 114, - 114, 115, 116, 116, 117, 117, 119, 120, 120, 121, 122, 123, 125, 127, - -127, -126, -124, -122, -122, -119, -116, -115, -116, 125, 100, 98, 119, - 122, 105, 92, 88, 94, 106, 109, 109, 113, 113, 109, 114, 126, -123, -128, - 119, 116, 123, -128, 125, 117, 112, 111, 111, 111, 110, 110, 111, 108, - 105, 109, 116, 117, 115, 113, 114, 116, 118, 117, 116, 117, 115, 113, 113, - 114, 116, 115, 111, 109, 112, 114, 113, 111, 111, 112, 113, 113, 113, 114, - 114, 114, 114, 116, 116, 116, 116, 115, 115, 116, 116, 115, 115, 116, 115, - 115, 115, 116, 117, 118, 119, 120, 120, 121, 122, 124, 125, 127, -128, - -127, -125, -122, -121, -120, -119, -117, -117, 127, 102, 98, 119, 122, - 106, 95, 90, 96, 106, 110, 110, 114, 115, 110, 114, 125, -124, -128, 119, - 115, 120, 126, 124, 118, 114, 112, 112, 111, 111, 112, 112, 109, 107, 110, - 116, 117, 115, 114, 113, 116, 118, 116, 116, 117, 116, 115, 115, 117, 117, - 116, 111, 110, 112, 113, 113, 112, 110, 111, 113, 113, 113, 114, 115, 115, - 116, 115, 116, 116, 116, 115, 115, 116, 116, 115, 116, 115, 115, 116, 116, - 116, 117, 117, 118, 119, 120, 121, 121, 124, 125, 127, -128, -127, -125, - -124, -122, -121, -120, -118, -120, 119, 100, 107, 121, 116, 103, 96, 95, - 100, 109, 110, 111, 115, 113, 111, 116, 126, -127, 124, 117, 114, 121, - 125, 122, 116, 113, 111, 111, 112, 112, 113, 111, 107, 107, 112, 116, 117, - 114, 112, 113, 117, 117, 116, 115, 115, 115, 115, 115, 115, 115, 114, 111, - 111, 114, 115, 113, 111, 111, 112, 113, 113, 113, 114, 115, 114, 114, 115, - 115, 116, 116, 115, 116, 116, 117, 115, 115, 115, 116, 116, 115, 116, 117, - 118, 120, 120, 120, 121, 122, 123, 125, 127, -128, -128, -127, -125, -123, - -123, -124, -125, -126, 118, 105, 108, 118, 114, 105, 102, 99, 105, 112, - 111, 112, 116, 115, 113, 117, 122, 124, 122, 116, 114, 119, 121, 119, 115, - 113, 111, 112, 112, 112, 113, 112, 110, 111, 113, 116, 116, 114, 112, 113, - 116, 116, 115, 114, 114, 114, 115, 114, 113, 115, 114, 114, 113, 114, 114, - 113, 113, 112, 113, 114, 115, 113, 114, 114, 115, 116, 116, 116, 116, 116, - 117, 116, 117, 116, 115, 115, 115, 116, 116, 116, 117, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 127, -127, -126, -127, -127, -127, - -126, 125, 112, 107, 116, 117, 111, 108, 104, 105, 112, 113, 113, 116, - 117, 113, 114, 118, 120, 121, 118, 112, 114, 118, 118, 115, 113, 111, 112, - 114, 113, 114, 115, 113, 111, 113, 115, 115, 115, 113, 110, 113, 114, 113, - 114, 114, 113, 114, 115, 115, 117, 116, 115, 114, 114, 114, 113, 114, 113, - 113, 113, 113, 113, 114, 114, 114, 115, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 115, 116, 118, 117, 117, 117, 118, 118, 119, 120, 121, 122, - 123, 123, 125, 126, 127, 126, 126, 126, 125, 126, 127, 126, 120, 114, 112, - 117, 116, 112, 110, 108, 110, 115, 114, 114, 117, 116, 114, 115, 117, 118, - 118, 116, 113, 114, 116, 115, 115, 112, 112, 114, 115, 115, 114, 114, 113, - 114, 114, 114, 114, 114, 113, 112, 113, 114, 114, 114, 114, 114, 116, 117, - 115, 116, 116, 115, 115, 114, 114, 114, 115, 113, 113, 115, 115, 115, 115, - 115, 115, 116, 117, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 118, - 118, 117, 117, 117, 118, 119, 120, 120, 121, 121, 122, 123, 124, 124, 124, - 124, 123, 123, 123, 124, 124, 122, 119, 118, 117, 116, 117, 115, 113, 113, - 114, 113, 115, 115, 115, 115, 115, 115, 115, 116, 115, 114, 113, 113, 114, - 114, 113, 112, 114, 115, 114, 114, 113, 113, 115, 115, 113, 114, 114, 114, - 113, 113, 114, 114, 115, 114, 115, 116, 116, 115, 115, 115, 115, 115, 115, - 114, 115, 115, 114, 114, 115, 115, 115, 115, 115, 115, 117, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 117, 116, 116, 117, 117, 117, 117, 118, 119, - 119, 119, 120, 120, 122, 121, 121, 121, 121, 121, 121, 120, 121, 122, 121, - 121, 119, 118, 118, 119, 118, 117, 115, 116, 116, 115, 115, 115, 116, 116, - 115, 116, 115, 115, 115, 114, 114, 114, 114, 114, 113, 112, 115, 115, 113, - 114, 113, 114, 115, 115, 114, 114, 114, 113, 113, 114, 114, 114, 115, 114, - 114, 116, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 114, 115, 115, - 115, 116, 116, 116, 116, 115, 115, 116, 116, 116, 116, 116, 116, 117, 117, - 117, 116, 117, 117, 117, 117, 117, 117, 118, 118, 119, 118, 119, 120, 120, - 119, 119, 119, 120, 120, 119, 119, 119, 120, 119, 120, 119, 118, 118, 118, - 117, 117, 117, 117, 116, 116, 115, 117, 116, 115, 115, 115, 115, 115, 115, - 114, 115, 114, 114, 114, 114, 113, 113, 113, 113, 115, 114, 114, 113, 114, - 114, 115, 114, 114, 115, 115, 114, 114, 114, 114, 114, 115, 115, 115, 116, - 115, 115, 115, 115, 116, 115, 115, 115, 115, 116, 115, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 117, 117, 117, 117, 117, 117, - 118, 119, 118, 118, 118, 119, 119, 119, 118, 118, 118, 118, 118, 118, 119, - 119, 118, 118, 118, 119, 119, 119, 118, 117, 117, 117, 117, 117, 117, 116, - 116, 116, 116, 116, 116, 116, 115, 117, 116, 115, 114, 114, 114, 114, 114, - 114, 114, 116, 115, 114, 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, - 116, 117, 115, 115, 116, 115, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 117, 117, 117, 117, 118, 117, 117, 117, 117, 117, 117, - 117, 118, 117, 118, 118, 119, 118, 118, 118, 118, 117, 117, 117, 117, 117, - 117, 117, 119, 117, 117, 117, 117, 117, 116, 116, 116, 116, 116, 117, 116, - 116, 116, 116, 116, 116, 116, 115, 115, 116, 115, 115, 115, 115, 115, 116, - 116, 116, 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 116, 117, 115, - 115, 115, 116, 115, 115, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 117, 117, - 118, 117, 117, 117, 117, 117, 117, 116, 116, 117, 117, 117, 118, 117, 117, - 117, 118, 117, 117, 117, 117, 117, 117, 118, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 116, 116, 118, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 115, 116, 116, 116, 115, 115, 115, 115, 116, 116, 116, 117, 116, 116, 115, - 115, 116, 115, 115, 115, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 118, 117, 117, 117, 117, 117, 117, - 117, 116, 116, 116, 117, 117, 116, 116, 116, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 117, 118, 116, 116, - 116, 116, 117, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 115, 115, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 117, 117, 117, 117, 118, 117, 116, 117, 117, 117, 117, - 116, 116, 116, 116, 117, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 118, 117, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 117, 117, 116, 116, 116, 116, 116, - 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 118, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 117, 117, 116, 116, 116, 116, 117, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 117, 116, 116, 116, 116, 116, 116, 116 - diff --git a/winsup/testsuite/winsup.api/devzero.c b/winsup/testsuite/winsup.api/devzero.c deleted file mode 100644 index 948b0bff5..000000000 --- a/winsup/testsuite/winsup.api/devzero.c +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include -#include -#include -#include - -int -main(int argc, char **argv) -{ - int fd, r, l; - char buf[1024]; - char *v; - - fd = open("/dev/zero", O_RDONLY); - if (fd < 0) - { - fprintf(stderr, "Unable to open /dev/zero for reading\n"); - perror("The error was"); - exit(1); - } - - l = read(fd, buf, 1024); - if (l != 1024) - { - fprintf(stderr, "Asked to read 1024 bytes, got %d\n", l); - exit(1); - } - - for (r=0; r<1024; r++) - if (buf[r] != 0) - { - fprintf(stderr, "/dev/zero returned a byte of %02x at offset %d\n", - buf[r], r); - exit(1); - } - - l = lseek(fd, 4096, 0); - if (l != 0) - { - fprintf(stderr, "l == %d\n", l); - exit(1); - } - - l = close(fd); - if (l != 0) - { - fprintf(stderr, "close: returned %d\n", l); - perror("The error was"); - exit(1); - } - - fd = open("/dev/zero", O_WRONLY); - if (fd < 0) - { - fprintf(stderr, "Unable to open /dev/zero for writing\n"); - perror("The error was"); - exit(1); - } - - l = write(fd, buf, 1024); - if (l != 1024) - { - fprintf(stderr, "Asked to write 1024 bytes, got %d\n", l); - exit(1); - } - - l = close(fd); - if (l != 0) - { - fprintf(stderr, "close: returned %d\n", l); - perror("The error was"); - exit(1); - } - - fd = open("/dev/zero", O_RDWR); - v = (char *)mmap(0, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); - if (v == (char *)-1) - { - fprintf(stderr, "mmap r/w /dev/zero failed\n"); - perror("The error was"); - exit(1); - } - - for (r=0; r<65536; r++) - if (v[r] != 0) - { - fprintf(stderr, "mmap'd r/w /dev/zero has byte %d at offset %d\n", - v[r], r); - exit(1); - } - munmap(v, 65536); - close(fd); - - fd = open("/dev/zero", O_RDONLY); - v = (char *)mmap(0, 65536, PROT_READ, MAP_SHARED, fd, 0); - if (v == (char *)-1) - { - fprintf(stderr, "mmap /dev/zero r/o failed\n"); - perror("The error was"); - exit(1); - } - - for (r=0; r<65536; r++) - if (v[r] != 0) - { - fprintf(stderr, "mmap'd r/o /dev/zero has byte %d at offset %d\n", - v[r], r); - exit(1); - } - munmap(v, 65536); - close(fd); - - exit(0); -} diff --git a/winsup/testsuite/winsup.api/iospeed.c b/winsup/testsuite/winsup.api/iospeed.c deleted file mode 100644 index 56bf715cf..000000000 --- a/winsup/testsuite/winsup.api/iospeed.c +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -int verbose = 0; - -void -v(char *fmt, ...) -{ - va_list ap; - if (!verbose) return; - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); - va_end(ap); -} - -#define TSIZE (1024 * 1024 * 16) - -unsigned long start_tic; - -void -start(FILE *f) -{ - fseek(f, 0, SEEK_SET); - start_tic = GetTickCount(); -} - -void -end() -{ - unsigned long end_tic = GetTickCount(); - printf("%6ld", end_tic - start_tic); -} - -void -test(int linesz, int cr) -{ - FILE *f = fopen("iospeed.dat", "wb"); - char buf[65536]; - int i, fd; - - memset(buf, 'x', linesz); - buf[linesz-1] = '\n'; - if (cr) - buf[linesz-2] = '\r'; - for (i=0; i 0); - end(); - - start(f); - while (fgets(buf, 64436, f)); - end(); - - f = fopen("iospeed.dat", "rb"); - fd = fileno(f); - - for (i=0; i 0); - end(); - - start(f); - while (fgets(buf, 64436, f)); - end(); - - printf("\n"); -} - -int -main(int argc, char **argv) -{ - if (argc > 1 && strcmp(argv[1],"-v") == 0) - verbose = 1; - - setbuf(stdout, 0); - - printf(" ----- text ----- ---- binary ----\n"); - printf("linesz cr getc fread fgets getc fread fgets\n"); - - test(4, 0); - test(64, 0); - test(4096, 0); - test(4, 1); - test(64, 1); - test(4096, 1); - - remove ("iospeed.dat"); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/known_bugs.tcl b/winsup/testsuite/winsup.api/known_bugs.tcl deleted file mode 100644 index e063ee6bb..000000000 --- a/winsup/testsuite/winsup.api/known_bugs.tcl +++ /dev/null @@ -1,4 +0,0 @@ -set xfail_list [list dup03 \ - fcntl05 setgroups01 setuid02 \ - ulimit01 unlink08 \ - sample-fail sample-miscompile] diff --git a/winsup/testsuite/winsup.api/ltp/access01.c b/winsup/testsuite/winsup.api/ltp/access01.c deleted file mode 100644 index ae9be948a..000000000 --- a/winsup/testsuite/winsup.api/ltp/access01.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : access01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for access(2) using F_OK, - * R_OK, W_OK and X_OK arguments. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 6 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) access(2) returns 0 for F_OK...(See Description) - * 2.) access(2) returns 0 for R_OK...(See Description) - * 3.) access(2) returns 0 for W_OK...(See Description) - * 4.) access(2) returns 0 for X_OK...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the access(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * access(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create a temp directory and cd to it. - * Creat a temp file wil read, write and execute permissions. - * - * Test: - * Loop if the proper options are given. - * Execute system call with F_OK on tmp file - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * Execute system call with X_OK on tmp file... - * Execute system call with W_OK on tmp file... - * Execute system call with R_OK on tmp file... - * - * Cleanup: - * Print errno log - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="access01"; /* Test program identifier. */ -int TST_TOTAL=4; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - - -char Fname[255]; - - -/*********************************************************************** - * Main - ***********************************************************************/ -int main(int ac, char **av) -{ - struct test_case_t { - char *file; - unsigned mode; - const char *string; - int experrno; - } Test_cases[] = { - { Fname, F_OK, "F_OK", 0 }, - { Fname, X_OK, "X_OK", 0 }, - { Fname, W_OK, "W_OK", 0 }, - { Fname, R_OK, "R_OK", 0 }, - }; - - int Ntc = sizeof(Test_cases) / sizeof(struct test_case_t); - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int tc; - - TST_TOTAL=Ntc; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (tc=0; tc -#include -#include - - -#include "test.h" -#include "usctest.h" - - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - -char *get_high_address(); - -const char *TCID="access03"; /* Test program identifier. */ -int TST_TOTAL=8; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={EFAULT, 0}; /* List must end with 0 */ - -int main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos. */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * R_OK on low pointer (-1) for path - */ - - - /* Call access(2) */ - TEST(access( (char *)-1,R_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char *)-1,R_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char *)-1,R_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char *)-1,R_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * W_OK on low pointer (-1) for path - */ - - - /* Call access(2) */ - TEST(access( (char *)-1,W_OK)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char *)-1,W_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char *)-1,W_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char *)-1,W_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * X_OK on low pointer (-1) for path - */ - - - /* Call access(2) */ - TEST(access( (char *)-1,X_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char*)-1,X_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char*)-1,X_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char*)-1,X_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * F_OK on low pointer (-1) for path - */ - - - /* Call access(2) */ - TEST(access( (char *)-1,F_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char*)-1,F_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char*)-1,F_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char*)-1,F_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * R_OK on high pointer (sbrk(0)+1) for path - */ - - - /* Call access(2) */ - TEST(access(get_high_address(),R_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char*)sbrk(0)+1,R_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char*)sbrk(0)+1,R_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char*)sbrk(0)+1,R_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * W_OK on high pointer (sbrk(0)+1) for path - */ - - - /* Call access(2) */ - TEST(access(get_high_address(),W_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char*)sbrk(0)+1,W_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char*)sbrk(0)+1,W_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char*)sbrk(0)+1,W_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * X_OK on high pointer (sbrk(0)+1) for path - */ - - - /* Call access(2) */ - TEST(access(get_high_address(),X_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access(high_address,X_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access(high_address,X_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access(high_address,X_OK) succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: - * F_OK on high pointer (sbrk(0)+1) for path - */ - - - /* Call access(2) */ - TEST(access(get_high_address(),F_OK)); - - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, - "access((char*)sbrk(0)+1,F_OK) failed as expected with errno %d (EFAULT) : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, - "access((char*)sbrk(0)+1,F_OK) failed with errno %d : %s but expected %d (EFAULT)", - TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, - "access((char*)sbrk(0)+1,F_OK) succeeded unexpectedly."); - - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make and change to a temporary directory */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove the temporary directory and exit with - return code appropriate for results */ - tst_rmdir(); - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/access04.c b/winsup/testsuite/winsup.api/ltp/access04.c deleted file mode 100644 index 069458886..000000000 --- a/winsup/testsuite/winsup.api/ltp/access04.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: access01 - * - * Test Description: - * Verify that access() succeeds to check the existance of a file if - * search access is permitted on the pathname of the specified file. - * - * Expected Result: - * access() should return 0 value and the specified file should exist - * on the file system. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * access01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTDIR "testdir" -#define TESTFILE "testdir/testfile" -#define DIR_MODE S_IRWXU | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="access01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* struct buffer for stat(2) */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call access(2) to check the existence of a - * file under specified path. - */ - TEST(access(TESTFILE, F_OK)); - - /* check return code of access(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, - "access(%s, F_OK) Failed, errno=%d : %s", - TESTFILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Use stat(2) to cross-check the - * existance of testfile under - * specified path. - */ - if (stat(TESTFILE, &stat_buf) < 0) { - tst_resm(TFAIL, "stat() on %s Failed, errno=%d", - TESTFILE, TEST_ERRNO); - } else { - tst_resm(TPASS, "Functionality of access(%s, " - "F_OK) successful", TESTFILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - * - * Create a temporary directory and change directory to it. - * Create a test directory and a file under test directory. - * Modify the mode permissions of testfile. - */ -void -setup() -{ - int fd; /* File handle for testfile */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Check that the test process id is not root/super-user */ - if (geteuid() == 0) { - tst_brkm(TBROK, NULL, "Must be non-root/super for this test!"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a test directory under temporary directory */ - if (mkdir(TESTDIR, DIR_MODE) < 0) { - tst_brkm(TBROK, cleanup, - "mkdir(%s, %#o) Failed, errno=%d : %s", - TESTDIR, DIR_MODE, errno, strerror(errno)); - } - - /* Make sure test directory has search permissions set */ - if (chmod(TESTDIR, DIR_MODE) < 0) { - tst_brkm(TBROK, cleanup, - "chmod(%s, %#o) Failed, errno=%d : %s", - TESTDIR, DIR_MODE, errno, strerror(errno)); - } - - /* Creat a test file under above directory created */ - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - - /* Close the testfile created above */ - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Change the mode permissions on the testfile */ - if (chmod(TESTFILE, 0) < 0) { - tst_brkm(TBROK, cleanup, - "chmod(%s, 0) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * Delete the test directory/file and temporary directory - * created in the setup. - */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/access05.c b/winsup/testsuite/winsup.api/ltp/access05.c deleted file mode 100644 index 757c64f33..000000000 --- a/winsup/testsuite/winsup.api/ltp/access05.c +++ /dev/null @@ -1,424 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: access03 - * - * Test Description: - * Verify that, - * 1. access() fails with -1 return value and sets errno to EACCES - * if the permission bits of the file mode do not permit the - * requested (Read/Write/Execute) access. - * 2. access() fails with -1 return value and sets errno to EINVAL - * if the specified access mode argument is invalid. - * 3. access() fails with -1 return value and sets errno to EFAULT - * if the pathname points outside allocate address space for the - * process. - * 4. access() fails with -1 return value and sets errno to ENOENT - * if the specified file doesn't exist (or pathname is NULL). - * 5. access() fails with -1 return value and sets errno to ENAMETOOLONG - * if the pathname size is > PATH_MAX characters. - * - * Expected Result: - * access() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * access03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be run by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define INV_OK -1 -#define TEST_FILE1 "test_file1" -#define TEST_FILE2 "test_file2" -#define TEST_FILE3 "test_file3" -#define TEST_FILE4 "test_file4" - -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -int no_setup(); -int setup1(); /* setup() to test access() for EACCES */ -int setup2(); /* setup() to test access() for EACCES */ -int setup3(); /* setup() to test access() for EACCES */ -int setup4(); /* setup() to test access() for EINVAL */ -int longpath_setup(); /* setup function to test access() for ENAMETOOLONG */ - -char Longpathname[PATH_MAX+2]; -char High_address_node[64]; - -struct test_case_t { /* test case structure */ - const char *pathname; - int a_mode; - const char *desc; - int exp_errno; - int (*setupfunc)(); -} Test_cases[] = { - { TEST_FILE1, R_OK, "Read Access denied on file", EACCES, setup1 }, - { TEST_FILE2, W_OK, "Write Access denied on file", EACCES, setup2 }, - { TEST_FILE3, X_OK, "Execute Access denied on file", EACCES, setup3 }, - { TEST_FILE4, INV_OK, "Access mode invalid", EINVAL, setup4 }, - { High_address_node, R_OK, "Address beyond address space", EFAULT, no_setup }, - { (char *)-1, R_OK, "Negative address", EFAULT, no_setup }, - { "", W_OK, "Pathname is empty", ENOENT, no_setup }, - { Longpathname, R_OK, "Pathname too long", ENAMETOOLONG, longpath_setup }, - { NULL, 0, NULL, 0, no_setup } -}; - -const char *TCID="access03"; /* Test program identifier. */ -int TST_TOTAL=8; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EACCES, EFAULT, EINVAL, ENOENT, ENAMETOOLONG, 0}; - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ -char *get_high_address (void); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *file_name; /* name of the testfile */ - const char *test_desc; /* test specific message */ - int access_mode; /* specified access mode for testfile */ - int ind; /* counter for testcase looping */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - file_name = Test_cases[ind].pathname; - access_mode = Test_cases[ind].a_mode; - test_desc = Test_cases[ind].desc; - - if (file_name == High_address_node) { - file_name = (char *)get_high_address(); - } - - /* - * Call access(2) to test different test conditions. - * verify that it fails with -1 return value and - * sets appropriate errno. - */ - TEST(access(file_name, access_mode)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "access() returned %d, " - "expected -1, errno:%d", TEST_RETURN, - Test_cases[ind].exp_errno); - continue; - } - - TEST_ERROR_LOG(TEST_ERRNO); - - /* - * Call a function to verify whether - * the specified file has specified - * access mode. - */ - if (TEST_ERRNO == Test_cases[ind].exp_errno) { - tst_resm(TPASS, "access() fails, %s, errno:%d", - test_desc, TEST_ERRNO); - } else { - tst_resm(TFAIL, "access() fails, %s, errno:%d, " - "expected errno:%d", test_desc, - TEST_ERRNO, Test_cases[ind].exp_errno); - } - } /* Test Case Looping */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - * - * Create a temporary directory and change directory to it. - * Call individual test specific setup functions. - */ -void -setup() -{ - int ind; /* counter for testsetup functions */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Check that the test process id is not root/super-user */ - if (geteuid() == 0) { - tst_brkm(TBROK, NULL, "Must be non-root/super for this test!"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* call individual setup functions */ - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - Test_cases[ind].setupfunc(); - } -} - -/* - * no_setup() - some test conditions do not need any setup. - * Hence, this function simply returns 0. - */ -int -no_setup() -{ - return 0; -} - -/* - * setup1() - Setup function to test access() for return value -1 - * and errno EACCES when read access denied for specified - * testfile. - * - * Creat/open a testfile and close it. - * Deny read access permissions on testfile. - * This function returns 0. - */ -int -setup1() -{ - int fd1; /* file handle for testfile */ - - /* Creat a test file under above directory created */ - if ((fd1 = open(TEST_FILE1, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEST_FILE1, FILE_MODE, errno, strerror(errno)); - } - - /* Close the testfile created above */ - if (close(fd1) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - } - - /* Change mode permissions on testfile */ - if (chmod(TEST_FILE1, 0333) < 0) { - tst_brkm(TBROK, cleanup, "chmod() failed on %s, errno=%d", - TEST_FILE1, errno); - } - - return 0; -} - -/* - * setup2() - Setup function to test access() for return value -1 and - * errno EACCES when write access denied on testfile. - * - * Creat/open a testfile and close it. - * Deny write access permissions on testfile. - * This function returns 0. - */ -int -setup2() -{ - int fd2; /* file handle for testfile */ - - /* Creat a test file under above directory created */ - if ((fd2 = open(TEST_FILE2, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEST_FILE2, FILE_MODE, errno, strerror(errno)); - } - - /* Close the testfile created above */ - if (close(fd2) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - TEST_FILE2, errno, strerror(errno)); - } - - /* Change mode permissions on testfile */ - if (chmod(TEST_FILE2, 0555) < 0) { - tst_brkm(TBROK, cleanup, "chmod() failed on %s, errno=%d", - TEST_FILE2, errno); - } - - return 0; -} - -/* - * setup3() - Setup function to test access() for return value -1 and - * errno EACCES when execute access denied on testfile. - * - * Creat/open a testfile and close it. - * Deny search access permissions on testfile. - * This function returns 0. - */ -int -setup3() -{ - int fd3; /* file handle for testfile */ - - /* Creat a test file under above directory created */ - if ((fd3 = open(TEST_FILE3, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEST_FILE3, FILE_MODE, errno, strerror(errno)); - } - - /* Close the testfile created above */ - if (close(fd3) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - TEST_FILE3, errno, strerror(errno)); - } - - /* Change mode permissions on testfile */ - if (chmod(TEST_FILE3, 0666) < 0) { - tst_brkm(TBROK, cleanup, "chmod() failed on %s, errno=%d", - TEST_FILE3, errno); - } - - return 0; -} - -/* - * setup4() - Setup function to test access() for return value -1 - * and errno EINVAL when specified access mode argument is - * invalid. - * - * Creat/open a testfile and close it. - * This function returns 0. - */ -int -setup4() -{ - int fd4; /* file handle for testfile */ - - /* Creat a test file under above directory created */ - if ((fd4 = open(TEST_FILE4, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEST_FILE4, FILE_MODE, errno, strerror(errno)); - } - - /* Close the testfile created above */ - if (close(fd4) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - TEST_FILE4, errno, strerror(errno)); - } - - return 0; -} - -/* - * longpath_setup() - setup to create a node with a name length exceeding - * the MAX. length of PATH_MAX. - */ -int -longpath_setup() -{ - int ind; - - for (ind = 0; ind <= (PATH_MAX + 1); ind++) { - Longpathname[ind] = 'a'; - } - - return 0; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * Delete the test directory/file and temporary directory - * created in the setup. - */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/alarm01.c b/winsup/testsuite/winsup.api/ltp/alarm01.c deleted file mode 100644 index 187e488c9..000000000 --- a/winsup/testsuite/winsup.api/ltp/alarm01.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : alarm01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for alarm(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) alarm(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the alarm(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * alarm(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="alarm01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call alarm(2) - */ - TEST(alarm(1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - tst_resm(TFAIL, "alarm(1) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "alarm(1) returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - void trapper(); - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - signal(SIGALRM, trapper); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -void -trapper(sig) -int sig; -{ - signal(SIGALRM, trapper); -} - diff --git a/winsup/testsuite/winsup.api/ltp/alarm02.c b/winsup/testsuite/winsup.api/ltp/alarm02.c deleted file mode 100644 index 03a41b4f7..000000000 --- a/winsup/testsuite/winsup.api/ltp/alarm02.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : alarm02 - * - * TEST TITLE : Boundary Value Test for alarm(2) - * - * PARENT DOCUMENT : almtds02 - * - * TEST CASE TOTAL : 3 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * BINARY LOCATION : CUTS_BIN/rf_tests/sys - * - * SOURCE LOCATION : CUTS_SRC/src/tests/sys - * - * AUTHOR : Billy Jean Horne - * - * CO-PILOT : Kathy Olmsted - * - * DATE STARTED : 06/01/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * Test Case One - A call to alarm() shall not return an error if - * seconds is a -1. - * Test FAILS if a non-zero value is returned. - * Test Case Two - A call to alarm() shall not return an error if - * seconds is the maximum unsigned integer (2**63). - * Test FAILS if a non-zero value is returned. - * Test Case Three - A call to alarm() shall not return an error if - * seconds is the maximum unsigned integer plus 1 ((2**63)+1). - * Test FAILS if a non-zero value is returned. - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * DETAILED DESCRIPTION - * - * Setup: - * Define a cleanup function. - * - * Test: - * Loop for each test case. - * Execute alarm (0) system call to clear previous alarm. - * Check return code, if system call failed (return=-1) - * Issue a BROK message and exit the test. - * Call alarm() with boundary values for seconds. - * Verify that returned value is as expected. - * Report results. - * - * Cleanup: - * - */ -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" /* required for usctest */ - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void alarm_received(); - - - -const char *TCID="alarm02"; /* Test program identifier. */ -int TST_TOTAL=3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_ * routines */ - -int received_alarm = 0; /* Indicates a SIGALRM was received */ - -/************************************************************ - * Main program - ***********************************************************/ - -int -main(int ac, char **av) -{ - - /* Parameters for usc code */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parameters for alarm test */ - const char *buf[] = { "-1", "ULONG_MAX", "ULONG_MAX+1"}; - unsigned long int sec[] = {-1, ULONG_MAX, ULONG_MAX+1}; - int exp[] = {0,0,0}; - int i; - - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - - setup(); - - /*************************************************************** - * check looping state - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - - Tst_count=0; - - for (i=0;i -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - -const char *TCID="alarm03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call alarm(2) - */ - TEST(alarm(100)); - - switch ( fork()) { - case -1: - tst_brkm(TBROK, cleanup, "fork failed, errno:%d %s", - errno, strerror(errno)); - break; - - case 0: - TEST( alarm(0) ); - - if ( TEST_RETURN != 0 ) - tst_resm(TFAIL, - "alarm(100), fork, alarm(0) child's alarm returned %d", - TEST_RETURN); - else if ( STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, - "alarm(100), fork, alarm(0) child's alarm returned %d", - TEST_RETURN); - - exit(0); - break; - - default: - Tst_count++; - TEST( alarm(0) ); - if ( TEST_RETURN <= 0 || TEST_RETURN > 100 ) - tst_resm(TFAIL, - "alarm(100), fork, alarm(0) parent's alarm returned %d", - TEST_RETURN); - - else if ( STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, - "alarm(100), fork, alarm(0) parent's alarm returned %d", - TEST_RETURN); - - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - void trapper(); - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - signal(SIGALRM, trapper); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -void -trapper(sig) -int sig; -{ - signal(SIGALRM, trapper); -} - diff --git a/winsup/testsuite/winsup.api/ltp/alarm07.c b/winsup/testsuite/winsup.api/ltp/alarm07.c deleted file mode 100644 index a9f269522..000000000 --- a/winsup/testsuite/winsup.api/ltp/alarm07.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: alarm03 - * - * Test Description: - * Check the functionality of the alarm() when the time input - * parameter is non-zero and the process does a fork. - * - * Expected Result: - * The alarm request should be cleared in the child process. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * - * Usage: - * alarm03 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID="alarm03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int almreceived = 0; /* flag to indicate SIGALRM received or not */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ -void sigproc(int sig); /* signal catching function */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int time_sec = 3; /* time for which alarm is set */ - int sleep_time = 5; /* waiting time for the SIGALRM signal */ - pid_t cpid; /* child process id */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call First alarm() with non-zero time parameter - * 'time_sec' to send SIGALRM to the process. - */ - TEST(alarm(time_sec)); - - /* Now, fork a child process */ - cpid = fork(); - if (cpid < 0) { - tst_resm(TFAIL, "fork() fails to create child, " - "errno:%d", errno); - } - - /* Wait for signal SIGALRM to be generated */ - sleep(sleep_time); - - if (STD_FUNCTIONAL_TEST) { - if (cpid == 0) { /* Child process */ - /* - * For child process if almreceived is 0 - * means alarm request is cleared. - */ - if (almreceived == 0) { - tst_resm(TPASS, "Functionality of " - "alarm(%u) successful", - time_sec); - } else { - tst_resm(TFAIL, "alarm request not " - "cleared in child, " - "almreceived:%d", almreceived); - } - } else { /* Parent process */ - /* Wait for child to complete execution */ - wait(0); - } - } else { - tst_resm(TPASS, "call returned %d", TEST_RETURN); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Setup signal handler to catch SIGALRM signal. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Set the signal catching function */ - if (signal(SIGALRM, sigproc) == SIG_ERR) { - tst_brkm(TFAIL, cleanup, - "signal() fails to catch SIGALARM, errno=%d", - errno); - } -} - - -/* - * sigproc(int) - This function defines the action that has to be taken - * when the SIGALRM signal is caught. - * It also sets the variable which is used to check whether the - * alarm system call was successful. - */ -void -sigproc(int sig) -{ - almreceived = almreceived + 1; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/asyncio02.c b/winsup/testsuite/winsup.api/ltp/asyncio02.c deleted file mode 100644 index 36c03b449..000000000 --- a/winsup/testsuite/winsup.api/ltp/asyncio02.c +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/************************************************************ - * OS Test - Silicon Graphics, Inc. - * Mendota Heights, Minnesota - * - * TEST IDENTIFIER: aiotcs02: write/close flushes data to the file - * - * PARENT DOCUMENT: aiotds01: kernel i/o - * - * AUTHOR: Barrie Kletscher - * - * CO-PILOT: Dave Baumgartner - * - * TEST ITEMS: - * for each open flags set used: - * 1. Multiple writes to a file work as specified for - * more than BUFSIZ bytes. - * 2. Multiple writes to a file work as specified for - * BUFSIZ bytes. - * 3. Multiple writes to a file work as specified for - * lower than BUFSIZ bytes. - * - * INPUT SPECIFICATIONS: - * Standard parse_opts supported options. - * - * OUTPUT SPECIFICATIONS - * Standard tst_res output format - * - * ENVIRONMENTAL NEEDS: - * This program uses the environment variable TMPDIR for the location - * of the temporary directory. - * - * - * SPECIAL PROCEDURAL REQUIREMENTS: - * The program must be linked with tst_*.o and parse_opts.o. - * - * INTERCASE DEPENDENCIES: - * NONE. - * - * DETAILED DESCRIPTION: - * Attempt to get some memory to work with. - * Call testrun writing (BUFSIZ + 1) bytes - * Call testrun writing BUFSIZ bytes - * Repeated call to testrun() with decreasing write sizes - * less than BUFSIZ - * End - * - * Start testrun() - * Attempt to open a temporary file. - * Write the memory to the file. - * Attempt to close the file which also flushes the buffers. - * Now check to see if the number of bytes written is the - * same as the number of bytes in the file. - * Cleanup - * - * BUGS: - * NONE. - * -************************************************************/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -#define FLAG O_RDWR | O_CREAT | O_TRUNC /* Flags used when opening temp tile */ -#define MODE 0777 /* Mode to open file with */ -#define WRITES 10 /* Number of times buffer is written */ -#define DECR 1000 /* Number of bytes decremented between */ - /* Calls to testrun() */ -#define OK -1 /* Return value from testrun() */ - -#define FNAME1 "aio02.1" -#define FNAME2 "aio02.2" -#define FNAME3 "aio02.3" - -#define ERR_MSG1 "Bytes in file not equal to bytes written." -#define ERR_MSG2 "Bytes in file (%d) not equal to bytes written (%d)." - -char *dp; /* pointer to area of memory */ - -void setup(); -void cleanup(void) __attribute__((noreturn)); -int testrun(int flag, int bytes, int ti); - -const char *TCID="asyncio02"; /* Test program identifier. */ -int TST_TOTAL=6; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* variable used to turn off tst_res buffering */ - -extern int errno; - -int exp_enos[]={0}; /* Array of expected errnos */ -char mesg[150]; -const char *filename; /* name of the temporary file */ - -char *Progname; -int Open_flags; - -int Flags[] = { - O_RDWR | O_CREAT | O_TRUNC, - O_RDWR | O_CREAT | O_TRUNC -}; - -int Num_flags; - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int ac, char **av) -{ - - int i; /* counter */ - int ret_val; /* return value from testrun call */ - int eok; /* everything is ok flag */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int flag_cnt; - - Tst_nobuf=1; - Num_flags = sizeof(Flags)/sizeof(int); - TST_TOTAL= 3 * Num_flags; - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (flag_cnt=0; flag_cnt= 0; i -= DECR) { - if((ret_val = testrun(Flags[flag_cnt],i,3)) != OK) { - char output[80]; /* local output char string */ - - (void)sprintf(output,ERR_MSG2,ret_val,i*WRITES); - tst_resm(TFAIL,output); - } - } - - if ( eok && STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, - "Less than BUFSIZE bytes multiple synchronous writes to a file checks out ok"); - - } - } - cleanup(); - - return 0; -} /* end main() */ - -/*********************************************************** - * - * This function does the actual running of the tests. - * - ***********************************************************/ -int -testrun(int flag, int bytes, int ti) -{ - - void cleanup(); - - int fildes, /* temporary file's descriptor */ - i; /* counter */ - - int ret; - - struct stat buffer; /* buffer of memory required for stat command */ - - /* - * Attempt to open a temporary file. - */ - - if((fildes = open(filename,flag,MODE)) == -1) { - sprintf(mesg, "open failed, errno:%d", errno); - tst_brkm(TBROK, cleanup, mesg); - } - - /* - * Write the memory to the file. - */ - - for(i = 0; i < WRITES; i++) { - TEST( write(fildes,dp,(unsigned)bytes) ); - - if( TEST_RETURN == -1) { - sprintf(mesg, "write failed, errno:%d", errno); - tst_brkm(TBROK, cleanup, mesg); - } - } /* end for() */ - - /* - * Attempt to close the file which also flushes the buffers. - */ - - if(close(fildes) == -1) { - sprintf(mesg, "close failed, errno:%d", errno); - tst_brkm(TBROK, cleanup, mesg); - } - - ret=OK; - if ( STD_FUNCTIONAL_TEST ) { - - /* - * Now check to see if the number of bytes written is the - * same as the number of bytes in the file. - */ - - if(stat(filename,&buffer) == -1) { - sprintf(mesg, "stat failed, errno:%d", errno); - tst_brkm(TBROK, cleanup, mesg); - } - - - if(buffer.st_size != (off_t)(bytes * WRITES)) { - ret=(int)buffer.st_size; - } - } - - if ( unlink(filename) == -1 ) { - sprintf(mesg, "unlink failed, errno:%d", errno); - tst_brkm(TBROK, cleanup, mesg); - } - - return ret; - -} /* end testrun() */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - /* Indicate which errnos are expected */ - TEST_EXP_ENOS(exp_enos); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* - * Attempt to get some memory to work with. - */ - - if((dp = (char *)malloc((unsigned)BUFSIZ+1)) == NULL) { - sprintf(mesg, "malloc failed, errno:%d", errno); - tst_brkm(TBROK, cleanup, mesg); - } - - -} /* End setup() */ - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/chdir02.c b/winsup/testsuite/winsup.api/ltp/chdir02.c deleted file mode 100644 index 552f912ac..000000000 --- a/winsup/testsuite/winsup.api/ltp/chdir02.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : chdir02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for chdir(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) chdir(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the chdir(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * chdir(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - -const char *TCID="chdir02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -const char *dirs[2] = { "/", "/tmp" }; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call chdir(2) - */ - TEST(chdir(dirs[lc%2])); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "chdir(%s) Failed, errno=%d : %s", dirs[lc%2], - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "chdir(%s) returned %d", dirs[lc%2], TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/chdir04.c b/winsup/testsuite/winsup.api/ltp/chdir04.c deleted file mode 100644 index da2b0ace9..000000000 --- a/winsup/testsuite/winsup.api/ltp/chdir04.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * chdir02.c - * - * DESCRIPTION - * Testcase to test whether chdir(2) sets errno correctly. - * - * ALGORITHM - * 1. Test for ENAMETOOLONG: - * Create a bad directory name with length more than - * - * VFS_MAXNAMELEN (Linux kernel variable), and attempt to - * chdir(2) to it. - * - * 2. Test for ENOENT: - * Attempt to chdir(2) on a non-existent directory - * - * 3. Test for EFAULT: - * Pass an address which lies outside the address space of the - * process, and expect an EFAULT. - * - * USAGE: - * chdir02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * NONE - */ - -#include -#include -#include -#include - -const char *TCID = "chdir02"; -int TST_TOTAL = 3; -extern int Tst_count; - -int exp_enos[] = {ENAMETOOLONG, ENOENT, EFAULT, 0}; - -char bad_dir[] = "abcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyz"; - -char noexist_dir[] = "/tmp/noexistdir"; - -struct test_case_t { - char *dname; - int error; -} TC[] = { - /* - * to test whether chdir() is setting ENAMETOOLONG if the - * directory is more than VFS_MAXNAMELEN - */ - {bad_dir, ENAMETOOLONG}, - - /* - * to test whether chdir() is setting ENOENT if the - * directory is not existing. - */ - {noexist_dir, ENOENT}, - - /* - * to test whether chdir() is setting EFAULT if the - * directory is an invalid address. - */ - {(void *)-1, EFAULT} -}; - -int flag; -#define FAILED 1 - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - int i; - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); - - /* set up the expected errnos */ - TEST_EXP_ENOS(exp_enos); - - /* check looping state if -i option is given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - /* loop through the test cases */ - for (i=0; i - * chmod01 [-c n] [-e] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define TESTFILE "testfile" - -const char *TCID="chmod01"; /* Test program identifier. */ -int TST_TOTAL=8; /* Total number of test conditions */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int Modes[] = {0, 07, 070, 0700, 0777, 02777, 04777, 06777}; - -void setup(); /* setup function for the test */ -void cleanup() __attribute__ ((noreturn));/* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat(2) struct contents */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int ind; /* counter variable for chmod(2) tests */ - unsigned mode; /* file mode permission */ - - TST_TOTAL = sizeof(Modes) / sizeof(int); - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - for (ind = 0; ind < TST_TOTAL; ind++) { - mode = Modes[ind]; - - /* - * Call chmod(2) with different mode permission - * bits to set it for "testfile". - */ - TEST(chmod(TESTFILE, mode)); - - /* check return code of chmod(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, - "chmod(%s, %#o) Failed, errno=%d : %s", - TESTFILE, mode, TEST_ERRNO, - strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the testfile information using - * stat(2). - */ - if (stat(TESTFILE, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "stat(2) of " - "%s failed, errno:%d", - TESTFILE, TEST_ERRNO); - } - stat_buf.st_mode &= ~S_IFREG; - - /* - * Check for expected mode permissions - * on testfile. - */ - if (stat_buf.st_mode == mode) { - tst_resm(TPASS, "Functionality of " - "chmod(%s, %#o) successful", - TESTFILE, mode); - } else { - tst_resm(TFAIL, "%s: Incorrect " - "modes 0%03o, Expected 0%03o", - TESTFILE, stat_buf.st_mode, - mode); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and close it - */ -void -setup() -{ - int fd; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a test file under temporary directory and close it */ - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/chmod02.c b/winsup/testsuite/winsup.api/ltp/chmod02.c deleted file mode 100644 index 8026768ae..000000000 --- a/winsup/testsuite/winsup.api/ltp/chmod02.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : chmod02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for chmod(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 8 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) chmod(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the chmod(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * chmod(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="chmod02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char fname[255]; -const char *buf = "file contents\n"; - -int Modes[] = {0, 07, 070, 0700, 0777, 02777, 04777, 06777}; - - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int ind; - int mode; - - TST_TOTAL = sizeof(Modes) / sizeof(int); - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind=0; ind -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="chown01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd, uid, gid; -const char *buf = "davef"; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call chown(2) - */ - TEST(chown(fname, uid,gid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "chown(%s, %d,%d) Failed, errno=%d : %s", fname, uid, gid, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "chown(%s, %d,%d) returned %d", fname, uid, gid, TEST_RETURN); - } - } /* end else */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* create a temp dir and cd to it. */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* set uid and gid */ - uid=geteuid(); - gid=getegid(); - - sprintf(fname,"t_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (write(fd, &buf, strlen(buf)) == -1) { - tst_brkm(TBROK, cleanup, "write(%s, &buf, strlen(buf)) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove temp dir and files */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/close01.c b/winsup/testsuite/winsup.api/ltp/close01.c deleted file mode 100644 index 4d4059823..000000000 --- a/winsup/testsuite/winsup.api/ltp/close01.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * close01.c - * - * DESCRIPTION - * Test that closing a regular file and a pipe works correctly - * - * ALGORITHM - * Creat a file, and dup() a fildes - * Open a pipe - * call close() using the TEST macro - * if the call fails - * issue a FAIL message and continue - * else if STD_FUNCTIONAL_TEST - * attempt to close the file/pipe again - * if there is an error - * issue a PASS message - * else - * issue a FAIL message - * else - * issue a PASS message - * - * - * USAGE: - * close01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID = "close01()"; -int TST_TOTAL = 2; -extern int Tst_count; - -char fname[40] = ""; - -int fild = -1; -int newfd = -1; -int pipefildes[2]; - -struct test_case_t { - int *fd; - const char *type; -} TC[] = { - /* file descriptor for a regular file */ - {&newfd, "file"}, - - /* file descriptor for a pipe */ - {&pipefildes[0], "pipe"} -}; - -int -main(int ac, char **av) -{ - - int i; - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - /* set up the file and pipe for the test */ - if ((fild = creat(fname, 0777)) == -1) { - perror (fname); - tst_brkm(TBROK, cleanup, "can't open file %s", fname); - } - - if ((newfd = dup(fild)) == -1) { - tst_brkm(TBROK, cleanup, "can't dup the file des"); - } - - if (pipe(pipefildes) == -1) { - tst_brkm(TBROK, cleanup, "can't open pipe"); - } - - /* loop through the test cases */ - - for (i = 0; i < TST_TOTAL; i++) { - - TEST(close(*TC[i].fd)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "call failed unexpectedly"); - continue; - } - - if (STD_FUNCTIONAL_TEST) { - /* attempt to close the fd again */ - if (close(*TC[i].fd) == -1) { - tst_resm(TPASS, "%s appears closed", - TC[i].type); - } else { - tst_resm(TFAIL, "%s close succeeded on" - "second attempt", TC[i].type); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - int mypid; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - mypid = getpid(); - sprintf(fname, "fname.%d", mypid); -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - if (fild >= 0) - close (fild); - if (newfd >= 0) - close (newfd); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/close02.c b/winsup/testsuite/winsup.api/ltp/close02.c deleted file mode 100644 index 72ecf8181..000000000 --- a/winsup/testsuite/winsup.api/ltp/close02.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * close02.c - * - * DESCRIPTION - * Check that an invalid file descriptor returns EBADF - * - * ALGORITHM - * loop if that option is specified - * call close using the TEST macro and passing in an invalid fd - * if the call succeedes - * issue a FAIL message - * else - * log the errno - * if the errno == EBADF - * issue a PASS message - * else - * issue a FAIL message - * cleanup - * - * USAGE: - * close02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -int exp_enos[] = {EBADF, 0}; - -const char *TCID = "close02()"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup */ - - /* set up expected errnos */ - TEST_EXP_ENOS(exp_enos); - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(close(-1)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "Closed a non existent fildes"); - } else { - TEST_ERROR_LOG(TEST_ERRNO); - - if (TEST_ERRNO != EBADF) { - tst_resm(TFAIL, "close() FAILED to set errno " - "to EBADF on an invalid fd, got %d", - errno); - } else { - tst_resm(TPASS, "call returned EBADF"); - } - } - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/close08.c b/winsup/testsuite/winsup.api/ltp/close08.c deleted file mode 100644 index 3fbcc3be8..000000000 --- a/winsup/testsuite/winsup.api/ltp/close08.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : close08 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for close(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) close(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the close(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * close(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="close08"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } - /* - * Call close(2) - */ - TEST(close(fd)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "close(%s) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "close(%s) returned %d", fname, TEST_RETURN); - } - } - - if (unlink(fname) == -1) { - tst_brkm(TBROK, cleanup, "unlink(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/creat01.c b/winsup/testsuite/winsup.api/ltp/creat01.c deleted file mode 100644 index 6f891701e..000000000 --- a/winsup/testsuite/winsup.api/ltp/creat01.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * creat01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of the creat(2) system call. - * - * ALGORITHM - * 1. creat() a file using 0444 mode, write to the fildes, write - * should return a positive count. - * - * 2. creat() should truncate a file to 0 bytes if it already - * exists, and should not fail. - * - * USAGE: - * creat01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(void); -void cleanup(void) __attribute__((noreturn)); -void functest1(void); -void functest2(void); - -const char *TCID = "creat01"; -int TST_TOTAL = 2; -extern int Tst_count; - -char filename[40]; - -#define MODE1 0644 -#define MODE2 0444 - -struct test_case_t { - char *fname; - int mode; - void (*functest)(); -} TC[] = { - /* creat() the file and write to it */ - {filename, MODE1, functest1}, - - /* creat() the same file and check that it is now 0 length */ - {filename, MODE2, functest2} -}; - -int -main(int ac, char **av) -{ - int i; - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* set "tstdir", and "testfile" variables */ - - /* check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - /* loop through the test cases */ - - for (i=0; i= 0) { - close(TEST_RETURN); - } - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * functest1() - check the functionality of the first test by making sure - * that a write to the file succeeds - */ -void -functest1() -{ - if (write(TEST_RETURN, "A", 1) != 1) { - tst_resm(TFAIL, "write was unsuccessful"); - } else { - tst_resm(TPASS, "file was created and written to successfully"); - } -} - -/* - * functest2() - check the functionality of the second test by making sure - * that the file is now 0 length - */ -void -functest2() -{ - struct stat buf; - - if (stat(filename, &buf) < 0) { - tst_brkm(TBROK, cleanup, "failed to stat test file"); - /*NOTREACHED*/ - } - if (buf.st_size != 0) { - tst_resm(TFAIL, "creat() FAILED to truncate " - "file to zero bytes"); - } else { - tst_resm(TPASS, "creat() truncated existing file to 0 bytes"); - } -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - if (geteuid() == 0) { - tst_brkm(TBROK, tst_exit, "Must not run this as root"); - /*NOTREACHED*/ - } - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified */ - TEST_PAUSE; - - tst_tmpdir(); - - sprintf(filename, "creat01.%d", getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - unlink(filename); - - /* delete the test directory created in setup() */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/creat03.c b/winsup/testsuite/winsup.api/ltp/creat03.c deleted file mode 100644 index 2ca21f1e0..000000000 --- a/winsup/testsuite/winsup.api/ltp/creat03.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * creat03.c - * - * DESCRIPTION - * Testcase to check whether the sticky bit cleared. - * - * ALGORITHM - * Creat a new file, fstat.st_mode should have the 01000 bit off - * - * USAGE: - * creat03 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "creat03"; /* Test program identifier */ -int TST_TOTAL = 1; /* Total number of test cases */ -extern int Tst_count; /* Test case counter */ - -char pfilname[40] = ""; -#define FMODE 0444 - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - struct stat statbuf; - unsigned short filmode; - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - /* check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(creat(pfilname, FMODE)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "Cannot creat %s", pfilname); - continue; - /*NOTREACHED*/ - } - - if (STD_FUNCTIONAL_TEST) { - if (fstat(TEST_RETURN, &statbuf) == -1) { - tst_brkm(TBROK, cleanup, "fstat() failed"); - } - filmode = statbuf.st_mode; - tst_resm(TINFO, "Created file has mode = 0%o", filmode); - if ((filmode & S_ISVTX) != 0) { - tst_resm(TFAIL, "save text bit not cleared"); - } else { - tst_resm(TPASS, "save text bit cleared"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - if (TEST_RETURN >= 0) { - close(TEST_RETURN); - } - - /* clean up things in case we are looping */ - if (unlink(pfilname) == -1) { - tst_brkm(TBROK, cleanup, "couldn't remove file"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - sprintf(pfilname, "./creat4.%d", getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at completion or - * premature exit - */ -void -cleanup(void) -{ - TEST_CLEANUP; - - /* remove the tmp dir and all its files */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/creat09.c b/winsup/testsuite/winsup.api/ltp/creat09.c deleted file mode 100644 index c3c88a7c6..000000000 --- a/winsup/testsuite/winsup.api/ltp/creat09.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : creat09 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for creat(2) using 0700 argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) creat(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the creat(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * creat(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="creat09"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - ******************************************* - * Call creat(2) with 0700 argument on fname - ******************************************* - */ - TEST(creat(fname, 0700)); - - /* check return code */ - - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "creat(%s, 0700) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "creat(%s, 0700) returned %d", fname, TEST_RETURN); - } - } - - /* close and remove file, possibly for next loop */ - if (close(TEST_RETURN) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } else if (unlink(fname) == -1) { - tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/dup01.c b/winsup/testsuite/winsup.api/ltp/dup01.c deleted file mode 100644 index 521df6a78..000000000 --- a/winsup/testsuite/winsup.api/ltp/dup01.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : dup01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for dup(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) dup(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the dup(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * dup(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - -const char *TCID="dup01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char Fname[255]; -int Fd; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call dup(2) - */ - TEST( dup(Fd) ); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "dup(%s) Failed, errno=%d : %s", Fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "dup(%s) returned %d", Fname, TEST_RETURN); - } - - /* close the new file so loops do not open too many files */ - if (close(TEST_RETURN) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* - * Initialize Fd in case we get a quick signal - */ - Fd=-1; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname, "dupfile"); - if ((Fd = open(Fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the open file we've been dup'ing */ - if (Fd != -1) { - if (close(Fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - Fd=-1; - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/dup02.c b/winsup/testsuite/winsup.api/ltp/dup02.c deleted file mode 100644 index ee759b89b..000000000 --- a/winsup/testsuite/winsup.api/ltp/dup02.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : dup02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Negative test for dup(2) with bad fd. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 06/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1-?.) dup(2) returns -1 with errno set to EBADF...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * Standard tst_res formatted output - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Loop through the test cases - * Execute system call - * Check return code, if system call failed (return=-1) - * if doing functional check - * check if errno set correctly, report results - * Otherwise, Issue a FAIL message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - -const char *TCID="dup02"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int Fds[] = { -1, 1500 }; - - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int nfds = sizeof(Fds) / sizeof(int); - int ind; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind=0; ind -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="dup03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - - -char Fname[255]; -int *Fd = NULL; -int Nfds=0; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call dup(2) - */ - TEST( dup(Fd[0]) ); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO == EMFILE ) { - tst_resm(TPASS, "dup(%d) Failed, errno=%d : %s", Fd[0], - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, "dup(%d) Failed, errno=%d %s, expected %d (EMFILE)", - Fd[0], TEST_ERRNO, strerror(TEST_ERRNO), EMFILE); - } - } - } else { - tst_resm(TFAIL, "dup(%d) returned %d, expected -1, errno:%d (EMFILE)", - Fd[0], TEST_RETURN, EMFILE); - - /* close the new file so loops do not open too many files */ - if (close(TEST_RETURN) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - long maxfds; - - /* - * Initialize Fd in case we get a quick signal - */ - maxfds = sysconf(_SC_OPEN_MAX); - if (maxfds < 1) { - tst_brkm(TBROK, cleanup, - "sysconf(_SC_OPEN_MAX) Failed, errno=%d : %s", - errno, strerror(errno)); - } - - Fd = (int *)malloc(maxfds*sizeof(int)); - Fd[0]=-1; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* - * open the file as many times as it takes to use up all fds - */ - sprintf(Fname, "dupfile"); - for (Nfds=1; Nfds<=maxfds; Nfds++) { - if ((Fd[Nfds-1] = open(Fname,O_RDWR|O_CREAT,0700)) == -1) { - - Nfds--; /* on a open failure, decrement the counter */ - if ( errno == EMFILE ) { - break; - } - else { /* open failed for some other reason */ - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - } - - /* - * make sure at least one was open and that all fds were opened. - */ - if ( Nfds == 0 ) { - tst_brkm(TBROK, cleanup, "Unable to open at least one file"); - } - if ( Nfds > maxfds ) { - tst_brkm(TBROK, cleanup, - "Unable to open enough files to use all file descriptors, tried %d", - maxfds); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the open file we've been dup'ing */ - if (Fd) { - while (Nfds-- >0) { - if (close(Fd[Nfds]) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - Fd[Nfds]=-1; - } - free(Fd); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/dup04.c b/winsup/testsuite/winsup.api/ltp/dup04.c deleted file mode 100644 index 1c4eaf188..000000000 --- a/winsup/testsuite/winsup.api/ltp/dup04.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : dup04 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for dup(2) of a system pipe descriptor - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 06/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) dup(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the dup(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * dup(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - -const char *TCID="dup04"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int Fd[2]; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call dup(2) for read side - */ - TEST( dup(Fd[0]) ); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "dup(%d) read side of syspipe Failed, errno=%d : %s", Fd[0], - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "dup(%d) read side of syspipe returned %d", Fd[0], - TEST_RETURN); - - } - else - Tst_count++; - - /* close the new file so loops do not open too many files */ - if (close(TEST_RETURN) == -1) { - tst_brkm(TBROK, cleanup, "close(%d) Failed, errno=%d : %s", - TEST_RETURN, errno, strerror(errno)); - } - } - - /* - * Call dup(2) for write side - */ - TEST( dup(Fd[1]) ); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "dup(%d) write side of syspipe Failed, errno=%d : %s", Fd[1], - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "dup(%d) write side of syspipe returned %d", Fd[1], - TEST_RETURN); - - } - else - Tst_count++; - - /* close the new file so loops do not open too many files */ - if (close(TEST_RETURN) == -1) { - tst_brkm(TBROK, cleanup, "close(%d) Failed, errno=%d : %s", - TEST_RETURN, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* - * Initialize Fd in case we get a quick signal - */ - Fd[0]=-1; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - if ( pipe(Fd) == -1 ) { - tst_brkm(TBROK, cleanup, "pipe(&Fd) Failed, errno=%d : %s", - errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - int ind; - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the open file we've been dup'ing */ - if (Fd[0] != -1) { - for (ind=0; ind<2; ind++) { - if (close(Fd[ind]) == -1) { - tst_resm(TWARN, "close(%d) Failed, errno=%d : %s", - Fd[ind], errno, strerror(errno)); - } - Fd[ind]=-1; - } - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/dup05.c b/winsup/testsuite/winsup.api/ltp/dup05.c deleted file mode 100644 index 097688353..000000000 --- a/winsup/testsuite/winsup.api/ltp/dup05.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : dup05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for dup(2) of a named pipe descriptor - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 06/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) dup(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the dup(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * dup(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - -const char *TCID="dup05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char Fname[255]; -int Fd; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call dup(2) - */ - TEST( dup(Fd) ); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "dup(%s) Failed, errno=%d : %s", Fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "dup(%s) returned %d", Fname, TEST_RETURN); - } - - /* close the new file so loops do not open too many files */ - if (close(TEST_RETURN) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* - * Initialize Fd in case we get a quick signal - */ - Fd=-1; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname, "dupfile"); - if ( mkfifo(Fname, 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "mkfifo(%s, 0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - if ((Fd = open(Fname, O_RDWR, 0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR, 0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the open file we've been dup'ing */ - if (Fd != -1) { - if (close(Fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - Fd=-1; - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/execl01.c b/winsup/testsuite/winsup.api/ltp/execl01.c deleted file mode 100644 index f91b0a820..000000000 --- a/winsup/testsuite/winsup.api/ltp/execl01.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : execl01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for execl(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/01/02 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) execl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the execl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * execl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="execl01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int pid; /* process id from fork */ -int status; /* status returned from waitpid */ - - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; /* turn off buffering in tst_ routines */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * fork, then call execl from child - */ - switch(pid=fork()) { - case 0: /* CHILD - Call execl(2) */ - execl("test", "test", NULL); - /* should not get here!! if we do, the parent will fail the Test Case */ - exit(errno); - case -1: /* ERROR!!! exit now!!*/ - tst_brkm(TBROK, cleanup, - "Unable to fork a child process to exec over! Errno:%d,:%s", - errno, strerror(errno)); - break; - default: - waitpid(pid, &status, 0); - if ( WIFEXITED(status) ) { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "execl - properly exec's a simple program.."); - } - } else { - TEST_ERROR_LOG(WEXITSTATUS(status)); - tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status); - } - break; - } /* switch */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* - * Send out info message that timing and errnolog info is not - * available because of the use of a child process for each exec - */ - if ( STD_TIMING_ON ) - tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\ -This is because the test forks to create a child process which then calls execl.\n\ -The TEST macro is NOT used."); - - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/execle01.c b/winsup/testsuite/winsup.api/ltp/execle01.c deleted file mode 100644 index ca2cdec4e..000000000 --- a/winsup/testsuite/winsup.api/ltp/execle01.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : execle01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for execle(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/01/02 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) execle(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the execle(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * execle(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="execle01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int pid; /* process id from fork */ -int status; /* status returned from waitpid */ -extern char **environ; /* pointer to this processes env, to pass along */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; /* turn off buffering in tst_ routines */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * fork, then call execle from child - */ - switch(pid=fork()) { - case 0: /* CHILD - Call execle(2) */ - execle("test", "test", NULL, environ); - /* should not get here!! if we do, the parent will fail the Test Case */ - exit(errno); - case -1: /* ERROR!!! exit now!!*/ - tst_brkm(TBROK, cleanup, - "Unable to fork a child process to exec over! Errno:%d,:%s", - errno, strerror(errno)); - break; - default: - waitpid(pid, &status, 0); - if ( WIFEXITED(status) ) { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "execle - properly exec's a simple program.."); - } - } else { - TEST_ERROR_LOG(WEXITSTATUS(status)); - tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status); - } - break; - } /* switch */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* - * Send out info message that timing and errnolog info is not - * available because of the use of a child process for each exec - */ - if ( STD_TIMING_ON ) - tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\ -This is because the test forks to create a child process which then calls execle.\n\ -The TEST macro is NOT used."); - - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/execlp01.c b/winsup/testsuite/winsup.api/ltp/execlp01.c deleted file mode 100644 index c3f8b2147..000000000 --- a/winsup/testsuite/winsup.api/ltp/execlp01.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : execlp01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for execlp(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/01/02 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) execlp(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the execlp(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * execlp(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="execlp01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int pid; /* process id from fork */ -int status; /* status returned from waitpid */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; /* turn off buffering in tst_ routines */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * fork, then call execlp from child - */ - switch(pid=fork()) { - case 0: /* CHILD - Call execlp(2) */ - execlp("/usr/bin/test", "/usr/bin/test", NULL); - /* should not get here!! if we do, the parent will fail the Test Case */ - exit(errno); - case -1: /* ERROR!!! exit now!!*/ - tst_brkm(TBROK, cleanup, - "Unable to fork a child process to exec over! Errno:%d,:%s", - errno, strerror(errno)); - break; - default: - waitpid(pid, &status, 0); - if ( WIFEXITED(status) ) { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "execlp - properly exec's a simple program.."); - } - } else { - TEST_ERROR_LOG(WEXITSTATUS(status)); - tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status); - } - break; - } /* switch */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* - * Send out info message that timing and errnolog info is not - * available because of the use of a child process for each exec - */ - if ( STD_TIMING_ON ) - tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\ -This is because the test forks to create a child process which then calls execlp.\n\ -The TEST macro is NOT used."); - - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/execv01.c b/winsup/testsuite/winsup.api/ltp/execv01.c deleted file mode 100644 index f59f29702..000000000 --- a/winsup/testsuite/winsup.api/ltp/execv01.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : execv01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for execv(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/01/02 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) execv(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the execv(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * execv(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include - -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -void cleanup(); - -const char *TCID="execv01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int pid; /* process id from fork */ -int status; /* status returned from waitpid */ -const char * const args[2]={"/usr/bin/test", 0}; /* argument list for execv call */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; /* turn off buffering in tst_ routines */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * fork, then call execv from child - */ - switch(pid=fork()) { - case 0: /* CHILD - Call execv(2) */ - execv("/usr/bin/test", args); - /* should not get here!! if we do, the parent will fail the Test Case */ - exit(errno); - case -1: /* ERROR!!! exit now!!*/ - tst_brkm(TBROK, cleanup, - "Unable to fork a child process to exec over! Errno:%d,:%s", - errno, strerror(errno)); - break; - default: - waitpid(pid, &status, 0); - if ( WIFEXITED(status) ) { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "execv - properly exec's a simple program.."); - } - } else { - TEST_ERROR_LOG(WEXITSTATUS(status)); - tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status); - } - break; - } /* switch */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* - * Send out info message that timing and errnolog info is not - * available because of the use of a child process for each exec - */ - if ( STD_TIMING_ON ) - tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\ -This is because the test forks to create a child process which then calls execv.\n\ -The TEST macro is NOT used."); - - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/execve01.c b/winsup/testsuite/winsup.api/ltp/execve01.c deleted file mode 100644 index 2584bdf05..000000000 --- a/winsup/testsuite/winsup.api/ltp/execve01.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : execve01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for execve(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/01/02 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) execve(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the execve(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * execve(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="execve01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int pid; /* process id from fork */ -int status; /* status returned from waitpid */ -const char *const args[2]={"/usr/bin/test", 0}; /* argument list for execve call */ -extern char **environ; /* pointer to this processes env, to pass along */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; /* turn off buffering in tst_ routines */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * fork, then call execve from child - */ - switch(pid=fork()) { - case 0: /* CHILD - Call execve(2) */ - execve("/usr/bin/test", args, environ); - /* should not get here!! if we do, the parent will fail the Test Case */ - exit(errno); - case -1: /* ERROR!!! exit now!!*/ - tst_brkm(TBROK, cleanup, - "Unable to fork a child process to exec over! Errno:%d,:%s", - errno, strerror(errno)); - break; - default: - waitpid(pid, &status, 0); - if ( WIFEXITED(status) ) { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "execve - properly exec's a simple program.."); - } - } else { - TEST_ERROR_LOG(WEXITSTATUS(status)); - tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status); - } - break; - } /* switch */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* - * Send out info message that timing and errnolog info is not - * available because of the use of a child process for each exec - */ - if ( STD_TIMING_ON ) - tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\ -This is because the test forks to create a child process which then calls execve.\n\ -The TEST macro is NOT used."); - - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/execvp01.c b/winsup/testsuite/winsup.api/ltp/execvp01.c deleted file mode 100644 index 8a1726a21..000000000 --- a/winsup/testsuite/winsup.api/ltp/execvp01.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : execvp01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for execvp(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/01/02 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) execvp(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the execvp(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * execvp(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="execvp01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int pid; /* process id from fork */ -int status; /* status returned from waitpid */ -const char *const args[2]={"/usr/bin/test", 0}; /* argument list for execvp call */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; /* turn off buffering in tst_ routines */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * fork, then call execvp from child - */ - switch(pid=fork()) { - case 0: /* CHILD - Call execvp(2) */ - execvp("/usr/bin/test", args); - /* should not get here!! if we do, the parent will fail the Test Case */ - exit(errno); - case -1: /* ERROR!!! exit now!!*/ - tst_brkm(TBROK, cleanup, - "Unable to fork a child process to exec over! Errno:%d,:%s", - errno, strerror(errno)); - break; - default: - waitpid(pid, &status, 0); - if ( WIFEXITED(status) ) { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "execvp - properly exec's a simple program.."); - } - } else { - TEST_ERROR_LOG(WEXITSTATUS(status)); - tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status); - } - break; - } /* switch */ - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* - * Send out info message that timing and errnolog info is not - * available because of the use of a child process for each exec - */ - if ( STD_TIMING_ON ) - tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\ -This is because the test forks to create a child process which then calls execvp.\n\ -The TEST macro is NOT used."); - - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/exit01.c b/winsup/testsuite/winsup.api/ltp/exit01.c deleted file mode 100644 index 74e6c093b..000000000 --- a/winsup/testsuite/winsup.api/ltp/exit01.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * exit01.c - * - * DESCRIPTION - * Check that exit returns the correct values to the waiting parent - * - * ALGORITHM - * Fork a process that immediately calls exit() with a known - * value. Check for that value in the parent. - * - * USAGE - * exit01 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID = "exit01"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int pid, npid, sig, nsig, exno, nexno, status; - int rval = 0; - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSIkNG ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup for test */ - - /* check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count = 0; - - sig = 0; - exno = 1; - - if ((pid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork failed, errno=%d", - errno, strerror(errno)); - } - - if (pid == 0) { /* parent */ - exit(exno); - } else { - sleep(1); /* let child start */ - npid = wait(&status); - - if (npid != pid) { - tst_resm(TFAIL, "wait error: " - "unexpected pid returned"); - rval = 1; - } - - nsig = status % 256; - - /* - * Check if the core dump bit has been set, bit # 7 - */ - if (nsig >= 128) { - nsig = nsig - 128; - } - - /* - * nsig is the signal number returned by wait - */ - if (nsig != sig) { - tst_resm(TFAIL, "wait error: " - "unexpected signal returned"); - rval = 1; - } - - /* - * nexno is the exit number returned by wait - */ - nexno = status / 256; - if (nexno != exno) { - tst_resm(TFAIL, "wait error: " - "unexpected exit number returned"); - rval = 1; - } - } - - if (rval != 1) { - tst_resm(TPASS, "exit() test PASSED"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at completion or - * premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/exit02.c b/winsup/testsuite/winsup.api/ltp/exit02.c deleted file mode 100644 index 1503106e9..000000000 --- a/winsup/testsuite/winsup.api/ltp/exit02.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * exit02.c - * - * DESCRIPTION - * Check that exit flushes output file buffers and closes files upon - * exitting - * - * ALGORITHM - * Fork a process that creates a file and writes a few bytes, and - * calls exit WITHOUT calling close(). The parent then reads the - * file. If everything that was written is present in the file, then - * the test passes. - * - * USAGE - * exit02 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID = "exit02"; -int TST_TOTAL = 1; -extern int Tst_count; - -#define READ 0 -#define WRITE 1 -#define MODE 0666 - -char filen[40]; - -int -main(int ac, char **av) -{ - int pid, npid, sig, nsig, exno, nexno, status; - int filed; - char wbuf[BUFSIZ], rbuf[BUFSIZ]; - int len, rlen; - int rval = 0; - char *strcpy(); - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup for test */ - - /* - * The following loop checks looping state if -i option given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - strcpy(wbuf, "abcd"); - len = strlen(wbuf); - - exno = sig = 0; - - if ((pid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork failed, error no = %d", - errno, strerror(errno)); - } - - if (pid == 0) { /* child */ - sleep(1); - if ((filed = creat(filen, MODE)) == -1) { - tst_resm(TINFO, "creat error: unable to" - "open output file"); - exit(2); - } - if (write(filed, wbuf, len) != len) { - tst_resm(TINFO, "write error"); - exit(2); - } - close(filed); - exit(exno); - } else { /* parent */ - npid = wait(&status); - - if (npid != pid) { - tst_resm(TFAIL, "wait error: " - "unexpected pid returned"); - rval = 1; - } - - nsig = status % 256; - - /* - * to check if the core dump bit has been - * set, bit # 7 - */ - if (nsig >= 128) - nsig = nsig - 128; - - /* - * nsig is the signal number returned by - * wait - */ - if (nsig != sig) { - tst_resm(TFAIL, "wait error: unexpected " - "signal returned %d", nsig); - rval = 1; - } - - /* - * nexno is the exit number returned by wait - */ - nexno = status / 256; - if (nexno != exno) { - tst_resm(TFAIL, "wait error: unexpected exit " - "number %d", nexno); - rval = 1; - } - - sleep(2); /* let child's exit close opened file */ - - filed = open(filen, O_RDONLY, READ); - if (filed == -1) { - tst_resm(TFAIL, "open error: " - "unable to open input file"); - rval = 1; - } else { - rlen = read(filed, rbuf, len); - if (len != rlen) { - tst_resm(TFAIL, "exit error: file " - "buffer was not flushed"); - rval = 1; - } else if (memcmp(rbuf, wbuf, rlen) != 0) { - tst_resm(TFAIL, "exit error: file " - "buffer was not flushed"); - rval = 1; - } - } - close(filed); - unlink(filen); - } - if (!rval) { - tst_resm(TPASS, "exit() test PASSED"); - } - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - perform all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - sprintf(filen, "tfile_%d",getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at completion or - * premature exit. - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* - * Remove tmp dir and all files in it - */ - tst_rmdir(); - - /* - * exit with return code appropriate for results - */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fchdir01.c b/winsup/testsuite/winsup.api/ltp/fchdir01.c deleted file mode 100644 index bd70c01b3..000000000 --- a/winsup/testsuite/winsup.api/ltp/fchdir01.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * fchdir01.c - * - * DESCRIPTION - * fchdir01 - create a directory and cd into it. - * - * ALGORITHM - * create a new directory - * open the directory and get a file descriptor - * loop if that option was specified - * fchdir() into the directory - * check the return code - * if failure, issue a FAIL message. - * otherwise, - * if doing functionality testing, call check_functionality() - * if correct, - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE: - * fchdir01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 03/2001 - Written by Wayne Boyer - * - * RESTRICTIONS - * none - */ - -#include "test.h" -#include "usctest.h" - -#include -#include -#include -#include - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID = "fchdir01"; -int TST_TOTAL = 1; -extern int Tst_count; - -int fd = -1; -char temp_dir_buf [PATH_MAX]; -char* temp_dir; -const char *TEST_DIR = "alpha"; - -#define MODES S_IRWXU - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - void check_functionality(void); - int r_val; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - /* get the name of the test dirctory */ - if ((temp_dir = (getcwd(temp_dir_buf, sizeof (temp_dir_buf)))) == NULL) { - tst_brkm(TBROK, cleanup, "%s - getcwd() in main() " - "failed", TCID); - } - - /* - * create a new directory and open it - */ - - if ((r_val = mkdir(TEST_DIR, MODES)) == -1){ - tst_brkm(TBROK, cleanup, "%s - mkdir() in main() " - "failed", TCID); - } - - if ((fd = open(TEST_DIR, O_RDONLY)) == -1) { - tst_brkm(TBROK, cleanup, "open of directory failed"); - } - - /* - * Use TEST macro to make the call - */ - - TEST(fchdir(fd)); - - if (TEST_RETURN == -1) { - tst_brkm(TFAIL, cleanup, "%s call failed - errno = %d :" - " %s", TCID, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - if (STD_FUNCTIONAL_TEST) { - check_functionality(); - } else { - tst_resm(TPASS, "call succeeded"); - } - } - - /* - * clean up things in case we are looping - */ - - /* - * NOTE: in case of failure here, we need to use "tst_resm()" - * and not "tst_brkm()". This is because if we get to this - * point, we have already set a PASS or FAIL for the test - * and "tst_brkm()" won't report as we might expect. - */ - - /* chdir back to our temporary work directory */ - if ((r_val = chdir("..")) == -1){ - tst_resm(TBROK, "fchdir failed - errno = %d : %s", - errno, strerror(errno)); - } - - if ((r_val = rmdir(TEST_DIR)) == -1){ - tst_resm(TBROK, "rmdir failed - errno = %d : %s", - errno, strerror(errno)); - } - - /* - * clean up things in case we are looping - */ - /* free(temp_dir); */ - temp_dir = NULL; - } - - cleanup(); - - /*NOTREACHED*/ -} - -/* - * check_functionality() - check that we are in the correct directory. - */ -void -check_functionality(void) -{ - char buf [PATH_MAX]; - char *cwd; - char **bufptr = &cwd; - char *dir; - - /* - * Get the current directory path. - */ - if ((cwd = (getcwd(buf, sizeof (buf)))) == NULL) { - tst_brkm(TBROK, cleanup, "%s - getcwd() in " - "check_functionality() failed", TCID); - } - - /* - * strip off all but the last directory name in the - * current working directory. - */ - do { - if ((dir = strsep(bufptr, "/")) == NULL) { - tst_brkm(TBROK, cleanup, "%s - strsep() in " - "check_functionality() failed", TCID); - } - } while(*bufptr != NULL); - - /* - * Make sure we are in the right place. - */ - if (strcmp(TEST_DIR, dir) == 0) { - tst_resm(TPASS, "%s call succeeded", TCID); - } else { - tst_resm(TFAIL, "%s functionality test failed", TCID); - } -} - -/* - * setup() - performs all the ONE TIME setup for this test. - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* create a test directory and cd into it */ - tst_tmpdir(); -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - if (fd >= 0) - close (fd); - - /* remove the test directory */ - tst_rmdir(); - - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/fchdir02.c b/winsup/testsuite/winsup.api/ltp/fchdir02.c deleted file mode 100644 index 4e1d9e74a..000000000 --- a/winsup/testsuite/winsup.api/ltp/fchdir02.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * fchdir02.c - * - * DESCRIPTION - * fchdir02 - try to cd into a bad directory (bad fd). - * - * CALLS - * fchdir() - * - * ALGORITHM - * loop if that option was specified - * call fchdir() with an invalid file descriptor - * check the errno value - * issue a PASS message if we get EBADF - errno 9 - * otherwise, the tests fails - * issue a FAIL message - * break any remaining tests - * call cleanup - * - * USAGE: - * fchdir02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 03/2001 - Written by Wayne Boyer - * - * RESTRICTIONS - * none - */ - -#include "test.h" -#include "usctest.h" - -#include -#include -#include - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID = "fchdir02"; -int TST_TOTAL = 1; -extern int Tst_count; - -int exp_enos[] = {9, 0}; /* 0 terminated list of expected errnos */ - -int -main(int ac, char **av) -{ - const int bad_fd = -5; - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - /* - * Look for a failure by using an invalid number for fd - */ - - TEST(fchdir(bad_fd)); - - if (TEST_RETURN != -1) { - tst_brkm(TFAIL, cleanup, "call succeeded with bad " - "file descriptor"); - } - - TEST_ERROR_LOG(TEST_ERRNO); - - switch(TEST_ERRNO) { - case EBADF: - tst_resm(TPASS, "expected failure - errno = %d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - break; - default: - tst_brkm(TFAIL, cleanup, "call failed with an " - "unexpected error - %d : %s", TEST_ERRNO, - strerror(TEST_ERRNO)); - } - } - - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all the ONE TIME setup for this test. - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* create a test directory and cd into it */ - tst_tmpdir(); - - /* Set up the expected error numbers for -e option */ - TEST_EXP_ENOS(exp_enos); -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* remove the test directory */ - tst_rmdir(); - - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/fchmod01.c b/winsup/testsuite/winsup.api/ltp/fchmod01.c deleted file mode 100644 index e2db7162a..000000000 --- a/winsup/testsuite/winsup.api/ltp/fchmod01.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fchmod01 - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fchmod(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fchmod(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fchmod(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fchmod01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -const char *buf = "davef"; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call fchmod(2) - */ - TEST(fchmod(fd, 0700)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fchmod(%s, 0700) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fchmod(%s, 0700) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (write(fd, &buf, strlen(buf)) == -1) { - tst_brkm(TBROK, cleanup, "write(%s, &buf, strlen(buf)) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the open file wev'e been chmoding */ - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/fchown01.c b/winsup/testsuite/winsup.api/ltp/fchown01.c deleted file mode 100644 index d692bfc74..000000000 --- a/winsup/testsuite/winsup.api/ltp/fchown01.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fchown01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fchown(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 02/14/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fchown(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fchown(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fchown(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ -#include -#include -#include - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fchown01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int Fd; /* file descriptor for fchown */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* Call fchown(2) just once */ - TEST(fchown(Fd, geteuid(), getegid())); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "fchown(Fd, geteuid(), getegid()) failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* Perform functional verification here */ - tst_resm(TPASS, - "fchown(Fd, geteuid(), getegid()) returned %d", - TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - char fname[1024]; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a tempdir and change to it */ - tst_tmpdir(); - - /* open a file for read/write */ - sprintf(fname, "./tmpfile.%d", getpid()); - if ( (Fd=open(fname, O_RDWR|O_CREAT, 0700)) == -1 ) - tst_brkm(TBROK, cleanup, - "Unable to open %s for read/write. Error:%d, %s", - fname, errno, strerror(errno)); /* this exits */ - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - close(Fd); - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove temp dir and files */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/fcntl02.c b/winsup/testsuite/winsup.api/ltp/fcntl02.c deleted file mode 100644 index cbdd08545..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl02.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_DUPFD argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fcntl02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call fcntl(2) with F_DUPFD argument on fname - */ - TEST(fcntl(fd, F_DUPFD, 0)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fcntl(%s, F_DUPFD, 0) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fcntl(%s, F_DUPFD, 0) returned %d", fname, TEST_RETURN); - } - if (close(TEST_RETURN) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we've had open */ - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fcntl03.c b/winsup/testsuite/winsup.api/ltp/fcntl03.c deleted file mode 100644 index 8199469c3..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl03.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl03 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_GETFD argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fcntl03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call fcntl(2) with F_GETFD argument on fname - */ - TEST(fcntl(fd, F_GETFD, 0)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fcntl(%s, F_GETFD, 0) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fcntl(%s, F_GETFD, 0) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fcntl04.c b/winsup/testsuite/winsup.api/ltp/fcntl04.c deleted file mode 100644 index 7af778936..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl04.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl04 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_GETFL argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fcntl04"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call fcntl(2) with F_GETFL argument on fname - */ - TEST(fcntl(fd, F_GETFL, 0)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fcntl(%s, F_GETFL, 0) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fcntl(%s, F_GETFL, 0) returned %d", fname, TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fcntl05.c b/winsup/testsuite/winsup.api/ltp/fcntl05.c deleted file mode 100644 index 80cfe8c89..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl05.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_GETLK argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fcntl05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -struct flock flocks; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - flocks.l_type = F_RDLCK; - /* - * Call fcntl(2) with F_GETLK argument on fname - */ - TEST(fcntl(fd, F_GETLK, &flocks)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fcntl(%s, F_GETLK, &flocks) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fcntl(%s, F_GETLK, &flocks) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - /* set needed flags in the flocks structure */ - flocks.l_whence=1; - flocks.l_start=0; - flocks.l_len=0; - flocks.l_pid=getpid(); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the file we have open */ - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fcntl07.c b/winsup/testsuite/winsup.api/ltp/fcntl07.c deleted file mode 100644 index e0082df45..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl07.c +++ /dev/null @@ -1,423 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl07 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Close-On-Exec functional test - * - * PARENT DOCUMENT : none - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 5 - * - * CPU TYPES : ALL - * - * AUTHOR : Glen Overby - * - * CO-PILOT : William Roske - * - * DATE STARTED : 08/11/93 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) test close-on-exec with a regular file - * 2.) test close-on-exec with a system pipe - * - * INPUT SPECIFICATIONS - * - * Standard arguments accepted by parse_opts(3). - * - * The -t (timing) and -e options apply to the fcntl(.., F_SETFD, ..) - * system call. - * - * -T fd : If this option is given, the program runs as "test_open", - * testing to see if it is open or not and exiting - * accordingly: - * 0 not open (EBADF from fcntl(..., F_GETFD, ...)) - * 3 no error from fcntl - * errno fcntl returned an error other than EBADF - * - * -F name : File to open. Must be an absolute path - * and the file must be writable; - * -n program: path to the 'test_open' program - * - * OUTPUT SPECIFICATIONS - * This test uses the cuts-style test_res format output consisting of: - * - * test-name PASS/FAIL/BROK message - * - * the message will tell what type of test and, if it failed, indicate - * what the failure was. - * - * DURATION - * Terminates - * - * SIGNALS - * None - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * If this test is not called with a full pathname, it must be able - * to find itself on $PATH - * - * INTERCASE DEPENDENCIES - * none - * - * DETAILED DESCRIPTION - * - * Setup: - * Setup signal handling. - * Create and make current a temporary directory. - * Open a regular file for writing - * Create a system pipe - * Create a named pipe and open it for writing - * - * Test: - * Set the file descriptor for close-on-exec - * Fork - * Child execlp's the program "test_open". - * If the exec fails, exit "2" - * Parent waits - * Report results. - * - * Cleanup: - * Close file and pipes - * Remove the temporary directory - * - * BUGS - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" -#include "search_path.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void help(); - -const char *TCID="fcntl07"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - - - -/* for parse_opts */ -int fflag, Tflag; /* binary flags: opt or not */ -char *fopt, *Topt; /* option arguments */ - -option_t options[] = { - { "F:", &fflag, &fopt }, /* -F filename */ - { "T:", &Tflag, &Topt }, /* -T exec'ed by test: test FD */ - { NULL, NULL, NULL } -}; - -int stat_loc; /* for waitpid() */ - -int file_fd, pipe_fds[2]; - /* file descriptors for a file and a system pipe */ -#define DEFAULT_FILE "DefaultFileName" -const char *File1 = DEFAULT_FILE; - -#define DEFAULT_SUBPROG "test_open" -const char *openck = DEFAULT_SUBPROG; /* support program name to check for open FD */ -char subprog_path[_POSIX_PATH_MAX]; /* path to exec "openck" with */ -#define STRSIZE 255 - -int *testfds[] = { - &file_fd, &pipe_fds[1], 0 - }; - -const char *testfdtypes[] = { - "regular file", - "write side of system pipe", - }; - -int test_open(const char *arg); -int do_exec(const char *prog, int fd, const char *tcd); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int exec_return; /* return from do_exec */ - int **tcp; /* testcase pointer (pointer to FD) */ - const char **tcd; /* testcase description pointer */ - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(ac, av, options, &help)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - if(fflag) /* -F option */ - File1 = fopt; - - if(Tflag) { /* -T option */ - exit(test_open(Topt)); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(av[0]); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for(tcp = testfds, tcd = testfdtypes; *tcp; tcp++, tcd++) { - - TEST(fcntl(**tcp, F_SETFD, FD_CLOEXEC)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fcntl(%s[%d], F_SETFD, FD_CLOEXEC) Failed, errno=%d : %s", - *tcd, **tcp, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /************************************************************* - * only perform functional verification if flag set - * (-f not given) - *************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - exec_return = do_exec(subprog_path, **tcp, *tcd); - - switch(exec_return) { - case -1: - tst_resm(TBROK, "fork failed. Errno %s [%d]", - strerror(errno), errno); - break; - case 1: - tst_resm(TBROK, "waitpid return was 0%o", stat_loc); - break; - case 2: - tst_resm(TBROK, "exec failed"); /* errno was in child */ - break; - case 0: - tst_resm(TPASS, "%s child exited 0, indicating that the file was closed", - *tcd); - break; - default: - tst_resm(TFAIL, "%s child exited non-zero, %d", *tcd, - exec_return); - break; - } - } - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup(char *path) -{ - search_path(path, subprog_path, X_OK, 1); - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - /* set up a regular file */ - if((file_fd=open(File1, O_CREAT|O_RDWR, 0666)) == -1) { - tst_brkm(TBROK, cleanup, "Open of file %s failed errno %d (%s)\n", File1, errno, strerror(errno)); - } - - /* set up a system pipe (write side gets CLOSE-ON-EXEC) */ - pipe(pipe_fds); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close everything */ - close(file_fd); - close(pipe_fds[0]); - close(pipe_fds[1]); - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -/*************************************************************************** - * issue a help message - ***************************************************************************/ -void -help() -{ - printf("-T fd : If this option is given, the program runs as 'test_open'\n"); - printf(" testing to see if it is open or not and exiting accordingly\n"); - printf("-F name : File to open. Must be an absolute path,\n"); - printf(" and the file must be writable\n"); - printf("-n program: path to the 'test_open' program\n"); -} - -/*---------------------------------------------------------------------------*/ -/* Perform an exec, then wait for the child to terminate. - * The child's termination status determines the success of the test - * - * Return codes: - * -1 BROK fork failed - * 1 BROK waitpid returned != exit status - * ???? exit code from child: - * 2 BROK exec failed - * 0 PASS fd was properly closed - * - */ - -int -do_exec(const char *prog, int fd, const char *tcd) -{ - int pid; - char pidname[STRSIZE]; -#ifdef DEBUG - int rc, status; /* for the fcntl */ -#endif - - /* set up arguments to exec'ed child */ - sprintf(pidname, "%d", fd); - -#ifdef DEBUG - rc = fcntl(fd, F_GETFD, &status); - printf("%s: fd = %d rc = %d status= %d, errno= %d\n", tcd, fd, rc, status, errno); -#endif - - switch(pid=fork()) { - case -1: - return(-1); - case 0: /* child */ - execlp(prog, openck, "-T", pidname, NULL); - - /* the ONLY reason to do this is to get the errno printed out */ - fprintf(stderr, "exec(%s, %s, -T, %s) failed. Errno %s [%d]\n", - prog, openck, pidname, strerror(errno), errno); - exit(2); - default: /* parent */ - waitpid(pid, &stat_loc, 0); - if(WIFEXITED(stat_loc)) { - return(WEXITSTATUS(stat_loc)); - } else { - return(1); - } - } -} - -/* - * PROGRAM TITLE : Test if a named file descriptor is open - * This function is called when fcntcs07 is called with the -T option. - * It tests if a file descriptor is open and exits accordingly. - */ -int -test_open(const char *arg) -{ - int fd, rc; - int status; - - fd = atoi(arg); - - rc = fcntl(fd, F_GETFD, &status); - -#ifdef DEBUG_T - printf("%s: fd = %d rc = %d status= %d, errno= %d\n", openck, fd, rc, - status, errno); -#endif - - if(rc == -1 && errno == EBADF) { - exit(0); - } - - if(rc != -1) - exit(3); - - exit(errno); - return -1; /* to remove compiler warning on IRIX */ -} diff --git a/winsup/testsuite/winsup.api/ltp/fcntl07B.c b/winsup/testsuite/winsup.api/ltp/fcntl07B.c deleted file mode 100644 index 4e94ff267..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl07B.c +++ /dev/null @@ -1,422 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl07B - * to see if it is open or not and exiting - * accordingly: - * 0 not open (EBADF from fcntl(..., F_GETFD, ...)) - * 3 no error from fcntl - * errno fcntl returned an error other than EBADF - * - * -F name : File to open. Must be an absolute path - * and the file must be writable; - * -n program: path to the 'test_open' program - * - * OUTPUT SPECIFICATIONS - * This test uses the cuts-style test_res format output consisting of: - * - * test-name PASS/FAIL/BROK message - * - * the message will tell what type of test and, if it failed, indicate - * what the failure was. - * - * DURATION - * Terminates - * - * SIGNALS - * None - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * If this test is not called with a full pathname, it must be able - * to find itself on $PATH - * - * INTERCASE DEPENDENCIES - * none - * - * DETAILED DESCRIPTION - * - * Setup: - * Setup signal handling. - * Create and make current a temporary directory. - * Create a named pipe and open it for writing - * - * Test: - * Set the file descriptor for close-on-exec - * Fork - * Child execlp's the program "test_open". - * If the exec fails, exit "2" - * Parent waits - * Report results. - * - * Cleanup: - * Close file and pipes - * Remove the temporary directory - * - * BUGS - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" -#include "search_path.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void help(); - -const char *TCID="fcntl07B"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - - -/* for parse_opts */ -int fflag, Tflag; /* binary flags: opt or not */ -char *fopt, *Topt; /* option arguments */ - -option_t options[] = { - { "F:", &fflag, &fopt }, /* -F filename */ - { "T:", &Tflag, &Topt }, /* -T exec'ed by test: test FD */ - { NULL, NULL, NULL } -}; - -int stat_loc; /* for waitpid() */ - -int npipe_fd; - /* file descriptors for a named pipe */ -#define DEFAULT_FILE "DefaultFileName" -const char *File1 = DEFAULT_FILE; - -#define DEFAULT_SUBPROG "test_open" -const char *openck = DEFAULT_SUBPROG; /* support program name to check for open FD */ -const char subprog_path[_POSIX_PATH_MAX];/* path to exec "openck" with */ -#define STRSIZE 255 -#define FIFONAME "FiFo" - -int *testfds[] = { - &npipe_fd, 0 - }; - -const char *testfdtypes[] = { - "named pipe" - }; - -int test_open(char *arg); -int do_exec(const char *prog, int fd, const char *tcd); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int exec_return; /* return from do_exec */ - int **tcp; /* testcase pointer (pointer to FD) */ - const char **tcd; /* testcase description pointer */ - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(ac, av, options, &help)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - if(fflag) /* -F option */ - File1 = fopt; - - if(Tflag) { /* -T option */ - exit(test_open(Topt)); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(av[0]); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for(tcp = testfds, tcd = testfdtypes; *tcp; tcp++, tcd++) { - - TEST(fcntl(**tcp, F_SETFD, FD_CLOEXEC)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fcntl(%s[%d], F_SETFD, FD_CLOEXEC) Failed, errno=%d : %s", - *tcd, **tcp, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /************************************************************* - * only perform functional verification if flag set - * (-f not given) - *************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - exec_return = do_exec(subprog_path, **tcp, *tcd); - - switch(exec_return) { - case -1: - tst_resm(TBROK, "fork failed. Errno %s [%d]", - strerror(errno), errno); - break; - case 1: - tst_resm(TBROK, "waitpid return was 0%o", stat_loc); - break; - case 2: - tst_resm(TBROK, "exec failed"); /* errno was in child */ - break; - case 0: - tst_resm(TPASS, "%s child exited 0, indicating that the file was closed", - *tcd); - break; - default: - tst_resm(TFAIL, "%s child exited non-zero, %d", *tcd, - exec_return); - break; - } - } - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup(char *path) -{ - search_path(path, subprog_path, X_OK, 1); - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - /* set up a named pipe (write side gets CLOSE-ON-EXEC) */ - if(mkfifo(FIFONAME, 0666) == -1) { - tst_brkm(TBROK, cleanup, "mkfifo of named pipe %s failed errno %d (%s)\n", FIFONAME, errno, strerror(errno)); - } - - if((npipe_fd=open(FIFONAME, O_RDWR, 0666)) == -1) { - tst_brkm(TBROK, cleanup, "Open of named pipe %s failed errno %d (%s)\n", File1, errno, strerror(errno)); - } - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close everything */ - close(npipe_fd); - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -/*************************************************************************** - * issue a help message - ***************************************************************************/ -void -help() -{ - printf("-T fd : If this option is given, the program runs as 'test_open'\n"); - printf(" testing to see if it is open or not and exiting accordingly\n"); - printf("-F name : File to open. Must be an absolute path,\n"); - printf(" and the file must be writable\n"); - printf("-n program: path to the 'test_open' program\n"); - -} - -/*---------------------------------------------------------------------------*/ -/* Perform an exec, then wait for the child to terminate. - * The child's termination status determines the success of the test - * - * Return codes: - * -1 BROK fork failed - * 1 BROK waitpid returned != exit status - * ???? exit code from child: - * 2 BROK exec failed - * 0 PASS fd was properly closed - * - */ - -int -do_exec(const char *prog, int fd, const char *tcd) -{ - int pid; - char pidname[STRSIZE]; -#ifdef DEBUG - int rc, status; /* for the fcntl */ -#endif - - /* set up arguments to exec'ed child */ - sprintf(pidname, "%d", fd); - -#ifdef DEBUG - rc = fcntl(fd, F_GETFD, &status); - printf("%s: fd = %d rc = %d status= %d, errno= %d\n", tcd, fd, rc, status, errno); -#endif - - switch(pid=fork()) { - case -1: - return(-1); - case 0: /* child */ - execlp(prog, openck, "-T", pidname, NULL); - - /* the ONLY reason to do this is to get the errno printed out */ - fprintf(stderr, "exec(%s, %s, -T, %s) failed. Errno %s [%d]\n", - prog, openck, pidname, strerror(errno), errno); - exit(2); - default: /* parent */ - waitpid(pid, &stat_loc, 0); - if(WIFEXITED(stat_loc)) { - return(WEXITSTATUS(stat_loc)); - } else { - return(1); - } - } -} - -/* - * PROGRAM TITLE : Test if a named file descriptor is open - * This function is called when fcntcs07 is called with the -T option. - * It tests if a file descriptor is open and exits accordingly. - */ -int -test_open(char *arg) -{ - int fd, rc; - int status; - - fd = atoi(arg); - - rc = fcntl(fd, F_GETFD, &status); - -#ifdef DEBUG_T - printf("%s: fd = %d rc = %d status= %d, errno= %d\n", openck, fd, rc, - status, errno); -#endif - - if(rc == -1 && errno == EBADF) { - exit(0); - } - - if(rc != -1) - exit(3); - - exit(errno); - return -1; /* To remove compiler warning on IRIX */ -} diff --git a/winsup/testsuite/winsup.api/ltp/fcntl08.c b/winsup/testsuite/winsup.api/ltp/fcntl08.c deleted file mode 100644 index eaf22436b..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl08.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl08 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_SETFL argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * close file - * remove temp directory - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -#ifndef O_NDELAY -#define O_NDELAY 0 -#endif - -const char *TCID="fcntl08"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char fname[255]; -int arg, fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call fcntl(2) with F_SETFL argument on fname - */ - TEST(fcntl(fd, F_SETFL, arg)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - tst_resm(TFAIL, "fcntl(%s, F_SETFL, %d) Failed, errno=%d : %s", - fname, arg, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fcntl(%s, F_SETFL, %d) returned %d", - fname, arg, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - /* set the flags to be used */ -#ifdef CRAY - arg = (O_NDELAY | O_APPEND | O_RAW | O_NONBLOCK); -#else - arg = (O_NDELAY | O_APPEND | O_NONBLOCK); -#endif /* ! CRAY */ - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we have open */ - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fcntl09.c b/winsup/testsuite/winsup.api/ltp/fcntl09.c deleted file mode 100644 index 3a827e149..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl09.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl09 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_SETLK argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fcntl09"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -struct flock flocks; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - -#if 0 - /* Ouch! Either read *or* write lock, but not both! - This code depends on F_RDLCK being 0. */ - flocks.l_type = F_RDLCK | F_WRLCK; -#else - flocks.l_type = F_WRLCK; -#endif - /* - * Call fcntl(2) with F_SETLK argument on fname - */ - TEST(fcntl(fd, F_SETLK, &flocks)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_RDLCK | F_WRLCK Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, - "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_RDLCK | F_WRLCK returned %d", - fname, TEST_RETURN); - } - } - - flocks.l_type = F_UNLCK; - /* - * Call fcntl(2) with F_SETLK argument on fname - */ - TEST(fcntl(fd, F_SETLK, &flocks)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_UNLCK Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, - "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_UNLCK returned %d", - fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"./file_%d",getpid()); - if (creat(fname, 02644) == -1) { - tst_brkm(TBROK, cleanup, "creat(%s, 02644) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if ((fd = open(fname,O_RDWR,0700)) == -1) { - tst_brkm(TBROK, cleanup, "open(%s, O_RDWR,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - flocks.l_whence=1; - flocks.l_start=0; - flocks.l_len=0; - flocks.l_pid=getpid(); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (unlink(fname) == -1) { - tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - - } - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fcntl10.c b/winsup/testsuite/winsup.api/ltp/fcntl10.c deleted file mode 100644 index e2de44bef..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl10.c +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fcntl10 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fcntl(2) using F_SETLKW argument. - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fcntl(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fcntl(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fcntl(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fcntl10"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -struct flock flocks; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - -#if 0 - /* Ouch! Either read *or* write lock, but not both! - This code depends on F_RDLCK being 0. */ - flocks.l_type = F_RDLCK | F_WRLCK; -#else - flocks.l_type = F_WRLCK; -#endif - /* - * Call fcntl(2) with F_SETLKW flocks.l_type = F_UNLCK argument on fname - */ - TEST(fcntl(fd, F_SETLKW, &flocks)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "fcntl(%s, F_SETLKW, &flocks) flocks.l_type = F_RDLCK | F_WRLCK Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, - "fcntl(%s, F_SETLKW, &flocks) flocks.l_type = F_RDLCK | F_WRLCK returned %d", - fname, TEST_RETURN); - } - } - - flocks.l_type = F_UNLCK; - /* - * Call fcntl(2) with F_SETLKW flocks.l_type = F_UNLCK argument on fname - */ - TEST(fcntl(fd, F_SETLKW, &flocks)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "fcntl(%s, F_SETLKW, &flocks) flocks.l_type = F_UNLCK Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, - "fcntl(%s, F_SETLKW, &flocks) flocks.l_type = F_UNLCK returned %d", - fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = creat(fname, 02644)) == -1) { - tst_brkm(TBROK, cleanup, "creat(%s, 02644) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if ((fd = open(fname,O_RDWR,0700)) == -1) { - tst_brkm(TBROK, cleanup, "open(%s, O_RDWR,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* set needed fields in the flocks structure */ - flocks.l_whence=1; - flocks.l_start=0; - flocks.l_len=0; - flocks.l_pid=getpid(); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fork01.c b/winsup/testsuite/winsup.api/ltp/fork01.c deleted file mode 100644 index 2aac2d427..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork01.c +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fork01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fork(2) - * - * PARENT DOCUMENT : frktds02 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Kathy Olmsted - * - * CO-PILOT : Steve Shaw - * - * DATE STARTED : 06/17/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fork returns without error - * 2.) fork returns the pid of the child - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * fork() - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * CHILD: - * determine PID - * write to PID to a file and close the file - * exit - * PARENT: - * wait for child to exit - * read child PID from file - * compare child PID to fork() return code and report - * results - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -#define KIDEXIT 42 -extern void setup(); -extern void cleanup(); - -#define LINE_SZ 20 /* size of the line written/read to the file */ -#define FILENAME "childpid" - - - -const char *TCID="fork01"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -/*************************************************************** - * child_pid - the child side of the test - * determine the PID and write to a file - ***************************************************************/ -void child_pid() -{ - - int fildes; - char tmp_line[LINE_SZ]; - - fildes = creat(FILENAME,0700); - sprintf(tmp_line,"%d\n",getpid()); - write(fildes,tmp_line,LINE_SZ); - close(fildes); - -} - -/*************************************************************** - * parent_pid - the parent side of the test - * read the value determined by the child - * compare and report results - ***************************************************************/ -void parent_pid() -{ - - int fildes; - char tmp_line[LINE_SZ]; - pid_t child_id; - - if ((fildes = open(FILENAME,O_RDWR)) == -1) { - tst_brkm(TBROK, cleanup, - "parent open failed. errno: %d (%s)\n", - errno, strerror(errno)); - } - else { - if (read(fildes,tmp_line,LINE_SZ) == 0) { - tst_brkm(TBROK,cleanup, "fork(): parent failed to read PID from file errno: %d (%s)", - errno, strerror(errno)); - } - else { - child_id = atoi(tmp_line); - if (TEST_RETURN != child_id) { - tst_resm(TFAIL,"child reported a pid of %d. parent received %d from fork()", - child_id,TEST_RETURN); - } else { - tst_resm(TPASS,"child pid and fork() return agree: %d",child_id); - } - } - close(fildes); - } -} - -/*************************************************************** - * main() - performs tests - * - ***************************************************************/ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int fails; - int kid_status, wait_status; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - fails = 0; - - /* - * Call fork(2) - */ - TEST(fork()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - if ( STD_FUNCTIONAL_TEST ) { - tst_resm(TFAIL, "fork() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - tst_resm(TBROK,"unable to continue"); - } - } - if (TEST_RETURN == 0) { - /* child */ - if ( STD_FUNCTIONAL_TEST ) { - child_pid(); - } - exit(KIDEXIT); - } else { - /* parent */ - if ( STD_FUNCTIONAL_TEST ) { - tst_resm(TPASS, "fork() returned %d", TEST_RETURN); - } - /* wait for the child to complete */ - wait_status = wait(&kid_status); - if ( STD_FUNCTIONAL_TEST ) { - if (wait_status == TEST_RETURN) { - if (kid_status != KIDEXIT << 8) { - tst_resm(TBROK, - "incorrect child status returned on wait(): %d", - kid_status); - fails++; - } - } - else { - tst_resm(TBROK, - "wait() for child status failed with %d errno: %d : %s", - wait_status,errno,strerror(errno)); - fails++; - } - if (fails == 0 ) { - /* verification tests */ - parent_pid(); - } - } /* STD_FUNCTIONAL_TEST */ - } /* TEST_RETURN */ - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void - setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void - cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_rmdir(); - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fork02.c b/winsup/testsuite/winsup.api/ltp/fork02.c deleted file mode 100644 index eeec828ec..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork02.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * fork02.c - * - * DESCRIPTION - * Test correct operation of fork: - * pid == 0 in child; - * pid > 0 in parent from wait; - * - * ALGORITHM - * Fork one process, check for pid == 0 in child. - * Check for pid > 0 in parent after wait. - * - * USAGE - * fork02 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include "test.h" -#include "usctest.h" - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID = "fork02"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int pid1, pid2, status; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - if ((pid1 = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - - if (pid1 == 0) { - tst_resm(TINFO, "Inside child"); - _exit(0); - } else { - tst_resm(TINFO, "Inside parent"); - pid2 = wait(&status); - tst_resm(TINFO, "exit status of wait %d", status); - - if (pid1 == pid2) { - tst_resm(TPASS, "test 1 PASSED"); - } else { - tst_resm(TFAIL, "test 1 FAILED"); - } - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fork03.c b/winsup/testsuite/winsup.api/ltp/fork03.c deleted file mode 100644 index fbc23bb37..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork03.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * fork03.c - * - * DESCRIPTION - * Check that child can use a large text space and do a large - * number of operations. - * - * ALGORITHM - * Fork one process, check for pid == 0 in child. - * Check for pid > 0 in parent after wait. - * - * USAGE - * fork03 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include "test.h" -#include "usctest.h" - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID = "fork03"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - float fl1, fl2; - int i; - int pid1, pid2, status; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - if ((pid1 = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - - if (pid1 == 0) { /* child */ - /* child uses some cpu cycles */ - for (i = 1; i < 32767; i++) { - fl1 = 0.000001; - fl1 = fl2 = 0.000001; - fl1 = fl1 * 10.0; - fl2 = fl1 / 1.232323; - fl1 = fl2 - fl2; - fl1 = fl2; - } - - /* Pid must always be zero in child */ - - if (pid1 != 0) { - exit(1); - } else { - exit(0); - } - } else { /* parent */ - tst_resm(TINFO, "process id in parent of child from " - "fork : %d", pid1); - pid2 = wait(&status); /* wait for child */ - - if (pid1 != pid2) { - tst_resm(TFAIL, "pids don't match : %d vs %d", - pid1, pid2); - continue; - } - - if ((status >> 8) != 0) { - tst_resm(TFAIL, "child exited with failure"); - continue; - } - - tst_resm(TPASS, "test 1 PASSED"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fork04.c b/winsup/testsuite/winsup.api/ltp/fork04.c deleted file mode 100644 index 7e8d80f96..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork04.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fork04 - * - * TEST TITLE : Child inheritance of Environment Variables after fork() - * - * PARENT DOCUMENT : frktds01 - * - * TEST CASE TOTAL : 3 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Kathy Olmsted - * - * CO-PILOT : Steve Shaw - * - * DATE STARTED : 06/17/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * Test these environment variables correctly inherited by child: - * 1. TERM - * 2. NoTSetzWq - * 3. TESTPROG - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * DETAILED DESCRIPTION - * - * Setup: - * Setup signal handling. - * Make and change to a temporary directory. - * Pause for SIGUSR1 if option specified. - * Add TESTPROG variable to the environment - * - * Test: - * Loop if the proper options are given. - * fork() - * Check return code, if system call failed (return=-1) - * Log the errno - * CHILD: - * open a temp file - * Determine environment values and write to file - * close file containing test values. - * exit. - * PARENT: - * Wait for child to exit. - * Verify exit status - * Open file containing test values. - * For each test case: - * Read the value from the file. - * Determine and report PASS/FAIL result. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Remove the temporary directory and exit. - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ -#include -#include -#include -#include -#include -#include /*Includes signal information. */ -#include -#include "test.h" -#include "usctest.h" - -const char *TCID="fork04"; /* Test program identifier. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - - - -#define KIDEXIT 42 /* Known value for child exit status */ -#define MAX_LINE_LENGTH 256 -#define OUTPUT_FILE "env.out" -#define ENV_NOT_SET "getenv() does not find variable set" - -/* list of environment variables to test */ -const char *environ_list[] = {"TERM","NoTSetzWq","TESTPROG"}; -#define NUMBER_OF_ENVIRON (int)(sizeof(environ_list)/sizeof(char *)) -int TST_TOTAL=NUMBER_OF_ENVIRON; /* Total number of test cases. */ - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove the temporary directory and exit with - return code appropriate for results */ - tst_rmdir(); - tst_exit(); - -} /* End cleanup() */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make and change to a temporary directory */ - tst_tmpdir(); - - /* add a variable to the environment */ - putenv(strdup("TESTPROG=FRKTCS04")); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * child_environment - the child side of the environment tests - * determine values for the variables and write to a file - ***************************************************************/ -void child_environment() -{ - - int fildes; - int index; - char msg[MAX_LINE_LENGTH]; - char *var; - - fildes = creat(OUTPUT_FILE,0700); - - - for (index=0;index: - * - ***********************************************************************/ -int -cmp_env_strings(char *pstring, char *cstring) -{ - char *penv, *cenv, *pvalue, *cvalue; - - /* - * Break pstring into env and value - */ - penv=pstring; - if ( (pvalue=strchr(pstring, ':')) == NULL ) { - tst_resm(TBROK, - "internal error - parent's env string not in correct format:'%s'", - pstring); - return -1; - } else { - *pvalue='\0'; - pvalue++; - if ( *pvalue == '\0' ) { - tst_resm(TBROK, "internal error - missing parent's env value"); - return -1; - } - } - - /* - * Break cstring into env and value - */ - cenv=cstring; - if ( (cvalue=strchr(cstring, ':')) == NULL ) { - tst_resm(TBROK, - "internal error - parent's env string not in correct format:'%s'", - cstring); - return -1; - } else { - *cvalue='\0'; - cvalue++; - if ( *cvalue == '\0' ) { - tst_resm(TBROK, "internal error - missing child's env value"); - return -1; - } - } - - if ( strcmp(penv, cenv) != 0 ) { - tst_resm(TBROK, "internal error - parent(%s) != child (%s) env", - penv, cenv); - return -1; - } - - if ( strcmp(pvalue, cvalue) != 0 ) { - tst_resm(TFAIL, "Env var %s changed after fork(), parent's %s, child's %s", - penv, pvalue, cvalue); - } else { - tst_resm(TPASS, "Env var %s unchanged after fork(): %s", - penv, cvalue); - } - return 0; - -} - -/*************************************************************** - * parent_environment - the parent side of the environment tests - * determine values for the variables - * read the values determined by the child - * compare values - ***************************************************************/ -void parent_environment() -{ - - int fildes; - char tmp_line[MAX_LINE_LENGTH]; - char parent_value[MAX_LINE_LENGTH]; - int index; - int ret; - char *var; - - if ((fildes = open(OUTPUT_FILE,O_RDWR)) == -1) { - tst_brkm(TBROK, cleanup, - "fork() test. Parent open of temporary file failed. errno %d (%s)\n", - errno, strerror(errno)); - } - for (index=0;index -#include "test.h" -#include "usctest.h" - -const char *TCID = "fork06"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -#define NUMFORKS 1000 - -int -main(int ac, char **av) -{ - int i, pid, status, childpid, succeed, fail; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - succeed = 0; - fail = 0; - - for (i = 0; i < NUMFORKS; i++) { - if ((pid = fork()) == -1) { - fail++; - continue; - } - - if (pid == 0) { /* child */ - _exit(0); - } - - /* parent */ - childpid = wait(&status); - if (pid != childpid) { - tst_resm(TFAIL, "pid from wait %d", childpid); - } - succeed++; - } - - tst_resm(TINFO, "tries %d", i); - tst_resm(TINFO, "successes %d", succeed); - tst_resm(TINFO, "failures %d", fail); - - if ((wait(&status)) == -1) { - tst_resm(TINFO, "There were no children to wait for"); - } else { - tst_resm(TINFO, "There were children left"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fork07.c b/winsup/testsuite/winsup.api/ltp/fork07.c deleted file mode 100644 index 7e06db7a1..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork07.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * fork07.c - * - * DESCRIPTION - * Check that all children inherit parent's file descriptor - * - * ALGORITHM - * Parent opens a file, writes to it; forks processes until - * -1 is returned. Each child attempts to read the file then returns. - * - * USAGE - * fork07 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "fork07"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -char pbuf[10]; -char fnamebuf[40]; - -int -main(int ac, char **av) -{ - int status, count, forks, pid1; - int ch_r_stat; - FILE *rea = NULL, *writ = NULL; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - if ((writ = fopen(fnamebuf, "w")) == NULL) - tst_resm(TFAIL, "failed to fopen file for write"); - if ((rea = fopen(fnamebuf, "r")) == NULL) - tst_resm(TFAIL, "failed to fopen file for read"); - - fprintf(writ,"abcdefghijklmnopqrstuv") ; - fflush(writ); - sleep(1); - - if ((getc(rea)) != 'a') - tst_resm(TFAIL, "getc from read side was confused"); - - forks = 0; - -forkone: - ++forks; - pid1 = -1; - if ( forks >= 1000 || (pid1 = fork()) != 0) { /* parent */ - if (pid1 > 0) { - goto forkone; - } else if (pid1 < 0) { - tst_resm(TINFO, "last child forked"); - } - } else { /* child */ - ch_r_stat = getc(rea); -#ifdef DEBUG - tst_resm(TINFO, "Child got char: %c", ch_r_stat); - tst_resm(TINFO, "integer value of getc in child " - "expected %d got %d", 'b', ch_r_stat); -#endif - if (ch_r_stat != EOF) { /* for error or EOF */ - tst_resm(TPASS, "test passed in child no %d", - forks); - exit(0); - } else { - tst_resm(TFAIL, "Test failed in child no. %d", - forks); - exit(-1); - } - } - - /* parent */ - --forks; - for (count = 0; count <= forks; count++) { - wait(&status); -#ifdef DEBUG - tst_resm(TINFO, " exit status of wait " - " expected 0 got %d", status); -#endif - if (status == 0) { - tst_resm(TPASS, "parent test passed"); - } else { - tst_resm(TFAIL, "parent test failed"); - } - } - tst_resm(TINFO, "Number of processes forked is %d", forks); - } - fclose (writ); - fclose (rea); - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; - - /* - * make a temp directory and cd to it - */ - tst_tmpdir(); - - strcpy(fnamebuf, "fork07."); - sprintf(pbuf, "%d", getpid()); - strcat(fnamebuf, pbuf); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * remove tmp dir and all files in it - */ - unlink(fnamebuf); - tst_rmdir(); - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fork09.c b/winsup/testsuite/winsup.api/ltp/fork09.c deleted file mode 100644 index 233acc76e..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork09.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * fork01.c - * - * DESCRIPTION - * Check that child has access to a full set of files. - * - * ALGORITHM - * Parent opens a maximum number of files - * Child closes one and attempts to open another, it should be - * available - * - * USAGE - * fork01 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include /* for OPEN_MAX */ -#include -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "fork01"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -char filname[40], childfile[40]; -int first; -FILE **fildeses; /* file streams */ -int mypid, nfiles; - -int -main(int ac, char **av) -{ - int pid, status, nf; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - fildeses = (FILE**)malloc((OPEN_MAX + 10) * sizeof(FILE *)); - if (fildeses == NULL) { - tst_brkm(TBROK, cleanup, "malloc failed"); - /*NOTREACHED*/ - } - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - mypid = getpid(); - - tst_resm(TINFO, "OPEN_MAX is %d", OPEN_MAX); - - /* establish first free file */ - sprintf(filname, "fork01.%d", mypid); - if ((first = creat(filname, 0660)) == -1) { - tst_brkm(TBROK, cleanup, "Cannot open first file %s, " - "errno = %d", filname, errno); - /*NOTREACHED*/ - } - close(first); - - tst_resm(TINFO, "first file descriptor is %d ", first); - - if (unlink(filname) == -1) { - tst_brkm(TBROK, cleanup, "Cannot unlink file %s, " - "errno = %d", filname, errno); - /*NOTREACHED*/ - } - - /* - * now open all the files for the test - */ - for (nfiles = first; nfiles < OPEN_MAX; nfiles++) { - sprintf(filname, "file%d.%d", nfiles, mypid); - if ((fildeses[nfiles] = fopen(filname, "a")) == NULL) { - tst_brkm(TBROK, cleanup, "Parent: cannot open " - "file %d %s errno = %d", nfiles, - filname, errno); - /*NOTREACHED*/ - } -#ifdef DEBUG - tst_resm(TINFO, "filname: %s", filname); -#endif - } - - tst_resm(TINFO, "Parent reporting %d files open", nfiles - 1); - - if ((pid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "Fork failed"); - /*NOTREACHED*/ - } - - if (pid == 0) { /* child */ - nfiles--; - if (fclose(fildeses[nfiles]) == -1) { - tst_resm(TINFO, "Child could not close file " - "#%d, errno = %d", nfiles, errno); - exit(1); - /*NOTREACHED*/ - } else { - sprintf(childfile, "cfile.%d", getpid()); - if ((fildeses[nfiles] = - fopen(childfile, "a")) == NULL) { - tst_resm(TINFO, "Child could not open " - "file %s, errno = %d", - childfile, errno); - exit(1); - /*NOTREACHED*/ - } else { - tst_resm(TINFO, "Child opened new " - "file #%d", nfiles); - unlink(childfile); - exit(0); - } - } - } else { /* parent */ - wait(&status); - if (status >> 8 != 0) { - tst_resm(TFAIL, "test 1 FAILED"); - } else { - tst_resm(TPASS, "test 1 PASSED"); - } - } - - /* clean up things in case we are looping */ - for (nf = first; nf < nfiles; nf++) { - fclose(fildeses[nf]); - sprintf(filname, "file%d.%d", nf, mypid); - unlink(filname); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; - - /* - * make a temp directory and cd to it - */ - tst_tmpdir(); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or at premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * remove tmp dir and all files in it - */ - tst_rmdir(); - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fork10.c b/winsup/testsuite/winsup.api/ltp/fork10.c deleted file mode 100644 index 9dcbbb3b5..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork10.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * fork04.c - * - * DESCRIPTION - * Check inheritance of file descriptor by children, they - * should all be refering to the same file. - * - * ALGORITHM - * Child reads several chars and exits. - * Parent forks another child, have the child and parent attempt to use - * that location - * - * USAGE - * fork04 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "fork04"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -char pidbuf[10]; -char fnamebuf[40]; - -int -main(int ac, char **av) -{ - int status, pid, fildes; - char parchar[2]; - char chilchar[2]; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - if ((fildes = creat(fnamebuf, 0600)) < 0) { - tst_brkm(TBROK, cleanup, "Parent: cannot open %s for " - "write, errno = %d", fnamebuf, errno); - /*NOTREACHED*/ - } - write(fildes, "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 27); - close(fildes); - - if ((fildes = open(fnamebuf, 0)) == -1) { - tst_brkm(TBROK, cleanup, "Parent: cannot open %s for " - "reading", fnamebuf); - /*NOTREACHED*/ - } - - if ((pid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() #1 failed"); - /*NOTREACHED*/ - } - - if (pid == 0) { /* child */ - tst_resm(TINFO, "fork child A"); - if (lseek(fildes, 10L, 0) == -1L) { - tst_resm(TFAIL, "bad lseek by child"); - exit(1); - } - exit(0); - } else { /* parent */ - wait(&status); - - /* parent starts second child */ - if ((pid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() #2 failed"); - /*NOTREACHED*/ - } - - if (pid == 0) { /* child */ - if (read(fildes, chilchar, 1) <= 0) { - tst_resm(TFAIL, "Child can't read " - "file"); - exit(1); - } else { - if (chilchar[0] != 'K') { - chilchar[1] = '\n'; - exit(1); - } else { - exit(0); - } - } - } else { /* parent */ - (void)wait(&status); - if (status >> 8 != 0) { - tst_resm(TFAIL, "Bad return from " - "second child"); - continue; - } - /* parent reads */ - if (read(fildes, parchar, 1) <= 0) { - tst_resm(TFAIL, "Parent cannot read " - "file"); - continue; - } else { - write(fildes, parchar, 1); - if (parchar[0] != 'L') { - parchar[1] = '\n'; - tst_resm(TFAIL, "Test failed"); - continue; - } - } - } - } - tst_resm(TPASS, "test 1 PASSED"); - close (fildes); - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; - - /* - * make a temp directory and cd to it - */ - tst_tmpdir(); - - strcpy(fnamebuf, "fork04."); - sprintf(pidbuf, "%d", getpid()); - strcat(fnamebuf, pidbuf); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * remove tmp dir and all files in it - */ - tst_rmdir(); - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fork11.c b/winsup/testsuite/winsup.api/ltp/fork11.c deleted file mode 100644 index 2b1035230..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork11.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * fork05.c - * - * DESCRIPTION - * Test that parent gets a pid from each child when doing wait - * - * ALGORITHM - * Fork NUMFORKS children that do nothing. - * - * USAGE - * fork05 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "fork05"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -#define NUMFORKS 100 - -int -main(int ac, char **av) -{ - int i, pid, cpid, status; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* - * perform global setup for the test - */ - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - for (i=0; i 0) { /* parent */ - cpid = wait(&status); - if (cpid == pid) { - tst_resm(TPASS, "fork #%d passed", i+1); - } else { - tst_resm(TFAIL, "fork #%d failed", i+1); - } - } else { - tst_resm(TFAIL, "fork #%d failed", i+1); - break; - } - } - tst_resm(TINFO, "Number of processes forked = %d", i); - tst_resm(TINFO, "Exit test 1"); - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* - * capture signals - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* - * Pause if that option was specified - */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/fpathconf01.c b/winsup/testsuite/winsup.api/ltp/fpathconf01.c deleted file mode 100644 index 37fbe9689..000000000 --- a/winsup/testsuite/winsup.api/ltp/fpathconf01.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fpathconf01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fpathconf(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 7 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fpathconf(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fpathconf(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fpathconf(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fpathconf01"; /* Test program identifier. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -#define FILENAME "fpafile01" - -int exp_enos[]={0, 0}; - -int i; - -struct pathconf_args -{ - const char *define_tag; - int value; - int defined; /* Some of these are undefined on regular files. - * Cancer does a slightly better job with these already, - * so this is all I'll do to this test. 11/19/98 roehrich - */ -} args[] = { - {"_PC_MAX_CANON", _PC_MAX_CANON, 0}, - {"_PC_MAX_INPUT", _PC_MAX_INPUT, 0}, - {"_PC_VDISABLE", _PC_VDISABLE, 0}, - {"_PC_LINK_MAX", _PC_LINK_MAX, 1}, - {"_PC_NAME_MAX", _PC_NAME_MAX, 1}, - {"_PC_PATH_MAX", _PC_PATH_MAX, 1}, - {"_PC_PIPE_BUF", _PC_PIPE_BUF, 0} -}; - -int TST_TOTAL=((sizeof(args)/sizeof(args[0]))); -int fd; /* temp file for fpathconf */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (i=0; i -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - -const char *TCID="fstat01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -struct stat statter; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call fstat(2) - */ - TEST(fstat(fd, &statter)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fstat(%s, &statter) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fstat(%s, &statter) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fstat02.c b/winsup/testsuite/winsup.api/ltp/fstat02.c deleted file mode 100644 index 224caf0d7..000000000 --- a/winsup/testsuite/winsup.api/ltp/fstat02.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: fstat02 - * - * Test Description: - * Verify that, fstat(2) succeeds to get the status of a file and fills - * the stat structure elements though file pointed to by file descriptor - * not opened for reading. - * - * Expected Result: - * fstat() should return value 0 on success and the stat structure elements - * should be filled with specified 'file' information. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * fstat02 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be run by 'non-super-user' only. - * - */ -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE 0644 -#define TESTFILE "testfile" -#define FILE_SIZE 1024 -#define BUF_SIZE 256 -#define MASK 0777 - -const char *TCID="fstat02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -uid_t User_id; /* user id/group id of test process */ -gid_t Group_id; -int fildes; /* File descriptor of testfile */ - -void setup(); /* Setup function for the test */ -void cleanup() __attribute__((noreturn));/* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call fstat(2) to get the status of - * specified 'file' pointed to by 'fd' - * into stat structure. - */ - TEST(fstat(fildes, &stat_buf)); - - /* check return code of fstat(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, - "fstat on %s Failed, errno=%d : %s", - TESTFILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Verify the data returned by fstat(2) - * aganist the expected data. - */ - if ((stat_buf.st_uid != User_id) || - (stat_buf.st_gid != Group_id) || - (stat_buf.st_size != FILE_SIZE) || - ((stat_buf.st_mode & MASK) != FILE_MODE)) { - tst_resm(TFAIL, "Functionality of fstat(2) on " - "'%s' Failed", TESTFILE); - } else { - tst_resm(TPASS, "Functionality of fstat(2) on " - "'%s' Succcessful", TESTFILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup() - Performs setup function for the test. - * Creat a temporary directory and chdir to it. - * Creat a temporary file and write some known data into it. - * Get the effective uid/gid of test process. - */ -void -setup() -{ - int i; - char tst_buff[BUF_SIZE]; - int wbytes; - int write_len = 0; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Check that the test process id is not super/root */ - if (geteuid() == 0) { - tst_brkm(TBROK, NULL, "Must be non-super/root for this test!"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - if ((fildes = open(TESTFILE, O_WRONLY|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* Write to the file 1k data from the buffer */ - while (write_len < FILE_SIZE) { - if ((wbytes = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } else { - write_len += wbytes; - } - } - - /* Get the uid/gid of the process */ - User_id = getuid(); - Group_id = getgid(); - -} /* End setup() */ - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the test file and remove the test file and temporary directory. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the test file */ - if (close(fildes) == -1) { - tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fstat03.c b/winsup/testsuite/winsup.api/ltp/fstat03.c deleted file mode 100644 index 47982ed47..000000000 --- a/winsup/testsuite/winsup.api/ltp/fstat03.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Test Name: fstat03 - * - * Test Description: - * Verify that, fstat(2) returns -1 and sets errno to EBADF if the file - * pointed to by file descriptor is not valid. - * - * Expected Result: - * fstat() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * fstat03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be executed by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define TEST_FILE "testfile" - -const char *TCID="fstat03"; /* Test program identifier. */ -int TST_TOTAL = 1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EBADF, 0}; -int fildes; /* testfile descriptor */ - -void setup(); /* Main setup function for the tests */ -void cleanup() __attribute__((noreturn));/* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* - * Invoke setup function to create a testfile under temporary - * directory. - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - /* - * Call fstat(2) to get the status information - * of a closed testfile pointed to by 'fd'. - * verify that fstat fails with -1 return value and - * sets appropriate errno. - */ - TEST(fstat(fildes, &stat_buf)); - - /* Check return code from fstat(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == EBADF) { - tst_resm(TPASS, "fstat() fails with " - "expected error EBADF"); - } else { - tst_resm(TFAIL, "fstat() fails with " - "wrong errno:%d", TEST_ERRNO); - } - } else { - tst_resm(TFAIL, "fstat() returned %d, " - "expected -1, error EBADF"); - } - } /* End for TEST_LOOPING */ - - /* - * Invoke cleanup() to delete the test directory/file(s) created - * in the setup(). - */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup(void) - performs all ONE TIME setup for this test. - * Exit the test program on receipt of unexpected signals. - * Create a temporary directory and change directory to it. - * Create a testfile under temporary directory. - * Close the testfile. - */ -void -setup() -{ - /* Capture unexpected signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Make a temp dir and cd to it */ - tst_tmpdir(); - - /* Create a testfile under temporary directory */ - if ((fildes = open(TEST_FILE, O_RDWR|O_CREAT, 0666)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0666) failed, errno=%d : %s", - TEST_FILE, errno, strerror(errno)); - } - - if (close(fildes) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TEST_FILE, errno, strerror(errno)); - } -} /* End of setup */ - -/* - * void - * cleanup() - Performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Print test timing stats and errno log if test executed with options. - * Close the testfile if still opened. - * Remove temporary directory and sub-directories/files under it - * created during setup(). - * Exit the test program with normal exit code. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove files and temporary directory created */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fstat04.c b/winsup/testsuite/winsup.api/ltp/fstat04.c deleted file mode 100644 index 1de507e62..000000000 --- a/winsup/testsuite/winsup.api/ltp/fstat04.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: fstat01 - * - * Test Description: - * Verify that, fstat(2) succeeds to get the status of a file pointed by - * file descriptor and fills the stat structure elements. - * - * Expected Result: - * fstat() should return value 0 on success and the stat structure should - * be filled with specified 'file' information. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * fstat01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be run by 'non-super-user' only. - * - */ -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE 0644 -#define TESTFILE "testfile" -#define FILE_SIZE 1024 -#define BUF_SIZE 256 -#define MASK 0777 - -const char *TCID="fstat01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -uid_t User_id; /* user id/group id of test process */ -gid_t Group_id; -int fildes; /* File descriptor of testfile */ - -void setup(); /* Setup function for the test */ -void cleanup() __attribute__((noreturn));/* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call fstat(2) to get the status of - * specified 'file' pointed to 'fd' - * into stat structure. - */ - TEST(fstat(fildes, &stat_buf)); - - /* check return code of fstat(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, - "fstat on %s Failed, errno=%d : %s", - TESTFILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Verify the data returned by fstat(2) - * aganist the expected data. - */ - if ((stat_buf.st_uid != User_id) || - (stat_buf.st_gid != Group_id) || - (stat_buf.st_size != FILE_SIZE) || - ((stat_buf.st_mode & MASK) != FILE_MODE)) { - tst_resm(TFAIL, "Functionality of fstat(2) on " - "'%s' Failed", TESTFILE); - } else { - tst_resm(TPASS, "Functionality of fstat(2) on " - "'%s' Succcessful", TESTFILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup() - Performs setup function for the test. - * Creat a temporary directory and chdir to it. - * Creat a test file and write some data into it. - * Get the user/group id info. of test process. - */ -void -setup() -{ - int i; /* counter */ - char tst_buff[BUF_SIZE]; /* data buffer */ - int wbytes; /* no. of bytes written */ - int write_len = 0; /* data length */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Check that the test process id is not super/root */ - if (geteuid() == 0) { - tst_brkm(TBROK, NULL, "Must be non-super/root for this test!"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - if ((fildes = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* Write to the file 1k data from the buffer */ - while (write_len < FILE_SIZE) { - if ((wbytes = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } else { - write_len += wbytes; - } - } - - /* Get the uid/gid of the process */ - User_id = getuid(); - Group_id = getgid(); - -} /* End setup() */ - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the testfile opened for reading/writing. - * Delete the testfile and temporary directory. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the test file */ - if (close(fildes) == -1) { - tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/fsync01.c b/winsup/testsuite/winsup.api/ltp/fsync01.c deleted file mode 100644 index 261ea0dbb..000000000 --- a/winsup/testsuite/winsup.api/ltp/fsync01.c +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : fsync01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for fsync(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) fsync(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the fsync(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * fsync(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="fsync01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -const char *buf = "davef"; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* write sone data to get fsync'd out */ - if (write(fd, &buf, strlen(buf)) == -1) { - tst_brkm(TBROK, cleanup, - "write(%s, &buf, strlen(buf)) Failed, errno=%d : %s", - fname, TEST_ERRNO, strerror(TEST_ERRNO)); - } - /* - * Call fsync(2) - */ - TEST(fsync(fd)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "fsync(%s) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "fsync(%s) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we have open */ - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/ftruncate01.c b/winsup/testsuite/winsup.api/ltp/ftruncate01.c deleted file mode 100644 index a45c167aa..000000000 --- a/winsup/testsuite/winsup.api/ltp/ftruncate01.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: ftruncate01 - * - * Test Description: - * Verify that, ftruncate(2) succeeds to truncate a file to a specified - * length if the file indicated by file descriptor opened for writing. - * - * Expected Result: - * ftruncate(2) should return a value 0 and the length of the file after - * truncation should be equal to the length it is truncated to. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * ftruncate01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be run by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" /* file under test */ -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define BUF_SIZE 256 /* buffer size */ -#define FILE_SIZE 1024 /* test file size */ -#define TRUNC_LEN 256 /* truncation length */ - -const char *TCID="ftruncate01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test conditions */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fildes; /* file descriptor for test file */ - -void setup(); /* setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat(2) struct contents */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - off_t file_length; /* test file length */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call ftruncate(2) to truncate a test file to a - * specified length. - */ - TEST(ftruncate(fildes, TRUNC_LEN)); - - /* check return code of ftruncate(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, - "ftruncate() of %s Failed, errno=%d : %s", - TESTFILE, TEST_ERRNO, - strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the testfile information using - * fstat(2). - */ - if (fstat(fildes, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, - "stat(2) of %s failed, error:%d", - TESTFILE, errno); - } - stat_buf.st_mode &= ~S_IFREG; - file_length = stat_buf.st_size; - - /* - * Check for expected size of testfile after - * truncate(2) on it. - */ - if (file_length != TRUNC_LEN) { - tst_resm(TFAIL, "%s: Incorrect file size %d, " - "Expected %d", TESTFILE, file_length, - TRUNC_LEN); - } else { - tst_resm(TPASS, "Functionality of ftruncate() " - "on %s successful", TESTFILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - */ -void -setup() -{ - int i; /* counter for for loop() */ - int c, c_total = 0; /* bytes to be written to file */ - char tst_buff[BUF_SIZE]; /* buffer to hold data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* open a file for reading/writing */ - if ((fildes = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - - /* Write to the file 1k data from the buffer */ - while (c_total < FILE_SIZE) { - if ((c = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } else { - c_total += c; - } - } -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the temporary file. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Close the testfile after writing data into it */ - if (close(fildes) == -1) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/ftruncate02.c b/winsup/testsuite/winsup.api/ltp/ftruncate02.c deleted file mode 100644 index 2b4e72326..000000000 --- a/winsup/testsuite/winsup.api/ltp/ftruncate02.c +++ /dev/null @@ -1,313 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: ftruncate02 - * - * Test Description: - * Verify that, ftruncate(2) succeeds to truncate a file to a certain length, - * but the attempt to read past the truncated length will fail. - * - * Expected Result: - * ftruncate(2) should return a value 0 and the attempt to read past the - * truncated length will fail. In case where the file before truncation was - * shorter, the bytes between the old and new should be all zeroes. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * ftruncate02 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be run by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" /* file under test */ -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define BUF_SIZE 256 /* buffer size */ -#define FILE_SIZE 1024 /* test file size */ -#define TRUNC_LEN1 256 /* truncation length */ -#define TRUNC_LEN2 512 /* truncation length */ - -const char *TCID="ftruncate02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test conditions */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fd; /* file descriptor of testfile */ -char tst_buff[BUF_SIZE]; /* buffer to hold testfile contents */ - -void setup(); /* setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat(2) struct contents */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - off_t file_length2; /* test file length */ - off_t file_length1; /* test file length */ - int rbytes, i; /* bytes read from testfile */ - int read_len = 0; /* total no. of bytes read from testfile */ - int err_flag = 0; /* error indicator flag */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call ftruncate(2) to truncate a test file to a - * specified length (TRUNC_LEN1). - */ - TEST(ftruncate(fd, TRUNC_LEN1)); - - /* check return code of ftruncate(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "ftruncate of %s to size %d Failed, " - "errno=%d : %s", TESTFILE, TRUNC_LEN1, - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the testfile information using - * fstat(2). - */ - if (fstat(fd, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "fstat(2) of %s failed" - " after 1st truncate, error:%d", - TESTFILE, errno); - } - stat_buf.st_mode &= ~S_IFREG; - file_length1 = stat_buf.st_size; - - /* - * Set the file pointer of testfile to the - * beginning of the file. - */ - if (lseek(fd, 0, SEEK_SET) < 0) { - tst_brkm(TFAIL, cleanup, "lseek(2) on %s failed" - " after 1st ftruncate, error:%d", - TESTFILE, errno); - } - - /* Read the testfile from the beginning. */ - while ((rbytes = read(fd, tst_buff, - sizeof(tst_buff))) > 0) { - read_len += rbytes; - } - - /* - * Execute ftruncate(2) again to truncate - * testfile to a size TRUNC_LEN2. - */ - TEST(ftruncate(fd, TRUNC_LEN2)); - - /* check return code of ftruncate(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "ftruncate of %s to size %d " - "Failed, errno=%d : %s", TESTFILE, - TRUNC_LEN2, TEST_ERRNO, - strerror(TEST_ERRNO)); - continue; - } - - /* - * Get the testfile information using - * fstat(2) - */ - if (fstat(fd, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "fstat(2) of %s failed" - " after 2nd truncate, error:%d", - TESTFILE, errno); - } - stat_buf.st_mode &= ~S_IFREG; - file_length2 = stat_buf.st_size; - - /* - * Set the file pointer of testfile to the - * offset TRUNC_LEN1 of testfile. - */ - if (lseek(fd, TRUNC_LEN1, SEEK_SET) < 0) { - tst_brkm(TFAIL, cleanup, "lseek(2) on %s failed" - " after 2nd ftruncate, error:%d", - TESTFILE, errno); - } - - /* Read the testfile contents till EOF */ - while((rbytes = read(fd, tst_buff, - sizeof(tst_buff))) > 0) { - for (i = 0; i < rbytes; i++) { - if (tst_buff[i] != 0) { - err_flag++; - } - } - } - - /* - * Check for expected size of testfile after - * issuing ftruncate(2) on it. - */ - if ((file_length1 != TRUNC_LEN1) || - (file_length2 != TRUNC_LEN2) || - (read_len != TRUNC_LEN1) || - (err_flag != 0)) { - tst_resm(TFAIL, "Functionality of ftruncate(2) " - "on %s Failed", TESTFILE); - } else { - tst_resm(TPASS, "Functionality of ftruncate(2) " - "on %s successful", TESTFILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - */ -void -setup() -{ - int i; /* counter variable */ - int wbytes; /* bytes written to testfile */ - int write_len = 0; /* total no. of bytes written to testfile */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - /* open a file for reading/writing */ - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - - /* Write to the file 1k data from the buffer */ - while (write_len < FILE_SIZE) { - if ((wbytes = write(fd, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } else { - write_len += wbytes; - } - } -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the testfile. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Close the testfile after writing data into it */ - if (close(fd) == -1) { - tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/ftruncate03.c b/winsup/testsuite/winsup.api/ltp/ftruncate03.c deleted file mode 100644 index 279b4e88f..000000000 --- a/winsup/testsuite/winsup.api/ltp/ftruncate03.c +++ /dev/null @@ -1,324 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: ftruncate03 - * - * Test Description: - * Verify that, - * 1) ftruncate(2) returns -1 and sets errno to EINVAL if the specified - * truncate length is less than 0. - * 2) ftruncate(2) returns -1 and sets errno to EBADF if the file descriptor - * of the specified file is not valid. - * - * Expected Result: - * ftruncate() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * ftruncate03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be executed by 'non-super-user' only. - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEST_FILE1 "test_file1" /* file under test */ -#define TEST_FILE2 "test_file2" /* file under test */ -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define BUF_SIZE 256 /* buffer size */ -#define FILE_SIZE 1024 /* test file size */ - -int no_setup(); -int setup1(); /* setup function to test chmod for EBADF */ -int setup2(); /* setup function to test chmod for EINVAL */ - -int fd1; /* File descriptor for testfile1 */ -int fd2; /* File descriptor for testfile2 */ - -struct test_case_t { /* test case struct. to hold ref. test cond's*/ - int fd; - const char *desc; - int exp_errno; - int len; - int (*setupfunc)(); -} Test_cases[] = { - { 1, "Length argument is -ve", EINVAL, -1, setup1 }, - { 2, "File descriptor is not valid", EBADF, 256, setup2 }, - { 0, NULL, 0, 0, no_setup } -}; - -const char *TCID="ftruncate03"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test conditions */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EINVAL, EBADF, 0}; - -void setup(); /* Main setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* Main cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *test_desc; /* test specific error message */ - int fildes; /* File descriptor of testfile */ - off_t trunc_len; /* truncate length */ - int ind; - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* - * Perform global setup for test to call individual test specific - * setup functions. - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - fildes = Test_cases[ind].fd; - test_desc = Test_cases[ind].desc; - trunc_len = Test_cases[ind].len; - - if (fildes == 1) { - fildes = fd1; - } else { - fildes = fd2; - } - - /* - * Call ftruncate(2) to test different test conditions. - * verify that it fails with return code -1 and sets - * appropriate errno. - */ - TEST(ftruncate(fildes, trunc_len)); - - /* check return code of ftruncate(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == Test_cases[ind].exp_errno) { - tst_resm(TPASS, "ftruncate() fails, %s," - " errno=%d", test_desc, - TEST_ERRNO); - } else { - tst_resm(TFAIL, "ftruncate() fails, %s," - " errno=%d, expected errno:%d", - test_desc, TEST_ERRNO, - Test_cases[ind].exp_errno); - } - } else { - tst_resm(TFAIL, "ftruncate() returned %d, " - "expected -1, errno:%d", TEST_RETURN, - Test_cases[ind].exp_errno); - } - } /* End of TEST CASE LOOPING. */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Fill the test buffer with some date used to fill test file(s). - * Call individual test specific setup functions. - */ -void -setup() -{ - int ind; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Check that the test process id is not root/super-user */ - if (geteuid() == 0) { - tst_brkm(TBROK, NULL, "Must be non-root/super for this test!"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* call individual setup functions */ - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - Test_cases[ind].setupfunc(); - } -} /* End of setup */ - -/* - * int - * setup1() - setup function for a test condition for which ftruncate(2) - * returns -1 and sets errno to EINVAL. - * Create a test file and open it for writing only. - */ -int -setup1() -{ - /* Open the testfile in write-only mode */ - if ((fd1 = open(TEST_FILE1, O_WRONLY|O_CREAT, 0644)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_WRONLY) Failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - } - return 0; -} /* End setup1() */ - -/* - * int - * setup2() - setup function for a test condition for which ftruncate(2) - * returns -1 and sets errno to EBADF. - * Create a test file and open it for reading/writing, and fill the - * testfile with the contents of test buffer. - * Close the test file. - * - */ -int -setup2() -{ - int c, i, c_total = 0; - char tst_buff[BUF_SIZE]; /* buffer to hold testfile contents */ - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* open a testfile for reading/writing */ - if ((fd2 = open(TEST_FILE2, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s", - TEST_FILE2, FILE_MODE, errno, strerror(errno)); - } - - /* Write to the file 1k data from the buffer */ - while (c_total < FILE_SIZE) { - if ((c = write(fd2, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TEST_FILE2, errno, strerror(errno)); - } else { - c_total += c; - } - } - - /* Close the testfile after writing data into it */ - if (close(fd2) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TEST_FILE2, errno, strerror(errno)); - } - return 0; -} /* End of setup2 */ - -/* - * int - * no_setup() - This function just returns 0. - */ -int -no_setup() -{ - return 0; -} - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the temporary file. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Close the testfile after opening it read-only in setup1 */ - if (close(fd1) == -1) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/getegid01.c b/winsup/testsuite/winsup.api/ltp/getegid01.c deleted file mode 100644 index 942201067..000000000 --- a/winsup/testsuite/winsup.api/ltp/getegid01.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getegid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getegid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getegid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getegid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getegid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getegid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0}; /* must be a 0 terminated list */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - ; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Get effective group id. - */ - ; - - /* Call getegid(2) */ - TEST(getegid( )); - - /* check return code */ - if ( TEST_RETURN < 0 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getegid - Get effective group id. failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; /* next loop for MTKERNEL */ - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getegid - Get effective group id. returned %d", TEST_RETURN); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/geteuid01.c b/winsup/testsuite/winsup.api/ltp/geteuid01.c deleted file mode 100644 index 82a681ec5..000000000 --- a/winsup/testsuite/winsup.api/ltp/geteuid01.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : geteuid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for geteuid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) geteuid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the geteuid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * geteuid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="geteuid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0}; /* must be a 0 terminated list */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - ; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Get effective user id. - */ - ; - - /* Call geteuid(2) */ - TEST(geteuid( )); - - /* check return code */ - if ( TEST_RETURN < 0 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "geteuid - Get effective user id. failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; /* next loop for MTKERNEL */ - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "geteuid - Get effective user id. returned %d", TEST_RETURN); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/getgid01.c b/winsup/testsuite/winsup.api/ltp/getgid01.c deleted file mode 100644 index e5b138c8a..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgid01.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getgid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getgid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getgid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getgid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getgid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getgid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call getgid(2) - */ - TEST(getgid()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getgid() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getgid() returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/getgid02.c b/winsup/testsuite/winsup.api/ltp/getgid02.c deleted file mode 100644 index 5efbda521..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgid02.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * getgid02.c - * - * DESCRIPTION - * Testcase to check the basic functionality of getegid(). - * - * ALGORITHM - * call setup - * loop if that option was specified - * Execute getegid() call using TEST macro - * if not expected value - * break remaining tests and cleanup - * if STD_FUNCTIONAL_TEST - * Execute geteuid() call - * Execute getpwduid() call - * if the passwd entry is NULL - * break the remaining tests and cleanup - * else if pwent->pw_gid != TEST_RETURN - * print failure message - * else - * print pass message - * else - * print pass message - * call cleanup - * - * USAGE: - * getgid02 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * none - */ - -#include -#include - -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "getgid02"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int euid; - struct passwd *pwent; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(getegid()); - - if (TEST_RETURN < 0) { - tst_brkm(TBROK, cleanup, "This should never happen"); - } - - if (STD_FUNCTIONAL_TEST) { - euid = geteuid(); - - pwent = getpwuid(euid); - - if (pwent == NULL) { - tst_brkm(TBROK, cleanup, "geteuid() returned " - "unexpected value %d", euid); - } else { - if (pwent->pw_gid != TEST_RETURN) { - tst_resm(TFAIL, "getegid() return value" - " %d unexpected - expected %d", - TEST_RETURN, pwent->pw_gid); - } else { - tst_resm(TPASS, "effective group id %d " - "is correct", TEST_RETURN); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup() -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/getgid03.c b/winsup/testsuite/winsup.api/ltp/getgid03.c deleted file mode 100644 index ef0eaea14..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgid03.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * getgid01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of getgid(). - * - * ALGORITHM - * call setup - * loop if that option was specified - * Execute getgid() call using TEST macro - * if not expected value - * break remaining tests and cleanup - * if STD_FUNCTIONAL_TEST - * Execute getuid() call - * Execute getpwduid() call - * if the passwd entry is NULL - * break the remaining tests and cleanup - * else if pwent->pw_gid != TEST_RETURN - * print failure message - * else - * print pass message - * else - * print pass message - * call cleanup - * - * USAGE: - * getgid01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * none - */ - -#include -#include - -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "getgid01"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int uid; - struct passwd *pwent; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(getgid()); - - if (TEST_RETURN < 0) { - tst_brkm(TBROK, cleanup, "This should never happen"); - } - - if (STD_FUNCTIONAL_TEST) { - uid = getuid(); - pwent = getpwuid(uid); - - if (pwent == NULL) { - tst_brkm(TBROK, cleanup, "getuid() returned " - "unexpected value %d", uid); - } else { - if (pwent->pw_gid != TEST_RETURN) { - tst_resm(TFAIL, "getgid() return value " - "%d unexpected - expected %d", - TEST_RETURN, pwent->pw_gid); - } else { - tst_resm(TPASS, "group id %d returned " - "correctly", TEST_RETURN); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup() -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/getgroups01.c b/winsup/testsuite/winsup.api/ltp/getgroups01.c deleted file mode 100644 index db9f942f6..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgroups01.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/*********************************************************************** -TEST IDENTIFIER: getgroups01 : Getgroups system call critical test - -PARENT DOCUMENT: ggrtds01: Getgroups system call test design spec - -AUTHOR: Barrie Kletscher - Rewrote : 11-92 by Richard Logan - -CO-PILOT: Dave Baumgartner - -TEST ITEMS: - 1. Check to see if getgroups(-1, gidset) fails and sets errno to EINVAL - 2. Check to see if getgroups(0, gidset) does not return -1 and gidset is - not modified. - 3. Check to see if getgroups(x, gigset) fails and sets errno to EINVAL, - where x is one less then what is returned by getgroups(0, gidset). - 4. Check to see if getgroups() succeeds and gidset contains - group id returned from getgid(). - -INPUT SPECIFICATIONS: - NONE - -OUTPUT SPECIFICATIONS: - Standard tst_res output format - -ENVIRONMENTAL NEEDS: - NONE. - -SPECIAL PROCEDURAL REQUIREMENTS: - None - -INTERCASE DEPENDENCIES: - Test case #3 depends on test case #2. - -DETAILED DESCRIPTION: - Set up the signal handling capabilities. - execute tests - exit - -BUGS: - None known. - -************************************************************/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="getgroups01"; /* Test program identifier. */ -int TST_TOTAL=4; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *ptr; /* message returned from parse_opts */ - - int i, /* counter */ - group, /* return value from Getgid() call */ - entries; /* number of group entries */ - - gid_t gidset[NGROUPS]; /* storage for all group ids */ - gid_t cmpset[NGROUPS]; - int ret; - int ret2; - int errors = 0; - char msg[500]; - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (ptr=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", ptr); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * Check to see if getgroups() fails on erraneous condition. - */ - TEST( getgroups(-1,gidset) ); - - if((ret=TEST_RETURN) != -1) { - sprintf(msg, - "getgroups(-1,gidset) returned %d, expected -1 and errno = EINVAL", - ret); - tst_resm(TFAIL,msg); - errors++; - } - else if ( STD_FUNCTIONAL_TEST ) { - if(errno != EINVAL) { - sprintf(msg, - "getgroups(-1,gidset) returned %d, errno = %d, expected errno %d (EINVAL)", - ret, errno, EINVAL); - tst_resm(TFAIL,msg); - errors++; - } - else { - sprintf(msg, - "getgroups(-1,gidset) returned %d and error = %d (EINVAL) as expected", - ret, errno); - tst_resm(TPASS, msg); - } - } - - /* - * Check that if ngrps is zero that the number of groups is return and - * the the gidset array is not modified. - * This is a POSIX special case. - */ - - memset(gidset, 052, NGROUPS); - memset(cmpset, 052, NGROUPS); - - TEST( getgroups(0,gidset) ); - if((ret=TEST_RETURN) < 0) { - sprintf(msg, - "getgroups(0,gidset) returned %d with errno = %d, expected num gids with no change to gidset", - ret, errno); - tst_resm(TFAIL,msg); - errors++; - } - else if ( STD_FUNCTIONAL_TEST ) { - /* - * check that gidset was unchanged - */ - if ( memcmp(cmpset, gidset, NGROUPS) != 0 ) { - sprintf(msg, - "getgroups(0,gidset) returned %d, the gidset array was modified", - ret); - tst_resm(TFAIL,msg); - errors++; - } - else { - sprintf(msg, - "getgroups(0,gidset) returned %d, the gidset array not was modified", - ret); - tst_resm(TPASS, msg); - } - } - - /* - * Check to see that is -1 is returned and errno is set to EINVAL when - * ngroups is not big enough to hold all groups. - */ - - if ( ret <= 1 ) { - sprintf(msg, "getgroups(0,gidset) returned %d, Unable to test that\nusing ngrps >=1 but less than number of grps", ret); - tst_resm(TCONF, msg); - errors++; - } - else { - TEST( getgroups(ret-1, gidset) ); - if ((ret2 = TEST_RETURN) == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( errno != EINVAL ) { - sprintf(msg, - "getgroups(%d, gidset) returned -1, but not errno %d (EINVAL) but %d", - ret-1, EINVAL, errno); - tst_resm(TFAIL, msg); - errors++; - } - else { - sprintf(msg, - "getgroups(%d, gidset) returned -1, and errno %d (EINVAL) when %d grps", - ret-1, errno, ret); - tst_resm(TPASS, msg); - } - } - } - else { - sprintf(msg, - "getgroups(%d, gidset) returned %d, expected -1 and errno EINVAL.", - ret-1, ret2); - tst_resm(TFAIL, msg); - errors++; - } - } - - /* - * Check to see if getgroups() succeeds and contains getgid's gid. - */ - - TEST( getgroups(NGROUPS,gidset) ); - if((entries = TEST_RETURN) == -1) { - sprintf(msg, "getgroups(NGROUPS,gidset) returned -1 and errno = %d", errno); - tst_resm(TFAIL, msg); - errors++; - } - else if ( STD_FUNCTIONAL_TEST ) { - - /* - * Check to see if getgroups() contains getgid(). - */ - - group = getgid(); - - for(i = 0; i < entries; i++) - { - if(gidset[i] == group) - { - sprintf(msg, - "getgroups(NGROUPS,gidset) ret %d contains gid %d (from getgid)", - entries, group); - tst_resm(TPASS, msg); - break; - } - } - - if( i == entries ) { - sprintf(msg, - "getgroups(NGROUPS,gidset) ret %d, does not contain gid %d (from getgid)", - entries, group); - tst_resm(TFAIL,msg); - errors++; - } - } - - } - cleanup(); - - return 0; -} /* end main() */ - - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - diff --git a/winsup/testsuite/winsup.api/ltp/getgroups02.c b/winsup/testsuite/winsup.api/ltp/getgroups02.c deleted file mode 100644 index e05258935..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgroups02.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getgroups02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getgroups(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getgroups(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getgroups(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getgroups(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getgroups02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -/* define array size for gids */ -#define GID_ARRAY_SIZE 100 - -gid_t gidset[GID_ARRAY_SIZE]; /* array of gids */ - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call getgroups(2) - */ - TEST(getgroups(GID_ARRAY_SIZE, gidset)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getgroups() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getgroups() returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/gethostid01.c b/winsup/testsuite/winsup.api/ltp/gethostid01.c deleted file mode 100644 index ebb6d1724..000000000 --- a/winsup/testsuite/winsup.api/ltp/gethostid01.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : gethostid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for gethostid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) gethostid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the gethostid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * gethostid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="gethostid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0}; /* must be a 0 terminated list */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - ; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Get host name - */ - ; - - /* Call gethostid(2) */ - TEST(gethostid( )); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "gethostid - Get host name failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; /* next loop for MTKERNEL */ - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "gethostid - Get host name returned %d", TEST_RETURN); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/gethostname01.c b/winsup/testsuite/winsup.api/ltp/gethostname01.c deleted file mode 100644 index 0e765bfad..000000000 --- a/winsup/testsuite/winsup.api/ltp/gethostname01.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : gethostname01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for gethostname(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) gethostname(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the gethostname(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * gethostname(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - - - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="gethostname01";/* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0}; /* must be a 0 terminated list */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - char hname[100]; /* host name */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Get host name - */ - ; - - /* Call gethostname(2) */ - TEST(gethostname(hname, sizeof(hname) )); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "gethostname - Get host name failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; /* next loop for MTKERNEL */ - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "gethostname - Get host name returned %d", TEST_RETURN); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/getpgid01.c b/winsup/testsuite/winsup.api/ltp/getpgid01.c deleted file mode 100644 index 88907f413..000000000 --- a/winsup/testsuite/winsup.api/ltp/getpgid01.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * getpgid01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of getpgid(). - * - * ALGORITHM - * block1: Does getpgid(0), and checks for error. - * block2: Does getpgid(getpid()) and checks for error. - * block3: Does getpgid(getppid()) and checks for error. - * block4: Verifies that getpgid(getpgid(0)) == getpgid(0). - * block5: Does getpgid(1) and checks for error. - * - * USAGE - * getpgid01 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * Expects that there are no EPERM limitations on getting the - * process group ID from proc 1 (init). - */ - -#include -#include -#include -#include -#include - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID = "getpgid01"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned by parse_opts */ - - register int pgid_0, pgid_1; - register int my_pid, my_ppid; - int ex_stat, fail = 0; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); - - /* check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - if ((pgid_0 = fork()) < 0) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - if (pgid_0 > 0) { /* parent */ - /* - * parent process waits for child to exit, and then - * exits itself. - */ - while ((pgid_0 = wait(&ex_stat)) > 0); - - if (WEXITSTATUS(ex_stat) == 0) { - tst_resm(TINFO, "%s PASSED", TCID); - } else { - tst_resm(TINFO, "%s FAILED", TCID); - } - - /* let the child carry on */ - exit(0); - } - - /* child */ - tst_resm(TINFO, "Enter block 1"); - fail = 0; - if ((pgid_0 = getpgid(0)) < 0) { - perror("getpgid"); - tst_resm(TFAIL, "getpgid(0) failed"); - fail = 1; - } - - if (fail) { - tst_resm(TINFO, "Test block 1: getpgid(0) FAILED"); - } else { - tst_resm(TPASS, "Test block 1: getpgid(0) PASSED"); - } - tst_resm(TINFO, "Exit block 1"); - - tst_resm(TINFO, "Enter block 2"); - fail = 0; - - my_pid = getpid(); - if ((pgid_1 = getpgid(my_pid)) < 0) { - perror("getpgid"); - tst_resm(TFAIL, "getpgid(my_pid=%d) failed", my_pid); - tst_exit(); - } - if (pgid_0 != pgid_1) { - tst_resm(TFAIL, "getpgid(my_pid=%d) != getpgid(0) " - "[%d != %d]", my_pid, pgid_1, pgid_0); - fail = 1; - } - if (fail) { - tst_resm(TINFO, "Test block 2: getpgid(getpid()) " - "FAILED"); - } else { - tst_resm(TPASS, "Test blcok 2: getpgid(getpid()) " - "PASSED"); - } - tst_resm(TINFO, "Exit block 2"); - - tst_resm(TINFO, "Enter block 3"); - fail = 0; - - my_ppid = getppid(); - if ((pgid_1 = getpgid(my_ppid)) < 0) { - perror("getpgid"); - tst_resm(TFAIL, "getpgid(my_ppid=%d) failed", - my_ppid); - tst_exit(); - } - if (pgid_0 != pgid_1) { - tst_resm(TFAIL, "getpgid(my_ppid=%d) != getpgid(0) " - "[%d != %d]", my_ppid, pgid_1, pgid_0); - fail = 1; - } - - if (fail) { - tst_resm(TINFO, "Test block 3: getpgid(getppid()) " - "FAILED"); - } else { - tst_resm(TPASS, "Test block 3: getpgid(getppid()) " - "PASSED"); - } - tst_resm(TINFO, "Exit block 3"); - - tst_resm(TINFO, "Enter block 4"); - fail = 0; - - if ((pgid_1 = getpgid(pgid_0)) < 0) { - perror("getpgid"); - tst_resm(TFAIL, "getpgid(my_pgid=%d) failed", pgid_0); - tst_exit(); - } - if (pgid_0 != pgid_1) { - tst_resm(TFAIL, "getpgid(my_pgid=%d) != getpgid(0) " - "[%d != %d]", pgid_0, pgid_1, pgid_0); - fail = 1; - } - - if (fail) { - tst_resm(TINFO, "Test block 4: getpgid(1) FAILED"); - } else { - tst_resm(TPASS, "Test block 4: getpgid(1) PASSED"); - } - tst_resm(TINFO, "Exit block 4"); -#ifndef __CYGWIN__ -block5: - tst_resm(TINFO, "Enter block 5"); - fail = 0; - - if (getpgid(1) < 0) { - perror("getpgid"); - tst_resm(TFAIL, "getpgid(1) failed"); - fail = 1; - } - - if (fail) { - tst_resm(TINFO, "Test block 5: getpgid(1) FAILED"); - } else { - tst_resm(TPASS, "Test block 5: getpgid(1) PASSED"); - } - tst_resm(TINFO, "Exit block 5"); -#endif - } - cleanup(); -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/getpgid02.c b/winsup/testsuite/winsup.api/ltp/getpgid02.c deleted file mode 100644 index f6eaec6f6..000000000 --- a/winsup/testsuite/winsup.api/ltp/getpgid02.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * getpgid02.c - * - * DESCRIPTION - * Testcase to check the basic functionality of getpgid(). - * - * ALGORITHM - * test 1: Does getpgid(-99) and expects ESRCH. - * test 2: Searches an unused pid and expects ESRCH. - * - * USAGE: - * getpgid02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * none - */ - -#include -#include -#include -#include -#include - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID = "getpgid01"; -int TST_TOTAL = 2; -extern int Tst_count; - -int pgid_0, pgid_1; -#define BADPID -99 - -int exp_enos[]={ESRCH, 0}; - -struct test_case_t { - int *id; - int error; -} TC[] = { - /* The pid value is negative */ - {&pgid_0, ESRCH}, - - /* The pid value does not match any process */ - {&pgid_1, ESRCH} -}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - int i; - const char *msg; /* message returned by parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); - - /* set up the expected errnos */ - TEST_EXP_ENOS(exp_enos); - - /* check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - - /* loop through the test cases */ - for (i = 0; i < TST_TOTAL; i++) { - - TEST(getpgid(*TC[i].id)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "call succeeded unexpectedly"); - continue; - } - - TEST_ERROR_LOG(TEST_ERRNO); - - if (TEST_ERRNO == TC[i].error) { - tst_resm(TPASS, "expected failure - " - "errno = %d : %s", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "unexpected error - %d : %s - " - "expected %d", TEST_ERRNO, - strerror(TEST_ERRNO), TC[i].error); - } - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - pgid_0 = BADPID; - - /* - * Find a pid that isn't currently being used. Start - * at 'our pid - 1' and go backwards until we find one. - * In this way, we can be reasonably sure that the pid - * we find won't be reused for a while as new pids are - * allocated counting up to PID_MAX. - */ - for (pgid_1 = getpid() - 1; --pgid_1 > 0; ) { - if (kill(pgid_1, 0) < 0 && errno == ESRCH) { - break; - } - } -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/getpgrp01.c b/winsup/testsuite/winsup.api/ltp/getpgrp01.c deleted file mode 100644 index 6997be264..000000000 --- a/winsup/testsuite/winsup.api/ltp/getpgrp01.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getpgrp01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getpgrp(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getpgrp(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getpgrp(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getpgrp(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getpgrp01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call getpgrp(2) - */ - TEST(getpgrp()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getpgrp() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getpgrp() returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/getpid01.c b/winsup/testsuite/winsup.api/ltp/getpid01.c deleted file mode 100644 index df8197d28..000000000 --- a/winsup/testsuite/winsup.api/ltp/getpid01.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getpid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getpid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getpid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getpid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getpid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getpid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call getpid(2) - */ - TEST(getpid()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getpid() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getpid() returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/getpid02.c b/winsup/testsuite/winsup.api/ltp/getpid02.c deleted file mode 100644 index 06d80b38d..000000000 --- a/winsup/testsuite/winsup.api/ltp/getpid02.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: getpid01 - * - * Test Description: - * Verify that getpid() system call gets the process ID of the of the - * calling process. - * - * Expected Result: - * getpid() should return pid of the process on success. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * - * Usage: - * getpid01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -const char *TCID="getpid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t proc_id; /* process id of the test process */ - pid_t pid; /* process id of the child process */ - pid_t pproc_id; /* parent process id */ - int status; /* exit status of child process */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Invoke getpid() to get the process id of - * the test process. - */ - TEST(getpid()); - - /* Save the process id returned by getpid() */ - proc_id = TEST_RETURN; - - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* Fork a child now */ - if ((pid = fork()) < 0) { - tst_resm(TFAIL, "fork() failed to create child," - " error=%d", TEST_ERRNO); - } else if (pid == 0) { /* Child process */ - /* Get the parent process id */ - pproc_id = getppid(); - - /* Verify if the two process IDs match */ - if (pproc_id != proc_id) { - exit(1); - } - exit(0); - } else { /* parent process */ - wait(&status); - - /* Check exit status of child */ - if (WEXITSTATUS(status) != 0) { - tst_resm(TFAIL, "getpid() returned " - "invalid pid %d", proc_id); - } else { - tst_resm(TPASS, "Functionality of " - "getpid() successful"); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Setup signal catching function. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/getppid01.c b/winsup/testsuite/winsup.api/ltp/getppid01.c deleted file mode 100644 index d0e6032c0..000000000 --- a/winsup/testsuite/winsup.api/ltp/getppid01.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getppid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getppid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getppid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getppid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getppid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getppid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call getppid(2) - */ - TEST(getppid()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getppid() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getppid() returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/getppid02.c b/winsup/testsuite/winsup.api/ltp/getppid02.c deleted file mode 100644 index 50a72e470..000000000 --- a/winsup/testsuite/winsup.api/ltp/getppid02.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * getppid01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of the getppid() syscall. - * - * USAGE: - * getppid01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include - -const char *TCID = "getppid01"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int pid, ppid; - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); - - /* - * check looping state if -i option is given - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* - * reset Tst_count in case we are looping. - */ - Tst_count = 0; - - ppid = getpid(); - pid = fork(); - if (pid < 0) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - - if (pid == 0) { /* child */ - TEST(getppid()); - - if (TEST_RETURN < 0) { - tst_resm(TFAIL, "something is really broken"); - continue; - } - - if (STD_FUNCTIONAL_TEST) { - if (TEST_RETURN != ppid) { - tst_resm(TFAIL, "getppid() failed"); - } else { - tst_resm(TPASS, "return value = " - "parent's pid value"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - } else { - wait(NULL); - - /* let the child carry on */ - exit(0); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/getuid01.c b/winsup/testsuite/winsup.api/ltp/getuid01.c deleted file mode 100644 index cd3dff769..000000000 --- a/winsup/testsuite/winsup.api/ltp/getuid01.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : getuid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for getuid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) getuid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the getuid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * getuid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="getuid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call getuid(2) - */ - TEST(getuid()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "getuid() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "getuid() returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/getuid02.c b/winsup/testsuite/winsup.api/ltp/getuid02.c deleted file mode 100644 index 966b55290..000000000 --- a/winsup/testsuite/winsup.api/ltp/getuid02.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * getuid02.c - * - * DESCRIPTION - * Testcase to check the basic functionality of the geteuid() system call. - * - * USAGE: - * getuid02 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include - -const char *TCID = "getuid02"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned by parse_opts */ - - struct passwd *pwent; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); - - /* check looping state if -i option is given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(geteuid()); - - if (TEST_RETURN < 0) { - tst_brkm(TBROK, cleanup, "This should never happen"); - } - - if (STD_FUNCTIONAL_TEST) { - - pwent = getpwuid(TEST_RETURN); - if (pwent == NULL) { - tst_resm(TFAIL, "geteuid() returned unexpected " - "value %d", TEST_RETURN); - } else { - if (pwent->pw_uid != TEST_RETURN) { - tst_resm(TFAIL, "getpwuid() value, %d, " - "does not match geteuid() " - "value, %d", pwent->pw_uid, - TEST_RETURN); - } else { - tst_resm(TPASS, "values from geteuid()" - " and getpwuid() match"); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/getuid03.c b/winsup/testsuite/winsup.api/ltp/getuid03.c deleted file mode 100644 index e18c366f4..000000000 --- a/winsup/testsuite/winsup.api/ltp/getuid03.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * getuid01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of the getuid() system call. - * - * USAGE: - * getuid01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ - -#include -#include -#include -#include - -const char *TCID = "getuid01"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned by parse_opts */ - - struct passwd *pwent; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - } - - setup(); - - /* check looping state if -i option is given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(getuid()); - - if (TEST_RETURN < 0) { - tst_brkm(TBROK, cleanup, "This should never happen"); - } - - if (STD_FUNCTIONAL_TEST) { - - pwent = getpwuid(TEST_RETURN); - if (pwent == NULL) { - tst_resm(TFAIL, "getuid() returned unexpected " - "value %d", TEST_RETURN); - } else { - if (pwent->pw_uid != TEST_RETURN) { - tst_resm(TFAIL, "getpwuid() value, %d, " - "does not match getuid() " - "value, %d", pwent->pw_uid, - TEST_RETURN); - } else { - tst_resm(TPASS, "values from getuid()" - " and getpwuid() match"); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/kill01.c b/winsup/testsuite/winsup.api/ltp/kill01.c deleted file mode 100644 index 042899173..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill01.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * kill01.c - * - * DESCRIPTION - * Test case to check the basic functionality of kill(). - * - * ALGORITHM - * call setup - * loop if the -i option was given - * fork a child - * execute the kill system call - * check the return value - * if return value is -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * if the process was terminated with the expected signal. - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE - * kill01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * This test should be ran as a non-root user. - */ - -#include "test.h" -#include "usctest.h" - -#include -#include -#include - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "kill01()"; -int TST_TOTAL = 1; - -extern int Tst_count; - -#define TEST_SIG SIGKILL - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t pid; - int exno, status, nsig; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - status = 1; - exno = 1; - pid = fork(); - if (pid < 0) { - tst_brkm(TBROK, cleanup, "Fork of child failed"); - } else if (pid == 0) { - pause(); - /*NOTREACHED*/ - exit(exno); - } else { - TEST(kill(pid, TEST_SIG)); - waitpid(pid, &status, 0); - } - - if (TEST_RETURN == -1) { - tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s", - TCID, TEST_ERRNO, strerror(TEST_ERRNO)); - /*NOTREACHED*/ - } - - if (STD_FUNCTIONAL_TEST) { - /* - * Check to see if the process was terminated with the - * expected signal. - */ - nsig = WTERMSIG(status); - if (nsig == TEST_SIG) { - tst_resm(TPASS, "received expected signal %d", - nsig); - } else { - tst_resm(TFAIL, "expected signal %d received %d" ,TEST_SIG,nsig); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/kill02.c b/winsup/testsuite/winsup.api/ltp/kill02.c deleted file mode 100644 index eba47cc6a..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill02.c +++ /dev/null @@ -1,857 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/*********************************************************************************** - - OS Test - Silicon Graphics, Inc. - - TEST IDENTIFIER : kill02 Sending a signal to processes with the same process group ID. - - PARENT DOCUMENT : kiltds01 Kill System Call. - - AUTHOR : Dave Baumgartner - - CO-PILOT : Barrie Kletscher - - DATE STARTED : 12/30/85 - - TEST ITEMS - - 1. Sending a signal to pid of zero sends to all processes whose process - group ID is equal to the process group ID as the sender. - - 2. Sending a signal to pid of zero does not send to processes in another process group. - - - OUTPUT SPECIFICATIONS - - PASS : - kiltcs02 1 PASS The signal was sent to all processes in the process group. - kiltcs02 2 PASS The signal was not sent to selective processes that were not in the process group. - - FAIL : - kiltcs02 1 FAIL The signal was not sent to all processes in the process group. - kiltcs02 2 FAIL The signal was sent to a process that was not in the process group. - - BROK : - kiltcs02 # BROK System call XXX failed. Errno:X, Error message:XXX. - kiltcs02 # BROK Setting to catch unexpected signal %d failed. Errno: %d, Error message %s. - kiltcs02 # BROK Setting to ignore signal %d failed. Errno: %d, Error message %s. - - WARN : - kiltcs02 0 WARN Unexpected signal X was caught. - - SPECIAL PROCEDURAL REQUIREMENTS - - The program must be linked with tst_res.o. - - DETAILED DESCRIPTION - - **Setup** - Set up unexpected signal handling. - Set up one pipe for each process to be created with no blocking for read. - - **MAIN** - If setup fails exit. - Fork 2 children(1 & 2). - Wait for set up complete messages from the 1st and 2nd child. - Send the signal SIGUSR1 with pid equal to zero. - Sleep a reasonable amount of time so that each child has been swapped in - to process the signal. - Now decide the outcome of the test items by reading from each pipe to find - out if the child was interrupted by the signal and wrote to it. - Remove the second child. - Tell the first child it is time to remove it's child B because the decisions have been made. - Exit. - - **First Child** - Set to catch SIGUSR1 with an int_rout1. - Set up to handle the message from the parent to remove child B. - Fork two children(A & B). - Wait for set up complete messages from child A & child B. - Send a set up complete message to the parent. - Pause until the signal SIGUSR1 comes in from the parent. - Pause until the parent says it is time to remove the child. - Exit. - - **Second Child** - Set to catch SIGUSR1 with an int_rout2. - Set the process group to be something different than the parents. - Send a set up complete message to the parent. - Pause until killed by parent because this child shouldn't receive signal SIGUSR1. - - **Child A** - Set to catch SIGUSR1 with an int_routA. - Send a set up complete message to the parent(First Child). - Pause until the signal SIGUSR1 comes in from the parent. - Exit. - - **Child B** - Set to catch SIGUSR1 with an int_routB. - Set the process group to be something different than the parents(First Child's). - Send a set up complete message to the parent. - Pause until killed by parent because this child shouldn't receive signal SIGUSR1. - - **usr1_rout-Used by all children** - Write to the appropriate pipe that the signal SIGUSR1 was caught. - - **usr2_rout** - Remove child B. - -******************************************************************************/ -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -#define MAXMESG 150 /*The maximum message that can be created. */ -#define CHAR_SET_FAILED "0" /*Set up failing status transferred through the pipe. */ -#define CHAR_SET_PASSED "1" /*Set up passing status transferred through the pipe. */ -#define SIG_CAUGHT "2" /*Indicates that the signal SIGUSR1 was caught. */ -#define SIG_RECEIVED 1 /*Integer value that indicates that the signal SIGUSR1 */ - /*was caught. */ -#define SIG_NOT_RECD 0 /*Integer value that indicates that the signal SIGUSR1 */ - /*was caught. */ -#define INT_SET_FAILED 0 /*Set up failing status transferred through the pipe. */ -#define INT_SET_PASSED 1 /*Set up passing status transferred through the pipe. */ -#define SLEEP_TIME 10 /*Amount of time the children get to catch the signal */ -#define TRUE 40 /*Child exits with this if execution was as */ - /*expected. */ -#define FALSE 50 /*Child exits with this if it timed out waiting for the */ - /*parents signal. */ -#define TIMEOUT 60 /*Amount of time given in alarm calls. */ -#define CHILD_EXIT(VAR) ((VAR >> 8) & 0377) /*Exit value from the child. */ -#define CHILD_SIG(VAR) (VAR & 0377) /*Signal value from the termination of child. */ - /*from the parent. */ -#define SYS_FAIL "The system call %s failed. Errno: %d, Error message: %s." - -int pid1; /*Return value from 1st fork. Global so that it can be */ - /*used in interrupt handling routines. */ -int pid2; /*Return value from 2nd fork. Global so that it can be */ - /*used in interrupt handling routines. */ -int pidA; /*Return value from 1st fork in child 1. Global so that it */ - /*can be used in interrupt handling routines. */ -int pidB; /*Return value from 2nd fork in child 1. Global so that it */ - /*can be used in interrupt handling routines. */ -extern int errno; /*Error number returned by a system call. */ -int pipe1_fd[2]; /*Pipe file descriptors used for communication */ - /*between child 1 and the 1st parent. */ -int pipe2_fd[2]; /*Pipe file descriptors used for communication */ - /*between child 2 and the 1st parent. */ -int pipeA_fd[2]; /*Pipe file descriptors used for communication */ - /*between child A and the 1st parent. */ -int pipeB_fd[2]; /*Pipe file descriptors used for communication */ - /*between child B and the 1st parent. */ -char pipe_buf[10]; /*Pipe buffer. */ -char buf_tmp1[2],buf_tmp2[2]; /*Temp hold for info read into pipe_buf. */ -int read1_stat = 0; /*Number of characters read from pipe 1. */ -int read2_stat = 0; /*Number of characters read from pipe 2. */ -int readA_stat = 0; /*Number of characters read from pipe A. */ -int readB_stat = 0; /*Number of characters read from pipe B. */ -int alarm_flag = FALSE; /*This flag indicates an alarm time out. */ -char who_am_i = '0'; /*This indicates which process is which when using */ - /*interrupt routine usr1_rout. */ - -void notify_timeout(); /*Signal handler that the parent enters if it times out */ - /*waiting for the child to indicate its set up status. */ -void parent_rout(); /*This is the parents routine. */ -void child1_rout(); /*This is child 1's routine. */ -void child2_rout(); /*This is child 2's routine. */ -void childA_rout(); /*This is child A's routine. */ -void childB_rout(); /*This is child B's routine. */ -void usr1_rout(); /*This routine is used by all children to indicate that */ - /*they have caught signal SIGUSR1. */ -void par_kill(); /*This routine is called by the original parent to */ - /*remove child 2 and to indicate to child 1 to */ - /*remove its children. */ -void chld1_kill(); /*This routine is used by child 1 to remove itself and */ - /*its children A and B. */ - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="kill02"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; /* var. used to turn off tst_res buffering */ - -int exp_enos[]={0}; /* Array of expected errnos */ - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int ac, char **av) -{ - char mesg[MAXMESG]; /* Holds messages to pass to tst_res. */ - - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - Tst_nobuf=1; - - /*************************************************************** - * parse standard options, and exit if there is an error - * the -t and -f options not support yet. - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - if ((pid1 = fork()) > 0) - { - /* - * This is the parent, fork again to create child 2. - */ - if ((pid2 = fork()) > 0) { - /* - * This is the parent. - */ - (void) parent_rout(); - } - else if (pid2 == 0) { - /* - * This is child 2. - */ - (void) child2_rout(); - } - else { - /* - * The second fork failed kill the first child. - */ - if (kill(pid1,SIGKILL) == -1 && errno != ESRCH) { - tst_resm(TWARN,"Child process may not have been killed."); - } - (void) sprintf(mesg,SYS_FAIL,"fork",errno,strerror(errno)); - tst_brkm(TBROK,cleanup,mesg); - } - - } - else if (pid1 == 0) { - /* - * This is child 1. - */ - (void) child1_rout(); - } - else { - /* - * Fork failed. - */ - (void) sprintf(mesg,SYS_FAIL,"fork",errno,strerror(errno)); - tst_brkm(TBROK,cleanup,mesg); - } - } - - cleanup(); - - return 0; -} /* END OF MAIN.*/ - -/****************************************************************************** - * This is the parents routine. The parent waits for the children 1 and 2 to - * get set up. Then sends the signal and checks the outcome. - *********************************************************************************/ -void parent_rout() -{ - char mesg[MAXMESG]; /*Used to buffer messages for tst_resm. */ - - /* - * Set to catch the alarm signal SIGALRM. - */ - if (signal(SIGALRM,notify_timeout) == SIG_ERR) { - (void) par_kill(); - tst_brkm(TBROK, NULL, - "Could not set to catch the parents time out alarm."); - tst_exit(); - } - - /* - * Setting to catch the timeout alarm worked now let the children start up. - * Set an alarm which causes a time out on the read pipe loop. - * The children will notify the parent that set up is complete - * and the pass/fail status of set up. - */ - (void) alarm(TIMEOUT); - - while ((read(pipe1_fd[0],pipe_buf,1) != 1) && (alarm_flag == FALSE)) - /*EMPTY*/; - strncpy(buf_tmp1,pipe_buf,1); - (void) alarm(TIMEOUT); - - while ((read(pipe2_fd[0],pipe_buf,1) != 1) && (alarm_flag == FALSE)) - /*EMPTY*/; - (void) alarm(0); /*Reset the alarm clock.*/ - strncpy(buf_tmp2,pipe_buf,1); - - /* - * Check the alarm flag. - */ - if (alarm_flag == TRUE) { - tst_brkm(TBROK,NULL,"The set up of the children failed by timing out."); - (void) par_kill(); - cleanup(); - } - - /* - * Check to see if either child failed in the set up. - */ - if ( (strncmp(buf_tmp1,CHAR_SET_FAILED,1) == 0) || - (strncmp(buf_tmp2,CHAR_SET_FAILED,1) == 0)) { - /* - * Problems were encountered in the set up of one of the children. - * The error message has been displayed by the child. - */ - (void) par_kill(); - cleanup(); - } - - /* - * Setup passed, now send SIGUSR1 to process id of zero. - */ - TEST( kill(0,SIGUSR1) ); - - if ( TEST_RETURN == -1) - { - (void) sprintf(mesg,SYS_FAIL,"kill",errno,strerror(errno)); - tst_brkm(TBROK,NULL,mesg); - (void) par_kill(); - cleanup(); - } - - /* - * Sleep for a while to allow the children to get a chance to - * catch the signal. - */ - (void) sleep(SLEEP_TIME); - - /* - * The signal was sent above and time has run out for child response, - * check the outcomes. - */ - read1_stat = read(pipe1_fd[0],pipe_buf,1); - if (read1_stat == -1 && errno == EAGAIN) read1_stat = 0; - read2_stat = read(pipe2_fd[0],pipe_buf,1); - if (read2_stat == -1 && errno == EAGAIN) read2_stat = 0; - readA_stat = read(pipeA_fd[0],pipe_buf,1); - if (readA_stat == -1 && errno == EAGAIN) readA_stat = 0; - readB_stat = read(pipeB_fd[0],pipe_buf,1); - if (readB_stat == -1 && errno == EAGAIN) readB_stat = 0; - - if (read1_stat == -1 || read2_stat == -1 || - readA_stat == -1 || readB_stat == -1) { - /* - * The read system call failed. - */ - (void) sprintf(mesg,SYS_FAIL,"read",errno,strerror(errno)); - tst_brkm(TBROK,NULL,mesg); - (void) par_kill(); - cleanup(); - } - - /* - * Check the processes that were supposed to get the signal. - */ - if (read1_stat == SIG_RECEIVED) { - if (readA_stat == SIG_RECEIVED) { - /* - * Both processes, 1 and A, that were supposed to receive - * the signal did receive the signal. - */ - if ( STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, - "The signal was sent to all processes in the process group."); - else - Tst_count++; - } - else { /*Process A didn't receive the signal.*/ - tst_resm(TFAIL,"Process A did not receive the signal."); - } - - } - else { /*Process 1 didn't receive the signal.*/ - tst_resm(TFAIL,"Process 1 did not receive the signal."); - } - - /* - * Check the processes that were not supposed to get the signal. - */ - if (read2_stat == SIG_NOT_RECD) { - if (readB_stat == SIG_NOT_RECD) { - /* - * Both processes, 2 and B did not receive the signal. - */ - if ( STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, - "The signal was not sent to selective processes that were not in the process group."); - else - Tst_count++; - } - else { /*Process B received the signal.*/ - tst_resm(TFAIL,"Process B received the signal."); - } - - } - - else /*Process 2 received the signal.*/ - { - tst_resm(TFAIL,"Process 2 received the signal."); - } - - (void) par_kill(); - return; -} /*End of parent_rout*/ - -/******************************************************************************* - * This is child 1's routine. It creates children A & B, checks their set up, - * reports to the parent set up pass/fail info., then waits for - * the parents signal. - ******************************************************************************/ -void child1_rout() -{ - char mesg[MAXMESG]; /*Used to buffer messages for tst_resm. */ - who_am_i = '1'; - - /* - * Set to catch the SIGUSR1 with int1_rout. - */ - if (signal(SIGUSR1,usr1_rout) == SIG_ERR) - { - tst_brkm(TBROK,NULL,"Could not set to catch the childrens signal."); - (void) write(pipe1_fd[1],CHAR_SET_FAILED,1); - exit(0); - } - - /* - * Create children A & B. - */ - if ((pidA = fork()) > 0) { - /* - * This is the parent(child1), fork again to create child B. - */ - if ((pidB = fork()) == 0) { - /* This is child B. */ - (void) childB_rout(); - } - - else if (pidB == -1) { - /* - * The fork of child B failed kill child A. - */ - if (kill(pidA,SIGKILL) == -1) - tst_resm(TWARN,"Child process may not have been killed."); - (void) sprintf(mesg,SYS_FAIL,"fork",errno,strerror(errno)); - tst_brkm(TBROK,NULL,mesg); - (void) write(pipe2_fd[1],CHAR_SET_FAILED,1); - exit(0); - } - } - - else if (pidA == 0) { - /* This is child A. */ - (void) childA_rout(); - - } - - else if (pidA == -1) { - /* - * The fork of child A failed. - */ - (void) sprintf(mesg,SYS_FAIL,"fork",errno,strerror(errno)); - tst_brkm(TBROK,NULL,mesg); - (void) write(pipe1_fd[1],CHAR_SET_FAILED,1); - exit(0); - } - - /* - * Set to catch the SIGUSR2 with chld1_kill. - */ - if (signal(SIGUSR2,chld1_kill) == SIG_ERR) { - tst_brkm(TBROK,NULL,"Could not set to catch the parents signal."); - (void) write(pipe1_fd[1],CHAR_SET_FAILED,1); - (void) chld1_kill(); - exit(0); - } - - /* - * Set to catch the alarm signal SIGALRM. - */ - if (signal(SIGALRM,notify_timeout) == SIG_ERR) { - tst_brkm(TBROK,NULL,"Could not set to catch the childs time out alarm."); - (void) write(pipe1_fd[1],CHAR_SET_FAILED,1); - (void) chld1_kill(); - exit(0); - } - - /* - * Setting to catch the signals worked now let the children start up. - * Set an alarm which causes a time out on the pipe read loop. - * The children A & B will notify the parent(child1) that set up is complete - * and the pass/fail status of set up. - */ - (void) alarm(TIMEOUT-40); - - while ((read(pipeA_fd[0],pipe_buf,1) != 1) && (alarm_flag == FALSE)) - /*EMPTY*/; - (void) alarm(TIMEOUT-40); - - while ((read(pipeB_fd[0],pipe_buf,1) != 1) && (alarm_flag == FALSE)) - /*EMPTY*/; - (void) alarm(0); /*Reset the alarm clock.*/ - - /* - * Check the alarm flag. - */ - if (alarm_flag == TRUE) { - tst_brkm(TBROK,NULL,"The set up of the children failed by timing out."); - (void) chld1_kill(); - (void) write(pipe1_fd[1],CHAR_SET_FAILED,1); - exit(0); - } - - /* - * Send a set up complete message to the parent. - */ - (void) write(pipe1_fd[1],CHAR_SET_PASSED,1); - - /* - * Pause until the signal SIGUSR1 or SIGUSR2 is sent from the parent. - */ - (void) pause(); - - /* - * Pause until signal SIGUSR2 is sent from the parent. - * This pause will only be executed if SIGUSR2 has not been received yet. - */ - while (1) { - sleep(1); - } - -} /*End of child1_rout*/ - -/******************************************************************************* - * This is the routine for child 2, which should not receive the parents signal. - ******************************************************************************/ -void child2_rout() -{ - who_am_i = '2'; - - /* - * Set the process group of this process to be different - * than the other processes. - */ - (void) setpgrp(); - - /* - * Set to catch the SIGUSR1 with usr1_rout. - */ - if (signal(SIGUSR1,usr1_rout) == SIG_ERR) { - tst_brkm(TBROK,cleanup,"Could not set to catch the parents signal."); - (void) write(pipe2_fd[1],CHAR_SET_FAILED,1); - exit(0); - } - - /* Send a set up complete message to parent.*/ - (void) write(pipe2_fd[1],CHAR_SET_PASSED,1); - - /* - * Pause until killed by the parent or SIGUSR1 is received. - */ - (void) pause(); -} - - -/******************************************************************************* - * This is the routine for child A, which should receive the parents signal. - ******************************************************************************/ -void childA_rout() -{ - who_am_i = 'A'; - - /* Send a set up complete message to parent.*/ - write(pipeA_fd[1],CHAR_SET_PASSED,1); - - /* - * Pause until killed by the parent or SIGUSR1 is received. - */ - (void) pause(); - - exit(0); -} /*End of childA_rout*/ - -/******************************************************************************* - * This is the routine for child B, which should not receive the parents signal. - ******************************************************************************/ -void childB_rout() -{ - who_am_i = 'B'; - - /* - * Set the process group of this process to be different - * than the other processes. - */ - (void) setpgrp(); - - /* Send a set up complete message to parent(child 1).*/ - write(pipeB_fd[1],CHAR_SET_PASSED,1); - - /* - * Pause until killed by the parent(child 1) or SIGUSR1 is received. - */ - (void) pause(); - - exit(0); -} - -/******************************************************************************* - * This routine sets up the interprocess communication pipes, signal handling, - * and process group information. - ******************************************************************************/ -void -setup() -{ - int errno_buf = 0; /*indicates the errno if pipe set up fails. */ - int err_flag = FALSE; /*Indicates if an error has occurred in pipe set up. */ - char mesg[MAXMESG]; /*Used to buffer messages for tst_res. */ - - /* - * Set the process group ID to be equal between the parent and children. - */ - (void) setpgrp(); - - /* - * Set to catch unexpected signals. - * SIGCLD is set to be ignored because we do not wait for termination status. - * SIGUSR1 is set to be ignored because this is the signal we are using for - * the test and we are not concerned with the parent getting it. - */ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - if (signal(SIGUSR1,SIG_IGN) == SIG_ERR) { - (void) sprintf(mesg, - "Setting to ignore signal SIGCLD failed. Errno: %d, Error message %s.", - errno,strerror(errno)); - tst_brkm(TBROK,NULL,mesg); - tst_exit(); - } - - if (signal(SIGCLD,SIG_IGN) == SIG_ERR) { - (void) sprintf(mesg, - "Setting to ignore signal SIGCLD failed. Errno: %d, Error message %s.", - errno,strerror(errno)); - tst_brkm(TBROK,NULL,mesg); - tst_exit(); - } - - /* Indicate which errnos are expected */ - TEST_EXP_ENOS(exp_enos); - - /* Pause if that option was specified */ - TEST_PAUSE; - - - /* - * Set up pipe1, pipe2, pipeA, and pipeB. - */ - if ((pipe(pipe1_fd) == -1) || (fcntl(pipe1_fd[0],F_SETFL,O_NDELAY) == -1)) - { - errno_buf = errno; - err_flag = TRUE; - } - - if ((pipe(pipe2_fd) == -1) || (fcntl(pipe2_fd[0],F_SETFL,O_NDELAY) == -1)) - { - errno_buf = errno; - err_flag = TRUE; - } - - if ((pipe(pipeA_fd) == -1) || (fcntl(pipeA_fd[0],F_SETFL,O_NDELAY) == -1)) - { - errno_buf = errno; - err_flag = TRUE; - } - - if ((pipe(pipeB_fd) == -1) || (fcntl(pipeB_fd[0],F_SETFL,O_NDELAY) == -1)) - { - errno_buf = errno; - err_flag = TRUE; - } - - /* - * Check for errors. - */ - if (err_flag == TRUE) - { - (void) sprintf(mesg,SYS_FAIL,"pipe",errno_buf,strerror(errno_buf)); - tst_brkm(TBROK, NULL, mesg); - tst_exit(); - } - return; - -} - -/*********************************************************** - * This routine indicates that the process caught SIGUSR1. - **********************************************************/ -void usr1_rout() -{ - char mesg[MAXMESG]; /*Used to buffer messages for tst_res. */ - - switch (who_am_i) - { - case '1': if (write(pipe1_fd[1],SIG_CAUGHT,1) == -1) - tst_resm(TWARN,"Writing signal catching status failed in child 1."); - break; - case '2': if (write(pipe2_fd[1],SIG_CAUGHT,1) == -1) - tst_resm(TWARN,"Writing signal catching status failed in child 2."); - break; - case 'A': if (write(pipeA_fd[1],SIG_CAUGHT,1) == -1) - tst_resm(TWARN,"Writing signal catching status failed in child A."); - break; - case 'B': if (write(pipeB_fd[1],SIG_CAUGHT,1) == -1) - tst_resm(TWARN,"Writing signal catching status failed in child B."); - break; - default: - sprintf(mesg,"Unexpected value %d for who_am_i in usr1_rout().",who_am_i); - tst_resm(TWARN,mesg); - break; - } - -} /*End of usr1_rout*/ - - -/*********************************************************** - * This routine handles the timeout alarm in the parent, - * which occurs when the child fails to notify the parent - * the status of set up. - **********************************************************/ -void notify_timeout() -{ - alarm_flag = TRUE; - -} /*End of notify_timeout*/ - -/*********************************************************** - * This routine handles the procedure for removing the - * children forked off during this test. - **********************************************************/ -void par_kill() -{ - char mesg[MAXMESG]; /*Used to buffer messages for tst_res. */ - /* - * Indicate to child1 that it can remove it's children and itself now. - */ - if (kill(pid1,SIGUSR2) == -1 && errno != ESRCH) - { - (void) sprintf(mesg,SYS_FAIL,"kill",errno,strerror(errno)); - tst_resm(TWARN,mesg); - tst_resm(TWARN,"Child 1 and it's children may still be alive."); - } - - /* - * Remove child 2. - */ - if (kill(pid2,SIGKILL) == -1 && errno != ESRCH) - tst_resm(TWARN,"Child2 may still be alive."); - - return; - -} /*End of par_kill*/ - - -/********************************************************************* - * This routine is executed by child 1 when the parent tells it to - * remove it's children and itself. - ********************************************************************/ -void chld1_kill() -{ - char mesg[MAXMESG]; /*Used to buffer messages for tst_resm. */ - - /* - * Remove children A & B. - */ - if (kill(pidA,SIGKILL) == -1 && errno != ESRCH) - { - (void) sprintf(mesg, - "The system call kill failed. Child 1's(A) child may still be alive. Errno: %d, Error message %s.", - errno,strerror(errno)); - tst_resm(TWARN,mesg); - } - if (kill(pidB,SIGKILL) == -1 && errno != ESRCH) - { - (void) sprintf(mesg, - "The system call kill failed. Child 1's(B) child may still be alive. Errno: %d, Error message %s.", - errno,strerror(errno)); - tst_resm(TWARN,mesg); - } - - exit(0); - -} /*End of chld1_kill*/ - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/kill03.c b/winsup/testsuite/winsup.api/ltp/kill03.c deleted file mode 100644 index 1de727fd7..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill03.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * kill03.c - * - * DESCRIPTION - * Test case to check that kill fails when given an invalid signal. - * - * ALGORITHM - * call setup - * loop if the -i option was given - * fork a child - * execute the kill system call with an invalid signal - * check the return value - * if return value is not -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * if the errno was set to 22 (invalid argument). - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE - * kill03 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * none - */ - -#include "test.h" -#include "usctest.h" - -#include -#include -#include - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "kill03()"; -int TST_TOTAL = 1; - -extern int Tst_count; - -int exp_enos[] = {EINVAL, 0}; - -#define TEST_SIG 2000 - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t pid; - int exno, status; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - TEST_EXP_ENOS(exp_enos); - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - status = 1; - exno = 1; - pid = fork(); - if (pid < 0) { - tst_brkm(TBROK, cleanup, "Fork of child failed"); - } else if (pid == 0) { - pause(); - /*NOTREACHED*/ - exit(exno); - } else { - TEST(kill(pid, TEST_SIG)); - kill(pid, SIGKILL); - waitpid(pid, &status, 0); - } - - if (TEST_RETURN != -1) { - tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s " - "Expected a return value of -1 got %d", - TCID, TEST_ERRNO, strerror(TEST_ERRNO)), - TEST_RETURN; - /*NOTREACHED*/ - } - - if (STD_FUNCTIONAL_TEST) { - /* - * Check to see if the errno was set to the expected - * value of 22 : EINVAL. - */ - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == EINVAL) { - tst_resm(TPASS, "errno set to %d : %s, as " - "expected", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "errno set to %d : %s expected " - "%d : %s", TEST_ERRNO, - strerror(TEST_ERRNO), 22, strerror(22)); - } - } - } - cleanup(); - - /*NOTREACHED*/ -} - - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/kill04.c b/winsup/testsuite/winsup.api/ltp/kill04.c deleted file mode 100644 index a7b3274c3..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill04.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * kill04.c - * - * DESCRIPTION - * Test case to check that kill() fails when passed a non-existant pid. - * - * ALGORITHM - * call setup - * loop if the -i option was given - * fork a child - * execute the kill system call with a non-existant PID - * check the return value - * if return value is not -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * if the errno was set to 3 (No such proccess) - * issue a PASS message - * otherwise - * issue a FAIL message - * call cleanup - * - * USAGE - * kill04 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * This test should be run by a non-root user - */ - -#include "test.h" -#include "usctest.h" - -#include -#include -#include - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "kill04()"; -int TST_TOTAL = 1; - -extern int Tst_count; - -int exp_enos[] = {ESRCH, 0}; - -#define TEST_SIG SIGKILL - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t pid, fake_pid; - int exno, status, fake_status, nsig; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - TEST_EXP_ENOS(exp_enos); - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - status = 1; - exno = 1; - pid = fork(); - if (pid < 0) { - tst_brkm(TBROK, cleanup, "Fork failed"); - } else if (pid == 0) { - pause(); - /*NOTREACHED*/ - exit(exno); - } else { - fake_pid = fork(); - if (fake_pid < 0) { - tst_brkm(TBROK, cleanup, "Second fork failed"); - } else if (fake_pid == 0) { - pause(); - /*NOTREACHED*/ - exit(exno); - } - kill(fake_pid, TEST_SIG); - waitpid(fake_pid, &fake_status, 0); - TEST(kill(fake_pid, TEST_SIG)); - kill(pid, TEST_SIG); - waitpid(pid, &status, 0); - } - - if (TEST_RETURN != -1) { - tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s " - "Expected a return value of -1 got %d", - TCID, TEST_ERRNO, strerror(TEST_ERRNO)), - TEST_RETURN; - /*NOTREACHED*/ - } - - if (STD_FUNCTIONAL_TEST) { - /* - * Check to see if the errno was set to the expected - * value of 3 : ESRCH - */ - nsig = WTERMSIG(status); - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == ESRCH) { - tst_resm(TPASS, "errno set to %d : %s, as " - "expected", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "errno set to %d : %s expected " - "%d : %s", TEST_ERRNO, - strerror(TEST_ERRNO), 3, strerror(3)); - } - } - } - cleanup(); - - /*NOTREACHED*/ -} - - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing status if that option was specified. - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/kill09.c b/winsup/testsuite/winsup.api/ltp/kill09.c deleted file mode 100644 index 3b4c24fb5..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill09.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : kill09 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for kill(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) kill(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the kill(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * kill(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void alarm_handler(int sig); - - - - -const char *TCID="kill09"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int fork_pid; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int status; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* make a child process so we can kill it */ - /* If we cannot fork => we cannot test kill, so break and exit */ - if ((fork_pid=fork()) == -1) { - tst_brkm(TBROK, cleanup, - "fork() Failure. errno=%d : %s", - errno, strerror(errno)); - } - - if (fork_pid == 0) { - /* CHILD */ - /* - * Setup alarm signal if we don't get the signal to prevent this process - * from hanging around forever. - */ - signal(SIGALRM, alarm_handler); - alarm(20); - pause(); - exit(1); - } - - /* PARENT */ - /* - * Call kill(2) - */ - TEST(kill(fork_pid, SIGKILL)); - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "kill(%d, SIGKILL) Failed, errno=%d : %s", fork_pid, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "kill(%d, SIGKILL) returned %d", fork_pid, TEST_RETURN); - } - } - - /* - * wait for process to cleanup zombies. - * - */ - waitpid(0, &status, WNOHANG); - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - (void) signal(SIGCHLD, SIG_IGN); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -void -alarm_handler(int sig) -{ - exit(8); -} diff --git a/winsup/testsuite/winsup.api/ltp/link02.c b/winsup/testsuite/winsup.api/ltp/link02.c deleted file mode 100644 index 84c53c23c..000000000 --- a/winsup/testsuite/winsup.api/ltp/link02.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : link02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for link(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) link(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the link(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * link(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="link02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char Fname[255], Lname[255]; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct stat fbuf, lbuf; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call link(2) - */ - TEST(link(Fname, Lname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "link(%s, %s) Failed, errno=%d : %s", - Fname, Lname, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - stat(Fname, &fbuf); - stat(Lname, &lbuf); - if ( fbuf.st_nlink > 1 && lbuf.st_nlink > 1 && - fbuf.st_nlink == lbuf.st_nlink ) - - tst_resm(TPASS, "link(%s, %s) returned %d and link cnts match", - Fname, Lname, TEST_RETURN); - else { - tst_resm(TFAIL, - "link(%s, %s) returned %d, stat link cnts do not match %d %d", - Fname, Lname, TEST_RETURN, fbuf.st_nlink, - lbuf.st_nlink); - } - } - if (unlink(Lname) == -1) { - tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int fd; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - strcpy(Fname, "tfile"); - if ((fd = open(Fname, O_RDWR|O_CREAT, 0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - strcpy(Lname, "lfile"); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/link03.c b/winsup/testsuite/winsup.api/ltp/link03.c deleted file mode 100644 index 38c16af72..000000000 --- a/winsup/testsuite/winsup.api/ltp/link03.c +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : link03 - * - * EXECUTED BY : anyone - * - * TEST TITLE : multi links tests - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/31/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) link(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * -N #links : Use #links links every iteration - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the link(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * link(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void help(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="link03"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; - -int exp_enos[]={0, 0}; - -#define BASENAME "lkfile" - -char Basename[255]; -char Fname[255]; -int Nlinks=0; -char *Nlinkarg; - -int Nflag=0; - - -/* for test specific parse_opts options */ -option_t options[] = { - { "N:", &Nflag, &Nlinkarg }, /* -N #links */ - { NULL, NULL, NULL } -}; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct stat fbuf, lbuf; - int cnt; - int nlinks; - char lname[255]; - - Tst_nobuf=1; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, options, &help)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - if ( Nflag ) { - if (sscanf(Nlinkarg, "%i", &Nlinks) != 1 ) { - tst_brkm(TBROK, NULL, "--N option arg is not a number"); - tst_exit(); - } - if ( Nlinks > 1000 ) { - tst_resm(TWARN, "--N option arg > 1000 - may get errno:%d (EMLINK)", - EMLINK); - } - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - if ( Nlinks ) - nlinks = Nlinks; - else - /* min of 10 links and max of a 100 links */ - nlinks = (lc%90)+10; - - for(cnt=1; cnt < nlinks; cnt++) { - - sprintf(lname, "%s%d", Basename, cnt); - /* - * Call link(2) - */ - TEST(link(Fname, lname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_brkm(TFAIL, cleanup, "link(%s, %s) Failed, errno=%d : %s", - Fname, lname, TEST_ERRNO, strerror(TEST_ERRNO)); - } - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - stat(Fname, &fbuf); - - for(cnt=1; cnt < nlinks; cnt++) { - sprintf(lname, "%s%d", Basename, cnt); - - stat(lname, &lbuf); - if ( fbuf.st_nlink <= 1 || lbuf.st_nlink <= 1 || - (fbuf.st_nlink != lbuf.st_nlink) ) { - - tst_resm(TFAIL, - "link(%s, %s[1-%d]) ret %d for %d files, stat values do not match %d %d", - Fname, Basename, nlinks, TEST_RETURN, nlinks, - fbuf.st_nlink, lbuf.st_nlink); - break; - } - } - if ( cnt >= nlinks ) { - tst_resm(TPASS, - "link(%s, %s[1-%d]) ret %d for %d files, stat linkcounts match %d", - Fname, Basename, nlinks, TEST_RETURN, nlinks, - fbuf.st_nlink); - } - } - else - Tst_count++; - - for(cnt=1; cnt < nlinks; cnt++) { - - sprintf(lname, "%s%d", Basename, cnt); - - if (unlink(lname) == -1) { - tst_res(TWARN, "unlink(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * help - ***************************************************************/ -void -help() -{ - printf(" -N #links : create #links hard links every iteration\n"); -} - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int fd; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname,"%s_%d", BASENAME, getpid()); - if ((fd = open(Fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_res(TWARN, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - sprintf(Basename, "%s_%d.", BASENAME, getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/link04.c b/winsup/testsuite/winsup.api/ltp/link04.c deleted file mode 100644 index b3453b5d0..000000000 --- a/winsup/testsuite/winsup.api/ltp/link04.c +++ /dev/null @@ -1,426 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : link04 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Negative test cases for link(2). - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 14 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/30/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1-14.) link(2) returns...(See Test_cases structure below) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * Standard tst_res output formt. - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the link(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * link(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include /* for PATH_MAX */ -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - -extern char *get_high_address(); - -const char *TCID="link04"; /* Test program identifier. */ -int TST_TOTAL=14; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int longpath_setup(); -int no_setup(); -int filepath_setup(); -int filepath2_setup(); -char Longpathname[PATH_MAX+2]; -char High_address[64]; -int dir_setup(); - -struct test_case_t { - const char *file1; - const char *desc1; - const char *file2; - const char *desc2; - int exp_errno; - int (*setupfunc1)(); - int (*setupfunc2)(); -} Test_cases[] = { - /* This test program should contain test cases where link */ - /* will fail regardless of who executed it (i.e. joe-user or root) */ - - /* first path is invalid */ - - { "nonexistfile", "non-existent file", "nefile", "nefile", - ENOENT, no_setup, no_setup}, - - { "", "path is empty string", "nefile", "nefile", - ENOENT, no_setup, no_setup}, - - { "neefile/file", "path contains a non-existent file", "nefile", "nefile", - ENOENT, no_setup, no_setup }, - -#ifndef __CYGWIN__ - { "regfile/file", "path contains a regular file", "nefile", "nefile", - ENOTDIR, filepath_setup, no_setup }, -#endif - - { Longpathname, "pathname too long", "nefile", "nefile", - ENAMETOOLONG, longpath_setup, no_setup }, - - { High_address, "address beyond address space", "nefile", "nefile", - EFAULT, no_setup, no_setup }, - - { (char *)-1, "negative address", "nefile", "nefile", - EFAULT, no_setup, no_setup }, - - /* second path is invalid */ - - { "regfile", "regfile", "", "empty string", - ENOENT, no_setup, no_setup}, - - { "regfile", "regfile", "neefile/file", "path contains a non-existent file", - ENOENT, filepath_setup, no_setup}, - - { "regfile", "regfile", "file/file", "path contains a regular file", - ENOENT, filepath_setup, no_setup}, - - { "regfile", "regfile", Longpathname, "pathname too long", - ENAMETOOLONG, no_setup, longpath_setup }, - - { "regfile", "regfile", High_address, "address beyond address space", - EFAULT, no_setup, no_setup }, - - { "regfile", "regfile", (char *)-1, "negative address", - EFAULT, no_setup, no_setup}, - - /* two existing files */ - - { "regfile", "regfile", "regfile2", "regfile2", - EEXIST, filepath_setup, filepath2_setup }, - - { NULL, NULL, NULL, NULL, 0, no_setup, no_setup } -}; - - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *fname1, *fname2; - const char *desc1, *desc2; - int ind; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind=0; Test_cases[ind].desc1 != NULL; ind++ ) { - - fname1 = Test_cases[ind].file1; - desc1 = Test_cases[ind].desc1; - fname2 = Test_cases[ind].file2; - desc2 = Test_cases[ind].desc2; - - if ( fname1 == High_address ) - fname1 = get_high_address(); - - if ( fname2 == High_address ) - fname2 = get_high_address(); - - /* - * Call link(2) - */ - TEST(link(fname1, fname2)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO == Test_cases[ind].exp_errno ) - tst_resm(TPASS, "link(<%s>, <%s>) Failed, errno=%d", - desc1, desc2, TEST_ERRNO); - else - tst_resm(TFAIL, - "link(<%s>, <%s>) Failed, errno=%d, expected errno:%d", - desc1, desc2, TEST_ERRNO, Test_cases[ind].exp_errno); - } - else - Tst_count++; - } else { - tst_resm(TFAIL, - "link(<%s>, <%s>) returned %d, expected -1, errno:%d", - desc1, desc2, TEST_RETURN, Test_cases[ind].exp_errno); - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int ind; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - for (ind=0; Test_cases[ind].desc1 != NULL; ind++ ) { - Test_cases[ind].setupfunc1(); - Test_cases[ind].setupfunc2(); - } - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -/****************************************************************** - * - ******************************************************************/ -int -no_setup() -{ - return 0; -} - -/****************************************************************** - * - ******************************************************************/ -int -longpath_setup() -{ - int ind; - - static int alreadycalled = 0; - - if ( alreadycalled ) - return 0; - alreadycalled++; - - for(ind=0; ind<= PATH_MAX+1; ind++) { - Longpathname[ind] = 'a'; - } - return 0; - -} - -/****************************************************************** - * - ******************************************************************/ -int -filepath2_setup() -{ - int fd; - static int alreadycalled = 0; - - if ( alreadycalled ) - return 0; - alreadycalled++; - - if ( (fd=creat("regfile2", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, "creat(regfile2, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - return 0; -} -/****************************************************************** - * - ******************************************************************/ -int -filepath_setup() -{ - int fd; - static int alreadycalled = 0; - - if ( alreadycalled ) - return 0; - alreadycalled++; - - if ( (fd=creat("regfile", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, "creat(regfile, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - return 0; -} - -/****************************************************************** - * - ******************************************************************/ -int -dir_setup() -{ - static int alreadycalled = 0; - - if ( alreadycalled ) - return 0; - alreadycalled++; - - if ( mkdir("dir", 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "mkdir(dir, 0700) Failed, errno=%d : %s", - errno, strerror(errno)); - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/ltp/link05.c b/winsup/testsuite/winsup.api/ltp/link05.c deleted file mode 100644 index 9387c25a8..000000000 --- a/winsup/testsuite/winsup.api/ltp/link05.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : link05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : multi links (EMLINK) negative test - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 3 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/31/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) link(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the link(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * link(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void help(); - - - -const char *TCID="link05"; /* Test program identifier. */ -#ifdef CRAY -int TST_TOTAL=2; /* Total number of test cases. */ -#else -int TST_TOTAL=1; /* Total number of test cases. */ -#endif -extern int Tst_count; /* Test Case counter for tst_* routines */ - -#define BASENAME "lkfile" - -char Basename[255]; -char Fname[255]; - -int Nflag=0; -char *Noptlinks; - -/* for test specific parse_opts options */ -option_t options[] = { - { "N:", &Nflag, &Noptlinks }, /* -N option */ - { NULL, NULL, NULL } -}; - -int nlinks = 1000; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct stat fbuf, lbuf; - int cnt; - char lname[255]; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, options, &help)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - if ( Nflag ) { - if ( sscanf(Noptlinks, "%i", &nlinks) != 1 ) { - tst_brkm(TBROK, cleanup, "-N option invalid, must be numeric"); - } - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for(cnt=1; cnt < nlinks; cnt++) { - - sprintf(lname, "%s%d", Basename, cnt); - /* - * Call link(2) - */ - TEST(link(Fname, lname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - tst_resm(TFAIL, "link(%s, %s) Failed, errno=%d : %s", - Fname, lname, TEST_ERRNO, strerror(TEST_ERRNO)); - } - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - stat(Fname, &fbuf); - - for(cnt=1; cnt < nlinks; cnt++) { - sprintf(lname, "%s%d", Basename, cnt); - - stat(lname, &lbuf); - if ( fbuf.st_nlink <= 1 || lbuf.st_nlink <= 1 || - (fbuf.st_nlink != lbuf.st_nlink) ) { - - tst_resm(TFAIL, - "link(%s, %s[1-%d]) ret %d for %d files, stat values do not match %d %d", - Fname, Basename, nlinks, TEST_RETURN, nlinks, - fbuf.st_nlink, lbuf.st_nlink); - break; - } - } - if ( cnt >= nlinks ) { - tst_resm(TPASS, - "link(%s, %s[1-%d]) ret %d for %d files, stat linkcounts match %d", - Fname, Basename, nlinks, TEST_RETURN, nlinks, - fbuf.st_nlink); - } - } - else - Tst_count++; - -#ifdef CRAY -/* - * IRIX (xfs) systems do not have the 1000 link limit. - * I tried 100000 links on 2/97 without error on IRIX 6.4. - */ - /* - * Now check that one more link will put you over the top - */ - sprintf(lname, "%s%d", Basename, cnt); - - /* - * Call link(2) - */ - TEST(link(Fname, lname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO == EMLINK ) { - tst_resm(TPASS, - "link(%s, %s) ret %d on %d link, errno:%d", - Fname, lname, TEST_RETURN, nlinks+1, EMLINK); - } - else { - tst_resm(TFAIL, - "link(%s, %s) ret %d on %d link, errno:%d, expected -1, errno:%d", - Fname, lname, TEST_RETURN, nlinks+1, - TEST_ERRNO, EMLINK); - } - } - else - Tst_count++; - } - else { - tst_resm(TFAIL, "link(%s, %s) ret %d on %d link, expected -1, errno:%d", - Fname, lname, TEST_RETURN, nlinks+1, EMLINK); - } -#endif /* CRAY */ - - for(cnt=1; cnt < nlinks; cnt++) { - - sprintf(lname, "%s%d", Basename, cnt); - - if (unlink(lname) == -1) { - tst_res(TWARN, "unlink(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * help - ***************************************************************/ -void -help() -{ - printf(" -N #links : create #links hard links every iteration\n"); -} - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int fd; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname,"%s_%d", BASENAME, getpid()); - if ((fd = open(Fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_res(TWARN, "close(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - sprintf(Basename, "%s_%d.", BASENAME, getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/lseek01.c b/winsup/testsuite/winsup.api/ltp/lseek01.c deleted file mode 100644 index 22d0c6c39..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek01.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : lseek01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for lseek(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 3 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) lseek(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the lseek(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * lseek(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="lseek01"; /* Test program identifier. */ -int TST_TOTAL=3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char Fname[255]; -int Fd; - -int Whence[] = {SEEK_SET, SEEK_CUR, SEEK_END, -1}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int ind; - int offset; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - offset=(lc%100)*4096; /* max size is 100 blocks */ - - for (ind=0; Whence[ind] >= 0; ind++) { - - /* - * Call lseek(2) - */ - TEST(lseek(Fd, (long)offset, Whence[ind])); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "lseek(%s, %ld, 0) Failed, errno=%d : %s", - Fname, offset, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "lseek(%s, %ld, %d) returned %d", Fname, - offset, Whence[ind], TEST_RETURN); - } - else - Tst_count++; - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname, "tfile_%d",getpid()); - if ((Fd = open(Fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we have open */ - if (close(Fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", Fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/lseek02.c b/winsup/testsuite/winsup.api/ltp/lseek02.c deleted file mode 100644 index 04fa3f10f..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek02.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : lseek02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Negative test for lseek(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 04/25/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) lseek(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the lseek(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * lseek(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="lseek02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int Whence[] = {SEEK_SET, SEEK_CUR, SEEK_END, -1}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call lseek(2) - */ - TEST( lseek(-1, (long)1, SEEK_SET) ); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_ERRNO == EBADF ) - - tst_resm(TPASS, - "lseek(-1, 1, SEEK_SET) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - else - tst_resm(TFAIL, - "lseek(-1, 1, SEEK_SET) Failed, errno=%d : %s, expected %d(EBADF)", - TEST_ERRNO, strerror(TEST_ERRNO), EBADF); - - } - else - Tst_count++; - - } else { - - tst_resm(TFAIL, "lseek(-1, 1, SEEK_SET) returned %d", - TEST_RETURN); - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/lseek03.c b/winsup/testsuite/winsup.api/ltp/lseek03.c deleted file mode 100644 index 51c303d85..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek03.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : lseek03 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Negative test for lseek(2) whence - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 04/25/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) lseek(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the lseek(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * lseek(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void rec_sigsys(int); - -const char *TCID="lseek03"; /* Test program identifier. */ -int TST_TOTAL=3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char fname[255]; -int fd; -int Rec_sigsys = 0; - -int Whences[] = { 4, -1, 7 }; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - unsigned ind; - int whence; - - TST_TOTAL=sizeof(Whences)/sizeof(int); - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - - signal(SIGSYS, rec_sigsys); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind=0; ind -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="lseek04"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char Fname[255]; -int Fd; - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call lseek(2) - */ - TEST(lseek(Fd, (long)1, SEEK_SET)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_ERRNO == ESPIPE ) - tst_resm(TPASS, - "lseek(fifofd, 1, SEEK_SET) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - else - tst_resm(TFAIL, - "lseek(fifofd, 1, SEEK_SET) Failed, errno=%d %s, expected %d(ESPIPE)", - TEST_ERRNO, strerror(TEST_ERRNO), - EINVAL); - } - else - Tst_count++; - } else { - - tst_resm(TFAIL, "lseek(fifofd, 1, SEEK_SET) returned %d", - TEST_RETURN); - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname,"tfile_%d",getpid()); - if ( mkfifo(Fname,0700) == -1) { - tst_brkm(TBROK, cleanup, - "mkfifo(%s, 0700) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - - if ( (Fd=open(Fname, O_RDWR, 0777)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR, 0777) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we have open */ - if (close(Fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", Fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/lseek05.c b/winsup/testsuite/winsup.api/ltp/lseek05.c deleted file mode 100644 index 8867086bd..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek05.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : lseek05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Negative test for lseek(2) of a pipe - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 04/25/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) lseek(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the lseek(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * lseek(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="lseek05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int Fd; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call lseek(2) - */ - TEST(lseek(Fd, (long)1, SEEK_SET)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_ERRNO == ESPIPE ) - tst_resm(TPASS, - "lseek(pipefd, 1, SEEK_SET) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - else - tst_resm(TFAIL, - "lseek(pipefd, 1, SEEK_SET) Failed, errno=%d %s, expected %d(ESPIPE)", - TEST_ERRNO, strerror(TEST_ERRNO), - EINVAL); - } - else - Tst_count++; - } else { - - tst_resm(TFAIL, "lseek(pipefd, 1, SEEK_SET) returned %d", - TEST_RETURN); - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int fds[2]; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - if ( pipe(fds) == -1) { - tst_brkm(TBROK, cleanup, - "pipe(&fds) Failed, errno=%d : %s", errno, strerror(errno)); - } - Fd = fds[0]; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we have open */ - if (close(Fd) == -1) { - tst_resm(TWARN, "close(%d) Failed, errno=%d : %s", Fd, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/lseek06.c b/winsup/testsuite/winsup.api/ltp/lseek06.c deleted file mode 100644 index f62c3422c..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek06.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: lseek01 - * - * Test Description: - * Verify that, lseek() call succeeds to set the file pointer position - * to less than or equal to the file size, when a file is opened for - * read or write. - * - * Expected Result: - * lseek() should return the offset from the beginning of the file measured - * in bytes. Also check if able to read valid data from this location. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * lseek01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define OFFSET 4 -#define TEMP_FILE "tmp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="lseek01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fildes; /* file handle for temp file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - char read_buf[1]; /* data read from temp. file */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Invoke lseek(2) to move the read/write file - * pointer/handle by OFFSET bytes. - */ - TEST(lseek(fildes, OFFSET, SEEK_SET)); - - /* check return code of lseek(2) */ - if (TEST_RETURN == (off_t)-1) { - tst_resm(TFAIL, "lseek on (%s) Failed, errno=%d : %s", - TEMP_FILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Check if the return value from lseek(2) - * is equal to the specified OFFSET value. - */ - if (TEST_RETURN != OFFSET) { - tst_resm(TFAIL, "lseek() returned incorrect " - "value %d, expected %d", - TEST_RETURN, OFFSET); - continue; - } - /* - * The return value is good, now check data. - * Read the data byte from this location. - */ - if (read(fildes, &read_buf, sizeof(read_buf)) < 0) { - tst_brkm(TFAIL, cleanup, "read() failed " - "on %s, error=%d", TEMP_FILE, errno); - } else { - /* - * Check if read byte is the expected character. - * For pos 4 ---> 'e' - */ - if (read_buf[0] != 'e') { - tst_resm(TFAIL, "Incorrect data read " - "from file %s", TEMP_FILE); - } else { - tst_resm(TPASS, "Functionality " - "of lseek() on %s " - "successful", TEMP_FILE); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - */ -void -setup() -{ - char write_buf[BUFSIZ]; /* buffer to hold data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Get the data to be written to temporary file */ - strcpy(write_buf, "abcdefg"); - - /* Creat/open a temporary file under above directory */ - if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE, FILE_MODE, errno, strerror(errno)); - } - - /* Write data into temporary file */ - if(write(fildes, write_buf, strlen(write_buf)) != (int)strlen(write_buf)) { - tst_brkm(TBROK, cleanup, "write(2) on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file created */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s:", - TEMP_FILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/lseek07.c b/winsup/testsuite/winsup.api/ltp/lseek07.c deleted file mode 100644 index c5a27b5b3..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek07.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: lseek02 - * - * Test Description: - * Verify that, lseek() call succeeds to set the file pointer position - * to more than the file size, when a file is opened for reading/writing. - * - * Expected Result: - * lseek() should return n+1, where n is the size of the file. - * Also when some data is written into this file it should start - * from that offset. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * lseek02 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE "tmp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="lseek02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fildes; /* file handle for temp file */ -size_t file_size; /* size of temporary file */ -char write_buf1[BUFSIZ]; /* buffer to hold data */ -char write_buf2[BUFSIZ]; /* buffer to hold data */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - char read_buf[BUFSIZ]; /* data read from temp. file */ - off_t offset; /* byte position in temporary file */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* Set the offset position */ - offset = file_size + (lc * strlen(write_buf2)); - - /* - * Invoke lseek(2) to move the write file - * pointer/handle by the specified offset value. - */ - TEST(lseek(fildes, offset, SEEK_SET)); - - /* check return code of lseek(2) */ - if (TEST_RETURN == (off_t)-1) { - tst_resm(TFAIL, "lseek on (%s) Failed, errno=%d : %s", - TEMP_FILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Check if the return value from lseek(2) - * is equal to the specified offset value. - */ - if (TEST_RETURN != offset) { - tst_resm(TFAIL, "lseek() returned " - "incorrect value %d, expected " - "%d", TEST_RETURN, offset); - continue; - } - /* - * The return value is okay, now write some data at - * the current offset position. - */ - if (write(fildes, write_buf2, strlen(write_buf2)) != - (int)strlen(write_buf2)) { - tst_brkm(TFAIL, cleanup, "write() failed to " - "write additional data, error = %d", - errno); - } - - /* - * Now close the file and open it again - * and read all of the data. - */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, cleanup, "close() on %s Failed," - " errno = %d", TEMP_FILE, errno); - } - - /* Open the file again in read/write mode */ - if ((fildes = open(TEMP_FILE, O_RDWR)) < 0) { - tst_brkm(TFAIL, cleanup, "Could not open the " - "%s readonly, error = %d", - TEMP_FILE, errno); - } - - /* - * Now read all of the data. The size should be the - * offset + strlen(write_buf2). - */ - if (read(fildes, &read_buf, (offset + - strlen(write_buf2))) < 0) { - tst_brkm(TFAIL, cleanup, "read() failed on %s, " - "error=%d", TEMP_FILE, errno); - } else { - /* - * Check data read is the complete data and not - * the only portion written. - */ - if ((strncmp(read_buf, write_buf1, - strlen(write_buf1))) != 0) { - tst_brkm(TFAIL, cleanup, - "Incorrect data read #1 from " - "file %s", TEMP_FILE); - } - if ((strncmp(&read_buf[offset], write_buf2, - strlen(write_buf2))) != 0) { - tst_brkm(TFAIL, cleanup, - "Incorrect data read #2 from " - "file %s", TEMP_FILE); - } - tst_resm(TPASS, "Functionality of " - "lseek() on %s successful", TEMP_FILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - * Get the size of the file using fstat(). - */ -void -setup() -{ - struct stat stat_buf; /* struct buffer for stat(2) */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Get the data to be written to temporary file */ - strcpy(write_buf1, "abcdefg"); - strcpy(write_buf2, "ijk"); - - /* Creat/open a temporary file for writing under above directory */ - if ((fildes = open(TEMP_FILE, O_WRONLY | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_WRONLY|O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE, FILE_MODE, errno, strerror(errno)); - } - - /* Write data into temporary file */ - if(write(fildes, write_buf1, strlen(write_buf1)) != - (int)strlen(write_buf1)) { - tst_brkm(TBROK, cleanup, "write(2) on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - /* Get the size of the temporary file after writing data */ - if (fstat(fildes, &stat_buf) < 0) { - tst_brkm(TBROK, cleanup, "fstat() on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - file_size = stat_buf.st_size; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file created */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s:", - TEMP_FILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/lseek08.c b/winsup/testsuite/winsup.api/ltp/lseek08.c deleted file mode 100644 index 32fdcc0e4..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek08.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: lseek03 - * - * Test Description: - * Verify that, lseek() call succeeds to set the file pointer position - * to the end of the file when 'whence' value set to SEEK_END and any - * attempts to read from that position should fail. - * - * Expected Result: - * lseek() should return the offset which is set to the file size measured - * in bytes. read() attempt should fail with -1 return value. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * lseek03 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE "tmp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="lseek03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fildes; /* file handle for temp file */ -ssize_t file_size; /* size of the temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - char read_buf[1]; /* data read from temp. file */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Invoke lseek(2) to move the read/write file - * pointer/handle to the END of the file. - */ - TEST(lseek(fildes, 0, SEEK_END)); - - /* check return code of lseek(2) */ - if (TEST_RETURN == (off_t)-1) { - tst_resm(TFAIL, "lseek on (%s) Failed, errno=%d : %s", - TEMP_FILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Check if the return value from lseek(2) - * is equal to the file_size. - */ - if (TEST_RETURN != file_size) { - tst_resm(TFAIL, "lseek() returned incorrect " - "value %d, expected %d", - TEST_RETURN, file_size); - continue; - } - /* - * The return value is okay, now attempt to read data - * from the file. This should fail as the file pointer - * should be pointing to END OF FILE. - */ - read_buf[0] = '\0'; - if (read(fildes, &read_buf, sizeof(read_buf)) > 0) { - tst_resm(TFAIL, "read() successful on %s", - TEMP_FILE); - } else { - tst_resm(TPASS, "Functionality of lseek() on " - "%s successful", TEMP_FILE); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /* NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - * Get the size of the file using fstat(). - */ -void -setup() -{ - struct stat stat_buf; /* struct. buffer for stat(2) */ - char write_buf[BUFSIZ]; /* buffer to hold data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Get the data to be written to temporary file */ - strcpy(write_buf, "abcdefg\n"); - - /* Creat/open a temporary file under above directory */ - if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE, FILE_MODE, errno, strerror(errno)); - } - - /* Write data into temporary file */ - if(write(fildes, write_buf, strlen(write_buf)) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - /* Get the size of the file using fstat */ - if (fstat(fildes, &stat_buf) < 0) { - tst_brkm(TBROK, cleanup, - "fstat(2) on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - file_size = stat_buf.st_size; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file created */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s:", - TEMP_FILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/lseek09.c b/winsup/testsuite/winsup.api/ltp/lseek09.c deleted file mode 100644 index 36688c656..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek09.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: lseek04 - * - * Test Description: - * Verify that, lseek() call succeeds to set the file pointer position - * to the current specified location, when 'whence' value is set to - * SEEK_CUR and the data read from the specified location should match - * the expected data. - * - * Expected Result: - * lseek() should return the specified offset from the beginning of the file - * measured in bytes. The data read from this location should match the - * expected data. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * lseek04 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE "tmp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="lseek04"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fildes; /* file handle for temp file */ -size_t file_size; /* total size of file after data write */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - char read_buf[BUFSIZ]; /* data read from temp. file */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Invoke lseek(2) to set the file - * pointer/handle from the current location - * of the file descriptor + specified offset. - */ - TEST(lseek(fildes, 1, SEEK_CUR)); - - /* check return code of lseek(2) */ - if (TEST_RETURN == (off_t)-1) { - tst_resm(TFAIL, "lseek on (%s) Failed, errno=%d : %s", - TEMP_FILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Check if the return value from lseek(2) is equal - * to the 3 positions from the beginning of the file. - * ie, 2 positions from lseek() in the setup + - * 1 position from above above. - */ - if (TEST_RETURN != 3) { - tst_resm(TFAIL, "lseek() returned incorrect " - "value %d, expected 4", TEST_RETURN); - continue; - } - /* - * Read the data byte from this location. - */ - read_buf[0] = '\0'; - if (read(fildes, &read_buf, (file_size - 3)) < 0) { - tst_brkm(TFAIL, cleanup, - "read() failed on %s, error=%d", - TEMP_FILE, errno); - } else { - /* - * Check if read data contains - * expected characters - * From pos 4 ---> 'defg'. - */ - if (memcmp(read_buf, "defg", 4)) { - tst_resm(TFAIL, "Incorrect data read " - "from file %s", TEMP_FILE); - } else { - tst_resm(TPASS, "Functionality of " - "lseek() on %s successful", - TEMP_FILE); - } - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - /* reset file pointer in case we are looping */ - if (lseek(fildes, 2, SEEK_SET) == -1) { - tst_brkm(TBROK, cleanup, "lseek failed - could not " - "reset file pointer"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - * Get the size of the file using fstat(). - */ -void -setup() -{ - struct stat stat_buf; /* buffer to hold stat info. */ - char write_buf[BUFSIZ]; /* buffer to hold data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Get the data to be written to temporary file */ - strcpy(write_buf, "abcdefg"); - - /* Creat/open a temporary file under above directory */ - if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE, FILE_MODE, errno, strerror(errno)); - } - - /* Write data into temporary file */ - if(write(fildes, write_buf, strlen(write_buf)) <= 0) { - tst_brkm(TBROK, cleanup, "write(2) on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - /* Get the temporary file information */ - if (fstat(fildes, &stat_buf) < 0) { - tst_brkm(TBROK, cleanup, "fstat(2) on %s Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - file_size = stat_buf.st_size; - - /* - * Reset the file pointer position to the specified offset - * from the beginning of the file. - */ - if (lseek(fildes, 2, SEEK_SET) != 2) { - tst_brkm(TBROK, cleanup, - "lseek() fails to set file ptr. to specified offset"); - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file created */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s:", - TEMP_FILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/lseek10.c b/winsup/testsuite/winsup.api/ltp/lseek10.c deleted file mode 100644 index ab3cc6ba3..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek10.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: lseek05 - * - * Test Description: - * Verify that, - * 1. lseek() returns -1 and sets errno to ESPIPE, if the file handle of - * the specified file is associated with a pipe, socket, or FIFO. - * 2. lseek() returns -1 and sets errno to EINVAL, if the 'Whence' argument - * is not a proper value. - * 3. lseek() returns -1 and sets errno to EBADF, if the file handle of - * the specified file is not valid. - * - * Expected Result: - * lseek() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * lseek05 [-c n] [-e] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE1 "tmp_file1" -#define TEMP_FILE2 "tmp_file2" -#define TEMP_FILE3 "tmp_file3" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define PIPE_MODE S_IFIFO | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define SEEK_TOP 10 - -const char *TCID="lseek05"; /* Test program identifier. */ -int TST_TOTAL=3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={ESPIPE, EINVAL, EBADF, 0}; - -int no_setup(); -int setup1(); /* setup function to test lseek() for ESPIPE */ -int setup2(); /* setup function to test lseek() for EINVAL */ -int setup3(); /* setup function to test lseek() for EBADF */ - -int fd1; /* file handle for testfile1 */ -int fd2; /* file handle for testfile2 */ -int fd3; /* file handle for testfile3 */ - -struct test_case_t { /* test case struct. to hold ref. test cond's*/ - int fd; - int Whence; - const char *desc; - int exp_errno; - int (*setupfunc)(); -} Test_cases[] = { - { 1, SEEK_SET, "'fd' associated with a pipe/fifo", ESPIPE, setup1 }, - { 2, SEEK_TOP, "'whence' argument is not valid", EINVAL, setup2 }, - { 3, SEEK_SET, "'fd' is not an open file descriptor", EBADF, setup3 }, - { 0, 0, NULL, 0, no_setup } -}; - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int fildes; /* file handle for testfile */ - int whence; /* position of file handle in the file */ - const char *test_desc; /* test specific error message */ - int ind; /* counter to test different test conditions */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - fildes = Test_cases[ind].fd; - test_desc = Test_cases[ind].desc; - whence = Test_cases[ind].Whence; - - /* Assign the 'fd' values appropriatly */ - if (fildes == 1) { - fildes = fd1; - } else if (fildes == 2) { - fildes = fd2; - } else { - fildes = fd3; - } - /* - * Invoke lseek(2) to test different test conditions. - * Verify that it fails with -1 return value and - * sets appropriate errno. - */ - TEST(lseek(fildes, 0, whence)); - - /* check return code of lseek(2) */ - if (TEST_RETURN != (off_t)-1) { - tst_resm(TFAIL, "lseek() returned %d, expected " - "-1, errno:%d", TEST_RETURN, - Test_cases[ind].exp_errno); - continue; - } - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == Test_cases[ind].exp_errno) { - tst_resm(TPASS, "lseek() fails, %s, errno:%d", - test_desc, TEST_ERRNO); - } else { - tst_resm(TFAIL, "lseek() fails, %s, errno:%d, " - "expected errno:%d", test_desc, - TEST_ERRNO, Test_cases[ind].exp_errno); - } - } - } - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Invoke individual test setup functions according to the order - * set in test struct. definition. - */ -void -setup() -{ - int ind; /* counter for test setup function */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* call individual setup functions */ - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - Test_cases[ind].setupfunc(); - } -} - -/* - * no_setup() - This is a dummy function which simply returns 0. - */ -int -no_setup() -{ - return 0; -} - -/* - * setup1() - setup function for a test condition for which lseek(2) - * returns -1 and sets errno to ESPIPE. - * Creat a named pipe/fifo using mknod() and open it for - * reading/writing. - * This function returns 0 on success. - */ -int -setup1() -{ - /* Creat a named pipe/fifo using mknod() */ - if (mknod(TEMP_FILE1, PIPE_MODE, 0) < 0) { - tst_brkm(TBROK, cleanup, - "mknod(%s, %#o, 0) Failed, errno=%d :%s", - TEMP_FILE1, FILE_MODE, errno, strerror(errno)); - } - - /* Open the named pipe/fifo for reading/writing */ - if ((fd1 = open(TEMP_FILE1, O_RDWR)) < 0) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR) Failed, errno=%d, :%s", - TEMP_FILE1, errno, strerror(errno)); - } - - return 0; -} - -/* - * setup2() - setup function for a test condition for which lseek(2) - * returns -1 and sets errno to EINVAL. - * Creat a temporary file for reading/writing and write some data - * into it. - * This function returns 0 on success. - */ -int -setup2() -{ - char write_buff[BUFSIZ]; /* buffer to hold data */ - - /* Get the data to be written to temporary file */ - strcpy(write_buff, "abcdefg"); - - /* Creat/open a temporary file under above directory */ - if ((fd2 = open(TEMP_FILE2, O_RDWR | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE2, FILE_MODE, errno, strerror(errno)); - } - - /* Write data into temporary file */ - if(write(fd2, write_buff, sizeof(write_buff)) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TEMP_FILE2, errno, strerror(errno)); - } - - return 0; -} - -/* - * setup3() - setup function for a test condition for which lseek(2) - * returns -1 and sets errno to EBADF. - * Creat a temporary file for reading/writing and close it. - * This function returns 0 on success. - */ -int -setup3() -{ - /* Creat/open a temporary file under above directory */ - if ((fd3 = open(TEMP_FILE3, O_RDWR | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE3, FILE_MODE, errno, strerror(errno)); - } - - /* Close the temporary file created above */ - if (close(fd3) < 0) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s:", - TEMP_FILE3, errno, strerror(errno)); - } - - return 0; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile(s) created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file(s) created in setup1/setup2*/ - if (close(fd1) < 0) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s:", - TEMP_FILE1, errno, strerror(errno)); - } - if (close(fd2) < 0) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s:", - TEMP_FILE2, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/lstat02.c b/winsup/testsuite/winsup.api/ltp/lstat02.c deleted file mode 100644 index eed8f78c7..000000000 --- a/winsup/testsuite/winsup.api/ltp/lstat02.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : lstat02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for lstat(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) lstat(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the lstat(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * lstat(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="lstat02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255], lname[255], symlnk[255], buf[255]; -int fd; -struct stat statter; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call lstat(2) - */ - TEST(lstat(symlnk, &statter)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "lstat(%s, &statter) Failed, errno=%d : %s", symlnk, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "lstat(%s, &statter) returned %d", symlnk, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } else if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - sprintf(symlnk,"lnfile_%d",getpid()); - if (symlink(fname, symlnk) == -1) { - tst_resm(TWARN, "symlink(%s, %s) Failed, errno=%d : %s", - fname, symlnk, errno, strerror(errno)); - } else if (readlink(symlnk, buf, 255) == -1) { - tst_resm(TWARN, "readlink(%s, buf, 255) Failed, errno=%d : %s", - symlnk, errno, strerror(errno)); - } else if (strcmp(buf, fname) != 0) { - tst_resm(TWARN, - "Setup Failure : Expected symbolic link contents of %s : Actual is %s", - fname, buf); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/mkdir01.c b/winsup/testsuite/winsup.api/ltp/mkdir01.c deleted file mode 100644 index 5772f0683..000000000 --- a/winsup/testsuite/winsup.api/ltp/mkdir01.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : mkdir01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic errno test for mkdir(2) - * - * PARENT DOCUMENT : mkstds02 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Bill Branum - * - * CO-PILOT : Kathy Olmsted - * - * DATE STARTED : 4/15/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * mkdir(2) test for errno(s) EFAULT. - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * DETAILED DESCRIPTION - * This test will verify that mkdir(2) returns a value of - * -1 and sets errno to EFAULT when the path argument points - * outside (above/below) the allocated address space of the - * process. - * - * Setup: - * Setup signal handling. - * Create and make current a temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno. - * If doing functional test - * check the errno returned and print result message - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Remove the temporary directory. - * Exit. - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - -char *get_high_address(); - -const char *TCID="mkdir01"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={EFAULT, 0}; /* List must end with 0 */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * TEST CASE: 1 - * mkdir() call with pointer below allocated address space. - */ - - /* Call mkdir(2) */ - TEST(mkdir((char *)-1,0777)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, "mkdir - path argument pointing below allocated address space failed as expected with errno %d : %s", TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, "mkdir - path argument pointing below allocated address space failed with errno %d : %s but expected %d (EFAULT)", TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, "mkdir - path argument pointing below allocated address space succeeded unexpectedly."); - - } - } - - - /* - * TEST CASE: 2 - * mkdir() call with pointer above allocated address space. - */ - - /* Call mkdir(2) */ - TEST(mkdir(get_high_address(),0777)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS, "mkdir - path argument pointing above allocated address space failed as expected with errno %d : %s", TEST_ERRNO, strerror(TEST_ERRNO)); - } - else { - tst_resm(TFAIL, "mkdir - path argument pointing above allocated address space failed with errno %d : %s but expected %d (EFAULT)", TEST_ERRNO, strerror(TEST_ERRNO),EFAULT); - } - } - else { - tst_resm(TFAIL, "mkdir - path argument pointing above allocated address space succeeded unexpectedly."); - - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Create a temporary directory and make it current. */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * Remove the temporary directory. - */ - tst_rmdir(); - - /* - * Exit with return code appropriate for results. - */ - tst_exit(); - -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/mkdir08.c b/winsup/testsuite/winsup.api/ltp/mkdir08.c deleted file mode 100644 index d1cc19344..000000000 --- a/winsup/testsuite/winsup.api/ltp/mkdir08.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : mkdir08 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for mkdir(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) mkdir(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the mkdir(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * mkdir(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="mkdir08"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mkdir(2) - */ - TEST(mkdir(fname, 0777)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "mkdir(%s) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "mkdir(%s) returned %d", fname, TEST_RETURN); - } - if(rmdir(fname) == -1) { - tst_brkm(TBROK, cleanup, "rmdir(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname, "./dir_%d", getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/mknod01.c b/winsup/testsuite/winsup.api/ltp/mknod01.c deleted file mode 100644 index e25194e0c..000000000 --- a/winsup/testsuite/winsup.api/ltp/mknod01.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : mknod01 - * - * EXECUTED BY : root - * - * TEST TITLE : Basic test for mknod(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 4 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 05/13/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) mknod(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the mknod(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * mknod(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="mknod01"; /* Test program identifier. */ -int TST_TOTAL; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char Path[1024]; /* path to create */ -int i; /* counter for test case loop */ -int tcases[] = { /* modes to give nodes created (1 per text case) */ - S_IFREG|0777, /* ordinary file with mode 0777 */ - S_IFIFO|0777, /* fifo special with mode 0777 */ - S_IFCHR|0777, /* character special with mode 0777 */ - S_IFBLK|0777, /* block special with mode 0777 */ - - S_IFREG|04700, /* ordinary file with mode 04700 (suid) */ - S_IFREG|02700, /* ordinary file with mode 02700 (sgid) */ - S_IFREG|06700, /* ordinary file with mode 06700 (sgid & suid) */ - -#ifdef CRAY - S_IFDIR|0777, /* Direcory */ - S_IRESTART|0400, /* restartbit */ -#ifdef S_IFOFD - S_IFOFD|0777, /* off line, with data */ -#endif -#ifdef S_IFOFL - S_IFOFL|0777, /* off line, with no data */ -#endif -#endif /* CRAY */ - -}; - - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - TST_TOTAL=(sizeof(tcases)/sizeof(tcases[0])); - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASES: - * Make nodes in tcases array - */ - for(i=0; i - * Aaron Laffin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID="mmap001"; -int TST_TOTAL=5; -extern int Tst_count; -static char *filename=NULL; -static int m_opt = 0; -static char *m_copt; - -void cleanup() -{ - /* - * remove the tmp directory and exit - */ - - if ( filename ) - free(filename); - - TEST_CLEANUP; - - tst_rmdir(); - - tst_exit(); -} - -void setup() -{ - char buf[1024]; - /* - * setup a default signal hander and a - * temporary working directory. - */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - tst_tmpdir(); - - TEST_PAUSE; - - snprintf(buf,1024,"testfile.%d",getpid()); - - filename = strdup(buf); -} - -void help() -{ - printf(" -m x size of mmap in pages (default 1000)\n"); -} - -/* - * add the -m option whose parameter is the - * pages that should be mapped. - */ -option_t options[] = -{ - { "m:", &m_opt, &m_copt }, - { NULL, NULL, NULL } -}; - -int main(int argc, char * argv[]) -{ - char *array; - const char *msg; - int i,lc; - int fd; - int pages,memsize; - - if ( (msg=parse_opts(argc, argv, options, help)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - if ( m_opt ) - { - memsize = pages = atoi( m_copt ); - - if (memsize < 1) - { - tst_brkm(TBROK, cleanup, "Invalid arg for -m: %s",m_copt); - } - - memsize *= getpagesize(); /* N PAGES */ - - } - else - { - /* - * default size 1000 pages; - */ - memsize = pages = 1000; - memsize *= getpagesize(); - } - - tst_resm(TINFO,"mmap()ing file of %u pages or %u bytes", pages,memsize); - - setup(); - - for (lc=0; TEST_LOOPING(lc); lc++) - { - Tst_count=0; - - fd = open(filename, O_RDWR | O_CREAT, 0666); - if ((fd == -1)) - tst_brkm(TBROK, cleanup, "Problems opening files"); - - if (lseek(fd, memsize, SEEK_SET) != memsize) - { - close(fd); - tst_brkm(TBROK, cleanup, "Problems doing the lseek: %d: %s", - errno,strerror(errno)); - } - - if (write(fd,"\0",1) !=1) - { - close(fd); - tst_brkm(TBROK, cleanup, "Problems writing: %d: %s", - errno,strerror(errno)); - } - - array = mmap(0, memsize, PROT_WRITE, MAP_SHARED,fd,0); - if (array == (char *)MAP_FAILED) - { - tst_resm(TFAIL, "mmap() failed: %d: %s", - errno,strerror(errno)); - tst_exit(); - } - else - { - tst_resm(TPASS, "mmap() completed successfully."); - } - - if ( STD_FUNCTIONAL_TEST ) - { - tst_resm(TINFO,"touching mmaped memory"); - - for(i = 0; i < memsize; i++) - { - array[i] = (char) i; - } - - /* - * seems that if the map area was bad, we'd get SEGV, hence we can - * indicate a PASS. - */ - tst_resm(TPASS, "we're still here, mmaped area must be good"); - - TEST( msync(array, memsize, MS_SYNC) ); - - if ( TEST_RETURN == -1 ) - { - tst_resm(TFAIL, "msync() failed: errno: %d: %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else - { - tst_resm(TPASS, "msync() was successful"); - } - - } /* STD_FUNCTIONAL_TEST */ - - TEST( munmap(array, memsize) ); - - if ( TEST_RETURN == -1 ) - { - tst_resm(TFAIL, "munmap() failed: errno: %d: %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } - else - { - tst_resm(TPASS, "munmap() was successful"); - } - - close(fd); - unlink(filename); - } - cleanup(); - return 0; -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap02.c b/winsup/testsuite/winsup.api/ltp/mmap02.c deleted file mode 100644 index 33a12738c..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap02.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: mmap02 - * - * Test Description: - * Call mmap() with prot parameter set to PROT_READ and with the file - * descriptor being open for read, to map a file creating mapped memory - * with read access. The minimum file permissions should be 0444. - * - * The call should succeed to create the mapped region with required - * attributes. - * - * Expected Result: - * mmap() should succeed returning the address of the mapped region, - * the mapped region should contain the contents of the mapped file. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * mmap02 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -char *addr; /* addr of memory mapped region */ -char *dummy; /* dummy string */ -size_t page_sz; /* system page size */ -int fildes = -1; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * with read access. - */ - TEST(mmap(0, page_sz, PROT_READ, - MAP_FILE|MAP_SHARED, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN == (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* Get the mmap return value */ - addr = (char *)TEST_RETURN; - - /* - * Read the file contents into the dummy - * string. - */ - if (read(fildes, dummy, page_sz) < 0) { - tst_brkm(TFAIL, cleanup, "read() on %s Failed, " - "error:%d", TEMPFILE, errno); - } - - /* - * Check whether mapped memory region has - * the file contents. - */ - if (memcmp(dummy, addr, page_sz)) { - tst_resm(TFAIL, "mapped memory area contains " - "invalid data"); - } else { - tst_resm(TPASS, - "Functionality of mmap() successful"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - /* Clean up things in case we are looping */ - /* Unmap the mapped memory */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TFAIL, NULL, "munmap() fails to unmap the " - "memory, errno=%d", errno); - } - - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * - * Get system page size, allocate and initialize the string dummy. - * Initialize addr such that it is more than one page below the break - * address of the process, and initialize one page region from addr - * with char 'A'. - * Create a temporary directory a file under it. - * Write some known data into file and close it. - * Change mode permissions on file to 0444. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* Allocate space for the test buffer */ - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, sizeof(tst_buff)) < (int)sizeof(tst_buff)) { - tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); - - /* Close the temporary file */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, cleanup, "close() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Change Mode permissions on Temporary file */ - if (chmod(TEMPFILE, 0444) < 0) { - tst_brkm(TFAIL, cleanup, "chmod(%s, 0444) Failed, errno=%d : " - "%s", TEMPFILE, errno, strerror(errno)); - } - - /* Open the temporary file again, - Readonly mode */ - if ((fildes = open(TEMPFILE, O_RDONLY)) < 0) { - tst_brkm(TFAIL, cleanup, "open(%s, O_RDONLY) Failed, errno=%d " - ": %s", TEMPFILE, errno, strerror(errno)); - } - - - /* Allocate and initialize dummy string of system page size bytes */ - if ((dummy = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, "calloc() failed to allocate space"); - tst_exit(); - } - -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Free the memory allocated to dummy variable. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Free the memory allocated for dummy string */ - if (dummy) { - free(dummy); - } - - if (fildes >= 0) - close (fildes); - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap03.c b/winsup/testsuite/winsup.api/ltp/mmap03.c deleted file mode 100644 index 9302d335d..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap03.c +++ /dev/null @@ -1,290 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: mmap03 - * - * Test Description: - * Call mmap() to map a file creating a mapped region with execute access - * under the following conditions - - * - The prot parameter is set to PROT_EXE - * - The file descriptor is open for read - * - The file being mapped has execute permission bit set. - * - The minimum file permissions should be 0555. - * - * The call should succeed to map the file creating mapped memory with the - * required attributes. - * - * Expected Result: - * mmap() should succeed returning the address of the mapped region, - * and the mapped region should contain the contents of the mapped file. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * mmap03 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -char *dummy; /* dummy variable to hold temp file contents */ -int fildes = -1; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * with execute access. - */ - TEST(mmap(0, page_sz, PROT_EXEC, - MAP_FILE|MAP_SHARED, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN == (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* Get the mmap return value */ - addr = (char *)TEST_RETURN; - - /* - * Read the file contents into the dummy - * variable. - */ - if (read(fildes, dummy, page_sz) < 0) { - tst_brkm(TFAIL, cleanup, "read() on %s Failed, " - "error:%d", TEMPFILE, errno); - } - - /* - * Check whether the mapped memory region - * has the file contents. - */ - if (memcmp(dummy, addr, page_sz)) { - tst_resm(TFAIL, "mapped memory region contains " - "invalid data"); - } else { - tst_resm(TPASS, - "Functionality of mmap() successful"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - /* Clean up things in case we are looping */ - /* Unmap the mapped memory */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TFAIL, NULL, "munmap() fails to unmap the " - "memory, errno=%d", errno); - } - - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Get the system page size. - * Create a temporary directory and a file under it. - * Write some known data into file and close it. - * Change the mode permissions on file to 0555. - * Re-open the file for reading. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* Allocate space for the test buffer */ - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, strlen(tst_buff)) < (int)strlen(tst_buff)) { - tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); - - /* Make sure proper permissions set on file */ - if (chmod(TEMPFILE, 0555) < 0) { - tst_brkm(TFAIL, cleanup, "chmod() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Close the temporary file opened for write */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, cleanup, "close() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Allocate and initialize dummy string of system page size bytes */ - if ((dummy = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, cleanup, - "calloc() failed to allocate memory for dummy"); - } - - /* Open the temporary file again for reading */ - if ((fildes = open(TEMPFILE, O_RDONLY)) < 0) { - tst_brkm(TFAIL, cleanup, "open(%s) with read-only Failed, " - "errno:%d", TEMPFILE, errno); - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - Free the memory allocated to dummy variable. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Free the memory space allocated for dummy variable */ - if (dummy) { - free(dummy); - } - - if (fildes >= 0) - close (fildes); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap04.c b/winsup/testsuite/winsup.api/ltp/mmap04.c deleted file mode 100644 index 64d3a8ebe..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap04.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: mmap04 - * - * Test Description: - * Call mmap() to map a file creating a mapped region with read/exec access - * under the following conditions - - * - The prot parameter is set to PROT_READ|PROT_EXEC - * - The file descriptor is open for read - * - The file being mapped has read and execute permission bit set. - * - The minimum file permissions should be 0555. - * - * The call should succeed to map the file creating mapped memory with the - * required attributes. - * - * Expected Result: - * mmap() should succeed returning the address of the mapped region, - * and the mapped region should contain the contents of the mapped file. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * mmap04 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap04"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -char *dummy; /* dummy variable to hold temp file contents */ -int fildes = -1; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * with read and execute access. - */ - TEST(mmap(0, page_sz, PROT_READ|PROT_EXEC, - MAP_FILE|MAP_SHARED, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN == (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - continue; - } - - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* Get the mmap return value */ - addr = (char *)TEST_RETURN; - - /* - * Read the file contents into the dummy - * variable. - */ - if (read(fildes, dummy, page_sz) < 0) { - tst_brkm(TFAIL, cleanup, "read() on %s Failed, " - "error:%d", TEMPFILE, errno); - } - - /* - * Check whether the mapped memory region - * has the file contents. - */ - if (memcmp(dummy, addr, page_sz)) { - tst_resm(TFAIL, "mapped memory region contains " - "invalid data"); - } else { - tst_resm(TPASS, - "Functionality of mmap() successful"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - /* Clean up things in case we are looping. */ - /* Unmap the mapped memory */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TFAIL, NULL, "munmap() fails to unmap the " - "memory, errno=%d", errno); - } - - - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Get the system page size. - * Create a temporary directory and a file under it. - * Write some known data into file and close it. - * Change the mode permissions on file to 0555. - * Re-open the file for reading. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, strlen(tst_buff)) < (int)strlen(tst_buff)) { - tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); - - /* Make sure proper permissions set on file */ - if (chmod(TEMPFILE, 0555) < 0) { - tst_brkm(TFAIL, cleanup, "chmod() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Close the temporary file opened for write */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, cleanup, "close() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Allocate and initialize dummy string of system page size bytes */ - if ((dummy = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, cleanup, - "calloc() failed to allocate memory for dummy"); - } - - /* Open the temporary file again for reading */ - if ((fildes = open(TEMPFILE, O_RDONLY)) < 0) { - tst_brkm(TFAIL, cleanup, "open(%s) with read-only Failed, " - "errno:%d", TEMPFILE, errno); - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Free the memeory allocated to dummy variable. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Free the memory space allocated for dummy variable */ - if (dummy) { - free(dummy); - } - - if (fildes >= 0) - close (fildes); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap05.c b/winsup/testsuite/winsup.api/ltp/mmap05.c deleted file mode 100644 index bcdfd0cd8..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap05.c +++ /dev/null @@ -1,301 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: mmap05 - * - * Test Description: - * Call mmap() to map a file creating mapped memory with no access under - * the following conditions - - * - The prot parameter is set to PROT_NONE - * - The file descriptor is open for read(any mode other than write) - * - The minimum file permissions should be 0444. - * - * The call should succeed to map the file creating mapped memory with the - * required attributes. - * - * Expected Result: - * mmap() should succeed returning the address of the mapped region, - * and an attempt to access the contents of the mapped region should give - * rise to the signal SIGSEGV. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * mmap05 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -int fildes = -1; /* file descriptor for temporary file */ -int pass=0; /* pass flag perhaps set to 1 in sig_handler */ -sigjmp_buf env; /* environment for sigsetjmp/siglongjmp */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ -void sig_handler(); /* signal handler to catch SIGSEGV */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - volatile char file_content; /* tempfile content */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * with no access. - */ - - TEST(mmap(0, page_sz, PROT_NONE, - MAP_FILE|MAP_SHARED, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN == (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - continue; - } - - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - - /* - * Try to access the mapped region. This should - * generate a SIGSEGV which will be caught below. - * - * This is wrapped by the sigsetjmp() call that will - * take care of restoring the program's context in an - * elegant way in conjunction with the call to - * siglongjmp() in the signal handler. - */ - if (sigsetjmp(env, 1) == 0) { - file_content = addr[0]; - } - - if (pass) { - tst_resm(TPASS, "Got SIGSEGV as expected"); - } else { - tst_resm(TFAIL, "Mapped memory region with NO " - "access is accessible"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - /* Unmap mapped memory and reset pass in case we are looping */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TFAIL, cleanup, "munmap() fails to unmap the " - "memory, errno=%d", errno); - } - pass = 0; - - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Get the system page size. - * Create a temporary directory and a file under it. - * Write some known data into file and close it. - * Change the mode permissions on file to 0444 - * Re-open the file for reading. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(NOFORK, sig_handler, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* Allocate space for the test buffer */ - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, strlen(tst_buff)) - != (int)strlen(tst_buff)) { - tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); - - /* Close the temporary file opened for write */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, cleanup, "close() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Make sure proper permissions set on file */ - if (chmod(TEMPFILE, 0444) < 0) { - tst_brkm(TFAIL, cleanup, "chmod() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Open the temporary file again for reading */ - if ((fildes = open(TEMPFILE, O_RDONLY)) < 0) { - tst_brkm(TFAIL, cleanup, "open(%s) with read-only Failed, " - "errno:%d", TEMPFILE, errno); - } -} - -/* - * sig_handler() - Signal Cathing function. - * This function gets executed when the test process receives - * the signal SIGSEGV while trying to access the contents of memory which - * is not accessible. - */ -void -sig_handler(sig) -{ - if (sig == SIGSEGV) { - /* set the global variable and jump back */ - pass = 1; - siglongjmp(env, 1); - } else { - tst_brkm(TBROK, cleanup, "received an unexpected signal"); - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (fildes >= 0) - close (fildes); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap06.c b/winsup/testsuite/winsup.api/ltp/mmap06.c deleted file mode 100644 index ec113c077..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap06.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: mmap06 - * - * Test Description: - * Call mmap() to map a file creating a mapped region with read access - * under the following conditions - - * - The prot parameter is set to PROT_READ - * - The file descriptor is open for writing. - * - * The call should fail to map the file. - * - * Expected Result: - * mmap() should fail returning -1 and errno should get set to EACCES. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * mmap06 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap06"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EACCES, 0}; - -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -int fildes = -1; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * with read access. - */ - TEST(mmap(0, page_sz, PROT_READ, - MAP_FILE|MAP_SHARED, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN != (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() returned invalid value, " - "expected: -1"); - /* Unmap the mapped memory */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TBROK, cleanup, "munmap() failed"); - } - continue; - } - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == EACCES) { - tst_resm(TPASS, "mmap() fails, 'fd' doesn't allow " - "desired access, errno:%d", errno); - } else { - tst_resm(TFAIL, "mmap() fails, 'fd' doesn't allow " - "desired access, invalid errno:%d", errno); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Get the system page size. - * Create a temporary directory and a file under it. - * Write some known data into file. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* Allocate space for the test buffer */ - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, - "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, strlen(tst_buff)) < (int)strlen(tst_buff)) { - tst_brkm(TFAIL, NULL, - "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (fildes >= 0) - close (fildes); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap07.c b/winsup/testsuite/winsup.api/ltp/mmap07.c deleted file mode 100644 index ab989f443..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap07.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: mmap07 - * - * Test Description: - * Call mmap() to map a file creating a mapped region with read access - * under the following conditions - - * - The prot parameter is set to PROT_WRITE - * - The file descriptor is open for writing. - * - The flags parameter has MAP_PRIVATE set. - * - * The call should fail to map the file. - * - * Expected Result: - * mmap() should fail returning -1 and errno should get set to EACCES. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * mmap07 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap07"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EACCES, 0}; - -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -int fildes = -1; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * with write access. - */ - TEST(mmap(0, page_sz, PROT_WRITE, - MAP_FILE|MAP_PRIVATE, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN != (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() returned invalid value, " - "expected: -1"); - /* Unmap the mapped memory */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TBROK, cleanup, "munmap() failed"); - } - continue; - } - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == EACCES) { - tst_resm(TPASS, "mmap() fails, 'fd' doesn't allow " - "desired access, errno:%d", errno); - } else { - tst_resm(TFAIL, "mmap() fails, 'fd' doesn't allow " - "desired access, invalid errno:%d", errno); - } - - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Get the system page size. - * Create a temporary directory and a file under it. - * Write some known data into file. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* Allocate space for the test buffer */ - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, strlen(tst_buff)) < (int)strlen(tst_buff)) { - tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (fildes >= 0) - close (fildes); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/mmap08.c b/winsup/testsuite/winsup.api/ltp/mmap08.c deleted file mode 100644 index 543c5397b..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap08.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: mmap08 - * - * Test Description: - * Verify that mmap() fails to map a file creating a mapped region - * when the file specified by file descriptor is not valid. - * - * Expected Result: - * mmap() should fail returning -1 and errno should get set to EBADF. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Create temporary directory. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * mmap08 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="mmap08"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EBADF, 0}; - -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -int fildes = -1; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call mmap to map the temporary file 'TEMPFILE' - * which is already closed. so, fildes is not valid. - */ - TEST(mmap(0, page_sz, PROT_WRITE, - MAP_FILE|MAP_SHARED, fildes, 0)); - - /* Check for the return value of mmap() */ - if (TEST_RETURN != (int)MAP_FAILED) { - tst_resm(TFAIL, "mmap() returned invalid value, " - "expected: -1"); - /* Unmap the mapped memory */ - if (munmap(addr, page_sz) != 0) { - tst_brkm(TBROK, cleanup, "munmap() failed"); - } - continue; - } - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == EBADF) { - tst_resm(TPASS, "mmap() fails, 'fd' is not valid, " - "errno:%d", errno); - } else { - tst_resm(TFAIL, "mmap() fails, 'fd' is not valid, " - "invalid errno:%d", errno); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Get the system page size. - * Create a temporary directory and a file under it. - * Write some known data into file and close it. - */ -void -setup() -{ - char *tst_buff; /* test buffer to hold known data */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TFAIL, NULL, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - if ((tst_buff = (char *)calloc(page_sz, sizeof(char))) == NULL) { - tst_brkm(TFAIL, NULL, - "calloc() failed to allocate space for tst_buff"); - tst_exit(); - } - - /* Fill the test buffer with the known data */ - memset(tst_buff, 'A', page_sz); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { - tst_brkm(TFAIL, NULL, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Write test buffer contents into temporary file */ - if (write(fildes, tst_buff, strlen(tst_buff)) - != (int)strlen(tst_buff)) { - tst_brkm(TFAIL, NULL, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - free(tst_buff); - cleanup(); - } - - /* Free the memory allocated for test buffer */ - free(tst_buff); - - /* Close the temporary file opened for writing */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, cleanup, "close() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (fildes >= 0) - close (fildes); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/munmap01.c b/winsup/testsuite/winsup.api/ltp/munmap01.c deleted file mode 100644 index 0527201be..000000000 --- a/winsup/testsuite/winsup.api/ltp/munmap01.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: munmap01 - * - * Test Description: - * Verify that, munmap call will succeed to unmap a mapped file or - * anonymous shared memory region from the calling process's address space - * and after successful completion of munmap, the unmapped region is no - * longer accessible. - * - * Expected Result: - * munmap call should succeed to unmap a mapped file or anonymous shared - * memory region from the process's address space and it returns with a - * value 0, further reference to the unmapped region should result in a - * segmentation fault (SIGSEGV). - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * munmap01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="munmap01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char *addr; /* addr of memory mapped region */ -int fildes; /* file descriptor for tempfile */ -unsigned int map_len; /* length of the region to be mapped */ - -void setup(); /* Main setup function of test */ -void cleanup(void); /* cleanup function for the test */ -void sig_handler(); /* signal catching function */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* Perform global setup for test */ - setup(); - - /* - * Call munmap to unmap the mapped region of the - * temporary file from the calling process's address space. - */ - TEST(munmap(addr, map_len)); - - /* Check for the return value of munmap() */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "munmap() fails, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Check whether further reference is possible - * to the unmapped memory region by writing - * to the first byte of region with - * some arbitrary number. - */ - *addr = 50; - - /* This message is printed if no SIGSEGV */ - tst_resm(TFAIL, "process succeeds to refer unmapped " - "memory region"); - } else { - tst_resm(TPASS, "call succeeded"); - } - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - } /* End for TEST_LOOPING */ - - /* exit with return code appropriate for results */ - tst_exit(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * - * Set up signal handler to catch SIGSEGV. - * Get system page size, create a temporary file for reading/writing, - * write one byte data into it, map the open file for the specified - * map length. - */ -void -setup() -{ - size_t page_sz; /* system page size */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* call signal function to trap the signal generated */ - if (signal(SIGSEGV, sig_handler) == SIG_ERR) { - tst_brkm(TBROK, cleanup, "signal fails to catch signal"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TBROK, cleanup, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* - * Get the length of the open file to be mapped into process - * address space. - */ - map_len = 3 * page_sz; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) { - tst_brkm(TBROK, cleanup, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* - * move the file pointer to maplength position from the beginning - * of the file. - */ - if (lseek(fildes, map_len, SEEK_SET) == -1) { - tst_brkm(TBROK, cleanup, "lseek() fails on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* Write one byte into temporary file */ - if (write(fildes, "a", 1) != 1) { - tst_brkm(TBROK, cleanup, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* - * map the open file 'TEMPFILE' from its beginning up to the maplength - * into the calling process's address space at the system choosen - * with read/write permissions to the the mapped region. - */ - addr = mmap(0, map_len, PROT_READ | PROT_WRITE, \ - MAP_FILE | MAP_SHARED, fildes, 0); - - /* check for the return value of mmap system call */ - if (addr == (char *)MAP_FAILED) { - tst_brkm(TBROK, cleanup, "mmap() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } -} - -/* - * sig_handler() - signal catching function. - * This function is used to trap the signal generated when tried to read or - * write to the memory mapped region which is already detached from the - * calling process address space. - * this function is invoked when SIGSEGV generated and it calls test - * cleanup function and exit the program. - */ -void -sig_handler() -{ - tst_resm(TPASS, "Functionality of munmap() successful"); - - /* Invoke test cleanup function and exit */ - cleanup(); - - /* exit with return code appropriate for results */ - tst_exit(); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the temporary file. - * Remove the temporary directory. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file */ - if (close(fildes) < 0) { - tst_brkm(TFAIL, NULL, "close() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Remove the temporary directory and all files in it */ - tst_rmdir(); -} diff --git a/winsup/testsuite/winsup.api/ltp/munmap02.c b/winsup/testsuite/winsup.api/ltp/munmap02.c deleted file mode 100644 index 7345e73e0..000000000 --- a/winsup/testsuite/winsup.api/ltp/munmap02.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: munmap02 - * - * Test Description: - * Verify that, munmap call will succeed to unmap a mapped file or - * anonymous shared memory region from the calling process's address space - * if the region specified by the address and the length is part or all of - * the mapped region. - * - * Expected Result: - * munmap call should succeed to unmap a part or all of mapped region of a - * file or anonymous shared memory from the process's address space and it - * returns with a value 0, - * further reference to the unmapped region should result in a segmentation - * fault (SIGSEGV). - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * munmap01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -const char *TCID="munmap02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -size_t page_sz; /* system page size */ -char *addr; /* addr of memory mapped region */ -int fildes; /* file descriptor for tempfile */ -unsigned int map_len; /* length of the region to be mapped */ - -void setup(); /* Main setup function of test */ -void cleanup(void); /* cleanup function for the test */ -void sig_handler(); /* signal catching function */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* Perform global setup for test */ - setup(); - - /* - * Call munmap to unmap the part of the mapped region of the - * temporary file from the address and length that is part of - * the mapped region. - */ - TEST(munmap(addr, map_len)); - - /* Check for the return value of munmap() */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "munmap() fails, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Check whether further reference is possible - * to the unmapped memory region by writing - * to the first byte of region with - * some arbitrary number. - */ - *addr = 50; - - /* This message is printed if no SIGSEGV */ - tst_resm(TFAIL, "process succeeds to refer unmapped " - "memory region"); - } else { - tst_resm(TPASS, "call succeeded"); - } - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - } /* End for TEST_LOOPING */ - - /* exit with return code appropriate for results */ - tst_exit(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Setup signal handler to catch SIGSEGV. - * Get system page size, create a temporary file for reading/writing, - * write one byte data into it, map the open file for the specified - * map length. - */ -void -setup() -{ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* call signal function to trap the signal generated */ - if (signal(SIGSEGV, sig_handler) == SIG_ERR) { - tst_brkm(TBROK, cleanup, "signal fails to catch signal"); - tst_exit(); - } - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Get the system page size */ - if ((page_sz = getpagesize()) < 0) { - tst_brkm(TBROK, cleanup, - "getpagesize() fails to get system page size"); - tst_exit(); - } - - /* - * Get the length of the open file to be mapped into process - * address space. - */ - map_len = 3 * page_sz; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Creat a temporary file used for mapping */ - if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) { - tst_brkm(TBROK, cleanup, "open() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* - * move the file pointer to maplength position from the beginning - * of the file. - */ - if (lseek(fildes, map_len, SEEK_SET) == -1) { - tst_brkm(TBROK, cleanup, "lseek() fails on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* Write one byte into temporary file */ - if (write(fildes, "a", 1) != 1) { - tst_brkm(TBROK, cleanup, "write() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* - * map the open file 'TEMPFILE' from its beginning up to the maplength - * into the calling process's address space at the system choosen - * with read/write permissions to the the mapped region. - */ - addr = mmap(0, map_len, PROT_READ | PROT_WRITE, - MAP_FILE | MAP_SHARED, fildes, 0); - - /* check for the return value of mmap system call */ - if (addr == (char *)MAP_FAILED) { - tst_brkm(TBROK, cleanup, "mmap() Failed on %s, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - tst_exit(); - } - - /* - * increment the start address of the region at which the file is - * mapped to a maplength of 3 times the system page size by the value - * of system page size and decrement the maplength value by the value - * of system page size. - */ - addr = (char *)((long)addr + page_sz); - map_len = map_len - page_sz; -} - -/* - * void - * sig_handler() - signal catching function. - * This function is used to trap the signal generated when tried to read or - * write to the memory mapped region which is already detached from the - * calling process address space. - * this function is invoked when SIGSEGV generated and it calls test - * cleanup function and exit the program. - */ -void -sig_handler() -{ - tst_resm(TPASS, "Functionality of munmap() successful"); - - /* Invoke test cleanup function and exit */ - cleanup(); - - /* exit with return code appropriate for results */ - tst_exit(); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Unmap the portion of the region of the file left unmapped. - * Close the temporary file. - * Remove the temporary directory. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * get the start address and length of the portion of - * the mapped region of the file. - */ - addr = (char *)((long)addr - page_sz); - map_len = map_len - page_sz; - - /* unmap the portion of the region of the file left unmapped */ - if (munmap(addr, map_len) < 0) { - tst_brkm(TBROK, NULL, - "munmap() fails to unmap portion of mapped region"); - } - - /* Close the temporary file */ - if (close(fildes) < 0) { - tst_brkm(TBROK, NULL, "close() on %s Failed, errno=%d : %s", - TEMPFILE, errno, strerror(errno)); - } - - /* Remove the temporary directory and all files in it */ - tst_rmdir(); -} diff --git a/winsup/testsuite/winsup.api/ltp/nice05.c b/winsup/testsuite/winsup.api/ltp/nice05.c deleted file mode 100644 index 1246e7fbd..000000000 --- a/winsup/testsuite/winsup.api/ltp/nice05.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : nice05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for nice(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) nice(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the nice(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * nice(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="nice05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int val; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - val = lc % 39; - /* - * Call nice(2) - */ - TEST(nice(val)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "nice(%d) Failed, errno=%d : %s", val, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "nice(%d) returned %d", val, TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/open02.c b/winsup/testsuite/winsup.api/ltp/open02.c deleted file mode 100644 index 594ab5b1c..000000000 --- a/winsup/testsuite/winsup.api/ltp/open02.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * open02.c - * - * DESCRIPTION - * Test if open without O_CREAT returns -1 if a file does not exist. - * - * ALGORITHM - * 1. open a new file without O_CREAT, test for return value of -1 - * - * USAGE: - * open02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ -#include -#include -#include -#include -#include -#include - -const char *TCID = "open02"; -int TST_TOTAL = 1; -extern int Tst_count; - -char pfilname[40] = ""; - -int exp_enos[] = {ENOENT, 0}; - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* - * parse standard command line options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup for test */ - - TEST_EXP_ENOS(exp_enos); - - /* - * check looping state if -i option given on the command line - */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - Tst_count = 0; /* reset Tst_count while looping. */ - - TEST(open(pfilname, O_RDWR, 0444)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "opened non-existent file"); - continue; - } - - TEST_ERROR_LOG(TEST_ERRNO); - - if (TEST_ERRNO != ENOENT) { - tst_resm(TFAIL, "open(2) set invalid errno: " - "expected ENOENT, got %d", TEST_ERRNO); - } else { - tst_resm(TPASS, "open returned ENOENT"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - umask(0); - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that options was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - sprintf(pfilname, "./open3.%d", getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at completion or - * premature exit. - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/open03.c b/winsup/testsuite/winsup.api/ltp/open03.c deleted file mode 100644 index 6a699bad1..000000000 --- a/winsup/testsuite/winsup.api/ltp/open03.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : open03 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for open(2) - * - * PARENT DOCUMENT : xxxtds01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) open(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the open(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * open(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="open03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call open(2) - */ - TEST(open(fname,O_RDWR|O_CREAT,0700)); - - fd=TEST_RETURN; - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "open(%s,O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "open(%s, O_RDWR|O_CREAT,0700) returned %d", - fname, TEST_RETURN); - } - - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } else if (unlink(fname) == -1) { - tst_brkm(TBROK, cleanup, - "unlink(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/pathconf01.c b/winsup/testsuite/winsup.api/ltp/pathconf01.c deleted file mode 100644 index 466875f21..000000000 --- a/winsup/testsuite/winsup.api/ltp/pathconf01.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : pathconf01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for pathconf(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 6 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) pathconf(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the pathconf(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * pathconf(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="pathconf01"; /* Test program identifier. */ -int TST_TOTAL; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int i; -const char *path = "/tmp"; - -struct pathconf_args -{ - const char *define_tag; - int value; -} args[] = { - {"_PC_LINK_MAX", _PC_LINK_MAX}, - {"_PC_NAME_MAX", _PC_NAME_MAX}, - {"_PC_PATH_MAX", _PC_PATH_MAX}, - {"_PC_PIPE_BUF", _PC_PIPE_BUF}, - {"_PC_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED}, - {"_PC_NO_TRUNC", _PC_NO_TRUNC}, - {NULL, 0} -}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - TST_TOTAL=(sizeof(args)/sizeof(args[0]))-1; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for (i=0; i -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="pause01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={EINTR, 0}; -void go(); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - (void) signal(SIGALRM, go); - alarm(1); - /* - * Call pause(2) - */ - TEST(pause()); - - /* check return code. Pause returns -1 and EINTR errno */ - if (TEST_RETURN != -1) { - tst_resm(TFAIL, - "pause() returned WITHOUT an error return code : %d", - TEST_ERRNO); - } else { - /* log the errno */ - TEST_ERROR_LOG(TEST_ERRNO); - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* check the errno */ - if (TEST_ERRNO == EINTR) - tst_resm(TPASS, "pause() returned %d", TEST_RETURN); - else - tst_resm(TFAIL, "pause() returned %d. Expected %d (EINTR)", - TEST_RETURN, EINTR); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -/* routine to catch the alarm signal */ -void -go() -{ -} diff --git a/winsup/testsuite/winsup.api/ltp/pipe01.c b/winsup/testsuite/winsup.api/ltp/pipe01.c deleted file mode 100644 index cc01cc988..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe01.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * pipe01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of the pipe(2) syscall: - * Check that both ends of the pipe (both file descriptors) are - * available to a process opening the pipe. - * - * ALGORITHM - * Write a string of characters down a pipe; read the string from the - * other file descriptor. Test passes if both can be done, as reported - * by the number of characters written and read. - * - * USAGE: - * pipe01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * RESTRICITONS - * NONE - */ -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "pipe01"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int fildes[2]; /* fds for pipe read and write */ - char wrbuf[BUFSIZ], rebuf[BUFSIZ]; - int red, written; /* no. of chars read/written to pipe */ - int greater, length; - char *strcpy(); - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(pipe(fildes)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "pipe() failed unexpectedly - errno %d", - TEST_ERRNO); - continue; - } - - if (STD_FUNCTIONAL_TEST) { - - strcpy(wrbuf, "abcdefghijklmnopqrstuvwxyz"); - length = strlen(wrbuf); - - if ((written = write(fildes[1], wrbuf, length)) == -1) { - tst_brkm(TBROK, cleanup, "write() failed"); - } - - if ((written < 0) || (written > 26)) { - tst_resm(TFAIL, "Condition #1 test failed"); - continue; - } - - if ((red = read(fildes[0], rebuf, written)) == -1) { - tst_brkm(TBROK, cleanup, "read() failed"); - } - - if ((red < 0) || (red > written)) { - tst_resm(TFAIL, "Condition #2 test failed"); - continue; - } - - /* are the strings written and read equal */ - if ((greater = memcmp(rebuf, wrbuf, red)) != 0) { - tst_resm(TFAIL, "Condition #3 test failed"); - continue; - } - tst_resm(TPASS, "pipe() functionality is correct"); - } else { - tst_resm(TPASS, "call succeeded"); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/pipe08.c b/winsup/testsuite/winsup.api/ltp/pipe08.c deleted file mode 100644 index 70d61dab8..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe08.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * pipe08.c - * - * DESCRIPTION - * Check that a SIGPIPE signal is generated when a write is - * attempted on an empty pipe. - * - * ALGORITHM - * 1. Write to a pipe after closing the read side. - * 2. Check for the signal SIGPIPE to be received. - * - * USAGE: - * pipe08 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * USAGE - * pipe08 - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "pipe08"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); -void sighandler(int); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int pipefd[2]; /* fds for pipe read/write */ - char wrbuf[BUFSIZ]; - int written, length; - int close_stat; /* exit status of close(read fd) */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - if (!STD_FUNCTIONAL_TEST) { - tst_resm(TWARN, "-f option should not be used"); - } - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(pipe(pipefd)); - - if (TEST_RETURN != 0) { - tst_resm(TFAIL, "call failed unexpectedly"); - continue; - } - - if ((close_stat = close(pipefd[0])) == -1) { - tst_brkm(TBROK, cleanup, "close of read side failed"); - } - - strcpy(wrbuf, "abcdefghijklmnopqrstuvwxyz\0"); - length = strlen(wrbuf); - - /* - * the SIGPIPE signal will be caught here or else - * the program will dump core when the signal is - * sent - */ - written = write(pipefd[1], wrbuf, length); - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * sighandler - catch signals and look for SIGPIPE - */ -void -sighandler(int sig) -{ - if (sig != SIGPIPE) { - tst_resm(TFAIL, "expected SIGPIPE, got %d", sig); - } else { - tst_resm(TPASS, "got expected SIGPIPE signal"); - } -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, sighandler, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/pipe09.c b/winsup/testsuite/winsup.api/ltp/pipe09.c deleted file mode 100644 index eb21bb601..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe09.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * pipe09.c - * - * DESCRIPTION - * Check that two processes can use the same pipe at the same time. - * - * ALGORITHM - * 1. Open a pipe - * 2. Fork a child which writes to the pipe - * 3. Fork another child which writes a different character to the pipe - * 4. Have the parent read from the pipe - * 5. It should get the characters from both children. - * - * USAGE: - * pipe09 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ -#include -#include -#include -#include "test.h" -#include "usctest.h" - -#define PIPEWRTCNT 100 /* must be an even number */ - -const char *TCID = "pipe09"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int i, red, wtstatus; - int pipefd[2]; /* fds for pipe read/write */ - char rebuf[BUFSIZ]; - int Acnt = 0, Bcnt = 0; /* count 'A' and 'B' */ - int fork_1, fork_2; /* ret values in parent */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(pipe(pipefd)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "pipe() call failed"); - continue; - } - - if (!STD_FUNCTIONAL_TEST) { - tst_resm(TWARN, "-f option should not be used"); - tst_resm(TPASS, "call succeeded"); - continue; - } - - if ((fork_1 = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() #1 failed"); - /*NOTREACHED*/ - } - - if (fork_1 == 0) { /* 1st child */ - if (close(pipefd[0]) != 0) { - tst_resm(TWARN, "pipefd[0] close failed, " - "errno = %d", errno); - exit(1); - } - - for (i = 0; i < PIPEWRTCNT / 2; ++i) { - if (write(pipefd[1], "A", 1) != 1) { - tst_resm(TWARN, "write to pipe failed"); - exit(1); - } - } - exit(0); - } - - /* parent */ - - waitpid(fork_1, &wtstatus, 0); - if (WEXITSTATUS(wtstatus) != 0) { - tst_brkm(TBROK, cleanup, "problem detected in child, " - "wait status %d, errno = %d", wtstatus, errno); - } - - if ((fork_2 = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() #2 failed"); - /*NOTREACHED*/ - } - - if (fork_2 == 0) { /* 2nd child */ - if (close(pipefd[0]) != 0) { - tst_resm(TWARN, "pipefd[0] close " - "failed, errno = %d", errno); - exit(1); - } - - for (i = 0; i < PIPEWRTCNT / 2; ++i) { - if (write(pipefd[1], "B", 1) != 1) { - tst_resm(TWARN, "write to pipe failed"); - exit(1); - } - } - exit(0); - } - - /* parent */ - - waitpid(fork_2, &wtstatus, 0); - if (WEXITSTATUS(wtstatus) != 0) { - tst_brkm(TBROK, cleanup, "problem detected in child, " - "wait status %d, errno = %d", wtstatus, errno); - } - - if (close(pipefd[1]) != 0) { - tst_brkm(TBROK, cleanup, "pipefd[1] close failed, " - "errno = %d", errno); - /*NOTREACHED*/ - } - - while ((red = read(pipefd[0], rebuf, 100)) > 0) { - for (i = 0; i < red; i++) { - if (rebuf[i] == 'A') { - Acnt++; - continue; - } - if (rebuf[i] == 'B') { - Bcnt++; - continue; - } - tst_resm(TFAIL, "got bogus '%c' character", - rebuf[i]); - break; - } - } - - if (red == -1) { - tst_brkm(TBROK, cleanup, "Failure reading pipefd pipe, " - "errno = %d", errno); - } - - if (Bcnt == Acnt && Bcnt == (PIPEWRTCNT / 2)) { - tst_resm(TPASS, "functionality appears to be correct"); - } else { - tst_resm(TFAIL, "functionality is not correct - Acnt " - "= %d, Bcnt = %d", Acnt, Bcnt); - } - - /* clean up things in case we are looping */ - Acnt = Bcnt = 0; - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/pipe10.c b/winsup/testsuite/winsup.api/ltp/pipe10.c deleted file mode 100644 index 52ac5d94e..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe10.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * pipe10.c - * - * DESCRIPTION - * Check that parent can open a pipe and have a child read from it - * - * ALGORITHM - * Parent opens pipe, child reads. Passes if child can read all the - * characters written by the parent. - * - * USAGE: - * pipe10 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ -#include -#include -#include -#include - -const char *TCID = "pipe10"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int fd[2]; /* fds for pipe read/write */ - char wrbuf[BUFSIZ], rebuf[BUFSIZ]; - int red, written; /* no of chars read and */ - /* written to pipe */ - int length, greater, forkstat; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(pipe(fd)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "pipe creation failed"); - continue; - } - - if (!STD_FUNCTIONAL_TEST) { - tst_resm(TPASS, "call succeeded"); - continue; - } - - strcpy(wrbuf, "abcdefghijklmnopqrstuvwxyz\0"); - length = strlen(wrbuf); - - written = write(fd[1], wrbuf, length); - - /* did write write at least some chars */ - if ((written < 0) || (written > length)) { - tst_brkm(TBROK, cleanup, "write to pipe failed"); - } - - forkstat = fork(); - - if (forkstat == -1) { - tst_brkm(TBROK, cleanup, "fork() failed"); - /*NOTREACHED*/ - } - - if (forkstat == 0) { /* child */ - red = read(fd[0], rebuf, written); - - /* did read , get at least some chars */ - if ((red < 0) || (red > written)) { - tst_brkm(TBROK, cleanup, "read pipe failed"); - } - - greater = memcmp(rebuf, wrbuf, red); - - /* are the strings written and read equal */ - if (greater == 0) { - tst_resm(TPASS, "functionality is correct"); - } else { - tst_resm(TFAIL, "read & write strings do " - "not match"); - } - } else { /* parent */ - /* let the child carry on */ - exit(0); - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/pipe11.c b/winsup/testsuite/winsup.api/ltp/pipe11.c deleted file mode 100644 index 558e70a96..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe11.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * pipe11.c - * - * DESCRIPTION - * Check if many children can read what is written to a pipe by the - * parent. - * - * ALGORITHM - * 1. Open a pipe and write to it - * 2. Fork a large number of children - * 3. Have the children read the pipe and check how many characters - * each got - * - * USAGE: - * pipe11 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ -#include -#include -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "pipe11"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -#define NUMCHILD 50 -#define NCPERCHILD 50 -char rawchars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; -int kidid; -int numchild; /* no of children to fork */ -int ncperchild; /* no of chars child should read */ -int szcharbuf; /* size of char buf */ -int pipewrcnt; /* chars written to pipe */ -char *wrbuf, *rdbuf; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int fd[2]; /* fds for pipe read/write */ - int i; - int fork_ret, status; - int nread, written; /* no of chars read and written */ - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(pipe(fd)); - - if (TEST_RETURN != 0) { - tst_resm(TFAIL, "pipe creation failed"); - continue; - } - - if (!STD_FUNCTIONAL_TEST) { - tst_resm(TPASS, "call succeeded"); - continue; - } - - written = write(fd[1], wrbuf, szcharbuf); - if (written != szcharbuf) { - tst_brkm(TBROK, cleanup, "write to pipe failed"); - } - -refork: - ++kidid; - fork_ret = fork(); - - if (fork_ret < 0) { - tst_brkm(TBROK, cleanup, "fork() failed"); - /*NOTREACHED*/ - } - - if ((fork_ret != 0) && (fork_ret != -1) && (kidid < numchild)) { - goto refork; - } - - if (fork_ret == 0) { /* child */ - if (close(fd[1])) { - tst_resm(TINFO, "child %d " "could not close " - "pipe", kidid); - exit(0); - } - nread = read(fd[0], rdbuf, ncperchild); - if (nread == ncperchild) { - tst_resm(TINFO, "child %d " "got %d chars", - kidid, nread); - exit(0); - } else { - tst_resm(TFAIL, "child %d did not receive " - "expected no of characters, got %d " - "characters", kidid, nread); - exit(1); - } - } - - /* parent */ - sleep(5); - tst_resm(TINFO, "There are %d children to wait for", kidid); - for (i = 1; i <= kidid; ++i) { - wait(&status); - if (status == 0) { - tst_resm(TPASS, "child %d exitted successfully", - i); - } else { - tst_resm(TFAIL, "child %d exitted with bad " - "status", i); - } - } - } - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - int i, j; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - numchild = NUMCHILD; - ncperchild = NCPERCHILD; - - kidid = 0; - - /* allocate read and write buffers */ - szcharbuf = numchild * ncperchild; - - /* make sure pipe write doesn't block */ - if (szcharbuf == PIPE_BUF) { - /* adjust number of characters per child */ - ncperchild = szcharbuf / numchild; - } - - if ((wrbuf = (char *)malloc(szcharbuf)) == (char *)0) { - tst_brkm(TBROK, cleanup, "malloc failed"); - /*NOTREACHED*/ - } - - if ((rdbuf = (char *)malloc(szcharbuf)) == (char *)0) { - tst_brkm(TBROK, cleanup, "malloc of rdbuf failed"); - /*NOTREACHED*/ - } - - /* initialize wrbuf */ - j = 0; - for (i = 0; i < szcharbuf; ) { - wrbuf[i++] = rawchars[j++]; - if (j >= (int)sizeof(rawchars)) { - j = 0; - } - } -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/poll01.c b/winsup/testsuite/winsup.api/ltp/poll01.c deleted file mode 100644 index 704b738a2..000000000 --- a/winsup/testsuite/winsup.api/ltp/poll01.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: poll01 - * - * Test Description: - * Verify that valid open file descriptor must be provided to poll() to - * succeed. - * - * Expected Result: - * poll should return the correct values when an valid file descriptor is - * provided. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * - * Usage: - * poll01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * None. - */ -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define BUF_SIZE 512 - -const char *TCID="poll01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int fildes[2]; /* file descriptors of the pipe. */ -struct pollfd fds[1]; /* struct. for poll() */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t cpid; /* child process id */ - char write_buf[] = "Testing\0"; /* buffer string for write */ - char read_buf[BUF_SIZE]; /* buffer for read-end of pipe */ - int status; /* exit status of child process */ - int rval; - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call poll() with the TEST macro. - */ - TEST(poll(fds, 1, -1)); - - /* check return code of poll() */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "poll() failed on write, errno=%d" - " : %s", TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - - /* write the message to the pipe */ - if (write(fildes[1], write_buf, strlen(write_buf)) - < (int)strlen(write_buf)) { - tst_brkm(TBROK, cleanup, "write() failed on write " - "to pipe, error:%d", errno); - } - - /* Fork child process */ - if ((cpid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - - if (cpid == 0) { /* Child process */ - /* - * close writing end of pipe and read from - * the pipe - */ - if (close(fildes[1]) == -1) { - tst_brkm(TFAIL, NULL, "close() failed on write " - "endof pipe, errno:%d", errno); - exit(1); - } - - /* - * Set poll() data structures to check - * if data is present on read - */ - fds[0].fd = fildes[0]; - fds[0].events = POLLIN; - - /* - * If data are present, then read the data. If poll() - * and read() return expected values, then the - * functionality of poll() is correct. - */ - rval = (poll(fds, 1, -1)); - - if (rval == -1) { - tst_resm(TFAIL, "poll() failed on read - " - "errno=%d : %s", - TEST_ERRNO, strerror(errno)); - exit(1); - } - - /* Read data from read end of pipe */ - if (read(fildes[0], read_buf, sizeof(read_buf)) != - (int)strlen(write_buf)) { - tst_brkm(TFAIL, NULL, "read() failed - " - "error:%d", errno); - exit(1); - } - - /* Now, do the actual comparision */ - if (memcmp(read_buf, write_buf, strlen(write_buf))) { - tst_resm(TFAIL, "Data from reading pipe " - "are different"); - exit(1); - } - - /* Everything is fine, exit normally */ - exit(0); - } else { /* Parent process */ - /* Wait for child to complete execution */ - wait(&status); - - if (WEXITSTATUS(status) == 1) { - tst_resm(TFAIL, "child exited abnormally"); - } else { - tst_resm(TPASS, - "Functionality of poll() successful"); - } - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * Creat read/write pipe using pipe(). - * Set poll data structures to check writing to the pipe. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Creat read/write pipe */ - if (pipe(fildes) < 0) { - tst_brkm(TBROK, tst_exit, - "pipe() failed to create interprocess channel"); - } - - /* Set poll data structures */ - fds[0].fd = fildes[1]; - fds[0].events = POLLOUT; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * close read end of pipe if still open. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close read end of pipe if still open */ - if (close(fildes[0]) < 0) { - tst_brkm(TFAIL, NULL, "close() failed on read-end of pipe, " - "errno:%d", errno); - } - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/read01.c b/winsup/testsuite/winsup.api/ltp/read01.c deleted file mode 100644 index 332b939a7..000000000 --- a/winsup/testsuite/winsup.api/ltp/read01.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : read01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for read(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) read(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the read(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * read(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -/* - * Set READ_BLOCK_SIZE to the block size of the system. - */ -#ifdef linux -#define READ_BLOCK_SIZE DEV_BSIZE -#else -#ifdef __CYGWIN__ -#define READ_BLOCK_SIZE S_BLKSIZE -#else -#define READ_BLOCK_SIZE BSIZE -#endif -#endif - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="read01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; -char fname[255]; -int fd, i; -int offset=0; -char *s; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - if (write(fd, s, READ_BLOCK_SIZE) == -1) { - tst_brkm(TBROK, cleanup, - "write(%s, %s, %d) Failed, errno=%d : %s", - fname, s, READ_BLOCK_SIZE, errno, strerror(errno)); - } - offset+=READ_BLOCK_SIZE; - if (lseek(fd, (long)(offset-READ_BLOCK_SIZE), 0) == -1) { - tst_brkm(TBROK, cleanup, - "lseek(%s, %ld, 0) Failed, errno=%d : %s", - fname, (long)(offset-READ_BLOCK_SIZE), errno, strerror(errno)); - } - /* - * Call read(2) - */ - TEST(read(fd, s, READ_BLOCK_SIZE)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "read(fd, s, READ_BLOCK_SIZE) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "read(pfds) returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - if ((s = malloc(READ_BLOCK_SIZE)) == NULL) { - tst_brkm(TBROK, cleanup, - "malloc(%d) Failed, errno=%d : %s", - READ_BLOCK_SIZE, errno, strerror(errno)); - } - (void) memset(s, '*', READ_BLOCK_SIZE); - for (i=0; i < READ_BLOCK_SIZE; i++) { - if ( s[i] != '*' ) { - tst_brkm(TBROK, cleanup, - "File Data pattern not setup correctly : expected * at s[%d] : found %c", - i, s[i]); - } - } - sprintf(fname,"./tfile_%d",getpid()); - if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (close(fd) == -1 ) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/read04.c b/winsup/testsuite/winsup.api/ltp/read04.c deleted file mode 100644 index c976cd6a4..000000000 --- a/winsup/testsuite/winsup.api/ltp/read04.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * read01.c - * - * DESCRIPTION - * Testcase to check if read returns the number of bytes read correctly. - * - * ALGORITHM - * Create a file and write some bytes out to it. - * Attempt to read more than written. - * Check the return count, and the read buffer. The read buffer should be - * same as the write buffer. - * - * USAGE: - * read01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None - */ -#include -#include -#include "test.h" -#include "usctest.h" - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID = "read01"; -int TST_TOTAL = 1; -extern int Tst_count; - -#define TST_SIZE 26 /* could also do strlen(palfa) */ -char fname[255]; -char palfa[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; -int fild; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int rfild; - char prbuf[BUFSIZ]; - - /* - * parse standard options - */ - if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup for test */ - - /* check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - Tst_count = 0; /* reset Tst_count while looping */ - - if ((rfild = open(fname, O_RDONLY)) == -1) { - tst_brkm(TBROK, cleanup, "can't open for reading"); - /*NOTREACHED*/ - } - TEST(read(rfild, prbuf, BUFSIZ)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "call failed unexpectedly"); - continue; - } - - if (STD_FUNCTIONAL_TEST) { - if (TEST_RETURN != TST_SIZE) { - tst_resm(TFAIL, "Bad read count - got %d - " - "expected %d", TEST_RETURN, TST_SIZE); - continue; - } - if (memcmp(palfa, prbuf, TST_SIZE) != 0) { - tst_resm(TFAIL, "read buffer not equal " - "to write buffer"); - continue; - } - tst_resm(TPASS, "functionality of read() is correct"); - } else { - tst_resm(TPASS, "call succeeded"); - } - if (close(rfild) == -1) { - tst_brkm(TBROK, cleanup, "close() failed"); - /*NOTREACHED*/ - } - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - sprintf(fname,"tfile_%d",getpid()); - - if ((fild = creat(fname, 0777)) == -1) { - tst_brkm(TBROK, cleanup, "creat(%s, 0777) Failed, errno = %d" - " : %s", fname, errno, strerror(errno)); - /*NOTREACHED*/ - } - if (write(fild, palfa, TST_SIZE) != TST_SIZE) { - tst_brkm(TBROK, cleanup, "can't write to Xread"); - /*NOTREACHED*/ - } - close (fild); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at completion or - * premature exit. - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - unlink(fname); - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/readdir01.c b/winsup/testsuite/winsup.api/ltp/readdir01.c deleted file mode 100644 index c77e90680..000000000 --- a/winsup/testsuite/winsup.api/ltp/readdir01.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : readdir01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : write multiple files and try to find them with readdir - * - * TEST CASE TOTAL : - * - * WALL CLOCK TIME : - * - * CPU TYPES : ALL - * - * AUTHOR : Nate Straz - * - * CO-PILOT : - * - * DATE STARTED : 02/16/2001 - * - * INITIAL RELEASE : Linux 2.4.x - * - * TEST CASES - * - * 1.) Create n files and check that readdir() finds n files - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the readdir(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * readdir(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include - /* test.h and usctest.h are the two header files that are required by the - * quickhit package. They contain function and macro declarations which you - * can use in your test programs - */ -#include "test.h" -#include "usctest.h" - - /* The setup and cleanup functions are basic parts of a test case. These - * steps are usually put in separate functions for clarity. The help function - * is only needed when you are adding new command line options. - */ -void setup(); -void help(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="readdir01"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -extern int Tst_nobuf; - -int exp_enos[]={0, 0}; - -#define BASENAME "readdirfile" - -char Basename[255]; -char Fname[255]; -int Nfiles=0; - -/* To add command line options you need to declare a structure to pass to - * parse_opts(). options is the structure used in this example. The format is - * the string that should be added to optstring in getopt(3), an integer that - * will be used as a flag if the option is given, and a pointer to a string that - * should receive the optarg parameter from getopt(3). Here we add a -N - * option. Long options are not supported at this time. - */ -char *Nfilearg; -int Nflag=0; - -/* for test specific parse_opts options */ -option_t options[] = { - { "N:", &Nflag, &Nfilearg }, /* -N #files */ - { NULL, NULL, NULL } -}; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int cnt; - int nfiles, fd; - char fname[255]; - DIR *test_dir; - struct dirent *dptr; - - Tst_nobuf=1; - - /*************************************************************** - * parse standard options - ***************************************************************/ - /* start off by parsing the command line options. We provide a function - * that understands many common options to control looping. If you are not - * adding any new options, pass NULL in place of options and &help. - */ - if ( (msg=parse_opts(ac, av, options, &help)) ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - if ( Nflag ) { - if (sscanf(Nfilearg, "%i", &Nfiles) != 1 ) { - tst_brkm(TBROK, NULL, "--N option arg is not a number"); - tst_exit(); - } - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - /* Next you should run a setup routine to make sure your environment is - * sane. - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state - ***************************************************************/ - /* TEST_LOOPING() is a macro that will make sure the test continues - * looping according to the standard command line args. - */ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - if ( Nfiles ) - nfiles = Nfiles; - else - /* min of 10 links and max of a 100 links */ - nfiles = (lc%90)+10; - - /* create a bunch of files to look at */ - for(cnt=0; cnt < nfiles; cnt++) { - - sprintf(fname, "%s%d", Basename, cnt); - if ((fd = open(fname, O_RDWR|O_CREAT, 0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (write(fd, "hello\n", 6) < 0) { - tst_brkm(TBROK, cleanup, - "write(%s, \"hello\\n\", 6) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } else if (close(fd) < 0) { - tst_res(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - } - - if ((test_dir = opendir(".")) == NULL) { - tst_resm(TFAIL, "opendir(\".\") Failed, errno=%d : %s", - errno, strerror(errno)); - } else { - /* count the entries we find to see if any are missing */ - cnt = 0; - errno = 0; - while ( (dptr = readdir(test_dir)) ) { - if (strcmp(dptr->d_name, ".") && strcmp(dptr->d_name, "..")) - cnt++; - } - - if (errno != 0) { - tst_resm(TFAIL, "readir(test_dir) Failed on try %d, errno=%d : %s", - cnt, errno, strerror(errno)); - } - if (cnt == nfiles) { - tst_resm(TPASS, "found all %d that were created", nfiles); - } else if (cnt > nfiles) { - tst_resm(TFAIL, "found more files than were created"); - tst_resm(TINFO, "created: %d, found: %d", nfiles, cnt); - } else { - tst_resm(TFAIL, "found less files than were created"); - tst_resm(TINFO, "created: %d, found: %d", nfiles, cnt); - } - } - - /* Here we clean up after the test case so we can do another iteration. - */ - for(cnt=0; cnt < nfiles; cnt++) { - - sprintf(fname, "%s%d", Basename, cnt); - - if (unlink(fname) == -1) { - tst_res(TWARN, "unlink(%s) Failed, errno=%d : %s", - Fname, errno, strerror(errno)); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * help - ***************************************************************/ -/* The custom help() function is really simple. Just write your help message to - * standard out. Your help function will be called after the standard options - * have been printed - */ -void -help() -{ - printf(" -N #files : create #files files every iteration\n"); -} - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* You will want to enable some signal handling so you can capture - * unexpected signals like SIGSEGV. - */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - /* One cavet that hasn't been fixed yet. TEST_PAUSE contains the code to - * fork the test with the -c option. You want to make sure you do this - * before you create your temporary directory. - */ - TEST_PAUSE; - - /* If you are doing any file work, you should use a temporary directory. We - * provide tst_tmpdir() which will create a uniquely named temporary - * directory and cd into it. You can now create files in the current - * directory without worrying. - */ - tst_tmpdir(); - - sprintf(Basename, "%s_%d.", BASENAME, getpid()); -} - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* If you use a temporary directory, you need to be sure you remove it. Use - * tst_rmdir() to do it automatically. - */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/readlink01.c b/winsup/testsuite/winsup.api/ltp/readlink01.c deleted file mode 100644 index 744fff02a..000000000 --- a/winsup/testsuite/winsup.api/ltp/readlink01.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name : readlink01 - * - * Test Description : - * Verify that, readlink will succeed to read the contents of the symbolic - * link created the process. - * - * Expected Result: - * readlink() should return the contents of symbolic link path in the buffer - * on success. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * readlink01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be run by 'non-super-user' only. - * - */ -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" -#define SYMFILE "slink_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define MAX_SIZE 256 - -const char *TCID="readlink01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_val; /* strlen of testfile */ - -void setup(); /* Setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - char buffer[MAX_SIZE]; /* temporary buffer to hold symlink contents*/ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call readlink(2) to read the contents of - * symlink into a buffer. - */ - TEST(readlink(SYMFILE, buffer, sizeof(buffer))); - - /* Check return code of readlink(2) */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "readlink() on %s failed, errno=%d : %s" - , SYMFILE, TEST_ERRNO, strerror(TEST_ERRNO)); - continue; - } - - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Compare the return value of readlink() - * with the expected value which is the - * strlen() of testfile. - */ - if (TEST_RETURN == exp_val) { - /* Check for the contents of buffer */ - if (memcmp(buffer, TESTFILE, exp_val) != 0) { - tst_resm(TFAIL, "Pathname %s and buffer" - " contents %s differ", - TESTFILE, buffer); - } else { - tst_resm(TPASS, "readlink() " - "functionality on '%s' is " - "correct", SYMFILE); - } - } else { - tst_resm(TFAIL, "readlink() return value %d " - "does't match, Expected %d", - TEST_RETURN, exp_val); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and close it - * Create a symbolic link of testfile. - */ -void -setup() -{ - int fd; /* file handle for testfile */ - - /* make sure test is not being run as root */ - if (0 == geteuid()) { - tst_brkm(TBROK, tst_exit, "Must not run test as root"); - } - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - } - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Create a symlink of testfile under temporary directory */ - if (symlink(TESTFILE, SYMFILE) < 0) { - tst_brkm(TBROK, cleanup, - "symlink(%s, %s) failed, errno=%d : %s", - TESTFILE, SYMFILE, errno, strerror(errno)); - } - - /* Get the strlen of testfile */ - exp_val = strlen(TESTFILE); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/readlink02.c b/winsup/testsuite/winsup.api/ltp/readlink02.c deleted file mode 100644 index 4ef6ffa11..000000000 --- a/winsup/testsuite/winsup.api/ltp/readlink02.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : readlink02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for readlink(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) readlink(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the readlink(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * readlink(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="readlink02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; -char fname[255], buf[255], symlnk[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call readlink(2) - */ - TEST(readlink(symlnk, buf, 255)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "readlink(%s, buf, 255) Failed, errno=%d : %s", symlnk, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "readlink(%s, buf, 255) returned %d", symlnk, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"./tfile_%d",getpid()); - if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - if (close(fd) == -1 ) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - sprintf(symlnk,"./sl_%d",getpid()); - if (symlink(fname, symlnk) == -1) { - tst_resm(TWARN, "symlnk(%s, %s) Failed, errno=%d : %s", - fname, symlnk, errno, strerror(errno)); - } - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/readlink03.c b/winsup/testsuite/winsup.api/ltp/readlink03.c deleted file mode 100644 index 41cf4bbe9..000000000 --- a/winsup/testsuite/winsup.api/ltp/readlink03.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name : readlink03 - * - * Test Description : - * Verify that, - * 1) readlink(2) returns -1 and sets errno to EACCES if search/write - * permission is denied in the directory where the symbolic link - * resides. - * 2) readlink(2) returns -1 and sets errno to EINVAL if the buffer size - * is not positive. - * 3) readlink(2) returns -1 and sets errno to EINVAL if the specified - * file is not a symbolic link file. - * 4) readlink(2) returns -1 and sets errno to ENAMETOOLONG if the - * pathname component of symbolic link is too long (ie, > PATH_MAX). - * 5) readlink(2) returns -1 and sets errno to ENOENT if the component of - * symbolic link points to an empty string. - * - * Expected Result: - * readlink() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * readlink03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS: - * This test should be executed by 'non-super-user' only. - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define MODE_RWX S_IRWXU | S_IRWXG | S_IRWXO -#define FILE_MODE S_IRUSR | S_IRGRP | S_IROTH -#define DIR_TEMP "testdir_1" -#define TESTFILE "testfile" -#define TEST_FILE1 "testdir_1/tfile_1" -#define SYM_FILE1 "testdir_1/sfile_1" -#define TEST_FILE2 "tfile_2" -#define SYM_FILE2 "sfile_2" -#define MAX_SIZE 256 - -const char *TCID="readlink03"; /* Test program identifier. */ -int TST_TOTAL=5; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EACCES, EINVAL, ENAMETOOLONG, ENOENT, 0}; - -int no_setup(); -int setup1(); /* setup function to test symlink for EACCES */ -int setup2(); /* setup function to test symlink for EEXIST */ -int lpath_setup(); /* setup function to test chmod for ENAMETOOLONG */ - -char Longpathname[PATH_MAX+2]; - -struct test_case_t { /* test case struct. to hold ref. test cond's*/ - const char *link; - const char *desc; - int exp_errno; - size_t buf_siz; - int (*setupfunc)(); -} Test_cases[] = { -#ifndef __CYGWIN__ - { SYM_FILE1, "No Search permissions to process", EACCES, 1, setup1 }, - { SYM_FILE2, "Buffer size is not positive", EINVAL, -1, setup2 }, - { TEST_FILE2, "File is not symbolic link", EINVAL, 1, no_setup }, -#else - { TEST_FILE2, "File is not symbolic link", EINVAL, 1, setup2 }, -#endif - { Longpathname, "Symlink path too long", ENAMETOOLONG, 1, lpath_setup }, - { "", "Symlink Pathname is empty", ENOENT, 1, no_setup }, - { NULL, NULL, 0, 0, no_setup } -}; - -extern void setup(); /* Setup function for the test */ -void cleanup() __attribute__((noreturn));/* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - char buffer[MAX_SIZE]; /* temporary buffer to hold symlink contents*/ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *sym_file; /* symbolic link file name */ - const char *test_desc; /* test specific error message */ - int i; /* counter to test different test conditions */ - size_t buf_size; /* size of buffer for readlink */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *)NULL, NULL); - if (msg != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* - * Invoke setup function to call individual test setup functions - * to simulate test conditions. - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - for (i = 0; Test_cases[i].desc != NULL; i++) { - sym_file = Test_cases[i].link; - test_desc = Test_cases[i].desc; - buf_size = Test_cases[i].buf_siz; - - if (buf_size == 1) { - buf_size = sizeof(buffer); - } - - /* - * Call readlink(2) to test different test conditions. - * verify that it fails with -1 return value and sets - * appropriate errno. - */ - TEST(readlink(sym_file, buffer, buf_size)); - - /* Check return code of readlink(2) */ - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "readlink() returned %d, " - "expected -1, errno:%d", TEST_RETURN, - Test_cases[i].exp_errno); - continue; - } - - TEST_ERROR_LOG(TEST_ERRNO); - - if (TEST_ERRNO == Test_cases[i].exp_errno) { - tst_resm(TPASS, "readlink(), %s, returned " - "errno %d", test_desc, TEST_ERRNO); - tst_resm(TPASS, "readlink(), %s, returned " - "errno %d", test_desc, TEST_ERRNO); - } else { - tst_resm(TFAIL, "readlink() failed, %s, " - "errno=%d, expected errno=%d", - test_desc, TEST_ERRNO, - Test_cases[i].exp_errno); - } - } /* End of TEST CASE LOOPING. */ - } /* End for TEST_LOOPING */ - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - - /*NOTREACHED*/ -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - * - * Create a temporary directory and change directory to it. - * Call test specific setup functions. - */ -void -setup() -{ - int i; - - /* make sure test is not being run as root */ - if (0 == geteuid()) { - tst_brkm(TBROK, tst_exit, "Must not run test as root"); - } - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* call individual setup functions */ - for (i = 0; Test_cases[i].desc != NULL; i++) { - Test_cases[i].setupfunc(); - } -} - -/* - * no_setup() - Some test conditions for readlink(2) do not any setup. - */ -int -no_setup() -{ - return 0; -} - -/* - * setup1() - setup function for a test condition for which readlink(2) - * returns -1 and sets errno to EACCES. - * - * Create a test directory under temporary directory and create a test file - * under this directory with mode "0666" permissions. - * Create a symlink of testfile under test directory. - * Modify the mode permissions on test directory such that process will not - * have search permissions on test directory. - */ -int -setup1() -{ - int fd; /* file handle for testfile */ - - if (mkdir(DIR_TEMP, MODE_RWX) < 0) { - tst_brkm(TBROK, cleanup, "mkdir(2) of %s failed", DIR_TEMP); - } - - if ((fd = open(TEST_FILE1, O_RDWR|O_CREAT, 0666)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0666) failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - } - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - } - - /* Creat a symbolic link of testfile under test directory */ - if (symlink(TEST_FILE1, SYM_FILE1) < 0) { - tst_brkm(TBROK, cleanup, "symlink of %s failed", TEST_FILE1); - } - - /* Modify mode permissions on test directory */ - if (chmod(DIR_TEMP, FILE_MODE) < 0) { - tst_brkm(TBROK, cleanup, "chmod(2) of %s failed", DIR_TEMP); - } - return 0; -} - -/* - * setup2() - setup function for a test condition for which readlink(2) - * returns -1 and sets errno to EINVAL. - * - * Create a testfile under temporary directory and create a symlink - * file of it. - */ -int -setup2() -{ - int fd; /* file handle for testfile */ - - /* Creat a testfile and close it */ - if ((fd = open(TEST_FILE2, O_RDWR|O_CREAT, 0666)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0666) failed, errno=%d : %s", - TEST_FILE2, errno, strerror(errno)); - } - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(%s) failed, errno=%d : %s", - TEST_FILE2, errno, strerror(errno)); - } - - /* Creat a symlink of testfile created above */ - if (symlink(TEST_FILE2, SYM_FILE2) < 0) { - tst_brkm(TBROK, cleanup, "symlink() failed to create %s in " - "setup2, error=%d", SYM_FILE2, errno); - } - return 0; -} - -/* - * lpath_setup() - setup to create a node with a name length exceeding - * the MAX. length of PATH_MAX. - */ -int -lpath_setup() -{ - int i; /* counter variable */ - - for (i = 0; i <= (PATH_MAX + 1); i++) { - Longpathname[i] = 'a'; - } - return 0; -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * - * Restore the mode permissions on test directory. - * Remove the temporary directory created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Restore mode permissions on test directory created in setup2() */ - if (chmod(DIR_TEMP, MODE_RWX) < 0) { - tst_brkm(TBROK, NULL, "chmod(2) of %s failed", DIR_TEMP); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/rename01.c b/winsup/testsuite/winsup.api/ltp/rename01.c deleted file mode 100644 index 14ae1f245..000000000 --- a/winsup/testsuite/winsup.api/ltp/rename01.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * rename01 - * - * DESCRIPTION - * This test will verify the rename(2) syscall basic functionality. - * Verify rename() works when the "new" file or directory does not exist. - * - * ALGORITHM - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * 1. "old" is plain file, new does not exists - * create the "old" file, make sure the "new" file - * dose not exist - * rename the "old" to the "new" file - * verify the "new" file points to the "old" file - * verify the "old" file does not exist - * - * 2. "old" is a directory,"new" does not exists - * create the "old" directory, make sure "new" - * dose not exist - * rename the "old" to the "new" - * verify the "new" points to the "old" - * verify the "old" does not exist - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * USAGE - * rename01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None. - */ -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -extern void do_file_setup(char *); - -const char *TCID="rename01"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char fname[255], mname[255]; -char fdir[255], mdir[255]; -struct stat buf1; -dev_t f_olddev, d_olddev; -ino_t f_oldino, d_oldino; - -struct test_case_t { - const char *name1; - const char *name2; - const char *desc; - dev_t *olddev; - ino_t *oldino; -} TC[] = { - /* comment goes here */ - {fname, mname, "file", &f_olddev, &f_oldino}, - - /* comment goes here */ - {fdir, mdir, "directory", &d_olddev, &d_oldino} -}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int i; - - /* - * parse standard options - */ - if ((msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* - * perform global setup for test - */ - setup(); - - /* - * check looping state if -i option given - */ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* loop through the test cases */ - for (i=0; i -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); -void do_file_setup(); - - - -const char *TCID="rename02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; -int fd; -char fname[255], mname[255]; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call rename(2) - */ - TEST(rename(fname, mname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "rename(%s, %s) Failed, errno=%d : %s", fname, mname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "rename(%s, %s) returned %d", fname, mname, TEST_RETURN); - } - if (unlink(mname) == -1) { - tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s", mname, errno, strerror(errno)); - } - do_file_setup(); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"./tfile_%d",getpid()); - sprintf(mname,"./rnfile_%d",getpid()); - do_file_setup(); - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - -void -do_file_setup() -{ - if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - if (close(fd) == -1 ) - tst_resm(TWARN, "close(%s) Failed on file create, errno=%d : %s", - fname, errno, strerror(errno)); - -} diff --git a/winsup/testsuite/winsup.api/ltp/rename08.c b/winsup/testsuite/winsup.api/ltp/rename08.c deleted file mode 100644 index 0788ddc98..000000000 --- a/winsup/testsuite/winsup.api/ltp/rename08.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * rename08 - * - * DESCRIPTION - * This test will verify that rename(2) syscall failed in EFAULT - * - * ALGORITHM - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * Create a valid file to use in the rename() call. - * - * Test: - * Loop if the proper options are given. - * 1. "old" is a valid file, newpath points to address - * outside allocated address space - * rename the "old" to the "new" file - * verify rename() failed with error EFAULT - * - * 2. "old" points to address outside allocated address space - * ,"new" is a valid file - * rename the "old" to the "new" - * verify rename() failed with error EFAULT - * - * 3. oldpath and newpath are all NULL - * try to rename NULL to NULL - * verify rename() failed with error EFAULT - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created.* - * USAGE - * rename08 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None. - */ -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -extern void do_file_setup(char *); - -const char *TCID="rename08"; /* Test program identifier. */ -int TST_TOTAL=3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={EFAULT, 0}; /* List must end with 0 */ - -int fd; -char fname[255]; - -struct test_case_t { - char *fd; - char *fd2; - int error; -} TC[] = { - /* "new" file is invalid - EFAULT */ - {fname, (char *)-1, EFAULT}, - - /* "old" file is invalid - EFAULT */ - {(char *)-1, fname, EFAULT}, - - /* both files are NULL - EFAULT */ - {NULL, NULL, EFAULT} -}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int i; - - /* - * parse standard options - */ - if ((msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* - * perform global setup for test - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* - * check looping state if -i option given - */ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* loop through the test cases */ - for (i = 0; i < TST_TOTAL; i++) { - - TEST(rename(TC[i].fd, TC[i].fd2)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "call succeeded unexpectedly"); - continue; - } - - TEST_ERROR_LOG(TEST_ERRNO); - - if (TEST_ERRNO == TC[i].error) { - tst_resm(TPASS, "expected failure - " - "errno = %d : %s", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "unexpected error - %d : %s - " - "expected %d", TEST_ERRNO, - strerror(TEST_ERRNO), TC[i].error); - } - } - } /* End for TEST_LOOPING */ - - /* - * cleanup and exit - */ - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Create a temporary directory and make it current. */ - tst_tmpdir(); - - sprintf(fname,"./tfile_%d",getpid()); - - do_file_setup(fname); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * Remove the temporary directory. - */ - tst_rmdir(); - - /* - * Exit with return code appropriate for results. - */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/rename10.c b/winsup/testsuite/winsup.api/ltp/rename10.c deleted file mode 100644 index 438ef3725..000000000 --- a/winsup/testsuite/winsup.api/ltp/rename10.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * rename10 - * - * DESCRIPTION - * This test will verify that rename(2) syscall fails with ENAMETOOLONG - * and ENOENT - * - * ALGORITHM - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * create the "old" file - * - * Test: - * Loop if the proper options are given. - * 1. rename the "old" to the "new" file - * verify rename() failed with error ENAMETOOLONG - * - * 2. "new" path contains a directory that does not exist - * rename the "old" to the "new" - * verify rename() failed with error ENOENT - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created.* - * - * USAGE - * rename10 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None. - */ -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -extern void do_file_setup(char *); - -const char *TCID="rename10"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char badmname[] = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyz"; - -int exp_enos[]={ENAMETOOLONG, ENOENT, 0}; /* List must end with 0 */ - -int fd; -char fname[255], mname[255]; -char mdir[255]; - -struct test_case_t { - char *fd1; - char *fd2; - int error; -} TC[] = { - /* badmname is too long for a file name - ENAMETOOLONG */ - {fname, badmname, ENAMETOOLONG}, - - /* mname contains a directory component which does not exist - ENOENT */ - {fname, mname, ENOENT} -}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - int i; - - /* - * parse standard options - */ - if ((msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* - * perform global setup for test - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* - * check looping state if -i option given - */ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* loop through the test cases */ - for (i=0; i < TST_TOTAL; i++) { - - TEST(rename(TC[i].fd1, TC[i].fd2)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "call succeeded unexpectedly"); - continue; - } - - TEST_ERROR_LOG(TEST_ERRNO); - - if (TEST_ERRNO == TC[i].error) { - tst_resm(TPASS, "expected failure - " - "errno = %d : %s", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "unexpected error - %d : %s - " - "expected %d", TEST_ERRNO, - strerror(TEST_ERRNO), TC[i].error); - } - } - } /* End for TEST_LOOPING */ - - /* - * cleanup and exit - */ - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Create a temporary directory and make it current. */ - tst_tmpdir(); - - sprintf(fname,"./tfile_%d",getpid()); - sprintf(mdir,"./rndir_%d",getpid()); - sprintf(mname,"%s/rnfile_%d",mdir,getpid()); - - do_file_setup(fname); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * Remove the temporary directory. - */ - tst_rmdir(); - - /* - * Exit with return code appropriate for results. - */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/rmdir01.c b/winsup/testsuite/winsup.api/ltp/rmdir01.c deleted file mode 100644 index 1d41f1c13..000000000 --- a/winsup/testsuite/winsup.api/ltp/rmdir01.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * rmdir01 - * - * DESCRIPTION - * This test will verify that rmdir(2) syscall basic functionality. - * verify rmdir(2) returns a value of 0 and the directory being - * removed - * - * ALGORITHM - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * make a directory tstdir - * call rmdir(tstdir), check the return value - * verify the directory tstdir does not exists. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created.* - * USAGE - * rmdir01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None. - */ -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup() __attribute__((noreturn)); - -#define PERMS 0777 - -const char *TCID="rmdir01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -char tstdir [100]; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct stat buf; - - /* - * parse standard options - */ - if ((msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL) { - tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); - } - - /* - * perform global setup for test - */ - setup(); - - /* - * check looping state if -i option given - */ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * TEST rmdir() base functionality - */ - - /* Initialize the test directory name */ - - /* create a directory */ - if ( mkdir(tstdir, PERMS) == -1 ) { - tst_brkm(TBROK, cleanup, "mkdir(%s, %#o) Failed", - tstdir, PERMS); - /*NOTREACHED*/ - } - /* call rmdir using TEST macro */ - - TEST(rmdir(tstdir)); - - if (TEST_RETURN == -1 ) { - tst_resm(TFAIL, "rmdir(%s) Failed", tstdir); - continue; - } - - if (STD_FUNCTIONAL_TEST) { - /* check whether tstdir been removed */ - if (stat(tstdir, &buf) != -1) { - tst_resm(TFAIL, "directory %s still exists", - tstdir); - continue; - } else { - tst_resm(TPASS, "directory has been removed"); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - } /* End for TEST_LOOPING */ - - /* - * cleanup and exit - */ - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* Create a temporary directory and make it current. */ - tst_tmpdir(); - - sprintf(tstdir,"./tstdir_%d",getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* - * Remove the temporary directory. - */ - tst_rmdir(); - - /* - * Exit with return code appropriate for results. - */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/rmdir04.c b/winsup/testsuite/winsup.api/ltp/rmdir04.c deleted file mode 100644 index ece6a9ff4..000000000 --- a/winsup/testsuite/winsup.api/ltp/rmdir04.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : rmdir04 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for rmdir(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) rmdir(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the rmdir(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * rmdir(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="rmdir04"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; -char *cwd; -char fname[255]; - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - if (mkdir(fname, 0777) == -1) { - tst_brkm(TBROK, cleanup, - "mkdir(%s) Failure. errno=%d : %s", fname, errno, strerror(errno)); - } - /* - * Call rmdir(2) - */ - TEST(rmdir(fname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "rmdir(%s) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "rmdir(%s) returned %d", fname, TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname, "./dir_%d", getpid()); - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/rmdir05.c b/winsup/testsuite/winsup.api/ltp/rmdir05.c deleted file mode 100644 index ff19b3a81..000000000 --- a/winsup/testsuite/winsup.api/ltp/rmdir05.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : rmdir05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Functionality Tests for rmdir(2) - * - * PARENT DOCUMENT : rmstds02 - * - * TEST CASE TOTAL : 6 - * - * WALL CLOCK TIME : 2 - * - * CPU TYPES : ALL - * - * AUTHOR : Bill Branum - * - * CO-PILOT : Steve Shaw - * - * DATE STARTED : 4/23/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * rmdir(2) test for errno(s) EINVAL, EMLINK, EFAULT - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * DETAILED DESCRIPTION - * Verify that rmdir(2) returns a value of -1 and sets errno - * to indicate the error. - * - * Setup: - * Setup signal handling. - * Create a temporary directory and make it current. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno. - * If doing functional test - * check the errno returned and print result message - * - * Cleanup: - * Print errno log and/or timing stats if options given. - * Remove the temporary directory. - * Exit. - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - -extern char *get_high_address(); - -const char *TCID="rmdir05"; /* Test program identifier. */ -int TST_TOTAL=6; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines. */ -struct stat stat_buf; /* Stat buffer used for verification. */ -char dir_name[256]; /* Array to hold directory name. */ - - -int -main(int argc, char **argv) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(argc, argv, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * TEST CASE: 1 - * path points to the current directory - */ - - /* Call rmdir(2) */ - TEST(rmdir(".")); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_RETURN == -1 ) { -#if defined(sgi) - if (TEST_ERRNO == EINVAL) { -#elif defined(linux) || defined (__CYGWIN__) - if (TEST_ERRNO & (EBUSY | ENOTEMPTY)) { -#endif - - /* For functionality tests, verify that the - * directory wasn't removed. - */ - if (stat(".",&stat_buf) == -1){ - tst_resm(TFAIL,"rmdir(\".\") removed the current working directory when it should have failed."); - } else { - tst_resm(TPASS,"rmdir(\".\") failed to remove the current working directory. Returned %d : %s",TEST_ERRNO,strerror(TEST_ERRNO)); - } - } else { -#if defined(sgi) - tst_resm(TFAIL,"rmdir(\".\") failed with errno %d : %s but expected %d (EINVAL)",TEST_ERRNO,strerror(TEST_ERRNO),EINVAL); -#elif defined(linux) || defined (__CYGWIN__) - tst_resm(TFAIL,"rmdir(\".\") failed with errno %d : %s but expected %d (EBUSY)",TEST_ERRNO,strerror(TEST_ERRNO),EBUSY); -#endif - } - } else { - tst_resm(TFAIL,"rmdir(\".\") succeeded unexpectedly."); - } - } - - - /* - * TEST CASE: 2 - * path points to the "." (dot) entry of a directory - */ -#if defined(linux) || defined (__CYGWIN__) - tst_resm(TCONF, "rmdir on \"dir/.\" supported on Linux"); -#elif defined(sgi) - /* Call rmdir(2) */ - TEST(rmdir("dir1/.")); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EINVAL) { - - /* For functionality tests, verify that the - * directory wasn't removed. - */ - if (stat("dir1/.",&stat_buf) == -1){ - tst_resm(TFAIL,"rmdir(\"dir1/.\") removed the \".\" entry of a directory when it should have failed."); - } else { - tst_resm(TPASS,"rmdir(\"dir1/.\") failed to remove the \".\" entry of a directory. Returned %d : %s",TEST_ERRNO,strerror(TEST_ERRNO)); - } - } else { - tst_resm(TFAIL,"rmdir(\"dir1/.\") failed with errno %d : %s but expected %d (EINVAL)",TEST_ERRNO,strerror(TEST_ERRNO),EINVAL); - } - } else { - tst_resm(TFAIL,"rmdir(\"dir1/.\") - path points to the \".\" entry of a directory succeeded unexpectedly."); - } - } -#endif - -#if defined(sgi) - /* - * TEST CASE: 3 - * the directory has been linked - */ - tst_resm(TCONF, "linked directories not valid on IRIX"); -#elif defined(linux) - tst_resm(TCONF, "linked directories test not implemented on Linux"); -#elif defined(CRAY) - - - /* Call rmdir(2) */ - TEST(rmdir("dir2")); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EMLINK) { - /* For functionality tests, verify that the directory wasn't - * removed. - */ - if (stat("dir2",&stat_buf) == -1){ - tst_resm(TFAIL,"rmdir(\"dir2\") removed a directory with multiple links when it should have failed."); - } else { - tst_resm(TPASS,"rmdir(\"dir2\") failed to remove a directory with multiple links. Returned %d : %s",TEST_ERRNO,strerror(TEST_ERRNO)); - } - } else { - tst_resm(TFAIL,"rmdir(\"dir2\") failed with errno %d : %s but expected %d (EMLINK)",TEST_ERRNO,strerror(TEST_ERRNO),EMLINK); - } - } else { - tst_resm(TFAIL,"rmdir(\"dir2\") - the directory has been linked succeeded unexpectedly."); - } - } -#endif /* linux */ - - - /* - * TEST CASE: 4 - * path argument points below the minimum allocated address space - */ - - - /* Call rmdir(2) */ - TEST(rmdir((char *)-1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS,"rmdir() - path argument points below the minimum allocated address space failed as expected with errno %d : %s",TEST_ERRNO,strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL,"rmdir() - path argument points below the minimum allocated address space failed with errno %d : %s but expected %d (EFAULT)",TEST_ERRNO,strerror(TEST_ERRNO),EFAULT); - } - } else { - tst_resm(TFAIL,"rmdir() - path argument points below the minimum allocated address space succeeded unexpectedly."); - } - } - - /* - * TEST CASE: 5 - * path argument points above the maximum allocated address space - */ - - - /* Call rmdir(2) */ - TEST(rmdir( get_high_address())); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - if ( TEST_RETURN == -1 ) { - if (TEST_ERRNO == EFAULT) { - tst_resm(TPASS,"rmdir() - path argument points above the maximum allocated address space failed as expected with errno %d : %s",TEST_ERRNO,strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL,"rmdir() - path argument points above the maximum allocated address space failed with errno %d : %s but expected %d (EFAULT)",TEST_ERRNO,strerror(TEST_ERRNO),EFAULT); - } - } else { - tst_resm(TFAIL,"rmdir() - path argument points above the maximum allocated address space succeeded unexpectedly."); - } - } - - /* - * TEST CASE: 6 - * able to remove a directory - */ - - /* Create a directory. */ - if (mkdir(dir_name,0777) != 0){ - tst_brkm(TBROK,cleanup,"mkdir(\"%s\") failed with errno %d : %s",dir_name,errno,strerror(errno)); - } - - /* Call rmdir(2) */ - TEST(rmdir(dir_name)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL,"rmdir(\"%s\") failed when it should have passed. Returned %d : %s",dir_name,TEST_ERRNO,strerror(TEST_ERRNO)); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - - /* Verify the directory was removed. */ - if (stat(dir_name,&stat_buf) != 0){ - tst_resm(TPASS,"rmdir(\"%s\") removed the directory as expected.",dir_name); - } else { - tst_resm(TFAIL,"rmdir(\"%s\") returned a zero exit status but failed to remove the directory.",dir_name); - } - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Create a temporary directory and make it current. */ - tst_tmpdir(); - - /* Create a directory. */ - if (mkdir("dir1",0777) == -1){ - tst_brkm(TBROK,cleanup,"mkdir() failed to create dir1."); - } - -#if defined(CRAY) - /* NOTE: linking directories is NOT valid on IRIX */ - - /* Create a directory that has multiple links to it. */ - if (mkdir("dir2",0777) == -1){ - tst_brkm(TBROK,cleanup,"mkdir() failed to create dir2."); - } else { - if (system("runcmd `get_attrib -A link` dir2 mlink_dir > link.out 2>&1") != 0){ - tst_brk(TBROK,"link.out",cleanup,"link failed to link dir2 and mlink_dir."); - } - } - -#endif - - /* Create a unique directory name. */ - sprintf(dir_name,"./dir_%d",getpid()); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - -#if defined(CRAY) - /* NOTE: setup was not done on IRIX */ - /* Unlink the directory. */ - if (system("runcmd `get_attrib -A unlink` dir2 > unlink.out 2>&1") != 0){ - tst_res(TWARN,"unlink.out","unlink failed to unlink dir2."); - } -#endif - - /* - * Remove the temporary directory. - */ - tst_rmdir(); - - /* - * Exit with a return value appropriate for the results. - */ - tst_exit(); - -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/sbrk01.c b/winsup/testsuite/winsup.api/ltp/sbrk01.c deleted file mode 100644 index 700fb6b17..000000000 --- a/winsup/testsuite/winsup.api/ltp/sbrk01.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : sbrk01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for sbrk(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 2 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 06/05/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) sbrk(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the sbrk(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * sbrk(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="sbrk01"; /* Test program identifier. */ -int TST_TOTAL=2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int Increment; /* Amount to make change size by */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - long tret; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(0); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - -#ifdef __CYGWIN__ - /* we need to initialize output buffer before first sbrk. - otherwise, when memory is freed bu second sbrk, fwrite will - fail */ - tst_resm(TINFO, "Entering test"); -#endif - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Increase by 8192 bytes - */ - Increment = 8192; - - /* Call sbrk(2) */ -#if defined(sgi) - tret=(long)sbrk(Increment); /* Remove -64 IRIX compiler warning */ - TEST_ERRNO=errno; -#else - TEST(sbrk(Increment)); - tret=TEST_RETURN; -#endif - - /* check return code */ - if ( tret == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "sbrk - Increase by 8192 bytes failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "sbrk - Increase by 8192 bytes returned %d", - tret); - } - } - - - /* - * TEST CASE: - * Decrease to original size - */ - Increment=(Increment * -1); - - /* Call sbrk(2) */ -#ifdef CRAY - TEST(sbrk(Increment)); - tret=TEST_RETURN; -#else - tret=(long)sbrk(Increment); - TEST_ERRNO=errno; -#endif - - /* check return code */ - if ( tret == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "sbrk - Decrease to original size failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "sbrk - Decrease to original size returned %d", tret); - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/select01.c b/winsup/testsuite/winsup.api/ltp/select01.c deleted file mode 100644 index 3b81f93db..000000000 --- a/winsup/testsuite/winsup.api/ltp/select01.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : select01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : select to a file - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 3 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 02/24/93 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) select(2) to a fd of regular file with no I/O and small timeout - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the select(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * join(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include /* For open system call parameters. */ -#include -#include -#include -#include - -#ifdef __CYGWIN__ -/* - FIXME: workaround for bug in newlib -- FD_ZERO is defined via bzero and - if we don't include strings.h compiler warns about implicit declaration -*/ -#include -#endif - -#include "test.h" -#include "usctest.h" - -#define FILENAME "select01" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="select01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int Fd; -fd_set Readfds; - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct timeval timeout; - long test_time = 0; /* in usecs */ - - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Assigning the specified seconds within the timeval structure. - */ - test_time = ((lc%2000)*100000); /* 100 milli-seconds */ - - /* - * Bound the time to a value less than 60 seconds - */ - - if ( test_time > 1000000 * 60 ) - test_time = test_time % (1000000 * 60); - - timeout.tv_sec = test_time / 1000000; - timeout.tv_usec = test_time - (timeout.tv_sec * 1000000); - - - /* Call the system call being tested. */ - TEST(select(4, &Readfds, 0, 0, &timeout)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "%d select(4, &Readfds, 0, 0, &timeout), timeout = %ld usecs, errno=%d", - lc, test_time, errno); - } - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* Perform functional verification here */ - tst_resm(TPASS, - "select(4, &Readfds, 0, 0, &timeout) timeout = %ld usecs", - test_time); - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - if ((Fd=open(FILENAME, O_CREAT | O_RDWR)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_CREAT | O_RDWR) failed: errno:%d\n", - errno); - } - - /* - * Initializing and assigning the standard output file descriptor to - * fd_set for select. - */ - - FD_ZERO(&Readfds); - FD_SET(Fd, &Readfds); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - close(Fd); - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/select02.c b/winsup/testsuite/winsup.api/ltp/select02.c deleted file mode 100644 index 935f4b273..000000000 --- a/winsup/testsuite/winsup.api/ltp/select02.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : select02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : select of system pipe fds - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : Glen Overby - * - * DATE STARTED : 02/24/93 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) select(2) to fd of system pipe with no I/O and small timeout - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the select(2) system call. It is intended - * to provide a limited exposure of the system call, for now. - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include /* For open system call parameters. */ -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="select02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int Fd[2]; -fd_set saved_Readfds, saved_Writefds; -fd_set Readfds, Writefds; - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct timeval timeout; - long test_time = 0; /* in usecs */ - - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Assigning the specified seconds within the timeval structure. - */ - - test_time = ((lc%2000)*100000); /* 100 milli-seconds */ - - /* - * Bound the time to a value less than 60 seconds - */ - - if ( test_time > 1000000 * 60 ) - test_time = test_time % (1000000 * 60); - - timeout.tv_sec = test_time / 1000000; - timeout.tv_usec = test_time - (timeout.tv_sec * 1000000); - - Readfds = saved_Readfds; - Writefds = saved_Writefds; - - /* Call the system call being tested. */ - - TEST(select(5, &Readfds, &Writefds, 0, &timeout)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "%d select(5, &Readfds, &Writefds, 0, &timeout) failed, errno=%d\n", - lc, errno); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* Perform functional verification here */ - tst_resm(TPASS, - "select(5, &Readfds, &Writefds, 0, &timeout) timeout = %ld usecs", - test_time); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - if (pipe(Fd) == -1 ) { - tst_brkm(TBROK, cleanup, "pipe(&Fd) failed, errno=%d", errno); - } - - /* - * Initializing and assigning the standard output file descriptor to - * fd_set for select. - */ - - FD_ZERO(&saved_Readfds); - FD_ZERO(&saved_Writefds); - FD_SET(Fd[0], &saved_Readfds); - FD_SET(Fd[1], &saved_Writefds); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/select03.c b/winsup/testsuite/winsup.api/ltp/select03.c deleted file mode 100644 index 225ef19a7..000000000 --- a/winsup/testsuite/winsup.api/ltp/select03.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : select03 - * - * EXECUTED BY : anyone - * - * TEST TITLE : select of fd of a named-pipe (FIFO) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : Glen Overby - * - * DATE STARTED : 02/24/93 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) select(2) of fd of a named-pipe (FIFO) with no I/O and small timeout value - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the select(2) system call. It is intended - * to provide a limited exposure of the system call, for now. - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include /* For open system call parameters. */ -#include -#include -#include -#include -#include - - -#include "test.h" -#include "usctest.h" - -#define FILENAME "select03" - -extern void setup(); -extern void cleanup(); - -const char *TCID="select03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int Fd; -fd_set saved_Readfds, saved_Writefds; -fd_set Readfds, Writefds; - - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - struct timeval timeout; - long test_time = 0; /* in usecs */ - - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Assigning the specified seconds within the timeval structure. - */ - - test_time = ((lc%2000)*100000); /* 100 milli-seconds */ - - /* - * Bound the time to a value less than 60 seconds - */ - - if ( test_time > 1000000 * 60 ) - test_time = test_time % (1000000 * 60); - - timeout.tv_sec = test_time / 1000000; - timeout.tv_usec = test_time - (timeout.tv_sec * 1000000); - - Readfds = saved_Readfds; - Writefds = saved_Writefds; - - /* Call the system call being tested. */ - - TEST(select(5, &Readfds, &Writefds, 0, &timeout)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "%d select(5, &Readfds, &Writefds, 0, &timeout) failed errno=%d\n", - lc, errno); - } else { - - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* Perform functional verification here */ - tst_resm(TPASS, - "select(5, &Readfds, &Writefds, 0, &timeout) timeout = %ld usecs", - test_time); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - - /* make and open FIFO */ - if ( mkfifo(FILENAME, 0777) == -1 ) { - tst_brkm(TBROK, cleanup, "mkfifo(%s, 0777) failed, errno=%d", - FILENAME, errno); - } - - if ((Fd=open(FILENAME, O_RDWR)) == -1 ) { - tst_brkm(TBROK, cleanup, "open(%s, O_RDWR) failed, errno=%d", - FILENAME, errno); - } - - /* - * Initializing and assigning the standard output file descriptor to - * fd_set for select. - */ - - FD_ZERO(&saved_Readfds); - FD_ZERO(&saved_Writefds); - FD_SET(Fd, &saved_Readfds); - FD_SET(Fd, &saved_Writefds); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/setgid01.c b/winsup/testsuite/winsup.api/ltp/setgid01.c deleted file mode 100644 index a75e88a1d..000000000 --- a/winsup/testsuite/winsup.api/ltp/setgid01.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setgid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for setgid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setgid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setgid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setgid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="setgid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; -int gid; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call setgid(2) - */ - TEST(setgid(gid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setgid(%d) Failed, errno=%d : %s", gid, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setgid(%d) returned %d", gid, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - gid = getgid(); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/setgroups01.c b/winsup/testsuite/winsup.api/ltp/setgroups01.c deleted file mode 100644 index ee1c54b63..000000000 --- a/winsup/testsuite/winsup.api/ltp/setgroups01.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setgroups01 - * - * EXECUTED BY : root - * - * TEST TITLE : Basic test for setgroups(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setgroups(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setgroups(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setgroups(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="setgroups01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int len = NGROUPS; -gid_t list[NGROUPS]; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call setgroups(2) - */ - TEST(setgroups(len, list)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setgroups(%d, list) Failed, errno=%d : %s", len, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setgroups(%d, list) returned %d", len, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - if ( geteuid() != 0 ) - tst_brkm(TBROK, cleanup, "Must be ROOT to run this test."); - - /* Pause if that option was specified */ - TEST_PAUSE; - - if (getgroups(len, list) == -1) { - tst_brkm(TBROK, cleanup, - "getgroups(%d, list) Failure. errno=%d : %s", - len, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/setpgid01.c b/winsup/testsuite/winsup.api/ltp/setpgid01.c deleted file mode 100644 index 0835c66a3..000000000 --- a/winsup/testsuite/winsup.api/ltp/setpgid01.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setpgid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for setpgid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setpgid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setpgid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setpgid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup() __attribute__ ((noreturn)); - -const char *TCID="setpgid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; -int pgid, pid; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call setpgid(2) - */ - TEST(setpgid(pid, pgid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setpgid(%d, %d) Failed, errno=%d : %s", pid, pgid, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setpgid(%d, %d) returned %d", pid, pgid, TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int status; - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* - * Make sure current process is NOT a session or pgrp leader - */ - - pgid=getpgrp(); - pid=getpid(); - - if (pgid == pid) { - if ((pid = fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() in setup() failed - errno %d", - errno); - } - - if (pid != 0) { /* parent - sits and waits */ - wait(&status); - exit(WEXITSTATUS(status)); - } else { /* child - continues with test */ - pid = getpid(); - } - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/setregid01.c b/winsup/testsuite/winsup.api/ltp/setregid01.c deleted file mode 100644 index e4251f04e..000000000 --- a/winsup/testsuite/winsup.api/ltp/setregid01.c +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setregid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for setregid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 5 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 05/13/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setregid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setregid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setregid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="setregid01"; /* Test program identifier. */ -int TST_TOTAL=5; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int gid, egid; /* current real and effective group id */ - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Dont change either real or effective gid - */ - gid=getgid(); - egid=getegid(); - - - /* Call setregid(2) */ - TEST(setregid(-1, -1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setregid - Dont change either real or effective gid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setregid - Dont change either real or effective gid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * change effective to effective gid - */ - - - /* Call setregid(2) */ - TEST(setregid(-1, egid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setregid - change effective to effective gid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setregid - change effective to effective gid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * change real to real gid - */ - - - /* Call setregid(2) */ - TEST(setregid(gid, -1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setregid - change real to real gid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setregid - change real to real gid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * change effective to real gid - */ - - - /* Call setregid(2) */ - TEST(setregid(-1, gid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setregid - change effective to real gid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setregid - change effective to real gid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * try to change real to current real - */ - - - /* Call setregid(2) */ - TEST(setregid(gid, gid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setregid - try to change real to current real failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setregid - try to change real to current real returned %d", TEST_RETURN); - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/setreuid01.c b/winsup/testsuite/winsup.api/ltp/setreuid01.c deleted file mode 100644 index 05467c80f..000000000 --- a/winsup/testsuite/winsup.api/ltp/setreuid01.c +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setreuid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for setreuid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 5 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 05/14/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setreuid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setreuid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setreuid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="setreuid01"; /* Test program identifier. */ -int TST_TOTAL=5; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int ruid, euid; /* real and effective user ids */ - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Don't change either real or effective uid - */ - ruid=getuid(); /* get real uid */ - euid=geteuid(); /* get effective uid */ - - - /* Call setreuid(2) */ - TEST(setreuid(-1, -1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setreuid - Don't change either real or effective uid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setreuid - Don't change either real or effective uid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * change effective to effective uid - */ - - - /* Call setreuid(2) */ - TEST(setreuid(-1, euid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setreuid - change effective to effective uid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setreuid - change effective to effective uid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * change real to real uid - */ - - - /* Call setreuid(2) */ - TEST(setreuid(ruid, -1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setreuid - change real to real uid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setreuid - change real to real uid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * change effective to real uid - */ - - - /* Call setreuid(2) */ - TEST(setreuid(-1, ruid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setreuid - change effective to real uid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setreuid - change effective to real uid returned %d", TEST_RETURN); - } - } - - - /* - * TEST CASE: - * try to change real to current real - */ - - - /* Call setreuid(2) */ - TEST(setreuid(ruid, ruid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setreuid - try to change real to current real failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setreuid - try to change real to current real returned %d", TEST_RETURN); - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/setuid01.c b/winsup/testsuite/winsup.api/ltp/setuid01.c deleted file mode 100644 index 37e18fd51..000000000 --- a/winsup/testsuite/winsup.api/ltp/setuid01.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setuid01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for setuid(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 05/14/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setuid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setuid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setuid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="setuid01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int uid; /* current user id */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * TEST CASE: - * Set the effective user ID to the current real uid - */ - uid=getuid(); - - /* Call setuid(2) */ - TEST(setuid(uid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setuid - Set the effective user ID to the current real uid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setuid - Set the effective user ID to the current real uid returned %d", TEST_RETURN); - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/setuid02.c b/winsup/testsuite/winsup.api/ltp/setuid02.c deleted file mode 100644 index ee55ae19b..000000000 --- a/winsup/testsuite/winsup.api/ltp/setuid02.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : setuid02 - * - * EXECUTED BY : root - * - * TEST TITLE : Basic test for setuid(2) as root - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 05/14/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) setuid(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the setuid(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * setuid(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include - -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="setuid02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */ - -int uid; /* current user id */ - - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - uid=getuid(); - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - /* - * TEST CASE: - * Set the effective user ID to the current real uid - */ - - /* Call setuid(2) */ - TEST(setuid(uid)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "setuid - Set the effective user ID to the current real uid failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "setuid - Set the effective user ID to the current real uid returned %d", TEST_RETURN); - } - } - - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp dir and cd to it */ - tst_tmpdir(); - - /* must be root */ - if ( geteuid() != 0 ) - tst_brkm(TBROK, cleanup, "Must be root for this test!"); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* remove files and temp dir */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/signal03.c b/winsup/testsuite/winsup.api/ltp/signal03.c deleted file mode 100644 index 2a0923ca2..000000000 --- a/winsup/testsuite/winsup.api/ltp/signal03.c +++ /dev/null @@ -1,663 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/*********************************************************************************** - * - * OS Test - Silicon Graphics, Inc. Eagan, Minnesota - * - * TEST IDENTIFIER : signal03 Boundary value and other invalid value checking - * of signal setup and signal sending. - * - * PARENT DOCUMENT : sgntds01 Signal System Call - * - * AUTHOR : Dave Baumgartner - * : Rewrote 12/92 by Richard Logan - * - * CO-PILOT : Barrie Kletscher - * - * DATE STARTED : 10/17/85 - * - * TEST ITEMS - * - * 1. SIGKILL can not be set to be caught, errno:EINVAL (POSIX). - * 2. SIGKILL can not be caught. - * 3. SIGKILL can not be set to be ignored, errno:EINVAL (POSIX). - * 4. SIGKILL can not be ignored. - * 5. SIGKILL can not be reset to default, errno:EINVAL (POSIX. - * - * ENVIRONMENTAL NEEDS - * - * NONE - * - * SPECIAL PROCEDURAL REQUIREMENTS - * - * None - * - * INTERCASE DEPENDENCIES - * - * 2 depends on 1 and 4 on 3. - * - * DETAILED DESCRIPTION - * - * main() - * Call catch_test to test setup and catching of SIGKILL. - * - * - * Call ignore_test to test setup and ignoring of SIGKILL. - * - * - * Call sigdfl_test to test setting SIGKILL to default. - * - * * END OF MAIN * - * - * - * catch_test() - * - * fork a child - * if this is the parent - * sleep to let child start. - * send sig to child. - * wait for the child to terminate. - * - * if the termination status of the child equals the signal sent to it - * Test item 1 PASSED the child was killed. - * else if status equals the exit value of SIG_CAUGHT - * Test item 2 FAILED sig was caught. - * else - * Test item 2 FAILED because the child was not killed - * but sig was not caught either. - * - * else this the child - * set exit_val to SIG_NOT_CAUGHT. - * set to catch sig, where the interrupt routine just sets - * exit_val to SIG_CAUGHT. - * - * If the return value and errno, after trying to set to catch sig, - * do not indicate that an error has occurred. - * Test item 1 FAILED bad return, return value:X, errno:X. - * else - * Test item 1 PASSED sig was not set to be caught. - * - * pause until the parent sends a signal. - * The child should be killed by the signal but if not exit - * with exit_val. - * - * * End of catch_test. * - * - * - * ignore_test() - * - * fork a child - * if this is the parent - * sleep to let child start. - * send SIGKILL to child. - * wait for the child to terminate. - * - * if the termination status of the child equals SIGKILL - * Test item 4 PASSED the child was killed. - * else if the status equals the exit value of SIG_IGNORED - * Test item 4 FAILED SIGKILL was ignored. - * - * else this the child - * - * If the return value and errno, after trying to set to ignore SIGKILL, - * do not indicate that an error has occurred. - * Test item 3 FAILED bad return, return value:X, errno:X. - * else - * Test item 3 PASSED SIGKILL was not set to be ignored. - * - * pause until the parent sends SIGKILL. - * The child should be killed by the signal but if not exit - * with SIG_IGNORED. - * - * * End of ignore_test. * - * - * - * sigdfl_test() - * - * If the return value and errno, after trying to set to SIGKILL to default, - * do not indicate that an error has occurred. - * Test item 5 FAILED bad return, return value:X, errno:X. - * else - * Test item 5 PASSED SIGKILL was not set to default. - * - * * End of sigdfl_test. * - * - * BUGS/NOTES - * Since the system call under test is executed in the child, no - * timings on this system call will be reported. - * -***********************************************************************************/ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void do_test(); -void sigdfl_test(); -void update_timings(); - -#if defined(linux) -# define SIG_PF sig_t /* This might need to be sighandler_t on some systems */ -#elif defined(__CYGWIN__) -typedef void (*sighandler_t) (int); -#define SIG_PF sighandler_t -#endif - -#define SIG_CAUGHT 1 -#define SIG_NOT_CAUGHT 0 -#define SIG_IGNORED 5 -#define TIMED_OUT 99 - -#define TIMEOUT 20 - -#define GO_FLAG 1 -#define ERROR_FLAG 2 -#define PASS_FLAG 3 -#define FAIL_FLAG 4 - -#define IGNORE_TEST 1 -#define CATCH_TEST 2 - -#define MAXMESG 150 /* The Maximum message that can be created. */ - -int exit_val; /* Global variable, used to tell whether the */ - /* child exited instead of being killed. */ -extern int errno; /* errno holds the error value returned by */ - /* a system call. */ -char mesg[MAXMESG]; /* Holds messages to pass to tst_res. */ - -struct ipc_t { - int status; - char mesg[MAXMESG]; - struct tblock timings; -} Ipc_info; - -const char *TCID = "signal03"; -int TST_TOTAL = 5; -extern int Tst_count; /* count of test items completed */ - -int Pid; /* Return value from fork. */ - -long Tret; - -/*********************************************************************** - * M A I N - ***********************************************************************/ -int -main(argc, argv) -int argc; -char **argv; -{ - int lc; - const char *msg; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(argc, argv, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - errno=-4; - - /* - * Call catch_test to test setup and catching of SIGKILL. - */ - (void) do_test(CATCH_TEST, Tst_count); - - /* - * Call ignore_test to test setup and ignoring of SIGKILL. - */ - (void) do_test(IGNORE_TEST, Tst_count); - - /* - * Call sigdfl_test to test setting SIGKILL to default. - */ - (void) sigdfl_test(); - - } - - cleanup(); - - return 0; -} /*End of main*/ - -/*********************************************************************** - * - ***********************************************************************/ -void -do_test(test_case, tst_count) -int test_case; -int tst_count; -{ - int term_stat; /* Termination status of the child returned to */ - /* the parent. */ - char string[30]; - int fd1[2]; /* ipc */ - int rd_sz; /* size of read */ - void p_timeout_handler(); - void c_timeout_handler(); - void catchsig(); - - Tst_count = tst_count; - - /* - * Create a pipe of ipc - */ - if ( pipe(fd1) == -1 ) { - sprintf(mesg, - "pipe system call failed, Errno: %d, Error message: %s", - errno,strerror(errno)); - tst_resm(TBROK,mesg); - tst_resm(TBROK,mesg); - return; - } - - /* - * Cause the read to return 0 once EOF is encountered and the - * read to return -1 if pipe is empty. - */ - - if ( fcntl(fd1[0], F_SETFL, O_NONBLOCK) == -1 ) { - sprintf(mesg, "fcntl(fd1[0], F_SETFL, O_NONBLOCK) failed: errno=%d", - errno); - tst_resm(TBROK,mesg); - tst_resm(TBROK,mesg); - close(fd1[0]); - close(fd1[1]); - return; - } - - if ((Pid = fork()) > 0) { /* parent */ - - signal(SIGALRM, p_timeout_handler); - - alarm(TIMEOUT); - - close(fd1[1]); /* close write side */ - - /* - * Deal with child's messages. - * Only the GO_FLAG status will allow parent to - * go on. All pipe io will be in the ipc_t structure sizes - * to avoid reading part of next message. - */ - while ( 1 ) { - - while ( (rd_sz=read(fd1[0], (char *)&Ipc_info, sizeof(Ipc_info))) != 0 ) { - if ( rd_sz > 0 ) - break; /* read something */ - } - - if ( rd_sz == 0 ) { /* if EOF encountered */ - sprintf(mesg, "child's pipe is closed before 'go' message received"); - tst_resm(TBROK, Ipc_info.mesg); - tst_resm(TBROK, Ipc_info.mesg); - close(fd1[0]); - return; - } - - else if ( Ipc_info.status == GO_FLAG ) { - break; /* go on */ - } - else if ( Ipc_info.status == ERROR_FLAG ) { - tst_resm(TBROK, "From child: %s", Ipc_info.mesg); - tst_resm(TBROK, "From child: %s", Ipc_info.mesg); - close(fd1[0]); - return; - } - else if ( Ipc_info.status == PASS_FLAG ) { - - if ( STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, "From child: %s", Ipc_info.mesg); - else - Tst_count++; - update_timings(Ipc_info.timings); - } - else if ( Ipc_info.status == FAIL_FLAG ) { - tst_resm(TFAIL, "From child: %s", Ipc_info.mesg); - update_timings(Ipc_info.timings); - } - else { - tst_resm(TINFO, "Unknown message from child: %s", mesg); - } - } - - /* - * Send the signal SIGKILL to the child. - */ - if (kill(Pid,SIGKILL) == -1) - { - /* - * The kill system call failed. - */ - sprintf(mesg, - "kill(Pid,SIGKILL) failed, Errno: %d, Error message: %s", - errno,strerror(errno)); - tst_resm(TBROK,mesg); - tst_resm(TBROK,mesg); - close(fd1[0]); - return; - } - - /* - * Wait for the child to terminate and check the termination status. - */ - if (wait(&term_stat) == -1) { - /* - * The wait system call failed. - */ - sprintf(mesg, - "Wait system call failed. Errno: %d, Error message: %s", - errno,strerror(errno)); - tst_resm(TBROK,mesg); - tst_resm(TBROK,mesg); - close(fd1[0]); - return; - } - else if ( STD_FUNCTIONAL_TEST ) { - if ((term_stat & 0377) == SIGKILL) { - /* - * The child was killed by the signal sent, - * which is correct. - */ - tst_resm(TPASS,"The child was killed by SIGKILL."); - } - else if ( (term_stat >> 8) == TIMED_OUT ) { - sprintf(mesg, "child exited with a timed out exit status"); - tst_resm(TBROK,mesg); - } - else { - if ((term_stat >> 8) == SIG_IGNORED && test_case == IGNORE_TEST ) { - sprintf(mesg, - "SIGKILL was ignored by child after sent by parent."); - } - else if ((term_stat >> 8) == SIG_CAUGHT && test_case == CATCH_TEST ) { - sprintf(mesg, - "SIGKILL was caught by child after sent by parent."); - } - else { - sprintf(mesg, - "Child's termination status is unexpected. Status: %d (%#o).", - term_stat, term_stat); - } - tst_resm(TFAIL, mesg); - } - } - else { - Tst_count++; /* increment test counter */ - } - close(fd1[0]); - - } /* End of parent. */ - else if (Pid == 0) { - /* - * This is the child. - * Set up to ignore/catch SIGKILL and check the return values. - */ - errno=0; - if ( test_case == IGNORE_TEST ) { - exit_val = SIG_IGNORED; - strcpy(string, "signal(SIGKILL, SIG_IGN)"); - - Tret=(long)signal(SIGKILL, SIG_IGN); - TEST_ERRNO=errno; - } - else { - exit_val = SIG_NOT_CAUGHT; - strcpy(string, "signal(SIGKILL, catchsig)"); - Tret=(long)signal(SIGKILL, catchsig); - TEST_ERRNO=errno; - } - Ipc_info.timings=tblock; - - if ( (SIG_PF)Tret == SIG_ERR ) { - if ( TEST_ERRNO == EINVAL ) { - sprintf(Ipc_info.mesg, "%s ret:%ld SIG_ERR (%ld) as expected", - string, Tret, (long)SIG_ERR); - Ipc_info.status = PASS_FLAG; - } - else { - sprintf(Ipc_info.mesg, - "%s ret:%ld, errno:%d expected ret:%ld, errno:%d", - string, Tret, TEST_ERRNO, (long)SIG_ERR, EINVAL); - Ipc_info.status = FAIL_FLAG; - } - - write(fd1[1], (char *)&Ipc_info, sizeof(Ipc_info)); - } - else { - /* - * The child was not allowed to set the signal to - * be ignored and errno was correct. - */ - sprintf(Ipc_info.mesg, - "%s ret:%ld, errno:%d expected ret:%ld, errno:%d", - string, Tret, TEST_ERRNO, (long)SIG_ERR, EINVAL); - Ipc_info.status = FAIL_FLAG; - write(fd1[1], (char *)&Ipc_info, sizeof(Ipc_info)); - } - - /* - * tell parent we are ready - setup by child is done - */ - Ipc_info.status = GO_FLAG; - write(fd1[1], (char *)&Ipc_info, sizeof(Ipc_info)); - - /* - * Set the alarm to wake up from the pause below if - * the parents signal is ignored. - */ - signal(SIGALRM, p_timeout_handler); - alarm(TIMEOUT); - - /* - * Pause until the parent sends a signal or until alarm is received. - */ - pause(); - - exit(exit_val); - - - } /* End of child. */ - else { - /* - * The fork system call failed. - */ - sprintf(mesg, - "Fork system call failed. Errno: %d, Error message: %s", - errno,strerror(errno)); - tst_resm(TBROK,mesg); - tst_resm(TBROK,mesg); - close(fd1[0]); - close(fd1[1]); - return; - } - -} /* End of do_test. */ - -/*********************************************************************** - * sigdfl_test - test for attempt to set SIGKILL to default - ***********************************************************************/ -void -sigdfl_test() -{ - /* - * Try to set SIGKILL to default and check the return values. - */ - errno=-4; - - Tret=(long)signal(SIGKILL,SIG_DFL); - TEST_RETURN=Tret; - TEST_ERRNO=errno; - - - if ( (SIG_PF)TEST_RETURN == SIG_ERR ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO != EINVAL ) { - sprintf(mesg, - "signal(SIGKILL,SIG_DFL) ret:%d, errno:%d expected ret:-1, errno:%d", - TEST_RETURN, TEST_ERRNO, EINVAL); - tst_resm(TFAIL, mesg); - } - else { - sprintf(mesg, - "signal(SIGKILL,SIG_DFL) ret:%d, errno:%d as expected.", - TEST_RETURN, TEST_ERRNO); - tst_resm(TPASS, mesg); - } - } - else - Tst_count++; - } - else { - sprintf(mesg, - "signal(SIGKILL,SIG_DFL) ret:%d, errno:%d expected ret:-1, errno:%d", - TEST_RETURN, TEST_ERRNO, EINVAL); - tst_resm(TFAIL, mesg); - } - -} /* End of sigdfl_test. */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* make and change to a temporary directory */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - - TEST_CLEANUP; - - /* - * remove the temporary directory and exit with - * return code appropriate for results - */ - - tst_rmdir(); - - tst_exit(); - -} /* End cleanup() */ - -/*********************************************************************** - * Signal handler routine that used by the parent to handler - * a time out situation. It will attempt to kill the child and - * call cleanup. - ***********************************************************************/ -void -p_timeout_handler() -{ - kill(Pid, SIGKILL); - cleanup(); -} - -/*********************************************************************** - * Signal handler routine that used by the child to handle - * a time out situation. It will set a global varaible and return - * if called. - ***********************************************************************/ -void -c_timeout_handler() -{ - exit_val = TIMED_OUT; - return; -} - -/*********************************************************************** - * This signal handling routine will set a global variable and return - * if called. - ***********************************************************************/ -void -catchsig() -{ - exit_val = SIG_CAUGHT; - return; -} - -/*********************************************************************** - * Update timing information - ***********************************************************************/ -void -update_timings(atblock) -struct tblock atblock; -{ - tblock.tb_max += atblock.tb_max; - tblock.tb_min += atblock.tb_min; - tblock.tb_total += atblock.tb_total; - tblock.tb_count += atblock.tb_count; -} diff --git a/winsup/testsuite/winsup.api/ltp/stat01.c b/winsup/testsuite/winsup.api/ltp/stat01.c deleted file mode 100644 index da3596e17..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat01.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: stat01 - * - * Test Description: - * Verify that, stat(2) succeeds to get the status of a file and fills the - * stat structure elements. - * - * Expected Result: - * stat() should return value 0 on success and fills the stat structure - * elements with the specified 'file' information. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * stat01 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * - */ -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE 0644 -#define TESTFILE "testfile" -#define FILE_SIZE 1024 -#define BUF_SIZE 256 -#define MASK 0777 - -const char *TCID="stat01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; -uid_t User_id; /* Owner id of the test file */ -gid_t Group_id; /* Group id of the test file */ -char nobody_uid[] = "nobody"; -struct passwd *ltpuser; - -void setup(); /* Setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - /*NOTREACHED*/ - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call stat(2) to get the status of - * specified 'file' into stat structure. - */ - TEST(stat(TESTFILE, &stat_buf)); - - /* check return code of stat(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, \ - "stat(%s, &stat_buf) Failed, errno=%d : %s", - TESTFILE, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - stat_buf.st_mode &= ~S_IFREG; - /* - * Verify the data returned by stat(2) - * aganist the expected data. - */ - if ((stat_buf.st_uid != User_id) || \ - (stat_buf.st_gid != Group_id) || \ - (stat_buf.st_size != FILE_SIZE) || \ - ((stat_buf.st_mode & MASK) != FILE_MODE)) { - tst_resm(TFAIL, "Functionality of " - "stat(2) on '%s' Failed", - TESTFILE); - } else { - tst_resm(TPASS, "Functionality of " - "stat(2) on '%s' Succcessful", - TESTFILE); - } - } else { - tst_resm(TINFO, "Call succeeded"); - } - } - Tst_count++; /* incr. TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - Performs setup function for the test. - * Creat a temporary directory and change directory to it. - * Creat a testfile and write some known data into it. - * Get the effective uid/gid of test process. - */ -void -setup() -{ - int i, fd; - char tst_buff[BUF_SIZE]; - int wbytes; - int write_len = 0; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); -#if 0 - /* Switch to nobody user for correct error code collection */ - if (geteuid() != 0) { - tst_brkm(TBROK, tst_exit, "Test must be run as root"); - } - ltpuser = getpwnam(nobody_uid); - if (setuid(ltpuser->pw_uid) == -1) { - tst_resm(TINFO, "setuid failed to " - "to set the effective uid to %d", - ltpuser->pw_uid); - perror("setuid"); - } -#endif - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* Write to the file 1k data from the buffer */ - while (write_len < FILE_SIZE) { - if ((wbytes = write(fd, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - /*NOTREACHED*/ - } else { - write_len += wbytes; - } - } - - /* Close the testfile created */ - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Get the uid/gid of the process */ - User_id = getuid(); - Group_id = getgid(); - -} /* End setup() */ - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test file and temporary directory created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/stat02.c b/winsup/testsuite/winsup.api/ltp/stat02.c deleted file mode 100644 index 745476fa0..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat02.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: stat02 - * - * Test Description: - * Verify that, stat(2) succeeds to get the status of a file and fills the - * stat structure elements though process doesn't have read access to the - * file. - * - * Expected Result: - * stat() should return value 0 on success and the stat structure elements - * should be filled with specified 'file' information. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * stat02 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * - */ -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define TESTFILE "testfile" -#define FILE_SIZE 1024 -#define BUF_SIZE 256 -#define NEW_MODE 0222 -#define MASK 0777 - -const char *TCID="stat02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; -uid_t User_id; /* eff. user id/group id of test process */ -gid_t Group_id; -char nobody_uid[] = "nobody"; -struct passwd *ltpuser; - -void setup(); /* Setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call stat(2) to get the status of - * specified 'file' into stat structure. - */ - TEST(stat(TESTFILE, &stat_buf)); - - /* check return code of stat(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "stat(%s, &stat_buf) Failed, errno=%d : %s", - TESTFILE, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - stat_buf.st_mode &= ~S_IFREG; - /* - * Verify the data returned by stat(2) - * aganist the expected data. - */ - if ((stat_buf.st_uid != User_id) || \ - (stat_buf.st_gid != Group_id) || \ - (stat_buf.st_size != FILE_SIZE) || \ - ((stat_buf.st_mode & MASK) != NEW_MODE)) { - tst_resm(TFAIL, "Functionality of " - "stat(2) on '%s' Failed", - TESTFILE); - } else { - tst_resm(TPASS, "Functionality of " - "stat(2) on '%s' Succcessful", - TESTFILE); - } - } else { - tst_resm(TPASS, "Call succeeded"); - } - } - Tst_count++; /* incr TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - Performs setup function for the test. - * Creat a temporary directory and change directory to it. - * Creat a testfile and write some data into it. - * Modify the mode permissions of testfile such that test process - * has read-only access to testfile. - */ -void -setup() -{ - int i, fd; /* counter, file handle for file */ - char tst_buff[BUF_SIZE]; /* data buffer for file */ - int wbytes; /* no. of bytes written to file */ - int write_len = 0; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); -#if 0 - /* Switch to nobody user for correct error code collection */ - if (geteuid() != 0) { - tst_brkm(TBROK, tst_exit, "Test must be run as root"); - } - ltpuser = getpwnam(nobody_uid); - if (setuid(ltpuser->pw_uid) == -1) { - tst_resm(TINFO, "setuid failed to " - "to set the effective uid to %d", - ltpuser->pw_uid); - perror("setuid"); - } -#endif - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* Write to the file 1k data from the buffer */ - while (write_len < FILE_SIZE) { - if ((wbytes = write(fd, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - /*NOTREACHED*/ - } else { - write_len += wbytes; - } - } - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Modify mode permissions on the testfile */ - if (chmod(TESTFILE, NEW_MODE) < 0) { - tst_brkm(TBROK, cleanup, - "chmod(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Get the uid/gid of the process */ - User_id = getuid(); - Group_id = getgid(); - -} /* End setup() */ - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the temporary directory and file created. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/stat03.c b/winsup/testsuite/winsup.api/ltp/stat03.c deleted file mode 100644 index dcddfd2a0..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat03.c +++ /dev/null @@ -1,391 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: stat03 - * - * Test Description: - * Verify that, - * 1) stat(2) returns -1 and sets errno to EACCES if search permission is - * denied on a component of the path prefix. - * 2) stat(2) returns -1 and sets errno to ENOENT if the specified file - * does not exists or empty string. - * 3) stat(2) returns -1 and sets errno to EFAULT if pathname points - * outside user's accessible address space. - * 4) stat(2) returns -1 and sets errno to ENAMETOOLONG if the pathname - * component is too long. - * 5) stat(2) returns -1 and sets errno to ENOTDIR if the directory - * component in pathname is not a directory. - * - * Expected Result: - * stat() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * stat03 [-c n] [-e] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define MODE_RWX S_IRWXU | S_IRWXG | S_IRWXO -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define DIR_TEMP "testdir_1" -#define TEST_FILE1 "testdir_1/tfile_1" -#define TEST_FILE2 "t_file/tfile_2" - -int no_setup(); -int setup1(); /* setup function to test chmod for EACCES */ -int setup2(); /* setup function to test chmod for ENOTDIR */ -int longpath_setup(); /* setup function to test chmod for ENAMETOOLONG */ -char nobody_uid[] = "nobody"; -struct passwd *ltpuser; - - -char Longpathname[PATH_MAX+2]; -char High_address_node[64]; - -struct test_case_t { /* test case struct. to hold ref. test cond's*/ - const char *pathname; - const char *desc; - int exp_errno; - int (*setupfunc)(); -} Test_cases[] = { -#ifndef __CYGWIN__ - { TEST_FILE1, "No Search permissions to process", EACCES, setup1 }, -#endif - { High_address_node, "Address beyond address space", EFAULT, no_setup }, - { (char *)-1, "Negative address", EFAULT, no_setup }, - { Longpathname, "Pathname too long", ENAMETOOLONG, longpath_setup }, - { "", "Pathname is empty", ENOENT, no_setup }, -#ifndef __CYGWIN__ - { TEST_FILE2, "Path contains regular file", ENOTDIR, setup2 }, -#endif - { NULL, NULL, 0, no_setup } -}; - -const char *TCID="stat03"; /* Test program identifier. */ -int TST_TOTAL = 6; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={EACCES, EFAULT, ENAMETOOLONG, ENOENT, ENOTDIR, 0}; - -void setup(); /* Main setup function for the tests */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ -char *get_high_address(void); - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *file_name; /* ptr. for file name whose mode is modified*/ - const char *test_desc; /* test specific error message */ - int ind; /* counter to test different test conditions */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - /*NOTREACHED*/ - } - - /* - * Invoke setup function to call individual test setup functions - * to simulate test conditions. - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - file_name = Test_cases[ind].pathname; - test_desc = Test_cases[ind].desc; - - if (file_name == High_address_node) { - file_name = (char *)get_high_address(); - } - - /* - * Call stat(2) to test different test conditions. - * verify that it fails with -1 return value and - * sets appropriate errno. - */ - TEST(stat(file_name, &stat_buf)); - - /* Check return code from stat(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == Test_cases[ind].exp_errno) { - tst_resm(TPASS, - "stat() fails, %s, errno:%d", - test_desc, TEST_ERRNO); - } else { - tst_resm(TFAIL, "stat() fails, %s," - " errno:%d, expected errno:%d", - test_desc, TEST_ERRNO, - Test_cases[ind].exp_errno); - } - } else { - tst_resm(TFAIL, "stat(2) returned %d," - " expected -1, errno:%d", TEST_RETURN, - Test_cases[ind].exp_errno); - } - } /* End of TEST CASE LOOPING. */ - Tst_count++; /* incr TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* - * Invoke cleanup() to delete the test directory/file(s) created - * in the setup(). - */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup(void) - performs all ONE TIME setup for this test. - * Exit the test program on receipt of unexpected signals. - * Create a temporary directory and change directory to it. - * Invoke individual test setup functions according to the order - * set in struct. definition. - */ -void -setup() -{ - int ind; /* counter for setup functions */ - - /* Capture unexpected signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); -#if 0 - /* Switch to nobody user for correct error code collection */ - if (geteuid() != 0) { - tst_brkm(TBROK, tst_exit, "Test must be run as root"); - } - ltpuser = getpwnam(nobody_uid); - if (setuid(ltpuser->pw_uid) == -1) { - tst_resm(TINFO, "setuid failed to " - "to set the effective uid to %d", - ltpuser->pw_uid); - perror("setuid"); - } -#endif - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* Make a temp dir and cd to it */ - tst_tmpdir(); - - /* call individual setup functions */ - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - Test_cases[ind].setupfunc(); - } -} /* End setup() */ - -/* - * int - * no_setup() - Some test conditions for stat(2) do not any setup. - * Hence, this function just returns 0. - * This function simply returns 0. - */ -int -no_setup() -{ - return 0; -} - - -/* - * int - * setup1() - setup function for a test condition for which stat(2) - * returns -1 and sets errno to EACCES. - * Create a test directory under temporary directory and create a test file - * under this directory with mode "0666" permissions. - * Modify the mode permissions on test directory such that process will not - * have search permissions on test directory. - * - * The function returns 0. - */ -int -setup1() -{ - int fd; /* file handle for testfile */ - - /* Creat a test directory */ - if (mkdir(DIR_TEMP, MODE_RWX) < 0) { - tst_brkm(TBROK, cleanup, "mkdir(2) of %s failed", DIR_TEMP); - /*NOTREACHED*/ - } - - /* Creat a test file under above test directory */ - if ((fd = open(TEST_FILE1, O_RDWR|O_CREAT, 0666)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0666) failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - /*NOTREACHED*/ - } - /* Close the test file */ - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Modify mode permissions on test directory */ - if (chmod(DIR_TEMP, FILE_MODE) < 0) { - tst_brkm(TBROK, cleanup, "chmod(2) of %s failed", DIR_TEMP); - /*NOTREACHED*/ - } - return 0; -} - -/* - * int - * setup2() - setup function for a test condition for which stat(2) - * returns -1 and sets errno to ENOTDIR. - * - * Create a test file under temporary directory so that test tries to - * change mode of a testfile "tfile_2" under "t_file" which happens to be - * another regular file. - */ -int -setup2() -{ - int fd; /* File handle for test file */ - - /* Creat a test file under temporary directory */ - if ((fd = open("t_file", O_RDWR|O_CREAT, MODE_RWX)) == -1) { - tst_brkm(TBROK, cleanup, - "open(2) on t_file failed, errno=%d : %s", - errno, strerror(errno)); - /*NOTREACHED*/ - } - /* Close the test file created above */ - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(t_file) Failed, errno=%d : %s", - errno, strerror(errno)); - /*NOTREACHED*/ - } - return 0; -} - -/* - * int - * longpath_setup() - setup to create a node with a name length exceeding - * the MAX. length of PATH_MAX. - * This function retruns 0. - */ -int -longpath_setup() -{ - int ind; /* counter variable */ - - for (ind = 0; ind <= (PATH_MAX + 1); ind++) { - Longpathname[ind] = 'a'; - } - return 0; -} - -/* - * void - * cleanup() - Performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Print test timing stats and errno log if test executed with options. - * Remove temporary directory and sub-directories/files under it - * created during setup(). - * Exit the test program with normal exit code. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - -#ifndef __CYGWIN__ - /* Restore mode permissions on test directory created in setup2() */ - if (chmod(DIR_TEMP, MODE_RWX) < 0) { - tst_brkm(TFAIL, NULL, "chmod(2) of %s failed", DIR_TEMP); - } -#endif - - /* Remove files and temporary directory created */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/stat05.c b/winsup/testsuite/winsup.api/ltp/stat05.c deleted file mode 100644 index 5c0964a93..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat05.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : stat05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for stat(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) stat(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the stat(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * stat(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="stat05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -struct stat statter; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call stat(2) with F_CLRALF argument on fname - */ - TEST(stat(fname, &statter)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "stat(%s, &statter) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "stat(%s, &statter) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/stat06.c b/winsup/testsuite/winsup.api/ltp/stat06.c deleted file mode 100644 index c5fae6fe5..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat06.c +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : stat06 - * - * EXECUTED BY : anyone - * - * TEST TITLE : stat(2) negative path testcases - * - * PARENT DOCUMENT : None - * - * TEST CASE TOTAL : 7 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/30/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1-7) See Testcases structure below. - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * -h : print help and exit - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the stat(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * stat(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - -const char *TCID="stat06"; /* Test program identifier. */ -int TST_TOTAL=8; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -extern char *get_high_address(); - -int exp_enos[]={0, 0}; - -int high_address_setup(); -int longpath_setup(); -int no_setup(); -int filepath_setup(); -char Longpathname[PATH_MAX+2]; -char High_address[64]; -struct stat statbuf; -jmp_buf sig11_recover; -void sig11_handler(int sig); - -struct test_case_t { - const char *pathname; - struct stat *stbuf; - const char *desc; - int exp_errno; - int (*setupfunc)(); -} Test_cases[] = { - { "nonexistfile", &statbuf, "non-existent file", ENOENT, no_setup}, - { "", &statbuf, "path is empty string", ENOENT, no_setup}, - { "nefile/file", &statbuf, "path contains a non-existent file", - ENOENT, no_setup }, -#ifndef __CYGWIN__ - { "file/file", &statbuf, "path contains a regular file", - ENOTDIR, filepath_setup }, -#endif - { Longpathname, &statbuf, "pathname too long", ENAMETOOLONG, longpath_setup }, - { High_address, &statbuf, "address beyond address space", EFAULT, high_address_setup }, - { (char *)-1, &statbuf, "negative address", EFAULT, no_setup }, - { "file", (struct stat *)-1, "invalid struct stat address", EFAULT, filepath_setup }, - { NULL, NULL, NULL, 0, no_setup } -}; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *fname; - const char *desc; - int ind; - struct stat *stbuf; - struct sigaction sa, osa; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - - fname = Test_cases[ind].pathname; - desc = Test_cases[ind].desc; - stbuf = Test_cases[ind].stbuf; - - if (stbuf == (struct stat *)-1) { - /* special sig11 case */ - sa.sa_handler = &sig11_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - - sigaction(SIGSEGV, NULL, &osa); - sigaction(SIGSEGV, &sa, NULL); - - if (setjmp(sig11_recover)) { - TEST_RETURN = -1; - TEST_ERRNO = EFAULT; - } else { - TEST(stat(fname, stbuf)); - } - sigaction(SIGSEGV, &osa, NULL); - } else { - /* - * Call stat(2) - */ - - TEST(stat(fname, stbuf)); - } - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO == Test_cases[ind].exp_errno ) - tst_resm(TPASS, "stat(<%s>, &stbuf) Failed, errno=%d", - desc, TEST_ERRNO); - else - tst_resm(TFAIL, - "stat(<%s>, &stbuf) Failed, errno=%d, expected errno:%d", - desc, TEST_ERRNO, Test_cases[ind].exp_errno); - } - else - Tst_count++; - } else { - tst_resm(TFAIL, - "stat(<%s>, &stbuf) returned %d, expected -1, errno:%d", - desc, TEST_RETURN, Test_cases[ind].exp_errno); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int ind; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - Test_cases[ind].setupfunc(); - } - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - -/****************************************************************** - * no_setup() - does nothing - ******************************************************************/ -int -no_setup() -{ - return 0; -} - -/****************************************************************** - * high_address_setup() - generates an address that should cause a segfault - ******************************************************************/ -int -high_address_setup() -{ - int ind; - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - if ( Test_cases[ind].pathname == High_address ) { - /*if ( strcmp(Test_cases[ind].pathname, HIGH_ADDRESS) == 0 ) { ***/ - Test_cases[ind].pathname = get_high_address(); - break; - } - } - return 0; - -} - -/****************************************************************** - * longpath_setup() - creates a filename that is too long - ******************************************************************/ -int -longpath_setup() -{ - int ind; - - for(ind=0; ind<= PATH_MAX+1; ind++) { - Longpathname[ind] = 'a'; - } - return 0; - -} - -/****************************************************************** - * filepath_setup() creates a file the exists that we will treat as a directory - ******************************************************************/ -int -filepath_setup() -{ - int fd; - - if ( (fd=creat("file", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, "creat(file) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - return 0; -} - -/****************************************************************** - * sig11_handler() - our segfault recover hack - ******************************************************************/ -void -sig11_handler(int sig) -{ - longjmp(sig11_recover, 1); -} diff --git a/winsup/testsuite/winsup.api/ltp/symlink01.c b/winsup/testsuite/winsup.api/ltp/symlink01.c deleted file mode 100644 index 54a24b87f..000000000 --- a/winsup/testsuite/winsup.api/ltp/symlink01.c +++ /dev/null @@ -1,2032 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** -* -* OS Test - Silicon Graphics, Inc. -* -* TEST IDENTIFIER : symlink01 (symlink) -* -* TEST TITLE : Make a Symbolic Link to a File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 5 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : readlink01 (readlink) -* -* TEST TITLE : Reads Value of a Symbolic Link -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 4 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : stat04 (stat) -* -* TEST TITLE : Gets File Status Indirectly From a Symbolic Link -* File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : lstat01 (lstat) -* -* TEST TITLE : Get file Status About a Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : mkdir05 (mkdir) -* -* TEST TITLE : Fail When Making a Directory File Indirectly From -* a Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 1 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : rmdir03 (rmdir) -* -* TEST TITLE : Fail When Removing a Directory File Indirectly -* From a Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 1 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : chdir01 (chdir) -* -* TEST TITLE : Changes Current Working DIrectory Location -* Indirectly From a Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : link01 (link) -* -* TEST TITLE : Creates a Link To a File Indirectly From a -* Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : unlink01 (unlink) -* -* TEST TITLE : Removes a Link To a File And Not Any Object File -* Which Maybe Pointed At -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 1 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : chmod01 (chmod) -* -* TEST TITLE : Change Object File Permissions Indirectly From a -* Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : utime01 (utime) -* -* TEST TITLE : Set File Access And Modify Object File Times -* Indirectly From a Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : rename01 (rename) -* -* TEST TITLE : Rename a Symbolic Link File And Not Any Object -* File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 3 -* -* WALL CLOCK TIME : 3 -* -* TEST IDENTIFIER : open01 (open) -* -* TEST TITLE : Create/Open a File For Reading Or Writing -* Indirectly From a Symbolic Link File -* -* PARENT DOCUMENT : symtds01 -* -* TEST CASE TOTAL : 5 -* -* WALL CLOCK TIME : 3 -* -* EXECUTED BY : whom ever -* -* CPU TYPES : ALL -* -* AUTHOR : David Fenner -* -* CO-PILOT : Jon Hendrickson -* -* DATE STARTED : 07/25/90 -* -* INITIAL RELEASE : UNICOS 6.0 -* -* TEST CASES -* -* For symlink -* -* 1. Create symbolic link with abnormal object name path -* 2. Create symbolic link with normal object name path -* 3. Create symbolic link with path to an existing object file -* 4. Receive EEXIST error when creating an already existing symbolic link file. -* 5. Receive ENAMETOOLONG error when creating symbolic link which exceeds PATH_MAX in length -* -* For readlink -* -* 1. Read a symbolic link file which points at no object file -* 2. Read a symbolic link file which points at an object file -* 3. Receive ENAMETOOLONG error when reading symbolic link which exceeds PATH_MAX in length -* 4. Receive an EINVAL error when reading a file which is not a symbolic -* link file. -* -* For stat -* -* 1. Get object file status through symbolic link file -* 2. Receive ENOENT error when accessing non-existent object file through symbolic link file -* 3. Receive ELOOP error when nesting of symbolic links exceed maximum -* -* For lstat -* -* 1. Get symbolic link file status when pointing at no object file -* 2. Get symbolic link file status when pointing at an object file -* 3. Get object file status when argument is not a symbolic link -* file. -* -* For mkdir -* -* 1. Receive EEXIST error when creating a directory through a symbolic link file -* -* For rmdir -* -* 1. Receive ENOTDIR error when removing an existing directory through a symbolic link file -* -* For chdir -* -* 1. Change current working directory through a symbolic link file -* 2. Receive ENOENT error when accessing non-existent directory through symbolic link file -* 3. Receive ELOOP error when nesting of symbolic links exceed maximum -* -* For link -* -* 1. Link an object file to a new file through symbolic link file -* 2. Receive ENOENT error when accessing non-existent object file through symbolic link file -* 3. Receive ELOOP error when nesting of symbolic links exceed maximum -* -* For unlink -* -* 1. Delete a symbolic link file and not the object file which it points at -* -* For chmod -* -* 1. Change file permissions of object file through a symbolic link file -* 2. Receive ENOENT error when accessing non-existent directory through symbolic link file -* 3. Receive ELOOP error when nesting of symbolic links exceed maximum -* -* For utime -* -* 1. Change inode times of object file through a symbolic link file -* 2. Receive ENOENT error when accessing non-existent directory through symbolic link file -* 3. Receive ELOOP error when nesting of symbolic links exceed maximum -* -* For rename -* -* 1. Rename a symbolic link file which points at no object file -* 2. Rename a symbolic link file which points at an object file without any object file alterations. -* 3. Receive EXDEV when trying to rename a symbolic link file to an address outside of current file system -* -* For open -* -* 1. Create an object file through a symbolic link file -* 2. Open an object file through a symbolic link file -* 3. Receive EEXIST error when exclusively creating an object file through a symbolic link file -* 4. Receive ENOENT error when accessing non-existent object file through symbolic link file -* 5. Receive ELOOP error when nesting of symbolic links exceed maximum -* -* ENVIRONMENTAL NEEDS -* None -* -* DETAILED DESCRIPTION -* -* Self-documenting code so see below -* -*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include /* open(2) system call */ -#include -#include -#include /* utime(2) system call */ -#include -#include /* stat(2) and lstat(2) system calls */ - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); -void help(); -void delete_files(); -void do_EEXIST(); -void do_ENOENT(); -void do_ELOOP(); -void do_ENOTDIR(); -void do_EXDEV(); -void do_ENAMETOOLONG(); -void do_EINVAL(); -void do_readlink(); -void do_stat(); -void do_chdir(); -void do_link(); -void do_unlink(); -void do_chmod(); -void do_utime(); -void do_rename(); -void do_open(); - -#define S_FILE "symbolic" /* Name of symbolic link file */ -#define O_FILE "object" /* Name of object file */ -#define A_S_FILE "asymbolic" /* Another name for a symbolic link file */ -#define Y_A_S_FILE "/NiCkEr" /* Yet another symbolic link file */ -#define BIG_STRING "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" - -#define DEFAULT_TCID "symlink01" -#define ALL 1 - -#define SYMLINK "symlink01" -#define READLINK "readlink01" -#define STAT "stat04" -#define LSTAT "lstat01" -#define MKDIR "mkdir05" -#define RMDIR "rmdir03" -#define CHDIR "chdir01" -#define LINK "link01" -#define UNLINK "unlink01" -#define CHMOD "chmod01" -#define UTIME "utime01" -#define RENAME "rename01" -#define OPEN "open01" - -#define cktcsid(s1,s2) (!strcmp(s1,s2)) -#define BUFMAX 512 -#define MODE 0700 -#define MASK 0100777 /* A regular file with r,w,x for all mask */ - -/* - * Lets be optimistic and only define messages for passing test cases - */ -const char *msgs[] = { - "Creation of symbolic link file to no object file is ok", - "Creation of symbolic link file and object file via symbolic link is ok", - "Creating an existing symbolic link file error is caught", - "Creating a symbolic link which exceeds maximum pathname error is caught", - "Reading of symbolic link file contents checks out ok", - "Reading a symbolic link which exceeds maximum pathname error is caught", - "Getting stat info about object file through symbolic link file is ok", - "Stat(2) error when accessing non-existent object through symbolic link is caught", - "lstat(2) of symbolic link file which points to no object file is ok", - "lstat(2) of symbolic link file which points at an object file is ok", - "mkdir(2) of object file through symbolic link file failed as expected", - "rmdir(2) of object file through symbolic link file failed as expected", - "chdir(2) to object file location through symbolic link file is ok", - "chdir(2) to non-existent object file location through symbolic link file failed as expected", - "link(2) to a symbolic link, which is pointing to an existing object file worked - file created and link count adjusted", - "link(2) to a symbolic link, which is pointing to a non-existing object file worked ok - file created and link count adjusted.", - "unlink(2) of symbolic link file with no object file removal is ok", - "chmod(2) of object file permissions through symbolic link file is ok", - "chmod(2) error when accessing non-existent object through symbolic link is caught", - "utime(2) change of object file access and modify times through symbolic link file is ok", - "utime(2) error when accessing non-existent object through symbolic link is caught", - "rename(3) of symbolic link file name which points at no object file is ok", - "rename(3) of symbolic link file name which points at object file is ok", - "rename(3) error of symbolic link file name across file systems is caught", - "open(2) with (O_CREAT | O_RDWR) to create object file through symbolic link file and all writes, reads, and lseeks are ok", - "open(2) with O_RDWR of existing object file through symbolic link file and all writes, reads, and lseeks are ok", - "open(2) with (O_CREAT | O_EXCL) error is caught when creating object file through symbolic link file", - "open(2) error with O_RDWR is caught when processing symbolic link file which points at no object file", - "Nested symbolic link access condition caught. ELOOP is returned", - "Reading a nonsymbolic link file error condition is caught. EINVAL is returned", - "lstat(2) of object file returns object file inode information", - "NULL" -}; - -/* - * Define test object setup and validation functions - */ -int creat_both(), creat_symlink(), creat_path_max(), ck_symlink(), - creat_object(), ck_object(), ck_both(), ck_path_max(); - - -/* - * Define test cases - */ -struct all_test_cases -{ - const char *tcid; - int test_fail; - int errno_val; - int pass_msg; - int (*test_setup)(); - int (*ck_test)(); - const char *fn_arg[3]; - -} test_objects[] = { - {SYMLINK, 0, 0, 0, creat_symlink, ck_symlink, {"%bc+eFhi!k", S_FILE, NULL}}, - {SYMLINK, 0, 0, 0, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {SYMLINK, 0, 0, 1, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {SYMLINK, 1, EEXIST, 2, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {SYMLINK, 1, ENAMETOOLONG, 3, creat_path_max, ck_path_max, {O_FILE, S_FILE, NULL}}, - {READLINK, 0, 0, 4, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {READLINK, 0, 0, 4, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {READLINK, 1, ENAMETOOLONG, 5, creat_path_max, ck_path_max, {O_FILE, S_FILE, NULL}}, - {READLINK, 1, EINVAL, 29, creat_object, ck_object, {O_FILE, NULL, NULL}}, - {STAT, 0, 0, 6, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {STAT, 1, ENOENT, 7, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {STAT, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}}, - {LSTAT, 0, 0, 8, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {LSTAT, 0, 0, 9, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {LSTAT, 0, 0, 30, creat_object, ck_object, {O_FILE, NULL, NULL}}, - {MKDIR, 1, EEXIST, 10, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {RMDIR, 1, ENOTDIR, 11, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {CHDIR, 0, 0, 12, creat_symlink, ck_symlink, {O_FILE, S_FILE, O_FILE}}, - {CHDIR, 1, ENOENT, 13, creat_symlink, ck_symlink, {"%bc+eFhi!k", S_FILE, NULL}}, - {CHDIR, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}}, - {LINK, 0, 0, 14, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {LINK, 0, 0, 15, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - /* The following link test case is invalid - leaving it defined so */ - /* I don't have to change all the entries in the all_tcses array after link */ - {LINK, -1, -1, -1, creat_symlink, ck_symlink, {NULL, NULL, NULL}}, - {UNLINK, 0, 0, 16, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {CHMOD, 0, 0, 17, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {CHMOD, 1, ENOENT, 18, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {CHMOD, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}}, - {UTIME, 0, 0, 19, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {UTIME, 1, ENOENT, 20, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {UTIME, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}}, - {RENAME, 0, 0, 21, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {RENAME, 0, 0, 22, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {RENAME, -1, EXDEV, 23, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {OPEN, 0, 0, 24, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {OPEN, 0, 0, 25, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}}, - {OPEN, -1, EEXIST, 26, creat_symlink, ck_symlink, {O_FILE, S_FILE, O_FILE}}, - {OPEN, 1, ENOENT, 27, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}}, - {OPEN, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}} -}; - -/* - * Define tcses - */ -struct tcses -{ - const char *tcid; - const char *syscall; - int test_cases; /* number of entries in test_objects array */ - struct all_test_cases *tc_ptr; - const char *desc; -} all_tcses[] = { - - { SYMLINK, "symlink", 5, &test_objects[0], - "Make a Symbolic Link to a File" }, - { READLINK, "readlink", 4, &test_objects[5], - "Reads Value of a Symbolic Link" }, - { STAT, "stat", 3, &test_objects[9], - "Gets File Status Indirectly From a Symbolic Link file" }, - { LSTAT, "lstat", 3, &test_objects[12], - "Get file Status About a Symbolic Link File" }, - { MKDIR, "mkdir", 1, &test_objects[15], - "Fail When Making a Directory File Indirectly from a symlink" }, - { RMDIR, "rmdir", 1, &test_objects[16], - "Fail When Removing a Directory File Indirectly from a symlink" }, - { CHDIR, "chdir", 3, &test_objects[17], - "Changes CWD Location Indirectly from a symlink" }, - { LINK, "link", 2, &test_objects[20], - "Creates a Link To a File Indirectly From a Symbolic" }, - { UNLINK, "unlink", 1, &test_objects[23], - "Removes a Link To a File but not the Object File" }, - { CHMOD, "chmod", 3, &test_objects[24], - "Change Object File Permissions Indirectly From a Symbolic" }, - { UTIME, "utime", 3, &test_objects[27], - "Set File Access And Modify Object File Times via symlink" }, - { RENAME, "rename", 3, &test_objects[30], - "Rename a Symbolic Link File And Not Any Object file" }, - { OPEN, "open", 5, &test_objects[33], - "Create/Open a File For Reading Or Writing via symlink" }, -}; - -/* - * Define GLOBAL variables - */ - -int TST_TOTAL; -int TEST_RESULT; -time_t a_time_value = 100; -const char *TCID = NULL; -char *Selectedtests = NULL; /* Name (tcid) of selected test cases */ -char test_msg[BUFMAX]; -char full_path[PATH_MAX+1]; -extern int Tst_count; -extern char *TESTDIR; -extern char *strrchr(); -extern int errno; - -struct stat asymlink, statter; -char Buffer[1024]; -char Buf[1024]; - -char *Tcid = NULL; - -option_t Options[] = { - { "T:", NULL, &Tcid }, /* -T tcid option */ - { NULL, NULL, NULL } -}; - -/*********************************************************************** - * MAIN - ***********************************************************************/ -int -main(int argc, char *argv[]) -{ - struct tcses *tcs_ptr, *get_tcs_info(); - int do_syscalltests(); - void cleanup(); - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - - /*************************************************************** - * parse standard options, and exit if there is an error - ***************************************************************/ - if ( (msg=parse_opts(argc, argv, Options, &help)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* - * If the -T option was used, use that TCID or use the default - */ - if ( Tcid != NULL ) { - TCID = Tcid; - Selectedtests=Tcid; - - } - else { - TCID = DEFAULT_TCID; -#ifndef ALL - Selectedtests = DEFAULT_TCID; -#else - Selectedtests = NULL; -#endif - } - - /* - * Get test case specification information and assign TST_TOTAL - */ - if ((tcs_ptr=get_tcs_info(Selectedtests)) == NULL) { - TST_TOTAL=1; - tst_brkm(TBROK, cleanup, - "Unknown symbolic link test case specification executed"); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - - setup(); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Execute tcs testing function and all defined test cases - */ - do_syscalltests(tcs_ptr); - - } /* End for TEST_LOOPING */ - - /* - * End appropriately - */ - cleanup(); - - return 0; -} - -/*********************************************************************** - * This function maps the name of the process to a test case specification - * defined in the all_tcses array of tcses structures. Either a pointer - * to the mapped test case specification information is returned or a - * null pointer. - * - * Argument is path to program name. - ***********************************************************************/ -struct tcses *get_tcs_info(ptr) -char *ptr; -{ - unsigned ctr; - struct tcses *tcs_ptr; - -#if ALL - if ( ptr == NULL ) { - - TST_TOTAL=0; - for (ctr=1; ctr < sizeof(all_tcses)/sizeof(struct tcses); ctr++) - TST_TOTAL += all_tcses[ctr].test_cases; - return all_tcses; - } -#endif - - - for(ctr=0; ctr < (sizeof(all_tcses)/sizeof(struct tcses)); ctr++) { - if ( strcmp(ptr, all_tcses[ctr].tcid) == 0 || - strcmp(ptr, all_tcses[ctr].syscall) == 0 ) { - tcs_ptr = &all_tcses[ctr]; - TCID = all_tcses[ctr].tcid; - TST_TOTAL=tcs_ptr->test_cases; - return(tcs_ptr); - } - - } - return(NULL); -} - -/*********************************************************************** - * Determines if what path points at is a symbolic link file - * - * Argument is path to symbolic link file. - * - * Return status is one if a symbolic link file. Zero if not a symbolic - * link file and a minus one if the path doesn't point at a file. - ***********************************************************************/ -int -see_if_a_symlink(path) -char *path; -{ - if (lstat(path, &asymlink) < 0) - return(-1); - - if ((asymlink.st_mode & S_IFMT) == S_IFLNK) - return(1); - else - return(0); -} - -/*********************************************************************** - * This function performs without any hesitation, file(s) deletions - ***********************************************************************/ -void -delete_files(path1, path2) -char *path1, *path2; -{ - unlink(path1); - unlink(path2); -} - -/*********************************************************************** - * - * This routine creates a symbolic link file. - * - * Argument one is symbolic link pathname to point at. - * Argument two is name of symbolic link file. - * - ***********************************************************************/ -int -creat_symlink(path1, path2) -char *path1, *path2; -{ - TEST( symlink(path1, path2) ); - errno=TEST_ERRNO; - if (TEST_RETURN == -1) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "symlink(2) Failure when creating setup %s object file: errno:%d %s", - path1, errno, strerror(errno)); - return(0); - } - else { - sprintf(Buf, "symlink(%s, %s) was succesful.\n", path1, path2); - strcat(Buffer, Buf); -#if DEBUG - tst_resm(TPASS, "symlink(%s, %s) was succesful.", path1, path2); -#endif - } - return(1); -} - -/*********************************************************************** - * - * This routine creates a regular file. - * - * Argument one is a pathname - * - ***********************************************************************/ -int -creat_object(path1) -char *path1; -{ - int fd; - if ((fd=creat(path1, MODE)) == -1) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "creat(2) Failure when creating setup %s object file: errno:%d %s", - path1, errno, strerror(errno)); - return(0); - } - else { - sprintf(Buf, "creat(%s, %#o) was succesful.\n", path1, MODE); - strcat(Buffer, Buf); -#if DEBUG - tst_resm(TPASS, "creat(%s, %#o) was succesful.", path1, MODE); -#endif - } - if (close(fd) == -1) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "close(2) Failure when closing setup %s object file: errno:%d %s", - path1, errno, strerror(errno)); - return(0); - } - return(1); -} - -/*********************************************************************** - * - * This routine creates a symbolic link file and a regular file. - * - * Argument one is a pathname of object file - * Argument two is symbolic link file name - * Argument three is regular file name - * - ***********************************************************************/ -int -creat_both(path1, path2, path3) -char *path1, *path2, *path3; -{ - if (creat_symlink(path1, path2) == -1) - return(0); - else if (creat_object(path3) == -1) - return(0); - return(1); -} - -/*********************************************************************** - * - * This routine checks if symbolic link file is a symbolic link file. - * - * Argument one is a pathname of object file - * Argument two is symbolic link file name - * Argument three is regular file name - * - ***********************************************************************/ -int -ck_symlink(path1, path2, path3) -char *path1, *path2, *path3; -{ - int ret; - - if ((ret=see_if_a_symlink(path2)) == -1) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "lstat(2) Failure when accessing %s symbolic link file which should contain %s path to %s file ", - path2, path1, path3); - return(0); - } - else if (ret == 0) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "%s is not a symbolic link file which contains %s path to %s file", - path2, path1, path3); - return(0); - } - return(1); -} - -/*********************************************************************** - * - * This routine checks if symbolic link file points at object file. - * - * Argument one is a pathname of object file - * Argument two is symbolic link file name - * Argument three is regular file name - * - ***********************************************************************/ -int -ck_both(path1, path2, path3) -char *path1, *path2, *path3; -{ - if (ck_symlink(path1, path2, path3) == 0) - return(0); - else if ((stat(path3, &statter) == -1) && (errno == ENOENT)) { - TEST_RESULT=TBROK; - sprintf(test_msg, "stat(2) Failure when accessing %s object file ", path3); - return(0); - } - else if ((stat(path2, &asymlink) == -1) && (errno == ENOENT)) { - TEST_RESULT=TBROK; - sprintf(test_msg, "stat(2) Failure when accessing %s symbolic link file ", - path2); - return(0); - } - else if (statter.st_ino != asymlink.st_ino) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "stat(2) Failure when accessing %s object file through %s symbolic link file ", - path3, path2); - return(0); - } - return(1); - -} - -/*********************************************************************** - * This routine populates full_path with a pathname whose length exceeds - * the PATH_MAX define value in param.h - * - * Argument one is a pathname of object file - * Argument two is symbolic link file name - * Argument three is regular file name - ***********************************************************************/ -int -creat_path_max(path1, path2, path3) -char *path1, *path2, *path3; -{ - int ctr, to_go, size, whole_chunks; - char buf [PATH_MAX]; - char *cwd; - - if ((cwd = getcwd(buf, sizeof (buf))) == NULL) - { - TEST_RESULT=TBROK; - sprintf(test_msg, - "getcwd(3) Failure in setup of %s %s %s test case object elements", - path1, path2, path3); - return(0); - } - size = strlen(cwd); - - to_go = PATH_MAX - size; - size = strlen(path1); - whole_chunks = to_go / size; - strcpy(full_path, cwd); - for (ctr=0; ctr < whole_chunks; ctr++) { - strcat(full_path, path1); - } - size= strlen(full_path); - to_go = PATH_MAX - size; - strcat(full_path, "/"); - for (ctr=0; ctr < to_go; ctr++) - strcat(full_path, "Z"); - - return(1); -} - -/*********************************************************************** - * This routine checks that full_path's length exceeds the PATH_MAX - * define value in param.h - * - * Argument one is a pathname of object file - * Argument two is symbolic link file name - * Argument three is regular file name - ***********************************************************************/ -int -ck_path_max(path1, path2, path3) -char *path1, *path2, *path3; -{ - if (strlen(full_path) == (PATH_MAX+1)) - return(1); - else - { - TEST_RESULT=TBROK; - sprintf(test_msg, "%s %d %s %s %s %s", - "full_path character array length was not", (PATH_MAX+1), - "characters long for test case object elements", - path1, path2, path3); - return(0); - } -} - -/*********************************************************************** - * This routine checks if the stat(2) and lstat(2) calls return the same - * information when the path is not a symbolic link file - * - * Argument one is a pathname of object file - * Argument two is symbolic link file name - * Argument three is regular file name - * - ***********************************************************************/ -int -ck_object(path1, path2, path3) -char *path1, *path2, *path3; -{ - int ret; - - if ((ret=see_if_a_symlink(path1)) < 0) { - TEST_RESULT=TFAIL; - sprintf(test_msg, - "lstat(2) failed to return inode information for a regular object file"); - return(0); - } - else if (ret == 1) { - TEST_RESULT=TFAIL; - sprintf(test_msg, - "lstat(2) detected a regular object file as a symbolic link file"); - return(0); - } - else if (stat(path1, &statter) == -1) { - TEST_RESULT=TBROK; - sprintf(test_msg, - "stat(2) failed to return inode information for a regular object file"); - return(0); - } - else if (bcmp((char *)&statter, (char *)&asymlink, sizeof(statter)) != 0) { - TEST_RESULT=TFAIL; - sprintf(test_msg, - "lstat(2) and stat(2) do not return same inode information for an object file"); - return(0); - - } - return(1); -} - -/*********************************************************************** - * Main test case processing function - * - * Argument is a ptr into the all_tcses array of structures of type tcses - ***********************************************************************/ -int -do_syscalltests(tcs) -struct tcses *tcs; -{ - int ctr, ret; - struct all_test_cases *tc_ptr; - - /* - * loop through desired number of test cases - */ - for (ctr=0, tc_ptr=tcs->tc_ptr; ctr < TST_TOTAL; ctr++, tc_ptr++) { - - if (tc_ptr->test_fail < 0) continue; - - Buffer[0]='\0'; - - /* - * If running all test cases for all tcid, set the TCID if needed. - */ - if ( Selectedtests == NULL ) { - if ( !TCID || strcmp(TCID, tc_ptr->tcid) != 0 ) { - TCID = tc_ptr->tcid; - Tst_count=0; - } - } - /* - * Insure that we are executing the correct tcs test case - */ - if (strcmp(TCID, tc_ptr->tcid) != 0) { - tst_resm(TBROK, "%s TCID attempted to execute %s %d %d test case", - TCID, tc_ptr->tcid, tc_ptr->test_fail, tc_ptr->errno_val); - continue; - } - TEST_RESULT=TPASS; - delete_files(S_FILE, O_FILE); - /* - * Perform test case setup - */ - ret = (tc_ptr->test_setup)(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1], - tc_ptr->fn_arg[2], tc_ptr->errno_val); - - /* If an expected error, try it out */ - - if (tc_ptr->test_fail) { - /* - * Try to perform test verification function - */ - if (! (tc_ptr->ck_test)(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1], - tc_ptr->fn_arg[2], tc_ptr->errno_val)) - tst_resm(TEST_RESULT, test_msg); - else if (tc_ptr->errno_val == EEXIST) - do_EEXIST(tc_ptr); - else if (tc_ptr->errno_val == ENOENT) - do_ENOENT(tc_ptr); - else if (tc_ptr->errno_val == ELOOP) - do_ELOOP(tc_ptr); - else if (tc_ptr->errno_val == ENOTDIR) - do_ENOTDIR(tc_ptr); - else if (tc_ptr->errno_val == EXDEV) - do_EXDEV(tc_ptr); - else if (tc_ptr->errno_val == ENAMETOOLONG) - do_ENAMETOOLONG(tc_ptr); - else if (tc_ptr->errno_val == EINVAL) - do_EINVAL(tc_ptr); - else - tst_resm(TBROK, "Test Case Declaration Error"); - } - else if (ret == 1) { /* No setup function error */ - - if (tc_ptr->errno_val != 0) - tst_resm(TBROK, "Test Case Declaration Error"); - else { - /* - * Perform test verification function - */ - ret=(tc_ptr->ck_test)(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1], - tc_ptr->fn_arg[2], tc_ptr->errno_val); - - /* Perform requested symbolic link system call test */ - - if ((cktcsid(tc_ptr->tcid, SYMLINK)) || - (cktcsid(tc_ptr->tcid, LSTAT))) { - if (ret == 1) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - tst_resm(TEST_RESULT, test_msg); - } - else if (ret == 0) - tst_resm(TEST_RESULT, test_msg); - else if (cktcsid(tc_ptr->tcid, READLINK)) - do_readlink(tc_ptr); - else if (cktcsid(tc_ptr->tcid, STAT)) - do_stat(tc_ptr); - else if (cktcsid(tc_ptr->tcid, CHDIR)) - do_chdir(tc_ptr); - else if (cktcsid(tc_ptr->tcid, LINK)) - do_link(tc_ptr); - else if (cktcsid(tc_ptr->tcid, UNLINK)) - do_unlink(tc_ptr); - else if (cktcsid(tc_ptr->tcid, CHMOD)) - do_chmod(tc_ptr); - else if (cktcsid(tc_ptr->tcid, UTIME)) - do_utime(tc_ptr); - else if (cktcsid(tc_ptr->tcid, RENAME)) - do_rename(tc_ptr); - else if (cktcsid(tc_ptr->tcid, OPEN)) - do_open(tc_ptr); - else - tst_resm(TBROK, "Unknown test case processing actions declared"); - } - } - else - tst_resm(TBROK, "Test Case Declaration Error"); - } - return(0); -} - -/*********************************************************************** - * This routine checks for the return of EEXIST errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_EEXIST(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (cktcsid(tc_ptr->tcid, SYMLINK)) { - - TEST( symlink(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1]) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == EEXIST)) - if ( STD_FUNCTIONAL_TEST ) - tst_resm(TPASS, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s", - "Expected EEXIST error when creating a symbolic link file", - "which already existed"); - } - else if (cktcsid(tc_ptr->tcid, MKDIR)) { - - TEST ( mkdir(tc_ptr->fn_arg[1],MODE) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == EEXIST)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else { - - tst_resm(TFAIL, "%s %s", - "Expected EEXIST error when creating a directory by a symbolic", - "link file which pointed at no object file"); - rmdir(tc_ptr->fn_arg[1]); - } - } - else if (cktcsid(tc_ptr->tcid, OPEN)) { - - TEST( open(tc_ptr->fn_arg[1], (O_EXCL | O_CREAT)) ) - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == EEXIST)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected EEXIST error for exclusively opening an object file", - "through a symbolic link file was not received:", - errno, strerror(errno)); - close (TEST_RETURN); - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks for the return of ENOENT errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_ENOENT(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (cktcsid(tc_ptr->tcid, STAT)) { - - if ((stat(tc_ptr->fn_arg[1], &asymlink) == -1) && (errno == ENOENT)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOENT error for stating a non-existent directory", - "through a symbolic link file was not received:", - errno, strerror(errno)); - } - else if (cktcsid(tc_ptr->tcid, CHDIR)) { - if ((chdir(tc_ptr->fn_arg[1]) == -1) && (errno == ENOENT)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else { - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOENT error for changing to a non-existent", - "directory through a symbolic link file was not received:", - errno, strerror(errno)); - chdir(TESTDIR); - } - } - else if (cktcsid(tc_ptr->tcid, LINK)) { - - if ((link(tc_ptr->fn_arg[1], "nick") == -1) && (errno == ENOENT)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - { - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOENT error condition when link(2) a symbolic", - "link which pointed at no object:", errno, strerror(errno)); - delete_files("nick", NULL); - } - } - else if (cktcsid(tc_ptr->tcid, CHMOD)) { - - if ((chmod(tc_ptr->fn_arg[1], MODE) == -1) && (errno == ENOENT)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOENT error condition when chmod(2) a symbolic", - "link which pointed at no object,", errno, strerror(errno)); - } - else if (cktcsid(tc_ptr->tcid, UTIME)) { - - if ((utime(tc_ptr->fn_arg[1], NULL) == -1) && (errno == ENOENT)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOENT error condition when utime(2) a symbolic", - "link which pointed at no object:", errno, strerror(errno)); - } - else if (cktcsid(tc_ptr->tcid, OPEN)) { - - if ((open(tc_ptr->fn_arg[1], O_RDWR) == -1) && (errno == ENOENT)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOENT error for opening a non-existent object", - " file through a symbolic link file was not received,", - errno, strerror(errno)); - close (TEST_RETURN); - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks for the return of ELOOP errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_ELOOP(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (cktcsid(tc_ptr->tcid, STAT)) { - - TEST( stat(tc_ptr->fn_arg[1], &asymlink) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == ELOOP)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, "%s errno:%d %s", - "Expected ELOOP errno from stat(2) (nested symb link),", - errno, strerror(errno)); - else - Tst_count++; - } - else if (cktcsid(tc_ptr->tcid, CHDIR)) { - - TEST( chdir(tc_ptr->fn_arg[1]) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == ELOOP)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else { - - tst_resm(TFAIL, "%s errno:%d %s", - "Expected ELOOP error condition when chdir(2) a nested symbolic link:", - errno, strerror(errno)); - chdir(TESTDIR); - } - } - else if (cktcsid(tc_ptr->tcid, LINK)) { - - TEST ( link(tc_ptr->fn_arg[1], O_FILE) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == ELOOP)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s errno:%d %s", - "Expected ELOOP error condition when link(2) a nested symbolic link:", - errno, strerror(errno)); - } - else if (cktcsid(tc_ptr->tcid, CHMOD)) { - - TEST ( chmod(tc_ptr->fn_arg[1], MODE) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == ELOOP)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s errno:%d %s", - "Expected ELOOP error condition when chmod(2) a nested symbolic link:", - errno, strerror(errno)); - return; - } - else if (cktcsid(tc_ptr->tcid, UTIME)) { - - TEST( utime(tc_ptr->fn_arg[1], NULL) ); - errno=TEST_ERRNO; - - if ((TEST_RETURN == -1) && (errno == ELOOP)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s errno:%d %s", - "Expected ELOOP error condition when utime(2) a nested symbolic link:", - errno, strerror(errno)); - } - else if (cktcsid(tc_ptr->tcid, OPEN)) { - - int fd; - TEST( open(tc_ptr->fn_arg[1], O_CREAT) ); - fd=TEST_RETURN; - errno=TEST_ERRNO; - if ((fd == -1) && (errno == ELOOP)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s errno:%d %s", - "Expected ELOOP error condition when open(2) a nested symbolic link:", - errno, strerror(errno)); - close (fd); - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks for the return of ENOTDIR errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_ENOTDIR(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (cktcsid(tc_ptr->tcid, RMDIR)) { - - TEST( mkdir(tc_ptr->fn_arg[0], MODE) ); - errno=TEST_ERRNO; - if (TEST_RETURN == -1) - tst_resm(TBROK, "mkdir(2) Failure when creating %s", - tc_ptr->fn_arg[0]); - else if ((rmdir(tc_ptr->fn_arg[1]) == -1) && (errno == ENOTDIR)) { - - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - rmdir(tc_ptr->fn_arg[0]); - } - else - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected ENOTDIR error for removing a non-existent", - "directory through a symbolic link file was not received,", - errno, strerror(errno)); - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks for the return of EXDEV errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_EXDEV(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (cktcsid(tc_ptr->tcid, RENAME)) { - - TEST( rename(tc_ptr->fn_arg[1], Y_A_S_FILE) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == EXDEV)) { - if (see_if_a_symlink(Y_A_S_FILE) == -1) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s %s file outside of current file system", - "rename(3) returned -1 when trying to move symbolic link file", - "outside of current file system, but created", Y_A_S_FILE); - } - else { - tst_resm(TFAIL, "%s %s errno:%d %s", - "Expected EXDEV error for renaming an existing symbolic", - "link file to a location outside of existing file system,", - errno, strerror(errno)); - delete_files("/NiCkEr", NULL); - } - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks for the return of ENAMETOOLONG errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_ENAMETOOLONG(tc_ptr) -struct all_test_cases *tc_ptr; -{ - int ret; - - if (cktcsid(tc_ptr->tcid, SYMLINK)) { - - TEST( symlink(tc_ptr->fn_arg[0], full_path) ); - errno=TEST_ERRNO; - if ((TEST_RETURN == -1) && (errno == ENAMETOOLONG)) - if (see_if_a_symlink(full_path) == -1) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s %d %s", - "symlink(2) returned -1 when trying to create a symbolic", - "link file whose name exceeded", (PATH_MAX+1), - "characters, but it created the symbolic link file"); - else - tst_resm(TFAIL, - "Expected ENAMETOOLONG error when creating %s symbolic link file with a path exceeding %d characters: errno:%d %s", - tc_ptr->fn_arg[1], (PATH_MAX+1), errno, strerror(errno)); - } - else if (cktcsid(tc_ptr->tcid, READLINK)) { - - char scratch[PATH_MAX+1]; - - ret=readlink(full_path, scratch, strlen(full_path)); - if (( ret == -1) && (errno == ENAMETOOLONG)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, - "Expected ENAMETOOLONG error when reading %s symbolic link file with a path exceeding %d characters: errno:%d %s", - tc_ptr->fn_arg[1], (PATH_MAX+1), errno, strerror(errno)); - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks for the return of EINVAL errno from requested - * system call - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_EINVAL(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (cktcsid(tc_ptr->tcid, READLINK)) { - TEST( readlink(tc_ptr->fn_arg[0], test_msg, BUFMAX) ); - errno=TEST_ERRNO; - if (TEST_RETURN == -1) { - if (errno == EINVAL) { - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - } else - tst_resm(TFAIL, "readlink(2) ret:-1, errno:%d, : Exp errno:%d", - errno, EINVAL); - } - else { - tst_resm(TFAIL, "readlink(2) did not returned -1 when reading %s", - "a file which is not a symbolic link file"); - } - } - else - tst_resm(TBROK, "Unknown test case processing actions declared"); -} - -/*********************************************************************** - * This routine checks out the readlink(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_readlink(tc_ptr) -struct all_test_cases *tc_ptr; -{ - char scratch[PATH_MAX]; - int ret; - - ret=readlink(tc_ptr->fn_arg[1], scratch, strlen(tc_ptr->fn_arg[0])); - - /*** the TEST macro cannot be used here for some reason ****/ - - if (ret == -1) { - tst_resm(TFAIL, - "readlink(2) failure on %s symbolic link file, errno=%d", - tc_ptr->fn_arg[1], errno); - - } - else if (strncmp(tc_ptr->fn_arg[0], scratch, - strlen(tc_ptr->fn_arg[0])) != 0) { - - /* Must null terminate scratch because readlink(2) doesn't */ - - scratch[strlen(tc_ptr->fn_arg[0])] = '\0'; - - tst_resm(TFAIL, - "readlink(2) Error : Expected %s symbolic link file contents but %s actual contents were returned", - tc_ptr->fn_arg[0], scratch); - } - else if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; -} - -/*********************************************************************** - * This routine checks out the stat(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_stat(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (statter.st_dev != asymlink.st_dev) - tst_resm(TFAIL, - "stat of symbolic link reference to object device info %ld != stat of object file device info %ld", - statter.st_dev, asymlink.st_dev); - - else if (statter.st_mode != asymlink.st_mode) - tst_resm(TFAIL, - "stat of symbolic link reference to object file permissions %ld != stat of object file permissions %ld", - statter.st_mode, asymlink.st_mode); - - else if (statter.st_nlink != asymlink.st_nlink) - tst_resm(TFAIL, - "stat of symbolic link reference to object file link count %ld != stat of object file link count %ld", - statter.st_nlink, asymlink.st_nlink); - - else if (statter.st_uid != asymlink.st_uid) - tst_resm(TFAIL, - "stat of symbolic link reference to object file uid %ld != stat of object file uid %ld", - statter.st_uid, asymlink.st_uid); - - else if (statter.st_gid != asymlink.st_gid) - tst_resm(TFAIL, - "stat of symbolic link reference to object file gid %ld != stat of object file gid %ld", - statter.st_gid, asymlink.st_gid); - - else if (statter.st_size != asymlink.st_size) - tst_resm(TFAIL, - "stat of symbolic link reference to object file size %ld != stat of object file size %ld", - statter.st_size, asymlink.st_size); - - else if (statter.st_atime != asymlink.st_atime) - tst_resm(TFAIL, - "stat of symbolic link reference to object access time %ld != stat of object file access time %ld", - statter.st_atime, asymlink.st_atime); - - else if (statter.st_mtime != asymlink.st_mtime) - tst_resm(TFAIL, - "stat of symbolic link reference to object modify time %ld != stat of object file modify time %ld", - statter.st_atime, asymlink.st_atime); - - else if (statter.st_ctime != asymlink.st_ctime) - tst_resm(TFAIL, - "stat of symbolic link reference to object change time %ld != stat of object file change time %ld", - statter.st_atime, asymlink.st_atime); - else if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; -} - -/*********************************************************************** - * This routine checks out the chdir(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_chdir(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (mkdir(tc_ptr->fn_arg[2],MODE) == -1) - tst_resm(TFAIL, "Could not create a setup directory file"); - else { - - sprintf(Buf, "mkdir(%s, %#o) was successful\n", tc_ptr->fn_arg[2],MODE); - strcat(Buffer, Buf); - - if (chdir(tc_ptr->fn_arg[1]) == -1) - tst_resm(TFAIL, "%sCould not change a directory file through a %s", - Buffer, "symbolic link which which pointed at object"); - else { - - char buf [PATH_MAX]; - char *cwd; - char expected_location[PATH_MAX]; - /* - * Build expected current directory position - */ - strcpy(expected_location, TESTDIR); - strcat(expected_location, "/"); - strcat(expected_location, tc_ptr->fn_arg[2]); - - if ((cwd = getcwd(buf, sizeof (buf))) == NULL) - tst_resm(TFAIL, "getcwd(3) FAILURE"); - else if (strcmp(cwd, expected_location) == 0) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else { - tst_resm(TFAIL, "%s%s %s %s not equal to expected %s", Buffer, - "chdir(2) returned successfully, but getcwd(3) indicated", - "new current working directory location", cwd, expected_location); - } - chdir(TESTDIR); - } - rmdir(tc_ptr->fn_arg[2]); - } -} - -/*********************************************************************** - * This routine checks out the link(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_link(tc_ptr) -struct all_test_cases *tc_ptr; -{ - struct stat stbuf; - - if (link(tc_ptr->fn_arg[1], "nick") == -1) { - tst_resm(TFAIL, "%slink(%s, \"nick\") failed, errno: %d\n%s %s", - Buffer, tc_ptr->fn_arg[1], errno, - "link of new file to object file via symbolic link file failed", - "when expected not to"); - } - else { - sprintf(Buf, "link(%s, \"nick\") was successful\n", tc_ptr->fn_arg[1]); - strcat(Buffer, Buf); - - if ( STD_FUNCTIONAL_TEST ) { - /* - * Check that links counts were properly set - */ - if (lstat(tc_ptr->fn_arg[1], &asymlink) == -1) { - tst_resm(TBROK, "lstat(%s) failed. errno: %d", - tc_ptr->fn_arg[1], errno); - - } else if (lstat("nick", &statter) == -1) { - tst_resm(TBROK, "lstat(nick) failed, errno:%d", errno); - } else { - if (statter.st_ino == asymlink.st_ino) { - if ((statter.st_nlink ==2) && (asymlink.st_nlink == 2)) { - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - } else { - lstat(tc_ptr->fn_arg[2], &stbuf); - - tst_resm(TFAIL, - "%slink(%s, %s) failed to adjust link count.\n\ - count for nick is %d, count for %s is %d, count for %s is %d.", - Buffer, tc_ptr->fn_arg[1], "nick", - statter.st_nlink, tc_ptr->fn_arg[1], asymlink.st_nlink, - tc_ptr->fn_arg[2], stbuf.st_nlink); - } - } else { - tst_resm(TFAIL, - "%sA lstat of %s (ino:%llu) and of\n\t\t\ -%s (ino:%llu), does not show them being the same ino.", Buffer, - tc_ptr->fn_arg[1], asymlink.st_ino, "nick", statter.st_ino); - } - } - } - delete_files("nick", NULL); - } -} - -/*********************************************************************** - * This routine checks out the unlink(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_unlink(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (stat(tc_ptr->fn_arg[2], &asymlink) == -1) - tst_resm(TBROK, - "stat(2) Failure when accessing %s object file", tc_ptr->fn_arg[2]); - else if (unlink(tc_ptr->fn_arg[1]) == -1) - tst_resm(TFAIL, "unlink(2) failed when removing symbolic link file"); - else { - sprintf(Buf, "unlink(%s) was successful\n", tc_ptr->fn_arg[1]); - strcat(Buffer, Buf); - if (stat(tc_ptr->fn_arg[2], &statter) == -1) - tst_resm(TFAIL,"%s %s", - "unlink(2) failed because it not only removed symbolic link", - "file which pointed at object file, but object file as well"); - - else - if ((statter.st_ino == asymlink.st_ino) && - (statter.st_dev == asymlink.st_dev) && - (statter.st_size == asymlink.st_size)) - - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s%s %s %s", Buffer, - "unlink(2) failed because it not only removed symbolic link", - "file which pointed at object file, but it changed object", - "file inode information"); - } - -} - -/*********************************************************************** - * This routine checks out the chmod(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_chmod(tc_ptr) -struct all_test_cases *tc_ptr; -{ - if (stat(tc_ptr->fn_arg[2], &asymlink) == -1) - tst_resm(TBROK, - "stat(2) Failure when accessing %s object file", tc_ptr->fn_arg[2]); - else if (chmod(tc_ptr->fn_arg[1], (MODE | MASK)) == -1) - tst_resm(TFAIL, "%s%s %s", Buffer, - "chmod(2) failed when changing file permission", - "through symbolic link file"); - else { - sprintf(Buf, "chmod(%s, %#o) was successful\n", tc_ptr->fn_arg[1], - (MODE | MASK)); - strcat(Buffer, Buf); - - if (stat(tc_ptr->fn_arg[2], &statter) == -1) - tst_resm(TBROK, - "stat(2) Failure when accessing %s object file", tc_ptr->fn_arg[2]); - else - if ((statter.st_mode == (MODE | MASK)) && - (statter.st_mode != asymlink.st_mode)) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s%s %o to %o %s", Buffer, - "chmod(2) failed to change object file permissions from", - asymlink.st_mode, (MODE | MASK), - "through symbolic link file"); - } - -} - -/*********************************************************************** - * This routine checks out the utime(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_utime(tc_ptr) -struct all_test_cases *tc_ptr; -{ - struct utimbuf utimes; - - if (stat(tc_ptr->fn_arg[2], &asymlink) == -1) - tst_resm(TBROK, "stat(2) Failure when accessing %s object file", - tc_ptr->fn_arg[2]); - else { - /* Now add a few values to access and modify times */ - - utimes.actime = asymlink.st_atime + a_time_value; - utimes.modtime = asymlink.st_mtime + a_time_value; - - /* Now hand off to utime(2) via symbolic link file*/ - - if (utime(tc_ptr->fn_arg[1], &utimes) == -1) - tst_resm(TFAIL, "%s %s", - "utime(2) failed to process object file access and modify", - "time updates through symbolic link"); - else { - /* Now verify changes were made */ - - if (stat(tc_ptr->fn_arg[2], &statter) == -1) - tst_resm(TBROK, - "stat(2) Failure when accessing %s object file", - tc_ptr->fn_arg[2]); - else { - time_t temp, diff; - - temp = statter.st_atime - asymlink.st_atime; - diff = (statter.st_mtime - asymlink.st_mtime) - temp; - - if (! diff) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, "%s %s %d greater than original times", - "utime(2) failed to change object file access and", - "modify times through symbolic link to a value", - a_time_value); - } - } - } -} - -/*********************************************************************** - * This routine checks out the rename(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_rename(tc_ptr) -struct all_test_cases *tc_ptr; -{ - int pts_at_object = 0; - - - if (stat(tc_ptr->fn_arg[2], &statter) != -1) - pts_at_object=1; - - TEST (rename(tc_ptr->fn_arg[1], A_S_FILE) ); - errno=TEST_ERRNO; - if (TEST_RETURN == -1) - tst_resm(TFAIL, "rename(3) failed to rename %s symbolic link file to %s", - tc_ptr->fn_arg[2], A_S_FILE); - else if (pts_at_object) - if (ck_both(tc_ptr->fn_arg[0], A_S_FILE, tc_ptr->fn_arg[2])) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, test_msg); - else if ( ! ck_symlink(tc_ptr->fn_arg[0], A_S_FILE, NULL)) - tst_resm(TFAIL, test_msg); - else if (stat(tc_ptr->fn_arg[1], &asymlink) != -1) - tst_resm(TFAIL, - "rename(3) did not remove %s when renaming to %s", - tc_ptr->fn_arg[1], A_S_FILE); - else if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; -} - -/*********************************************************************** - * This routine checks out the open(2) system call for a successful - * invocation - * - * Argument is pointer to test_objects array of structures of type - * all_test_cases - ***********************************************************************/ -void -do_open(tc_ptr) -struct all_test_cases *tc_ptr; -{ - int fd = -1; - int ret, pts_at_object = 0; - char scratch[PATH_MAX]; - - - if (stat(tc_ptr->fn_arg[2], &statter) != -1) - pts_at_object=1; - - if (pts_at_object) { - TEST( open(tc_ptr->fn_arg[1], O_RDWR) ); - errno=TEST_ERRNO; - if ((fd=TEST_RETURN) == -1) { - tst_resm(TFAIL, - "open(2) Failure when opening object file through symbolic link file"); - return; - } - } - else { - TEST(open(tc_ptr->fn_arg[1], (O_CREAT | O_RDWR), MODE) ); - errno=TEST_ERRNO; - if ((fd=TEST_RETURN) == -1) { - tst_resm(TFAIL, - "open(2) Failure when creating object file through symbolic link file"); - return; - } - } - if ((ret=write(fd, BIG_STRING, strlen(BIG_STRING))) == -1) { - tst_resm(TFAIL, - "write(2) Failure to object file opened through a symbolic link file: errno:%d", - errno); - } - else if (ret != strlen(BIG_STRING)) { - tst_resm(TFAIL, - "write(2) Failed to write %d bytes to object file opened through a symbolic link file", - strlen(BIG_STRING)); - } - else if (lseek(fd, 0L, 0) == -1) { - tst_resm(TFAIL, - "lseek(2) Failed to position to beginning of object file opened through a symbolic link file: errno = %d", - errno); - } - else if ((ret=read(fd, scratch, strlen(BIG_STRING))) == -1) { - tst_resm(TFAIL, - "read(2) Failure of object file opened through a symbolic link file: errno = %d", - errno); - } - else if (ret != strlen(BIG_STRING)) { - tst_resm(TFAIL, - "read(2) Failed to read %d bytes to object file opened through a symbolic link file", - strlen(BIG_STRING)); - } - else if (strncmp(BIG_STRING, scratch, strlen(BIG_STRING)) != 0) { - tst_resm(TFAIL, - "Content of write(2) and read(2) Failed to object file through symbolic link file was not as expected. Expected %s and read returned %s", - BIG_STRING, scratch); - } - else { - /* - * Close off symbolic link file to object file access - */ - if (close(fd) == -1) { - tst_resm(TFAIL, - "close(2) Failure when closing object file accessed symbolic link file"); - } - /* - * Now, lets open up and read object file and compare contents - */ - else if ((fd=open(tc_ptr->fn_arg[0], O_RDONLY)) == -1) { - tst_resm(TFAIL, "open(2) Failure when opening %s file: errno:%d %s", - tc_ptr->fn_arg[0], errno, strerror(errno)); - } - else if ((ret=read(fd, scratch, strlen(BIG_STRING))) == -1) { - tst_resm(TFAIL, - "read(2) Failure of object file opened through a symbolic link file: errno:%d", errno); - } - else if (ret != strlen(BIG_STRING)) { - tst_resm(TFAIL, - "read(2) Failed to read %d bytes to object file opened through a symbolic link file", - strlen(BIG_STRING)); - } - else if (strncmp(BIG_STRING, scratch, strlen(BIG_STRING)) != 0) { - tst_resm(TFAIL, - "Content of write(2) and read(2) Failed to object file through symbolic link file was not as expected. Expected %s and read returned %s", - BIG_STRING, scratch); - } - else if (pts_at_object) { - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - } - else { /* Insure newly created object file is pointed at */ - if (ck_both(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1], tc_ptr->fn_arg[0])) - if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST ) - tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]); - else - Tst_count++; - else - tst_resm(TFAIL, test_msg); - } - close(fd); - } -} - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* create a temporary directory and go to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* remove temporary directory and all files in it. */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - - -/* - * - */ -void help() -{ - unsigned ind; - - printf(" -T id Determines which tests cases to execute:\n"); - - for (ind=0; ind -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="symlink02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255], symlnk[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call symlink(2) - */ - TEST(symlink(fname, symlnk)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "symlink(%s, %s) Failed, errno=%d : %s", - fname, symlnk, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "symlink(%s, %s) returned %d", - fname, symlnk, TEST_RETURN); - } - if (unlink(symlnk) == -1) { - tst_brkm(TBROK, cleanup, - "unlink(%s) Failed, errno=%d : %s", - symlnk, errno, strerror(errno)); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(fname,"tfile_%d",getpid()); - if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - - if (close(fd) == -1 ) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - sprintf(symlnk,"st_%d",getpid()); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/symlink03.c b/winsup/testsuite/winsup.api/ltp/symlink03.c deleted file mode 100644 index 4d0542768..000000000 --- a/winsup/testsuite/winsup.api/ltp/symlink03.c +++ /dev/null @@ -1,404 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name : symlink03 - * - * Test Description : - * Verify that, - * 1) symlink(2) returns -1 and sets errno to EACCES if search/write - * permission is denied in the directory where the symbolic link is - * being created. - * 2) symlink(2) returns -1 and sets errno to EEXIST if the specified - * symbolic link already exists. - * 3) symlink(2) returns -1 and sets errno to EFAULT if the specified - * file or symbolic link points to invalid address. - * 4) symlink(2) returns -1 and sets errno to ENAMETOOLONG if the - * pathname component of symbolic link is too long (ie, > PATH_MAX). - * 5) symlink(2) returns -1 and sets errno to ENOTDIR if the directory - * component in pathname of symbolic link is not a directory. - * 6) symlink(2) returns -1 and sets errno to ENOENT if the component of - * symbolic link points to an empty string. - * - * Expected Result: - * symlink() should fail with return value -1 and set expected errno. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * if errno set == expected errno - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call fails with unexpected errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory(s)/file(s) created. - * - * Usage: - * symlink03 [-c n] [-e] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * This test should be executed by 'non-super-user' only. - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define MODE_RWX S_IRWXU | S_IRWXG | S_IRWXO -#define FILE_MODE S_IRUSR | S_IRGRP | S_IROTH -#define DIR_TEMP "testdir_1" -#define TESTFILE "testfile" -#define TEST_FILE1 "testdir_1/tfile_1" -#define SYM_FILE1 "testdir_1/sfile_1" -#define TEST_FILE2 "tfile_2" -#define SYM_FILE2 "sfile_2" -#define TEST_FILE3 "tfile_3" -#define SYM_FILE3 "t_file/sfile_3" - -const char *TCID="symlink03"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={ENOTDIR, ENOENT, ENAMETOOLONG, EFAULT, EEXIST, EACCES, 0}; - -int no_setup(); -int setup1(); /* setup function to test symlink for EACCES */ -int setup2(); /* setup function to test symlink for EEXIST */ -int setup3(); /* setup function to test symlink for ENOTDIR */ -int longpath_setup(); /* setup function to test chmod for ENAMETOOLONG */ - -char Longpathname[PATH_MAX+2]; -char High_address_node[64]; - -struct test_case_t { /* test case struct. to hold ref. test cond's*/ - const char *file; - const char *link; - const char *desc; - int exp_errno; - int (*setupfunc)(); -} Test_cases[] = { - { TEST_FILE1, SYM_FILE1, "No Search permissions to process", EACCES, setup1 }, - { TEST_FILE2, SYM_FILE2, "Specified symlink already exists", EEXIST, setup2 }, - { TESTFILE, High_address_node, "Address beyond address space", EFAULT, no_setup }, - { TESTFILE, (char *)-1, "Negative address", EFAULT, no_setup }, - { TESTFILE, Longpathname, "Symlink path too long", ENAMETOOLONG, longpath_setup }, - { TESTFILE, "", "Symlink Pathname is empty", ENOENT, no_setup }, -#ifndef __CYGWIN__ - { TEST_FILE3, SYM_FILE3, "Symlink Path contains regular file", ENOTDIR, setup3 }, -#endif - { NULL, NULL, NULL, 0, no_setup } -}; - -extern void setup(); /* Setup function for the test */ -void cleanup() __attribute__((noreturn));/* Cleanup function for the test */ -char *get_high_address (void); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *test_file; /* testfile name */ - const char *sym_file; /* symbolic link file name */ - const char *test_desc; /* test specific error message */ - int ind; /* counter to test different test conditions */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - /*NOTREACHED*/ - } - - /* - * Invoke setup function to call individual test setup functions - * to simulate test conditions. - */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - test_file = Test_cases[ind].file; - sym_file = Test_cases[ind].link; - test_desc = Test_cases[ind].desc; - - if (sym_file == High_address_node) { - sym_file = (char *)get_high_address(); - } - /* - * Call symlink(2) to test different test conditions. - * verify that it fails with -1 return value and sets - * appropriate errno. - */ - TEST(symlink(test_file, sym_file)); - - /* Check return code of symlink(2) */ - if (TEST_RETURN == -1) { - /* - * Perform functional verification if - * test executed without (-f) option. - */ - TEST_ERROR_LOG(TEST_ERRNO); - if (TEST_ERRNO == Test_cases[ind].exp_errno) { - tst_resm(TPASS, "symlink() Fails, %s, " - "errno=%d", test_desc, - TEST_ERRNO); - } else { - tst_resm(TFAIL, "symlink() Fails, %s, " - "errno=%d, expected errno=%d", - test_desc, TEST_ERRNO, - Test_cases[ind].exp_errno); - } - } else { - tst_resm(TFAIL, "symlink() returned %d, " - "expected -1, errno:%d", TEST_RETURN, - Test_cases[ind].exp_errno); - } - } /* End of TEST CASE LOOPING. */ - - Tst_count++; /* incr. TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Call test specific setup functions. - */ -void -setup() -{ - int ind; - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* call individual setup functions */ - for (ind = 0; Test_cases[ind].desc != NULL; ind++) { - Test_cases[ind].setupfunc(); - } -} /* End setup() */ - -/* - * int - * no_setup() - Some test conditions for mknod(2) do not any setup. - * Hence, this function just returns 0. - * This function simply returns 0. - */ -int -no_setup() -{ - return 0; -} - -/* - * int - * setup1() - setup function for a test condition for which symlink(2) - * returns -1 and sets errno to EACCES. - * Create a test directory under temporary directory and create a test file - * under this directory with mode "0666" permissions. - * Modify the mode permissions on test directory such that process will not - * have search permissions on test directory. - * - * The function returns 0. - */ -int -setup1() -{ - int fd; /* file handle for testfile */ - - if (mkdir(DIR_TEMP, MODE_RWX) < 0) { - tst_brkm(TBROK, cleanup, "mkdir(2) of %s failed", DIR_TEMP); - /*NOTREACHED*/ - } - - if ((fd = open(TEST_FILE1, O_RDWR|O_CREAT, 0666)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0666) failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - /*NOTREACHED*/ - } - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Modify mode permissions on test directory */ - if (chmod(DIR_TEMP, FILE_MODE) < 0) { - tst_brkm(TBROK, cleanup, "chmod(2) of %s failed", DIR_TEMP); - /*NOTREACHED*/ - } - return 0; -} - -/* - * int - * setup2() - EEXIST - */ -int -setup2() -{ - int fd; /* file handle for testfile */ - - if ((fd = open(TEST_FILE2, O_RDWR|O_CREAT, 0666)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, 0666) failed, errno=%d : %s", - TEST_FILE1, errno, strerror(errno)); - /*NOTREACHED*/ - } - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TEST_FILE2, errno, strerror(errno)); - /*NOTREACHED*/ - } - - if (symlink(TEST_FILE2, SYM_FILE2) < 0) { - tst_brkm(TBROK, cleanup, - "symlink() Fails to create %s in setup2, error=%d", - SYM_FILE2, errno); - /*NOTREACHED*/ - } - return 0; -} - -/* - * int - * longpath_setup() - setup to create a node with a name length exceeding - * the MAX. length of PATH_MAX. - * This function retruns 0. - */ -int -longpath_setup() -{ - int ind; /* counter variable */ - - for (ind = 0; ind <= (PATH_MAX + 1); ind++) { - Longpathname[ind] = 'a'; - } - return 0; -} - -/* - * int - * setup3() - setup function for a test condition for which symlink(2) - * returns -1 and sets errno to ENOTDIR. - * - * Create a symlink file under temporary directory so that test tries to - * create symlink file "tfile_3" under "t_file" which happens to be - * another symlink file. - */ -int -setup3() -{ - int fd; /* file handle for testfile */ - - /* Creat/open a testfile and close it */ - if ((fd = open("t_file", O_RDWR|O_CREAT, MODE_RWX)) == -1) { - tst_brkm(TBROK, cleanup, - "open(2) on t_file failed, errno=%d : %s", - errno, strerror(errno)); - /*NOTREACHED*/ - } - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, "close(t_file) Failed, errno=%d : %s", - errno, strerror(errno)); - /*NOTREACHED*/ - } - return 0; -} - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Restore the mode permissions on test directory. - * Remove the temporary directory created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Restore mode permissions on test directory created in setup2() */ - if (chmod(DIR_TEMP, MODE_RWX) < 0) { - tst_brkm(TBROK, NULL, "chmod(2) of %s failed", DIR_TEMP); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/symlink04.c b/winsup/testsuite/winsup.api/ltp/symlink04.c deleted file mode 100644 index c6ddd0630..000000000 --- a/winsup/testsuite/winsup.api/ltp/symlink04.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name : symlink01 - * - * Test Description : - * Verify that, symlink will succeed to creat a symbolic link of an existing - * object name path. - * - * Expected Result: - * symlink() should return value 0 on success and symbolic link of an - * existing object should be created. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * symlink01 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * None. - * - */ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" -#define SYMFILE "slink_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="symlink01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; - -extern void setup(); /* Setup function for the test */ -void cleanup() __attribute__((noreturn));/* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - /*NOTREACHED*/ - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call symlink(2) to create a symlink of - * testfile. - */ - TEST(symlink(TESTFILE, SYMFILE)); - - /* Check return code of symlink(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "symlink(%s, %s) Failed, errno=%d : %s", - TESTFILE, SYMFILE, TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the symlink file status information - * using lstat(2). - */ - if (lstat(SYMFILE, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "lstat(2) of " - "%s failed, error:%d", SYMFILE, - errno); - /*NOTREACHED*/ - } - - /* Check if the st_mode contains a link */ - if (!S_ISLNK(stat_buf.st_mode)) { - tst_resm(TFAIL, - "symlink of %s doesn't exist", - TESTFILE); - } else { - tst_resm(TPASS, "symlink(%s, %s) " - "functionality successful", - TESTFILE, SYMFILE); - } - } else { - tst_resm(TPASS, "Call succeeded"); - } - } - - /* Unlink the symlink file for next loop */ - if (unlink(SYMFILE) == -1) { - tst_brkm(TBROK, cleanup, - "unlink(%s) Failed, errno=%d : %s", - SYMFILE, errno, strerror(errno)); - /*NOTREACHED*/ - } - Tst_count++; /* incr TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and close it - */ -void -setup() -{ - int fd; /* file handle for testfile */ - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* creat/open a testfile */ - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Close the temporary file created above */ - if (close(fd) == -1) { - tst_resm(TBROK, "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } -} /* End setup() */ - - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/symlink05.c b/winsup/testsuite/winsup.api/ltp/symlink05.c deleted file mode 100644 index 3b2bbcb8c..000000000 --- a/winsup/testsuite/winsup.api/ltp/symlink05.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name : symlink02 - * - * Test Description : - * Verify that, symlink will succeed to creat a symbolic link of an - * non-existing object name path. - * - * Expected Result: - * symlink() should return value 0 on success and symlink of an - * non-existing object should be created. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * symlink02 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * This test should be run by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" -#define SYMFILE "slink_file" - -const char *TCID="symlink02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; - -extern void setup(); /* Setup function for the test */ -void cleanup() __attribute__((noreturn));/* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat structure buffer */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - /*NOTREACHED*/ - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call symlink(2) to create a symlink of - * an non-existing testfile. - */ - TEST(symlink(TESTFILE, SYMFILE)); - - /* Check return code of symlink(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, \ - "symlink(%s, %s) Failed, errno=%d : %s", - TESTFILE, SYMFILE, TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the symlink file status information - * using lstat(2). - */ - if (lstat(SYMFILE, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "lstat(2) of " - "%s failed, error:%d", - SYMFILE, errno); - /*NOTREACHED*/ - } - - /* Check if the st_mode contains a link */ - if (!S_ISLNK(stat_buf.st_mode)) { - tst_resm(TFAIL, \ - "symlink of %s doesn't exist", - TESTFILE); - } else { - tst_resm(TPASS, "symlink(%s, %s) " - "functionality successful", - TESTFILE, SYMFILE); - } - } else { - tst_resm(TPASS, "Call succeeded"); - } - } - - /* Unlink the symlink file for next loop */ - if (unlink(SYMFILE) == -1) { - tst_brkm(TBROK, cleanup, - "unlink(%s) Failed, errno=%d : %s", - SYMFILE, errno, strerror(errno)); - } - Tst_count++; /* incr TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - -} /* End setup() */ - - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the temporary directory created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/sync01.c b/winsup/testsuite/winsup.api/ltp/sync01.c deleted file mode 100644 index c7df322ea..000000000 --- a/winsup/testsuite/winsup.api/ltp/sync01.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : sync01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for sync(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) sync(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the sync(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * sync(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="sync01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call sync(2) - */ - TEST_VOID(sync()); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "sync() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "sync() returned %d", TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/sync02.c b/winsup/testsuite/winsup.api/ltp/sync02.c deleted file mode 100644 index 5535e1add..000000000 --- a/winsup/testsuite/winsup.api/ltp/sync02.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: sync01 - * - * Test Description: - * Open a file for write; modify the file, then do a sync(). - * Verify that the data has been written to disk by re-opening the file. - * - * Expected Result: - * sync() alawys returns 0 in Linux. The data written to the file should - * be updated to the disk. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * sync01 [-c n] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * None. - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE "temp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -const char *TCID="sync01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -char write_buffer[BUFSIZ]; /* buffer used to write data to file*/ -int fildes; /* file descriptor for temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - char read_buffer[BUFSIZ]; /* buffer used to read data from file*/ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* Perform global setup for test */ - setup(); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call sync(2) to commit buffer data to disk. - */ - TEST_VOID(sync()); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "%s, Failed, errno=%d : %s", - TCID, TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* Set the file ptr to b'nning of file */ - if (lseek(fildes, 0, SEEK_SET) < 0) { - tst_brkm(TFAIL, cleanup, "lseek() " - "failed on %s, error=%d", - TEMP_FILE, errno); - /*NOTREACHED*/ - } - - /* Read the contents of file */ - if (read(fildes, read_buffer, \ - sizeof(read_buffer)) > 0) { - if (memcmp(read_buffer, write_buffer, strlen(write_buffer))) { - tst_resm(TFAIL, "Data read " - "from %s doesn't match " - "with witten data", - TEMP_FILE); - } else { - tst_resm(TPASS, "Functionality " - "of sync() successful"); - } - } else { - tst_brkm(TFAIL, cleanup, - "read() Fails on %s, error=%d", - TEMP_FILE, errno); - /*NOTREACHED*/ - } - } else { - tst_resm(TPASS, "call succeeded"); - } - } - Tst_count++; /* incr. TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Copy some data into data buffer */ - strcpy(write_buffer, "abcdefghijklmnopqrstuvwxyz"); - - /* Creat a temporary file under above directory */ - if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR | O_CREAT, %#o) Failed, errno=%d :%s", - TEMP_FILE, FILE_MODE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Write the buffer data into file */ - if (write(fildes, write_buffer, strlen(write_buffer)) != \ - (int)strlen(write_buffer)) { - tst_brkm(TBROK, cleanup, - "write() failed to write buffer data to %s", - TEMP_FILE); - /*NOTREACHED*/ - } - -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Close the temporary file */ - if (close(fildes) == -1) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s", - TEMP_FILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/time01.c b/winsup/testsuite/winsup.api/ltp/time01.c deleted file mode 100644 index c5658e260..000000000 --- a/winsup/testsuite/winsup.api/ltp/time01.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : time01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for time(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) time(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the time(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * time(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="time01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call time(2) - */ - TEST(time(0)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "time(0) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "time(0) returned %d", TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - void trapper(); - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/time02.c b/winsup/testsuite/winsup.api/ltp/time02.c deleted file mode 100644 index 011546e8f..000000000 --- a/winsup/testsuite/winsup.api/ltp/time02.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: time01 - * - * Test Description: - * Verify that time(2) returns the value of time in seconds since - * the Epoch and stores this value in the memory pointed to by the parameter. - * - * Expected Result: - * time() should return the time (seconds) since the Epoch and this value - * should be equal to the value stored in the specified parameter. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * - * Usage: - * time01 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * None. - * - */ - -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -extern void setup(); /* setup function for the test */ -void cleanup(void) __attribute__((noreturn));/* cleanup function for the test */ - -const char *TCID="time01"; /* Test program identifier. */ -int TST_TOTAL = 1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - time_t tloc; /* time_t variables for time(2) */ - - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc=0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call time() to get the time in seconds - * since Epoch. - */ - TEST(time(&tloc)); - - /* Check return code from time(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "time(0) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test executed - * without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - if (tloc == TEST_RETURN) { - tst_resm(TPASS, "time() returned value " - "%d, stored value %d are same", - TEST_RETURN, tloc); - } else { - tst_resm(TFAIL, "time() returned value " - "%d, stored value %d are " - "different", TEST_RETURN, tloc); - } - } else { - tst_resm(TPASS, "call succeeded"); - } - - } - Tst_count++; /* incr. TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* cleanup and exit */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * setup() - performs all ONE TIME setup for this test. - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/times01.c b/winsup/testsuite/winsup.api/ltp/times01.c deleted file mode 100644 index a1bd1d838..000000000 --- a/winsup/testsuite/winsup.api/ltp/times01.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : times01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for times(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) times(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the times(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * times(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="times01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -struct tms mytimes; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call times(2) - */ - TEST(times(&mytimes)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "times(&mytimes) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "times(&mytimes) returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - void trapper(); - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/times02.c b/winsup/testsuite/winsup.api/ltp/times02.c deleted file mode 100644 index 1dae36c5a..000000000 --- a/winsup/testsuite/winsup.api/ltp/times02.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * times02.c - * - * DESCRIPTION - * Testcase to test that times() sets errno correctly - * - * ALGORITHM - * block1: Pass an invalid address as the "tms" structure, and expect - * that times() would return EFAULT. - * - * USAGE: - * times02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * NONE - */ - -#include -#include -#include -#include - -const char *TCID = "times02"; -int TST_TOTAL = 1; -extern int Tst_count; -int exp_enos[]={EFAULT, 0}; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int argc, char **argv) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /* parse standard options */ - if ((msg = parse_opts(argc, argv, (option_t *)NULL, NULL)) != - (char *)NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - /* check for looping state if -i option is given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - TEST(times((void *)-1)); - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - if (errno != EFAULT) { - tst_resm(TFAIL, "Expected EFAULT, got %d", - errno); - } else { - tst_resm(TPASS, "Received EFAULT as expected"); - } - - } else { - tst_resm(TFAIL, "times(2) failed to FAIL"); - } - - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - * performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -c option. - */ - TEST_PAUSE; -} - -/* - * cleanup() - * performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); - /*NOTREACHED*/ -} diff --git a/winsup/testsuite/winsup.api/ltp/times03.c b/winsup/testsuite/winsup.api/ltp/times03.c deleted file mode 100644 index 453d311cc..000000000 --- a/winsup/testsuite/winsup.api/ltp/times03.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * times01.c - * - * DESCRIPTION - * Testcase to check the basic functionality of the times() system call. - * - * ALGORITHM - * This testcase checks the values that times(2) system call returns. - * Start a process, and spend some CPU time by performing a spin in - * a for-loop. Then use the times() system call, to determine the - * cpu time/sleep time, and other statistics. - * - * USAGE: - * times01 [-c n] [-f] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * NONE - */ - -#include -#include -#include -#include -#include -#include - -const char *TCID = "times01"; -int TST_TOTAL = 1; -extern int Tst_count; -int exp_enos[]={0}; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int argc, char **argv) -{ - const char *msg; /* message returned from parse_opts */ - - struct tms buf1, buf2; - time_t start_time, end_time; - int i, pid2, status, fail=0; - - /* parse standard options */ - if ((msg = parse_opts(argc, argv, (option_t *)NULL, NULL)) != - (char *)NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - - for (i = 0; i < 1000000; i++); - /* - * At least some CPU time must be used. This is - * achieved by executing the times(2) call for - * atleast 5 secs. This logic makes it independant - * of the processor speed. - */ - start_time = time(NULL); - for (;;) { - if (times(&buf1) == (clock_t)-1) { - TEST_ERROR_LOG(errno); - tst_resm(TFAIL, "Call to times(2) " - "failed, errno = %d", errno); - } - end_time = time(NULL); - if ((end_time - start_time) > 5) { - break; - } - } - if (times(&buf1) == (clock_t)-1) { - TEST_ERROR_LOG(errno); - tst_resm(TFAIL, "Call to times(2) failed, " - "errno = %d", errno); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - if (buf1.tms_utime == 0) { - tst_resm(TFAIL, "Error: times() report " - "0 user time"); - fail=1; - } - if (buf1.tms_stime == 0) { - tst_resm(TFAIL, "Error: times() report " - "0 system time"); - fail=1; - } - if (buf1.tms_cutime != 0) { - tst_resm(TFAIL, "Error: times() report " - "%d child user time", - buf1.tms_cutime); - fail=1; - } - if (buf1.tms_cstime != 0) { - tst_resm(TFAIL, "Error: times() report " "%d child system time", - buf1.tms_cstime); - fail=1; - } - - pid2 = fork(); - if (pid2 < 0) { - tst_brkm(TFAIL, cleanup, "Fork failed"); - /*NOTREACHED*/ - } else if (pid2 == 0) { - for (i = 0; i < 2000000; i++); - /* - * Atleast some CPU time must be used - * even in the child process (thereby - * making it independent of the - * processor speed). In fact the child - * uses twice as much CPU time. - */ - start_time = time(NULL); - for (;;) { - if (times(&buf2) == (clock_t)-1) { - tst_resm(TFAIL, - "Call to times " - "failed, " - "errno = %d", - errno); - exit(1); - } - end_time = time(NULL); - if ((end_time - start_time) - > 10) { - break; - } - } - exit(0); - } - waitpid(pid2, &status, 0); - if (WEXITSTATUS(status) != 0) { - tst_resm(TFAIL, "Call to times(2) " - "failed in child"); - } - if (times(&buf2) == (clock_t)-1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "Call to times failed " - "errno = %d", errno); - fail=1; - } - if (buf1.tms_utime > buf2.tms_utime) { - tst_resm(TFAIL, "Error: parents's " - "user time(%d) before child " - "> parent's user time (%d) " - "after child", - buf1.tms_utime, - buf2.tms_utime); - fail=1; - } - if (buf2.tms_cutime == 0) { - tst_resm(TFAIL, "Error: times() " - "report %d child user " - "time should be > than " - "zero", buf2.tms_cutime); - fail=1; - } - if (buf2.tms_cstime == 0) { - tst_resm(TFAIL, "Error: times() " - "report %d child system time " - "should be > than zero", - buf2.tms_cstime); - fail=1; - } - if (fail == 0) { - tst_resm(TPASS, "%s: Functionality " - "test passed", TCID); - } - - } else { - tst_resm(TPASS, "%s call succeeded", TCID); - } - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - * performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -c option. - */ - TEST_PAUSE; -} - -/* - * cleanup() - * performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); - /*NOTREACHED*/ -} diff --git a/winsup/testsuite/winsup.api/ltp/truncate01.c b/winsup/testsuite/winsup.api/ltp/truncate01.c deleted file mode 100644 index 1e2931605..000000000 --- a/winsup/testsuite/winsup.api/ltp/truncate01.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: truncate01 - * - * Test Description: - * Verify that, truncate(2) succeeds to truncate a file to a specified - * length. - * - * Expected Result: - * truncate(2) should return a value 0 and the length of the file after - * truncation should be equal to the length it is truncated to. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * truncate01 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * This test should be run by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" /* file under test */ -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define BUF_SIZE 256 /* buffer size */ -#define FILE_SIZE 1024 /* test file size */ -#define TRUNC_LEN 256 /* truncation length */ - -const char *TCID="truncate01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test conditions */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; - -void setup(); /* setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat(2) struct contents */ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - off_t file_length; /* test file length */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call truncate(2) to truncate a test file to a - * specified length. - */ - TEST(truncate(TESTFILE, TRUNC_LEN)); - - /* check return code of truncate(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, - "truncate(%s, %d) Failed, errno=%d : %s", - TESTFILE, TRUNC_LEN, TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the testfile information using - * stat(2). - */ - if (stat(TESTFILE, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "stat(2) of " - "%s failed, error:%d", - TESTFILE, errno); - /*NOTREACHED*/ - } - stat_buf.st_mode &= ~S_IFREG; - file_length = stat_buf.st_size; - - /* - * Check for expected size of testfile after - * truncate(2) on it. - */ - if (file_length != TRUNC_LEN) { - tst_resm(TFAIL, "%s: Incorrect file " - "size %d, Expected %d", - TESTFILE, file_length, - TRUNC_LEN); - } else { - tst_resm(TPASS, "Functionality of " - "truncate(%s, %d) successful", - TESTFILE, TRUNC_LEN); - } - } else { - tst_resm(TPASS, "%s call succeeded", TCID); - } - } - Tst_count++; /* incr TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Fill the buffer with some arbitrary data to be written to a file. - * Create a test file under temporary directory and close it - * write arbitrary data into testfile. - */ -void -setup() -{ - int fd, i; /* file handler for testfile */ - int c, c_total = 0; /* no. bytes to be written to file */ - char tst_buff[BUF_SIZE]; /* buffer to hold data */ - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* Creat a testfile under temporary directory */ - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Write to the file 1k data from the buffer */ - while (c_total < FILE_SIZE) { - if ((c = write(fd, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - /*NOTREACHED*/ - } else { - c_total += c; - } - } - - /* Close the testfile after writing data into it */ - if (close(fd) == -1) { - tst_brkm(TBROK, cleanup, - "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - /*NOTREACHED*/ - } -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/truncate02.c b/winsup/testsuite/winsup.api/ltp/truncate02.c deleted file mode 100644 index 4ba802949..000000000 --- a/winsup/testsuite/winsup.api/ltp/truncate02.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Test Name: truncate02 - * - * Test Description: - * Verify that, truncate(2) succeeds to truncate a file to a certain length, - * but the attempt to read past the truncated length will fail. - * - * Expected Result: - * truncate(2) should return a value 0 and the attempt to read past the - * truncated length will fail. In case where the file before truncation was - * shorter, the bytes between the old and new should be all zeroes. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Create temporary directory. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * Delete the temporary directory created. - * - * Usage: - * truncate02 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * This test should be run by 'non-super-user' only. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" /* file under test */ -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define BUF_SIZE 256 /* buffer size */ -#define FILE_SIZE 1024 /* test file size */ -#define TRUNC_LEN1 256 /* truncation length */ -#define TRUNC_LEN2 512 /* truncation length */ - -const char *TCID="truncate02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test conditions */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int fd; /* file descriptor of testfile */ -char tst_buff[BUF_SIZE]; /* buffer to hold testfile contents */ -int exp_enos[]={0}; - -void setup(); /* setup function for the test */ -void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - struct stat stat_buf; /* stat(2) struct contents */ - int lc, i; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - off_t file_length2; /* test file length */ - off_t file_length1; /* test file length */ - int rbytes; /* bytes read from testfile */ - int read_len = 0; /* total no. of bytes read from testfile */ - int err_flag = 0; /* error indicator flag */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count = 0; - - /* - * Call truncate(2) to truncate a test file to a - * specified length (TRUNC_LEN1). - */ - TEST(truncate(TESTFILE, TRUNC_LEN1)); - - /* check return code of truncate(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, \ - "truncate(%s, %d) Failed, errno=%d : %s", - TESTFILE, TRUNC_LEN1, TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the testfile information using - * stat(2). - */ - if (stat(TESTFILE, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "stat(2) of " - "%s failed after 1st truncate, " - "error:%d", TESTFILE, errno); - /*NOTREACHED*/ - } - file_length1 = stat_buf.st_size; - - /* - * Set the file pointer of testfile to the - * beginning of the file. - */ - if (lseek(fd, 0, SEEK_SET) < 0) { - tst_brkm(TFAIL, cleanup, "lseek(2) on " - "%s failed after 1st truncate, " - "error:%d", TESTFILE, errno); - /*NOTREACHED*/ - } - - /* Read the testfile from the beginning. */ - while ((rbytes = read(fd, tst_buff, \ - sizeof(tst_buff))) > 0) { - read_len += rbytes; - } - - /* - * Execute truncate(2) again to truncate - * testfile to a size TRUNC_LEN2. - */ - TEST(truncate(TESTFILE, TRUNC_LEN2)); - - /* check return code of truncate(2) */ - if (TEST_RETURN == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "truncate of %s to " - "size %d Failed, errno=%d : %s", - TESTFILE, TRUNC_LEN2, - TEST_ERRNO, - strerror(TEST_ERRNO)); - } - - /* - * Get the testfile information using - * stat(2) - */ - if (stat(TESTFILE, &stat_buf) < 0) { - tst_brkm(TFAIL, cleanup, "stat(2) of " - "%s failed after 2nd truncate, " - "error:%d", TESTFILE, errno); - /*NOTREACHED*/ - } - file_length2 = stat_buf.st_size; - - /* - * Set the file pointer of testfile to the - * offset TRUNC_LEN1 of testfile. - */ - if (lseek(fd, TRUNC_LEN1, SEEK_SET) < 0) { - tst_brkm(TFAIL, cleanup, "lseek(2) on " - "%s failed after 2nd truncate, " - "error:%d", TESTFILE, errno); - /*NOTREACHED*/ - } - - /* Read the testfile contents till EOF */ - while((rbytes = read(fd, tst_buff, \ - sizeof(tst_buff))) > 0) { - for (i = 0; i < rbytes; i++) { - if (tst_buff[i] != 0) { - err_flag++; - } - } - } - - /* - * Check for expected size of testfile after - * issuing truncate(2) on it. - */ - if ((file_length1 != TRUNC_LEN1) || \ - (file_length2 != TRUNC_LEN2) || \ - (read_len != TRUNC_LEN1) || \ - (err_flag != 0)) { - tst_resm(TFAIL, "Functionality of " - "truncate(2) on %s Failed", - TESTFILE); - } else { - tst_resm(TPASS, \ - "Functionality of truncate(2) " - "on %s successful", TESTFILE); - } - } else { - tst_resm(TPASS, "%s call succeeded", TCID); - } - } - Tst_count++; /* incr. TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * Create a temporary directory and change directory to it. - * Create a test file under temporary directory and write some - * data into it. - */ -void -setup() -{ - int i; /* counter variable */ - int wbytes; /* bytes written to testfile */ - int write_len = 0; /* total no. of bytes written to testfile */ - - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - - /* Fill the test buffer with the known data */ - for (i = 0; i < BUF_SIZE; i++) { - tst_buff[i] = 'a'; - } - - /* Creat a testfile and write some data into it */ - if ((fd = open(TESTFILE, O_RDWR|O_CREAT, FILE_MODE)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s", - TESTFILE, FILE_MODE, errno, strerror(errno)); - /*NOTREACHED*/ - } - - /* Write to the file 1k data from the buffer */ - while (write_len < FILE_SIZE) { - if ((wbytes = write(fd, tst_buff, sizeof(tst_buff))) <= 0) { - tst_brkm(TBROK, cleanup, - "write(2) on %s Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } else { - write_len += wbytes; - } - } -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - * Close the temporary file opened for reading/writing. - * Remove the test directory and testfile created in the setup. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - */ - TEST_CLEANUP; - - /* Close the testfile after writing data into it */ - if (close(fd) == -1) { - tst_brkm(TFAIL, NULL, - "close(%s) Failed, errno=%d : %s", - TESTFILE, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/ulimit01.c b/winsup/testsuite/winsup.api/ltp/ulimit01.c deleted file mode 100644 index c3f09fba3..000000000 --- a/winsup/testsuite/winsup.api/ltp/ulimit01.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : ulimit01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for ulimit(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 6 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) ulimit(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * The libcuts.a and libsys.a libraries must be included in - * the compilation of this test. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the ulimit(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * ulimit(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="ulimit01"; /* Test program identifier. */ -int TST_TOTAL=6; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int cmd; -long limit; /* saved limit */ - -struct limits_t { - int cmd; - long newlimit; - int nlim_flag; /* special flag for UL_SETFSIZE records */ - int exp_fail; -} Scenarios[] = { - - { UL_GETFSIZE, -1, 0, 0 }, - { UL_SETFSIZE, -1, 0, 1 }, /* negative test */ - { UL_SETFSIZE, -2, 1, 0 }, /* case case: must be after UL_GETFSIZE */ - { UL_SETFSIZE, -2, 2, 0 }, /* case case: must be after UL_GETFSIZE */ - -#if UL_GMEMLIM - { UL_GMEMLIM, -1, 0, 0 }, -#endif -#if UL_GDESLIM - { UL_GDESLIM, -1, 0, 0 }, -#endif -#if UL_GSHMEMLIM - { UL_GSHMEMLIM, -1, 0, 0 }, -#endif - -}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - int i; /* inner loop (test case) counter */ - const char *msg; /* message returned from parse_opts */ - int tmp; - - TST_TOTAL = sizeof(Scenarios)/sizeof(struct limits_t); - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - for ( i=0; i -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="umask01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call umask(2) - */ - TEST(umask(022)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "umask(022) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "umask(022) returned %d", TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - void trapper(); - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/umask02.c b/winsup/testsuite/winsup.api/ltp/umask02.c deleted file mode 100644 index 9a1c61c53..000000000 --- a/winsup/testsuite/winsup.api/ltp/umask02.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * umask02.c - * - * DESCRIPTION - * Check that umask changes the mask, and that the previous - * value of the mask is returned correctly for each value. - * - * ALGORITHM - * For each mask value (9 bits) set mask, and check that the return - * corresponds to the previous value set. - * - * USAGE: - * umask02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * None - */ - -#include -#include "test.h" -#include "usctest.h" - -const char *TCID = "umask02"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int argc, char **argv) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int uret = 0, i, mskval = 0000; - - /* parse standard options */ - if ((msg = parse_opts(argc, argv, (option_t *)NULL, NULL)) != - (char *) NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); - - /* Check for looping state if -i option is given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - for (umask(++mskval), i = 1; mskval < 01000; - uret = umask(++mskval), i++) { - if ((uret != mskval - 1) && (mskval != 0000)) { - tst_brkm(TBROK, cleanup, "bad mask value " - "returned"); - /*NOTREACHED*/ - } else { - tst_resm(TPASS, "umask(%d) susuccessfully " - "returned %d.", mskval, uret); - } - } - mskval = 0000; - uret = 0; - tst_resm(TINFO, "end of loop %d\n", lc); - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - * performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -c option. - */ - TEST_PAUSE; -} - -/* - * cleanup() - * performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); - /*NOTREACHED*/ -} diff --git a/winsup/testsuite/winsup.api/ltp/umask03.c b/winsup/testsuite/winsup.api/ltp/umask03.c deleted file mode 100644 index 341da7507..000000000 --- a/winsup/testsuite/winsup.api/ltp/umask03.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * umask01.c - * - * DESCRIPTION - * Check that umask changes the mask, and that the previous - * value of the mask is returned correctly for each value. - * - * ALGORITHM - * For each mask value (9 bits) set mask, and check that the return - * corresponds to the previous value set. - * - * USAGE: - * umask01 [-c n] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * None - */ - -#include "test.h" -#include "usctest.h" -#include -#include -#include - -const char *TCID = "umask01"; -int TST_TOTAL = 1; -extern int Tst_count; - -char filname[40]; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int -main(int argc, char **argv) -{ - int lc; - const char *msg; - - struct stat statbuf; - unsigned mskval = 0000; - int fildes, i; - unsigned low9mode; - - /* parse standard options */ - if ((msg = parse_opts(argc, argv, (option_t *) NULL, NULL)) - != (char *) NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup */ - - /* check looping state if -i option is given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - for (umask(mskval = 0077), i = 1; mskval < 01000; - i++, umask(++mskval)) { - unlink(filname); - if ((fildes = creat(filname, 0777)) == -1) { - tst_resm(TBROK, "cannot create " - "file with mskval 0%o %d", - mskval, mskval); - } else { - if (fstat(fildes, &statbuf) != 0) { - tst_resm(TBROK, "cannot fstat file"); - } else { - low9mode = statbuf.st_mode & 0777; - if (low9mode != (~mskval & 0777)) { - tst_brkm(TBROK, cleanup, - "got %0 expected %o" - "mask didnot take", - low9mode, - (~mskval & 0777)); - /*NOTREACHED*/ - } else { - tst_resm(TPASS, "Test " - "condition: %d, umask: " - "0%o", i, mskval); - } - } - } - close(fildes); - } - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup - * performs all ONE TIME setup for this test - */ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make temp dir and cd to it */ - tst_tmpdir(); - - sprintf(filname, "umask2.%d", getpid()); -} - -/* - * cleanup - * performs all ONE TIME cleanup for this test at completion or - * premature exit - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified - * print errno log if that option was specified - */ - TEST_CLEANUP; - - /* - * cleanup the temporary files and the temporary directory - */ - unlink(filname); - tst_rmdir(); - - /* - * exit with return code appropriate for results - */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/uname01.c b/winsup/testsuite/winsup.api/ltp/uname01.c deleted file mode 100644 index 36b166786..000000000 --- a/winsup/testsuite/winsup.api/ltp/uname01.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : uname01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for uname(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) uname(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the uname(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * uname(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="uname01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -struct utsname un; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call uname(2) - */ - TEST(uname(&un)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "uname(&un) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "uname(&un) returned %d", TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - void trapper(); - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/unlink05.c b/winsup/testsuite/winsup.api/ltp/unlink05.c deleted file mode 100644 index 3aae0cf0d..000000000 --- a/winsup/testsuite/winsup.api/ltp/unlink05.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : unlink05 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for unlink(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) unlink(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the unlink(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * unlink(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); -void create_file(); - - - -const char *TCID="unlink05"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call unlink(2) - */ - TEST(unlink(fname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "unlink(%s) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "unlink(%s) returned %d", fname, TEST_RETURN); - } - /* recreate file for next loop */ - create_file(); - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - create_file(); -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - -void -create_file() -{ - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } -} diff --git a/winsup/testsuite/winsup.api/ltp/unlink06.c b/winsup/testsuite/winsup.api/ltp/unlink06.c deleted file mode 100644 index a62a268c0..000000000 --- a/winsup/testsuite/winsup.api/ltp/unlink06.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : unlink06 - * - * EXECUTED BY : anyone - * - * TEST TITLE : unlink(2) of a FIFO - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/30/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) unlink(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the unlink(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * unlink(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void create_file(); -void cleanup(void) __attribute__((noreturn)); - - -const char *TCID="unlink06"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char Fname[255]; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - create_file(); - - /* - * Call unlink(2) - */ - TEST(unlink(Fname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "unlink(%s) Failed, errno=%d : %s", Fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else if ( STD_FUNCTIONAL_TEST ) { - if ( access(Fname, F_OK) != -1 ) { - tst_resm(TFAIL, - "unlink(%s) returned %d, but access says file still exists.", - Fname, TEST_RETURN); - } - else { - tst_resm(TPASS, "unlink(%s) returned %d", Fname, TEST_RETURN); - } - } - else - Tst_count++; - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - sprintf(Fname, "fifo_unlink%d", getpid()); - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - -/****************************************************************** - * - ******************************************************************/ -void -create_file() -{ - if(mkfifo(Fname, 0777) == -1) { - tst_brkm(TBROK, cleanup, - "mkfifo(%s, 0777) failed errno:%d %s\n", Fname, - errno, strerror(errno)); - } -} diff --git a/winsup/testsuite/winsup.api/ltp/unlink07.c b/winsup/testsuite/winsup.api/ltp/unlink07.c deleted file mode 100644 index 133109621..000000000 --- a/winsup/testsuite/winsup.api/ltp/unlink07.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : unlink07 - * - * EXECUTED BY : anyone - * - * TEST TITLE : unlink(2) negative testcases - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/30/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1-8) See Testcases structure below. - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the unlink(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * unlink(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include /* for PATH_MAX */ -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - -extern char *get_high_address(); - -const char *TCID="unlink07"; /* Test program identifier. */ -int TST_TOTAL=6; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int longpath_setup(); -int no_setup(); -int filepath_setup(); -char Longpathname[PATH_MAX+2]; -char High_address[64]; - -struct test_case_t { - const char *pathname; - const char *desc; - int exp_errno; - int (*setupfunc)(); -} Test_cases[] = { - { "nonexistfile", "non-existent file", ENOENT, no_setup}, - { "", "path is empty string", ENOENT, no_setup}, - { "nefile/file", "path contains a non-existent file", - ENOENT, no_setup }, - { High_address, "address beyond address space", EFAULT, no_setup }, -#ifndef __CYGWIN__ - { "file/file", "path contains a regular file", - ENOTDIR, filepath_setup }, -#endif - { High_address, "address beyond address space", EFAULT, no_setup }, - { Longpathname, "pathname too long", ENAMETOOLONG, longpath_setup }, - { (char *)-1, "negative address", EFAULT, no_setup }, - { NULL, NULL, 0, no_setup } -}; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *fname; - const char *desc; - int ind; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - - fname = Test_cases[ind].pathname; - desc = Test_cases[ind].desc; - - if ( fname == High_address ) - fname = get_high_address(); - - /* - * Call unlink(2) - */ - TEST(unlink(fname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO == Test_cases[ind].exp_errno ) - tst_resm(TPASS, "unlink(<%s>) Failed, errno=%d", - desc, TEST_ERRNO); - else - tst_resm(TFAIL, - "unlink(<%s>) Failed, errno=%d, expected errno:%d", - desc, TEST_ERRNO, Test_cases[ind].exp_errno); - } - else - Tst_count++; - } else { - tst_resm(TFAIL, - "unlink(<%s>) returned %d, expected -1, errno:%d", - desc, TEST_RETURN, Test_cases[ind].exp_errno); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int ind; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - Test_cases[ind].setupfunc(); - } - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - chmod("unwrite_dir", 0777); - chmod("unsearch_dir", 0777); - - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - -/****************************************************************** - * - ******************************************************************/ -int -no_setup() -{ - return 0; -} - -/****************************************************************** - * - ******************************************************************/ -int -longpath_setup() -{ - int ind; - - for(ind=0; ind<= PATH_MAX+1; ind++) { - Longpathname[ind] = 'a'; - } - return 0; - -} -/****************************************************************** - * - ******************************************************************/ -int -filepath_setup() -{ - int fd; - - if ( (fd=creat("file", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, "creat(file) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - return 0; -} - diff --git a/winsup/testsuite/winsup.api/ltp/unlink08.c b/winsup/testsuite/winsup.api/ltp/unlink08.c deleted file mode 100644 index e793b46f2..000000000 --- a/winsup/testsuite/winsup.api/ltp/unlink08.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : unlink08 - * - * EXECUTED BY : anyone - * - * TEST TITLE : unlink(2) negative testcases - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 3 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : Richard Logan - * - * CO-PILOT : William Roske - * - * DATE STARTED : 03/30/94 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1-3) See Testcases structure below. - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the unlink(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * unlink(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(void) __attribute__((noreturn)); - - - -const char *TCID="unlink08"; /* Test program identifier. */ -int TST_TOTAL=3; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int unwrite_dir_setup(); -int unsearch_dir_setup(); -int dir_setup(); -int no_setup(); - -struct test_case_t { - const char *pathname; - const char *desc; - int (*setupfunc)(); - int exp_ret; /* -1 means error, 0 means != -1 */ - int exp_errno; -} Test_cases[] = { - { "unwrite_dir/file", "unwritable directory", unwrite_dir_setup, - -1, EACCES}, - { "unsearch_dir/file", "unsearchable directory", unsearch_dir_setup, - -1, EACCES }, -#ifdef linux - { "regdir", "directory", dir_setup, -1, EISDIR}, -#else - { "regdir", "directory", dir_setup, -1, EPERM}, -#endif - - { NULL, NULL, no_setup, -1, 0 } -}; - -/*********************************************************************** - * Main - ***********************************************************************/ -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - const char *fname; - const char *desc; - int ind; - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - - fname = Test_cases[ind].pathname; - desc = Test_cases[ind].desc; - - /* - * Call unlink(2) - */ - TEST(unlink(fname)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - if ( Test_cases[ind].exp_ret == -1 ) { /* neg test */ - if ( STD_FUNCTIONAL_TEST ) { - if ( TEST_ERRNO == Test_cases[ind].exp_errno ) - tst_resm(TPASS, "unlink(<%s>) Failed, errno=%d", - desc, TEST_ERRNO); - else - tst_resm(TFAIL, - "unlink(<%s>) Failed, errno=%d, expected errno:%d", - desc, TEST_ERRNO, Test_cases[ind].exp_errno); - } - else - Tst_count++; - } - else { - tst_resm(TFAIL, "unlink(<%s>) Failed, errno=%d", - desc, TEST_ERRNO); - } - } else { - if ( Test_cases[ind].exp_ret == -1 ) { - tst_resm(TFAIL, - "unlink(<%s>) returned %d, expected -1, errno:%d", - desc, TEST_RETURN, Test_cases[ind].exp_errno); - } - else if ( STD_FUNCTIONAL_TEST ) { - tst_resm(TPASS, - "unlink(<%s>) returned %d", - desc, TEST_RETURN); - } - else - Tst_count++; - Test_cases[ind].setupfunc(1); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - int ind; - int postest = 0; - - /* capture signals */ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - /* Pause if that option was specified */ - TEST_PAUSE; - - if ( geteuid() == 0 ) { - postest++; - } - - for (ind=0; Test_cases[ind].desc != NULL; ind++ ) { - if ( Test_cases[ind].exp_errno == EACCES && postest ) - Test_cases[ind].exp_ret=0; /* set as a pos test */ - Test_cases[ind].setupfunc(0); - } - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - chmod("unwrite_dir", 0777); - chmod("unsearch_dir", 0777); - - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - -} /* End cleanup() */ - -/****************************************************************** - * - ******************************************************************/ -int -unwrite_dir_setup(flag) -int flag; -{ - int fd; - - if ( ! flag ) { /* initial setup */ - if (mkdir("unwrite_dir", 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "mkdir(unwrite_dir, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - - if ( (fd=creat("unwrite_dir/file", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, - "creat(unwrite_dir/file, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - - if ( chmod("unwrite_dir", 0555) == -1 ) { - tst_brkm(TBROK, cleanup, - "chmod(unwrite_dir, 0555) failed, errno:%d %s", - errno, strerror(errno)); - } - } - else { /* resetup */ - if ( chmod("unwrite_dir", 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "chmod(unwrite_dir, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - - if ( (fd=creat("unwrite_dir/file", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, - "creat(unwrite_dir/file, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - - if ( chmod("unwrite_dir", 0555) == -1 ) { - tst_brkm(TBROK, cleanup, - "chmod(unwrite_dir, 0555) failed, errno:%d %s", - errno, strerror(errno)); - } - } - return 0; -} - -/****************************************************************** - * - ******************************************************************/ -int -unsearch_dir_setup(flag) -int flag; -{ - int fd; - - if ( ! flag ) { /* initial setup */ - if (mkdir("unsearch_dir", 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "mkdir(unsearch_dir, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - - if ( (fd=creat("unsearch_dir/file", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, - "creat(unsearch_dir/file, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - - if ( chmod("unsearch_dir", 0666) == -1 ) { - tst_brkm(TBROK, cleanup, - "chmod(unsearch_dir, 0666) failed, errno:%d %s", - errno, strerror(errno)); - } - } - else { /* resetup */ - if ( chmod("unsearch_dir", 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "chmod(unsearch_dir, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - - if ( (fd=creat("unsearch_dir/file", 0777)) == -1 ) { - tst_brkm(TBROK, cleanup, - "creat(unsearch_dir/file, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - close(fd); - - if ( chmod("unsearch_dir", 0666) == -1 ) { - tst_brkm(TBROK, cleanup, - "chmod(unsearch_dir, 0666) failed, errno:%d %s", - errno, strerror(errno)); - } - } - return 0; -} - -/****************************************************************** - * - ******************************************************************/ -int -dir_setup(flag) -int flag; -{ - if (mkdir("regdir", 0777) == -1 ) { - tst_brkm(TBROK, cleanup, - "mkdir(unwrite_dir, 0777) failed, errno:%d %s", - errno, strerror(errno)); - } - return 0; -} - -/****************************************************************** - * - ******************************************************************/ -int -no_setup(flag) -int flag; -{ - return 0; -} diff --git a/winsup/testsuite/winsup.api/ltp/vfork01.c b/winsup/testsuite/winsup.api/ltp/vfork01.c deleted file mode 100644 index 2792ce08b..000000000 --- a/winsup/testsuite/winsup.api/ltp/vfork01.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Name: vfork01 - * - * Test Description: - * Fork a process using vfork() and verify that, the attribute values like - * euid, ruid, suid, egid, rgid, sgid, umask, inode and device number of - * root and current working directories are same as that of the parent - * process. - * - * Expected Result: - * The attribute values like euid, ruid, suid, egid, rgid, sgid, umask, inode - * and device number of root and current working directory of the parent and - * child processes should be equal. - * - * Algorithm: - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, - * Verify the Functionality of system call - * if successful, - * Issue Functionality-Pass message. - * Otherwise, - * Issue Functionality-Fail message. - * Cleanup: - * Print errno log and/or timing stats if options given - * - * Usage: - * vfork01 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions: - * None. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID="vfork01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ -int exp_enos[]={0}; - -/* Variables to hold parent/child eff/real/saved uid/gid values */ -uid_t Peuid, Ceuid, Csuid, Psuid, Pruid, Cruid; -gid_t Pegid, Cegid, Psgid, Csgid, Prgid, Crgid; -mode_t Pumask,Cumask; - -char Pcwd_buf [PATH_MAX], Ccwd_buf [PATH_MAX]; -char *Pcwd, *Ccwd; /* - * pathname of working directory of - * child/parent process. - */ -/* stat structure to hold directory/inode information for parent/child */ -struct stat StatPbuf; -struct stat StatCbuf; -struct stat Stat_cwd_Pbuf; -struct stat Stat_cwd_Cbuf; - -void setup(); /* Main setup function of test */ -void cleanup() __attribute__((noreturn));/* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t cpid; /* process id of the child process */ - int exit_status; /* exit status of child process */ - - /* Parse standard options given to run the test. */ - msg = parse_opts(ac, av, (option_t *) NULL, NULL); - if (msg != (char *) NULL) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /* Perform global setup for test */ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /* Check looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* Reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call vfork(2) to create a child process without - * fully copying the address space of parent. - */ - TEST(vfork()); - - /* check return code of vfork() */ - if ((cpid = TEST_RETURN) == -1) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "vfork() Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else if (cpid == 0) { /* Child process */ - /* - * Perform functional verification if test - * executed without (-f) option. - */ - if (STD_FUNCTIONAL_TEST) { - /* - * Get the euid, ruid, egid, rgid, umask value - * and the current working directory of the - * child process - */ -#if (linux) - if (getresuid(&Cruid, &Ceuid, &Csuid) < 0) { - tst_resm(TFAIL, "getresuid() fails to " - "get real/eff./saved uid of " - "child process"); - _exit(1); - } - - if (getresgid(&Crgid, &Cegid, &Csgid) < 0) { - tst_resm(TFAIL, "getresgid() fails to " - "get real/eff./saved gid of " - "child process"); - _exit(1); - } -#else - Cruid = getuid (); - Ceuid = geteuid (); - Csuid = 0; - Crgid = getgid (); - Cegid = getegid (); - Csgid = 0; -#endif - /* - * Get the file mode creation mask value of - * child process by setting value zero and - * restore the previous mask value. - */ - Cumask = umask(0); - - /* - * Restore the process mask of child to - * previous value. - */ - umask(Cumask); - - /* - * Get the pathname of current working - * directory for the child process. - */ - if ((Ccwd = (char *)getcwd(Ccwd_buf, \ - BUFSIZ)) == NULL) { - tst_resm(TFAIL, "getcwd failed for the " - "child process"); - _exit(1); - } - - /* - * Get the device number and the inode - * number of "/" directory for the child - * process. - */ - if (stat("/", &StatCbuf) < 0) { - tst_resm(TFAIL, "stat(2) failed to get " - "info. of'/' in the child " - "process"); - _exit(1); - } - - /* - * Get the device/inode number of "." - * (working directory) for the child process. - */ - if (stat(Ccwd, &Stat_cwd_Cbuf) < 0) { - tst_resm(TFAIL, "stat(2) failed to get " - "info. of working irectory in " - "the child"); - _exit(1); - } - - /* Now, do the actual comparision */ - if (Peuid != Ceuid || Pegid != Cegid || \ - Psuid != Csuid || Psgid != Csgid || \ - Pruid != Cruid || Prgid != Crgid || \ - Pumask != Cumask) { - tst_resm(TFAIL, "Arribute values of " - "parent and child don't match"); - _exit(1); - } else { - tst_resm(TINFO, "Arribute values of " - "parent and child match"); - } - - /* Check for the same working directories */ - if (strcmp(Pcwd, Ccwd) != 0) { - tst_resm(TFAIL, "Working directories " - "of parent and child don't " - "match"); - _exit(1); - } else { - tst_resm(TINFO, "Working directories " - "of parent and child match"); - } - - /* - * Check for the same device/inode number of - * '/' directory. - */ - if ((StatPbuf.st_ino != StatCbuf.st_ino) || \ - (StatPbuf.st_dev != StatCbuf.st_dev)) { - tst_resm(TFAIL, "Device/inode number " - "of parent and childs '/' " - " don't match"); - _exit(1); - } else { - tst_resm(TINFO, "Device/inode number " - "of parent and childs '/' " - "match"); - } - - /* - * Check for the same device and inode number - * of "." (current working directory. - */ - if ((Stat_cwd_Pbuf.st_ino != \ - Stat_cwd_Cbuf.st_ino) || \ - (Stat_cwd_Pbuf.st_dev != \ - Stat_cwd_Cbuf.st_dev)) { - tst_resm(TFAIL, "Device/inode number " - "of parent and childs '.' " - "don't match"); - _exit(1); - } else { - tst_resm(TINFO, "Device/inode number " - "of parent and childs '.' " - "match"); - } - - /* - * Exit with normal exit code if everything - * fine - */ - _exit(0); - } - } else { /* parent process */ - /* - * Let the parent process wait till child completes - * its execution. - */ - wait(&exit_status); - - /* Check for the exit status of child process */ - if (WEXITSTATUS(exit_status) == 0) { - tst_resm(TPASS, \ - "Call of vfork() successful"); - } else if (WEXITSTATUS(exit_status) == 1) { - tst_resm(TFAIL, \ - "Child process exited abnormally"); - } - } - Tst_count++; /* incr. TEST_LOOP counter */ - } /* End for TEST_LOOPING */ - - /* Call cleanup() to undo setup done for the test. */ - cleanup(); - /*NOTREACHED*/ - -} /* End main */ - -/* - * void - * setup() - performs all ONE TIME setup for this test. - * This function gets real/effective/saved uid/gid, umask, the device/inode - * number of '/' and current working directory for the parent process. - */ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* - * Get the euid, ruid, egid, rgid, umask value - * and the current working directory of the parent process. - */ -#if (linux) - if (getresuid(&Pruid, &Peuid, &Psuid) < 0) { - tst_brkm(TFAIL, cleanup, "getresuid() fails to get " - "real/eff./saved uid of parent"); - } - - if (getresgid(&Prgid, &Pegid, &Psgid) < 0) { - tst_brkm(TFAIL, cleanup, "getresgid() fails to get " - "real/eff./saved gid of parent"); - } -#else - Pruid = getuid (); - Peuid = geteuid (); - Psuid = 0; - Prgid = getgid (); - Pegid = getegid (); - Psgid = 0; -#endif - /* Get the process file mode creation mask by setting value 0 */ - Pumask = umask(0); - umask(Pumask); /* - * Restore the mask value of the - * process. - */ - /* - * Get the pathname of current working directory of the parent - * process. - */ - if ((Pcwd = (char *) getcwd(Pcwd_buf, BUFSIZ)) == NULL) { - tst_brkm(TFAIL, cleanup, - "getcwd failed for the parent process"); - } - - /* - * Get the device and inode number of root directory for the - * parent process. - */ - if (stat("/", &StatPbuf) == -1) { - tst_brkm(TFAIL, cleanup, "stat(2) failed to get info. of '/' " - "in parent process"); - } - - /* - * Get the device number and the inode number of "." (current- - * working directory) for the parent process. - */ - if (stat(Pcwd, &Stat_cwd_Pbuf) < 0) { - tst_brkm(TFAIL, cleanup, "stat(2) failed to get info. of " - "working directory in parent process"); - } -} /* End setup() */ - -/* - * void - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ diff --git a/winsup/testsuite/winsup.api/ltp/wait02.c b/winsup/testsuite/winsup.api/ltp/wait02.c deleted file mode 100644 index a7de67a28..000000000 --- a/winsup/testsuite/winsup.api/ltp/wait02.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : wait02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for wait(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) wait(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the wait(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * wait(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="wait02"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -int fork_pid, ret_code; -void trapper(); - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* create a child to wait for */ - if ((fork_pid=fork()) == -1) { - tst_brkm(TBROK, cleanup, "fork() Failure. errno=%d : %s", errno, strerror(errno)); - } else if (fork_pid == 0) { - /* Child, sleep a second then exit */ - sleep(1); - exit(1); - } - - /* Parent, wait for child to die */ - TEST(wait(&ret_code)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "wait(1) Failed, errno=%d : %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "wait(&ret_code) returned %d", TEST_RETURN); - } - } - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; - -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/wait401.c b/winsup/testsuite/winsup.api/ltp/wait401.c deleted file mode 100644 index 51f71da55..000000000 --- a/winsup/testsuite/winsup.api/ltp/wait401.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * wait401.c - * - * DESCRIPTION - * wait401 - check that a call to wait4() correctly waits for a child - * process to exit - * - * ALGORITHM - * loop if that option was specified - * fork a child. - * issue the system call - * check the return value - * if return value == -1 - * issue a FAIL message, break remaining tests and cleanup - * if we are doing functional testing - * issue a PASS message if the wait4 call returned the child's pid - * else - * issue a FAIL message - * call cleanup - * - * USAGE: - * wait401 [-c n] [-f] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * none - */ - -#include "test.h" -#include "usctest.h" - -#include -#define _USE_BSD -#include -#include -#include - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "wait401()"; -int TST_TOTAL = 1; -extern int Tst_count; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t pid; - int status = 1; - struct rusage *rusage = NULL; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - /* - * Allocate some space for the rusage structure - */ - - if ((rusage = (struct rusage *)malloc(sizeof(struct rusage))) - == NULL) { - tst_brkm(TBROK, cleanup, "malloc() failed"); - } - - pid = fork(); - - if (pid == -1) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - - if (pid == 0) { /* this is the child */ - /* - * sleep for a moment to let us do the test - */ - sleep(1); - exit(0); - } else { /* this is the parent */ - - /* call wait4 with the TEST() macro */ - TEST(wait4(pid, &status, 0, rusage)); - } - - if (TEST_RETURN == -1) { - tst_brkm(TFAIL, cleanup, "%s call failed - errno = %d " - ": %s", TCID, TEST_ERRNO, strerror(TEST_ERRNO)); - } - - if (STD_FUNCTIONAL_TEST) { - /* - * The return from this call should be non-zero. - */ - if (WIFEXITED(status) == 0) { - tst_brkm(TFAIL, cleanup, "%s call succeeded but " - "WIFEXITED() did not return expected value " - "- %d", TCID, WIFEXITED(status)); - } else if (TEST_RETURN != pid) { - tst_resm(TFAIL, "%s did not return the " - "expected value. %d", TCID, - TEST_RETURN); - } else { - - tst_resm(TPASS, "Received child pid as expected."); - } - } - tst_resm(TPASS, "%s call succeeded", TCID); - - /* - * Clean up things in case we are looping. - */ - free(rusage); - rusage = NULL; - } - - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all the ONE TIME setup for this test. - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/wait402.c b/winsup/testsuite/winsup.api/ltp/wait402.c deleted file mode 100644 index 30f7500ac..000000000 --- a/winsup/testsuite/winsup.api/ltp/wait402.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * wait402.c - * - * DESCRIPTION - * wait402 - check for ECHILD errno when using an illegal pid value - * - * ALGORITHM - * loop if that option was specified - * issue the system call with an illegal pid value - * check the errno value - * issue a PASS message if we get ECHILD - * otherwise, the tests fails - * issue a FAIL message - * break any remaining tests - * call cleanup - * - * USAGE: - * wait402 [-c n] [-e] [-i n] [-I x] [-p x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * none - */ - -#include "test.h" -#include "usctest.h" - -#include -#define _USE_BSD -#include -#include -#include - -/* - * See the Makefile for comments about the following preprocessor code. - */ -#if defined (__CYGWIN__) -#define PID_MAX 0xfffffffd -#else -#ifndef _LTP_TASKS_H -#include /* for PID_MAX value - new */ -#else -#include /* for PID_MAX value - old */ -#endif -#endif - -void cleanup(void) __attribute__((noreturn)); -void setup(void); - -const char *TCID= "wait402()"; -int TST_TOTAL = 1; -extern int Tst_count; - -int exp_enos[] = {10, 0}; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - pid_t pid; - pid_t epid = PID_MAX + 1; - int status = 1; - struct rusage *rusage=NULL; - - /* parse standard options */ - if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - } - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - - /* - * Allocate some space for the rusage structure. - */ - - if ((rusage = (struct rusage *)malloc(sizeof(struct rusage))) - == NULL) { - tst_brkm(TBROK, cleanup, "malloc() failed"); - } - - pid = fork(); - - if (pid == -1) { - tst_brkm(TBROK, cleanup, "fork() failed"); - } - - if (pid == 0) { /* this is the child */ - /* - * sleep for a moment to let us do the test - */ - sleep(1); - exit(0); - } else { /* this is the parent */ - /* - * call wait4 with the TEST() macro. epid is set - * to an illegal positive value. This should give - * an ECHILD error. - */ - TEST(wait4(epid, &status, 0, rusage)); - } - - if (TEST_RETURN == 0) { - tst_brkm(TFAIL, cleanup, "call failed to produce expected error - errno = %d - %s", TEST_ERRNO, strerror(TEST_ERRNO)); - } - - TEST_ERROR_LOG(TEST_ERRNO); - - switch (TEST_ERRNO) { - case ECHILD: - tst_resm(TPASS, "received expected failure - errno = %d - %s", - TEST_ERRNO, strerror(TEST_ERRNO)); - break; - default: - tst_brkm(TFAIL, cleanup, "call failed to produce expected " - "error - errno = %d - %s", TEST_ERRNO, - strerror(TEST_ERRNO)); - } - - /* - * Clean up things in case we are looping. - */ - if (pid > 0) { - wait4(pid, &status, 0, rusage); - } - free(rusage); - rusage = NULL; - } - - cleanup(); - - /*NOTREACHED*/ -} - -/* - * setup() - performs all the ONE TIME setup for this test. - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Set up the expected error numbers for -e option */ - TEST_EXP_ENOS(exp_enos); - - /* Pause if that option was specified */ - TEST_PAUSE; -} - -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* exit with return code appropriate for results */ - tst_exit(); -} - diff --git a/winsup/testsuite/winsup.api/ltp/write01.c b/winsup/testsuite/winsup.api/ltp/write01.c deleted file mode 100644 index 355190af6..000000000 --- a/winsup/testsuite/winsup.api/ltp/write01.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - * - */ -/* $Id$ */ -/********************************************************** - * - * OS Test - Silicon Graphics, Inc. - * - * TEST IDENTIFIER : write01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for write(2) - * - * PARENT DOCUMENT : usctpl01 - * - * TEST CASE TOTAL : 1 - * - * WALL CLOCK TIME : 1 - * - * CPU TYPES : ALL - * - * AUTHOR : William Roske - * - * CO-PILOT : Dave Fenner - * - * DATE STARTED : 03/30/92 - * - * INITIAL RELEASE : UNICOS 7.0 - * - * TEST CASES - * - * 1.) write(2) returns...(See Description) - * - * INPUT SPECIFICATIONS - * The standard options for system call tests are accepted. - * (See the parse_opts(3) man page). - * - * OUTPUT SPECIFICATIONS - * - * DURATION - * Terminates - with frequency and infinite modes. - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * RESOURCES - * None - * - * ENVIRONMENTAL NEEDS - * No run-time environmental needs. - * - * SPECIAL PROCEDURAL REQUIREMENTS - * None - * - * INTERCASE DEPENDENCIES - * None - * - * DETAILED DESCRIPTION - * This is a Phase I test for the write(2) system call. It is intended - * to provide a limited exposure of the system call, for now. It - * should/will be extended when full functional tests are written for - * write(2). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * UPDATE HISTORY - * user date description - * ------------------------------------------------------ - * wermager 3/00 Switched sequence of calls to TEST_PAUSE - * and tst_tmpdir() in setup(). - * - *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ - -#include -#include -#include -#include -#include -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -const char *TCID="write01"; /* Test program identifier. */ -int TST_TOTAL=1; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int exp_enos[]={0, 0}; - -char fname[255]; -int fd; -char buf = 'w'; - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - /*************************************************************** - * parse standard options - ***************************************************************/ - if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) { - tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - tst_exit(); - } - - /*************************************************************** - * perform global setup for test - ***************************************************************/ - setup(); - - /* set the expected errnos... */ - TEST_EXP_ENOS(exp_enos); - - /*************************************************************** - * check looping state if -c option given - ***************************************************************/ - for (lc=0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping. */ - Tst_count=0; - - /* - * Call write(2) - */ - TEST(write(fd, &buf, 1)); - - /* check return code */ - if ( TEST_RETURN == -1 ) { - TEST_ERROR_LOG(TEST_ERRNO); - tst_resm(TFAIL, "write(%s, F_CLRALF, 1) Failed, errno=%d : %s", fname, - TEST_ERRNO, strerror(TEST_ERRNO)); - } else { - /*************************************************************** - * only perform functional verification if flag set (-f not given) - ***************************************************************/ - if ( STD_FUNCTIONAL_TEST ) { - /* No Verification test, yet... */ - tst_resm(TPASS, "write(%s, F_CLRALF, 1) returned %d", fname, TEST_RETURN); - } - } - - } /* End for TEST_LOOPING */ - - /*************************************************************** - * cleanup and exit - ***************************************************************/ - cleanup(); - - return 0; -} /* End main */ - -/*************************************************************** - * setup() - performs all ONE TIME setup for this test. - ***************************************************************/ -void -setup() -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - - /* Pause if that option was specified */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - sprintf(fname,"tfile_%d",getpid()); - if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) { - tst_brkm(TBROK, cleanup, - "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", - fname, errno, strerror(errno)); - } -} /* End setup() */ - - -/*************************************************************** - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - ***************************************************************/ -void -cleanup() -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - /* close the file we have open */ - if (close(fd) == -1) { - tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno)); - } - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} /* End cleanup() */ - - diff --git a/winsup/testsuite/winsup.api/ltp/write02.c b/winsup/testsuite/winsup.api/ltp/write02.c deleted file mode 100644 index a5675bd6d..000000000 --- a/winsup/testsuite/winsup.api/ltp/write02.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * write02.c - * - * DESCRIPTION - * Basic functionality test: does the return from write match the count - * of the number of bytes written. - * - * - * ALGORITHM - * Create a file and write some bytes out to it. - * Check the return count against the number returned. - * - * USAGE: - * write02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * None - */ - -#include -#include "test.h" -#include "usctest.h" -#include - -const char *TCID = "write02()"; -int TST_TOTAL = 1; -extern int Tst_count; - -void cleanup(void) __attribute__ ((noreturn)); -void setup(void); - -char pfiln[40] = ""; - -int -main(int argc, char **argv) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int cwrite; - int fild; - int iws; - int badcount = 0; - char pwbuf[BUFSIZ + 1]; - - /* parse standard options */ - if ((msg = parse_opts(argc, argv, (option_t *) NULL, NULL))) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - setup(); /* global setup for test */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - tst_resm(TINFO, "Block 1: test to see write() returns proper " - "write count"); - - for (iws = 0; iws < BUFSIZ; iws++) { - pwbuf[iws] = 'A' + (iws % 26); - } - pwbuf[BUFSIZ] = '\n'; - - if ((fild = creat(pfiln, 0777)) == -1) { - tst_brkm(TBROK, cleanup, "Can't creat Xwrit"); - /*NOTREACHED*/ - } - for (iws = BUFSIZ; iws > 0; iws--) { - if ((cwrite = write(fild, pwbuf, iws)) != iws) { - TEST_ERROR_LOG(errno); - badcount++; - tst_resm(TINFO, "bad write count"); - } - } - if (badcount != 0) { - tst_resm(TFAIL, "write() FAILED to return proper cnt"); - } else { - tst_resm(TPASS, "write() PASSED"); - } - tst_resm(TINFO, "block 1 passed"); - close(fild); - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - umask(0); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* make a temp directory and cd to it */ - tst_tmpdir(); - - sprintf(pfiln, "./write1.%d", getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at completion or - * premature exit. - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - unlink(pfiln); - - /* Remove tmp dir and all files in it */ - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); -} diff --git a/winsup/testsuite/winsup.api/ltp/write03.c b/winsup/testsuite/winsup.api/ltp/write03.c deleted file mode 100644 index 7d6f1f945..000000000 --- a/winsup/testsuite/winsup.api/ltp/write03.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * NAME - * write03.c - * - * DESCRIPTION - * Testcase to check that write(2) doesn't corrupt a file when it fails - * - * ALGORITHM - * Create a file for writing, write 100 bytes to it. Then make write(2) - * fail with some erroneous parameter, close the fd. Then reopen the - * file in RDONLY mode, and read the contents of the file. Compare the - * buffers, to see whether they are same. - * - * USAGE: - * write03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * History - * 07/2001 John George - * -Ported - * - * Restrictions - * NONE - */ - -#include -#include -#include -#include -#include - -/* 0 terminated list of expected errnos */ -int exp_enos[] = {14,0}; - -const char *TCID = "write03"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void) __attribute__((noreturn)); - -int fd = -1; -char filename[100]; - -int -main(int argc, char **argv) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - char wbuf[BUFSIZ], rbuf[BUFSIZ]; - - /* parse standard options */ - if ((msg = parse_opts(argc, argv, (option_t *)NULL, NULL)) != - (char *)NULL) { - tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); - /*NOTREACHED*/ - } - - /* global setup */ - setup(); - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset Tst_count in case we are looping */ - Tst_count = 0; - - tst_resm(TINFO, "Enter Block 1: test to check if write " - "corrupts the file when write fails"); - - fd = creat(filename, 0644); - if (fd < 0) { - tst_resm(TBROK, "creating a new file failed"); - cleanup(); - /*NOTREACHED*/ - } - - (void)memset(wbuf, '0', 100); - - if (write(fd, wbuf, 100) == -1) { - tst_resm(TFAIL, "failed to write to %s", filename); - cleanup(); - /*NOTREACHED*/ - } - - if (write(fd, (void *)-1, 100) != -1) { - tst_resm(TFAIL, "write(2) failed to fail"); - cleanup(); - /*NOTREACHED*/ - } - TEST_ERROR_LOG(errno); - close(fd); - fd = -1; - - if ((fd = open(filename, O_RDONLY)) == -1) { - tst_resm(TBROK, "open(2) failed, errno: %d", errno); - cleanup(); - /*NOTREACHED*/ - } - - if (read(fd, rbuf, 100) == -1) { - tst_resm(TBROK, "read(2) failed, errno: %d", errno); - cleanup(); - /*NOTREACHED*/ - } - - if (memcmp(wbuf, rbuf, 100) == 0) { - tst_resm(TPASS, "failure of write(2) didnot corrupt " - "the file"); - } else { - tst_resm(TFAIL, "failure of write(2) corrupted the " - "file"); - } - tst_resm(TINFO, "Exit block 1"); - } - cleanup(); - /*NOTREACHED*/ -} - -/* - * setup() - performs all ONE TIME setup for this test - */ -void -setup(void) -{ - /* capture signals */ - tst_sig(FORK, DEF_HANDLER, cleanup); - - /* Set up the expected error numbers for -e option */ - TEST_EXP_ENOS(exp_enos); - - /* Pause if that option was specified - * TEST_PAUSE contains the code to fork the test with the -i option. - * You want to make sure you do this before you create your temporary - * directory. - */ - TEST_PAUSE; - - /* Create a unique temporary directory and chdir() to it. */ - tst_tmpdir(); - - sprintf(filename, "./write03.%d", getpid()); -} - -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit - */ -void -cleanup(void) -{ - /* - * print timing stats if that option was specified. - * print errno log if that option was specified. - */ - TEST_CLEANUP; - - if (fd >= 0) - close (fd); - - unlink(filename); - tst_rmdir(); - - /* exit with return code appropriate for results */ - tst_exit(); - /*NOTREACHED*/ -} diff --git a/winsup/testsuite/winsup.api/mmaptest01.c b/winsup/testsuite/winsup.api/mmaptest01.c deleted file mode 100644 index fe3226d1b..000000000 --- a/winsup/testsuite/winsup.api/mmaptest01.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - Copyright 2001 Free Software Foundation, Inc. - Written by Michael Chastain, - Changes by Corinna Vinschen, : - - Using mkstemp to generate filenames. - - Adding tests - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - This program demonstrates a bug in cygwin's mmap. - I open one file, mmap it, and close it. - I open a different file, mmap it, and close it. - - The second file re-uses the file handle (which is OK), - but then it re-uses the buffer as well! Ouch! - - This bug occurs on cygwin1.dll dated 2001-01-31. - It causes gnu cpp to screw up its include file buffers. - - Compile with "gcc -o y1 y1.c". - - Output from a bad cygwin1.dll: - - y1.txt: 3 0x4660000 y1 y1 y1 y1 y1 y1 y1 - y2.txt: 3 0x4660000 y1 y1 y1 y1 y1 y1 y1 - - Output from a good cygwin1.dll: - - y1.txt: 3 0x14060000 y1 y1 y1 y1 y1 y1 y1 - y2.txt: 3 0x14070000 y2 y2 y2 y2 y2 y2 y2 - - Output from Red Hat Linux 7: - - y1.txt: 3 0x40017000 y1 y1 y1 y1 y1 y1 y1 - y2.txt: 3 0x40018000 y2 y2 y2 y2 y2 y2 y2 - */ - -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID = "mmaptest01"; /* Test program identifier. */ -int TST_TOTAL = 7; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -/* some systems have O_BINARY and some do not */ -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -/* filler for file 1 */ -char const line1 [] = "y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1\n"; -#define size1 (sizeof(line1) - 1) -#define count1 ((4096 / size1) + 1) - -/* filler for file 2 */ -char const line2 [] = "y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2\n"; -#define size2 (sizeof(line2) - 1) -#define count2 ((4096 / size2) + 1) - -int main () -{ - char fnam1[32]; - char fnam2[32]; - - int fd1; - char * buf1; - - int fd2; - char * buf2; - - char buf3[20]; - - unsigned i; - - strcpy (fnam1, "mmaptest01.1.XXXXXX"); - strcpy (fnam2, "mmaptest01.2.XXXXXX"); - - /* create file 1 */ - //fd1 = open (fnam1, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644); - fd1 = mkstemp (fnam1); - for (i = 0; i < count1; i++) - write (fd1, line1, size1); - close (fd1); - - /* create file 2 */ - //fd2 = open (fnam2, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644); - fd2 = mkstemp (fnam2); - for (i = 0; i < count2; i++) - write (fd2, line2, size2); - close (fd2); - - /* mmap file 1 */ - fd1 = open (fnam1, O_RDONLY | O_BINARY, 0644); - buf1 = mmap (0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd1, 0); - close (fd1); - - /* mmap file 2 */ - fd2 = open (fnam2, O_RDONLY | O_BINARY, 0644); - buf2 = mmap (0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd2, 0); - close (fd2); - - /* the buffers have to be different */ - Tst_count = 0; - tst_resm (buf1 == buf2 || !memcmp (buf1, buf2, 20) ? TFAIL : TPASS, - "mmap uses unique buffers when mapping different already closed files"); - munmap (buf2, 4096); - - /* mmap file 1 twice with MAP_PRIVATE */ - fd2 = open (fnam1, O_RDONLY | O_BINARY, 0644); - buf2 = mmap (0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd2, 0); - close (fd2); - - tst_resm (buf1 == buf2 ? TFAIL : TPASS, - "mmap uses different buffers on MAP_PRIVATE mapping"); - - tst_resm (memcmp (buf1, buf2, 20) ? TFAIL : TPASS, - "two private buffers of the same file are identical"); - - buf1[0] = 0x7f; - tst_resm (!memcmp (buf1, buf2, 20) ? TFAIL : TPASS, - "changes are private in MAP_PRIVATE mappings"); - - munmap (buf1, 4096); - munmap (buf2, 4096); - - /* mmap file 1 twice with MAP_SHARED */ - fd1 = open (fnam1, O_RDWR | O_BINARY, 0644); - buf1 = mmap (0, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd1, 0); - close (fd1); - - fd2 = open (fnam1, O_RDWR | O_BINARY, 0644); - buf2 = mmap (0, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, 0); - close (fd2); - - tst_resm (memcmp (buf1, buf2, 20) ? TFAIL : TPASS, - "two shared buffers of the same file are identical"); - - buf1[0] = 0x7f; - tst_resm (memcmp (buf1, buf2, 20) ? TFAIL : TPASS, - "changes are shared between MAP_SHARED mappings of the same file"); - if (buf1 == buf2) /* Win 9x weirdness */ - msync (buf2, 4096, MS_SYNC); - else - munmap (buf2, 4096); - - fd2 = open (fnam1, O_RDWR | O_BINARY, 0644); - memset (buf3, 0, 20); - read (fd2, buf3, 20); - close (fd2); - - tst_resm (memcmp (buf1, buf3, 20) ? TFAIL : TPASS, - "changes are propagated to the mapped file on MAP_SHARED mapping"); - - munmap (buf1, 4096); - unlink (fnam1); - unlink (fnam2); - tst_exit (); -} - diff --git a/winsup/testsuite/winsup.api/mmaptest02.c b/winsup/testsuite/winsup.api/mmaptest02.c deleted file mode 100644 index bec7c392c..000000000 --- a/winsup/testsuite/winsup.api/mmaptest02.c +++ /dev/null @@ -1,190 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -sigset_t unblock_sigsegv; -jmp_buf r; -size_t pg; - -int fd; - -/* Checks behaviour of anonymous mmap. - - test_1: If we map a 2-page region and unmap its second page, the first page - must remain. - - test_2: If we map a 2-page region and unmap its first page, the second - page must remain. - - test_3: If we map two consecutive 1-page regions and unmap them both with - one munmap, both must go away. -*/ - -void -perror_exit (const char *str, int code) -{ - printf ("%s: %s\n", str, strerror (errno)); - exit (code); -} - -void -anonmap_init () -{ - sigemptyset (&unblock_sigsegv); - sigaddset (&unblock_sigsegv, SIGSEGV); - pg = getpagesize (); - fd = open ("/dev/zero", O_RDWR); -} - -char * -anonmap (size_t size) -{ - return (char *) mmap (0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); -} - -void -anonfree (char *loc, size_t size) -{ - munmap (loc, size); -} - -void -sigsegv (int unused) -{ - sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0); - longjmp (r, 1); -} - -int -compare_pointers (const void *a, const void *b) -{ - const char *x = *(const char *const *)a; - const char *y = *(const char *const *)b; - - if (x > y) - return 1; - if (x < y) - return -1; - return 0; -} - -void -test_1 () -{ - char *x = anonmap (pg * 2); - if (x == (char *)MAP_FAILED) - perror_exit ("test 1 mmap", 1); - - signal (SIGSEGV, sigsegv); - if (setjmp (r)) - perror_exit ("test 1 fault", 2); - - x[0] = 1; - x[pg] = 1; - - anonfree (x + pg, pg); - x[0] = 2; - - if (setjmp (r) == 0) - { - x[pg] = 1; - perror_exit ("test 1 no fault", 3); - } -} - -void -test_2 () -{ - char *x = anonmap (pg * 2); - if (x == (char *)MAP_FAILED) - perror_exit ("test 2 mmap", 4); - - signal (SIGSEGV, sigsegv); - if (setjmp (r)) - perror_exit ("test 2 fault", 5); - - x[0] = 1; - x[pg] = 1; - - anonfree (x, pg); - x[pg] = 2; - - if (setjmp (r) == 0) - { - x[0] = 1; - perror_exit ("test 2 no fault", 6); - } -} - -void -test_3 () -{ - char *x[10]; - char *y; - int i; - - /* There's no way to guarantee we get consecutive pages from the OS. The - approach taken here is to allocate ten of them, sort the list, and - look for consecutive pages. */ - for (i = 0; i < 10; i++) - { - x[i] = anonmap (pg); - if (x[i] == (char *)MAP_FAILED) - perror_exit ("test 3 mmap 1", 7); - } - qsort (x, 10, sizeof (char *), compare_pointers); - - y = 0; - for (i = 0; i < 9; i++) - if (x[i] + pg == x[i+1]) - { - y = x[i]; - break; - } - if (y == 0) - { - fputs ("test 3: couldn't get two consecutive pages, giving up\n", stdout); - exit (65); - } - - signal (SIGSEGV, sigsegv); - if (setjmp (r)) - perror_exit ("test 3 fault", 8); - - y[0] = 1; - y[pg] = 1; - - anonfree (y, pg * 2); - - if (setjmp (r) == 0) - { - y[0] = 1; - perror_exit ("test 3 no fault 1", 9); - } - - signal (SIGSEGV, sigsegv); - if (setjmp (r) == 0) - { - y[pg] = 1; - perror_exit ("test 3 no fault 2", 10); - } -} - -int -main () -{ - anonmap_init(); - - test_1(); - test_2(); - test_3(); - - exit(0); -} diff --git a/winsup/testsuite/winsup.api/mmaptest03.c b/winsup/testsuite/winsup.api/mmaptest03.c deleted file mode 100644 index 8046f0bf8..000000000 --- a/winsup/testsuite/winsup.api/mmaptest03.c +++ /dev/null @@ -1,154 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - Checks if mapping of already closed file survives fork() - - Checks if mapping the same region of the same file twice - is done correctly. -*/ - -sigset_t unblock_sigsegv; -jmp_buf r; - -static const char *msg; -static const char *what; -/* filler for file */ -char const line[] = "y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1"; - -void -perror_exit (const char *str) -{ - printf ("%s: %s\n", str, strerror (errno)); - fflush (stdout); - exit (1); -} - -void -sigsegv (int unused) -{ - sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0); - if (msg) - { - char buf[132]; - sprintf (buf, "%s %s\n", what, msg); - write (1, buf, strlen (buf)); - msg = NULL; - } - longjmp (r, 1); -} - -int -main(int argc, char **argv) -{ - int fd, status; - struct stat statbuf; - volatile char c, *buf1, *buf2; - pid_t pid; - - /* Create data file */ - if ((fd = open("y.txt", O_RDWR | O_CREAT | O_TRUNC, 0644)) == -1) - perror_exit ("Can't create data file"); - write (fd, line, sizeof(line) - 1); - close (fd); - - /* Open data file */ - if ((fd = open("y.txt", O_RDONLY)) == -1) - perror_exit ("Can't open data file"); - - if (fstat(fd, &statbuf) < 0) - perror_exit ("fstat failed"); - - if (!statbuf.st_size) - perror_exit ("filesize is 0"); - - if ((buf1 = mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0)) - == MAP_FAILED) - perror_exit ("mmap 1 failed"); - - close(fd); - - /* Open data file a second time */ - if ((fd = open("y.txt", O_RDONLY)) == -1) - perror_exit ("Can't open data file in second run"); - - if ((buf2 = mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0)) - == MAP_FAILED) - perror_exit ("mmap 2 failed"); - - close(fd); - - sigemptyset (&unblock_sigsegv); - sigaddset (&unblock_sigsegv, SIGSEGV); - signal (SIGSEGV, sigsegv); - - if (setjmp (r)) - perror_exit ("SEGV in fork"); - - if ((pid = fork())) - { - // write (1, "continuing in parent\n", strlen ("continuing in parent\n")); - what = "parent"; - } - else - { - // write (1, "continuing in child\n", strlen ("continuing in child\n")); - what = "child"; - } - - if (pid == -1) - perror_exit ("fork failed"); - - if (setjmp (r)) - perror_exit (pid ? "SEGV in parent" : "SEGV in child"); - - msg = "testing buf1"; - c = buf1[0]; - msg = "testing buf2"; - c = buf2[0]; - - if (setjmp (r)) - perror_exit (pid ? "SEGV in parent's munmap" : "SEGV in child's munmap"); - - if (munmap((void *) buf1, statbuf.st_size)) - perror_exit (pid ? "munmap failed in parent" : "munmap failed in child"); - - if (setjmp (r) == 0) - { - msg = "testing buf1 after unmap"; - c = buf1[0]; - perror_exit (pid ? "no SEGV in parent after munmap" : "no SEGV in child after munmap"); - } - - if (setjmp (r)) - perror_exit (pid ? "SEGV in parent after munmap" : "SEGV in child after munmap"); - - msg = "testing buf2 again"; - c = buf2[0]; - - if (setjmp (r)) - perror_exit (pid ? "SEGV in parent's munmap" : "SEGV in child's munmap"); - - if (munmap((void *) buf2, statbuf.st_size)) - perror_exit (pid ? "munmap failed in parent" : "munmap failed in child"); - - if (pid) - { - waitpid (pid, &status, 0); - unlink ("y.txt"); - if (!WIFEXITED (status) || WEXITSTATUS (status)) - { - printf ("forked process exited with status %p\n", (char *) status); - return 1; - } - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/mmaptest04.c b/winsup/testsuite/winsup.api/mmaptest04.c deleted file mode 100644 index 52302bae1..000000000 --- a/winsup/testsuite/winsup.api/mmaptest04.c +++ /dev/null @@ -1,103 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -int -main () -{ - char *data, *data2 = NULL, *data3; - int i, pagesize; - int fd; - - pagesize = 65536; //getpagesize(); - - /* - * First, make a file with some known garbage in it. - */ - data = (char *) malloc (pagesize); - if (!data) - exit (1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand (); - umask (0); - fd = open ("conftestmmap", O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0600); - if (fd < 0) - { - printf ("creat: %d\n", errno); - exit (1); - } - if (write (fd, data, pagesize) != pagesize) - { - printf ("write: %d\n", errno); - exit (1); - } - close (fd); - - /* - * Next, try to mmap the file. - */ - fd = open ("conftestmmap", O_RDWR | O_BINARY); - if (fd < 0) - { - printf ("write: %d\n", errno); - exit (1); - } - if ((data2 = mmap (data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE, fd, 0L)) == MAP_FAILED) - { - printf ("mmap: %d\n", errno); - exit (1); - } - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - { - printf ("check-if: %d\n", errno); - exit (1); - } - - /* - * Finally, make sure that changes to the mapped area - * do not percolate back to the file as seen by read(). - * (This is a bug on some variants of i386 svr4.0.) - */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = (char *) malloc (pagesize); - if (!data3) - { - printf ("malloc2: %d\n", errno); - exit (1); - } - if (read (fd, data3, pagesize) != pagesize) - { - printf ("read: %d\n", errno); - exit (1); - } - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - { - printf ("check-if2: %d\n", errno); - exit (1); - } - if (msync (data2, pagesize, MS_SYNC)) - { - printf ("msync: %d\n", errno); - exit (1); - } - if (munmap (data2, pagesize)) - { - printf ("munmap: %d\n", errno); - exit (1); - } - close (fd); - unlink ("conftestmmap"); - exit (0); -} diff --git a/winsup/testsuite/winsup.api/msgtest.c b/winsup/testsuite/winsup.api/msgtest.c deleted file mode 100644 index e002a7fda..000000000 --- a/winsup/testsuite/winsup.api/msgtest.c +++ /dev/null @@ -1,348 +0,0 @@ -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. - * - * 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. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 THE NETBSD FOUNDATION, INC. AND 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 THE FOUNDATION OR 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. - * - * Obtained from: $NetBSD: msgtest.c,v 1.7 2002/07/20 08:36:25 grant Exp $ - * $FreeBSD: /repoman/r/ncvs/src/tools/regression/sysvmsg/msgtest.c,v 1.1 2002/08/15 06:34:37 alfred Exp $ - */ - -/* - * Test the SVID-compatible Message Queue facility. - */ - -/* - * CV, 2003-11-17: Add to Cygwin testsuite. - */ -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID = "msgtest"; /* Test program identifier. */ -int TST_TOTAL = 31; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -void print_msqid_ds (struct msqid_ds *, mode_t); -void sigsys_handler(int); -void sigchld_handler (int); -void cleanup (void); -void receiver (void); - -#define MESSAGE_TEXT_LEN 255 - -/* - * Define it as test_mymsg because we already have struct mymsg and we dont - * want to conflict with it. Also, regression fails when the default mymsg - * struct is used, because mtext[] array is '1', so the passed string cannot - * be processed. - */ -struct test_mymsg { - long mtype; - char mtext[MESSAGE_TEXT_LEN]; -}; - -const char *m1_str = "California is overrated."; -const char *m2_str = "The quick brown fox jumped over the lazy dog."; - -#define MTYPE_1 1 -#define MTYPE_1_ACK 2 - -#define MTYPE_2 3 -#define MTYPE_2_ACK 4 - -int sender_msqid = -1; -pid_t child_pid; - -key_t msgkey; - -int -main(int argc, char *argv[]) -{ - struct sigaction sa; - struct msqid_ds m_ds; - struct test_mymsg m; - sigset_t sigmask; - - Tst_count = 0; - - /* - * Install a SIGSYS handler so that we can exit gracefully if - * System V Message Queue support isn't in the kernel. - */ - sa.sa_handler = sigsys_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGSYS, &sa, NULL) == -1) - tst_brkm (TBROK, cleanup, "sigaction SIGSYS"); - - /* - * Install and SIGCHLD handler to deal with all possible exit - * conditions of the receiver. - */ - sa.sa_handler = sigchld_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGCHLD, &sa, NULL) == -1) - tst_brkm (TBROK, cleanup, "sigaction SIGCHLD"); - - msgkey = ftok("/", 4160); - tst_resm (msgkey == (key_t)-1 ? TFAIL : TPASS, - "ftok(\"/\") returns valid value"); - - /* - * Initialize child_pid to ourselves to that the cleanup function - * works before we create the receiver. - */ - child_pid = getpid(); - - sender_msqid = msgget(msgkey, IPC_CREAT | 0640); - tst_resm (sender_msqid == -1 ? TFAIL : TPASS, "sender calls msgget"); - - tst_resm (msgctl(sender_msqid, IPC_STAT, &m_ds) == -1 ? TFAIL : TPASS, - "msgctl IPC_STAT"); - - print_msqid_ds(&m_ds, 0640); - - m_ds.msg_perm.mode = (m_ds.msg_perm.mode & ~0777) | 0600; - - tst_resm (msgctl(sender_msqid, IPC_SET, &m_ds) == -1 ? TFAIL : TPASS, - "msgctl IPC_SET"); - - bzero(&m_ds, sizeof m_ds); - - tst_resm (msgctl(sender_msqid, IPC_STAT, &m_ds) == -1 ? TFAIL : TPASS, - "msgctl IPC_STAT"); - - tst_resm ((m_ds.msg_perm.mode & 0777) != 0600 ? TFAIL : TPASS, - "IPC_SET of mode holds"); - - print_msqid_ds(&m_ds, 0600); - - switch ((child_pid = fork())) { - case -1: - tst_brkm (TBROK, cleanup, "fork"); - /* NOTREACHED */ - - case 0: - tst_resm (TPASS, "fork"); - receiver(); - break; - - default: - Tst_count += 8; - break; - } - - /* - * Send the first message to the receiver and wait for the ACK. - */ - m.mtype = MTYPE_1; - strcpy(m.mtext, m1_str); - tst_resm (msgsnd(sender_msqid, &m, sizeof(m), 0) == -1 ? TFAIL : TPASS, - "sender: msgsnd 1"); - - tst_resm (msgrcv(sender_msqid, &m, sizeof(m), MTYPE_1_ACK, 0) - != sizeof(m) ? TFAIL : TPASS, "sender: msgrcv 1 ack"); - - print_msqid_ds(&m_ds, 0600); - - /* - * Send the second message to the receiver and wait for the ACK. - */ - m.mtype = MTYPE_2; - strcpy(m.mtext, m2_str); - tst_resm (msgsnd(sender_msqid, &m, sizeof(m), 0) == -1 ? TFAIL : TPASS, - "sender: msgsnd 2"); - - tst_resm (msgrcv(sender_msqid, &m, sizeof(m), MTYPE_2_ACK, 0) - != sizeof(m) ? TFAIL : TPASS, "sender: msgrcv 2 ack"); - - /* - * Suspend forever; when we get SIGCHLD, the handler will exit. - */ - sigemptyset(&sigmask); - (void) sigsuspend(&sigmask); - - /* - * ...and any other signal is an unexpected error. - */ - tst_brkm (TBROK, cleanup, "sender: received unexpected signal"); - exit (1); -} - -void -sigsys_handler(int signo) -{ - - tst_brkm (TBROK, cleanup, - "System V Message Queue support is not present in the kernel"); -} - -void -sigchld_handler(int signo) -{ - struct msqid_ds m_ds; - int cstatus; - - /* - * Reap the child; if it exited successfully, then the test passed! - */ - if (waitpid(child_pid, &cstatus, 0) != child_pid) - tst_brkm (TBROK, cleanup, "waitpid"); - - if (WIFEXITED(cstatus) == 0) - tst_brkm (TBROK, cleanup, "receiver exited abnormally"); - - if (WEXITSTATUS(cstatus) != 0) - tst_brkm (TBROK, cleanup, "receiver exited with status %d", - WEXITSTATUS(cstatus)); - - /* - * If we get here, the child has exited normally, and thus - * we should exit normally too. First, tho, we print out - * the final stats for the message queue. - */ - - tst_resm (msgctl(sender_msqid, IPC_STAT, &m_ds) == -1 ? TFAIL : TPASS, - "msgctl IPC_STAT"); - - print_msqid_ds(&m_ds, 0600); - - cleanup (); -} - -void -cleanup() -{ - - /* - * If we're the sender, and it exists, remove the message queue. - */ - if (child_pid != 0 && sender_msqid != -1) { - tst_resm (msgctl(sender_msqid, IPC_RMID, NULL) == -1 - ? TFAIL : TPASS, "msgctl IPC_RMID"); - } - tst_exit (); -} - -void -print_msqid_ds(struct msqid_ds *mp, mode_t mode) -{ - uid_t uid = geteuid(); - gid_t gid = getegid(); - - printf("PERM: uid %d, gid %d, cuid %d, cgid %d, mode 0%o\n", - (int)mp->msg_perm.uid, (int)mp->msg_perm.gid, - (int)mp->msg_perm.cuid, (int)mp->msg_perm.cgid, - mp->msg_perm.mode & 0777); - - printf("qnum %lu, qbytes %lu, lspid %d, lrpid %d\n", - mp->msg_qnum, (u_long)mp->msg_qbytes, mp->msg_lspid, - mp->msg_lrpid); - - printf("stime: %s", ctime(&mp->msg_stime)); - printf("rtime: %s", ctime(&mp->msg_rtime)); - printf("ctime: %s", ctime(&mp->msg_ctime)); - - /* - * Sanity check a few things. - */ - - tst_resm (mp->msg_perm.uid != uid || mp->msg_perm.cuid != uid - ? TFAIL : TPASS, "uid matches"); - - tst_resm (mp->msg_perm.gid != gid || mp->msg_perm.cgid != gid - ? TFAIL : TPASS, "gid matches"); - - tst_resm ((mp->msg_perm.mode & 0777) != mode ? TFAIL : TPASS, - "mode matches"); -} - -void -receiver() -{ - struct test_mymsg m; - int msqid; - - tst_resm ((msqid = msgget(msgkey, 0)) == -1 ? TFAIL : TPASS, - "receiver: msgget"); - - /* - * Receive the first message, print it, and send an ACK. - */ - - tst_resm (msgrcv(msqid, &m, sizeof(m), MTYPE_1, 0) != sizeof(m) - ? TFAIL : TPASS, "receiver: msgrcv 1"); - - printf("%s\n", m.mtext); - tst_resm (strcmp(m.mtext, m1_str) != 0 ? TFAIL : TPASS, - "receiver: message 1 data is correct"); - - m.mtype = MTYPE_1_ACK; - - tst_resm (msgsnd(msqid, &m, sizeof(m), 0) == -1 ? TFAIL : TPASS, - "receiver: msgsnd ack 1"); - - /* - * Receive the second message, print it, and send an ACK. - */ - - tst_resm (msgrcv(msqid, &m, sizeof(m), MTYPE_2, 0) != sizeof(m) - ? TFAIL : TPASS, "receiver: msgrcv 2"); - - printf("%s\n", m.mtext); - tst_resm (strcmp(m.mtext, m2_str) != 0 ? TFAIL : TPASS, - "receiver: message 2 data is correct"); - - m.mtype = MTYPE_2_ACK; - - tst_resm (msgsnd(msqid, &m, sizeof(m), 0) == -1 ? TFAIL : TPASS, - "receiver: msgsnd ack 2"); - - /* Allow parent to receive message before getting SIGCHLD. */ - sleep (1); - exit(0); -} diff --git a/winsup/testsuite/winsup.api/nullgetcwd.c b/winsup/testsuite/winsup.api/nullgetcwd.c deleted file mode 100644 index 25bdf4514..000000000 --- a/winsup/testsuite/winsup.api/nullgetcwd.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include -#include -#include -int -main (int argc, char **argv) -{ - char *cwd = getcwd (NULL, 256); - if (cwd == NULL) - { - fprintf (stderr, "%s: getcwd returns NULL\n", argv[0]); - exit (1); - } - - exit (0); -} - diff --git a/winsup/testsuite/winsup.api/pthread/cancel1.c b/winsup/testsuite/winsup.api/pthread/cancel1.c deleted file mode 100644 index 96ae390ce..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel1.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * File: cancel1.c - * - * Test Synopsis: Test setting cancel state and cancel type. - * - - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - pthread_setcancelstate function - * - pthread_setcanceltype function - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - pthread_create, pthread_self work. - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -void * -mythread(void * arg) -{ - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* ... */ - { - int oldstate; - int oldtype; - - assert(pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate) == 0); - assert(oldstate == PTHREAD_CANCEL_ENABLE); /* Check default */ - assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0); - assert(pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL) == 0); - assert(pthread_setcancelstate(oldstate, &oldstate) == 0); - assert(oldstate == PTHREAD_CANCEL_DISABLE); /* Check setting */ - - assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype) == 0); - assert(oldtype == PTHREAD_CANCEL_DEFERRED); /* Check default */ - assert(pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) == 0); - assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0); - assert(pthread_setcanceltype(oldtype, &oldtype) == 0); - assert(oldtype == PTHREAD_CANCEL_ASYNCHRONOUS); /* Check setting */ - } - - return 0; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - assert((t[0] = pthread_self()) != NULL); - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - - /* - * Give threads time to run. - */ - Sleep(NUMTHREADS * 1000); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - failed = !threadbag[i].started; - - if (failed) - { - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print ouput on failure. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - /* ... */ - } - - assert(!failed); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel10.c b/winsup/testsuite/winsup.api/pthread/cancel10.c deleted file mode 100644 index 5e0cc6770..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel10.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * File: cancel10.c - * - * Test Synopsis: Test if system is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static int cancelled = 0; - -static void *Thread(void *punused) -{ - while (!cancelled) - Sleep (0); - - system (NULL); - - return NULL; -} - -int main (void) -{ - void * result; - pthread_t t; - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - assert (pthread_cancel (t) == 0); - cancelled = 1; - assert (pthread_join (t, &result) == 0); - assert (result == PTHREAD_CANCELED); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel11.c b/winsup/testsuite/winsup.api/pthread/cancel11.c deleted file mode 100644 index b6554ed69..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel11.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * File: cancel11.c - * - * Test Synopsis: Test if system is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static void sig_handler(int sig) -{ -} - -static void *Thread(void *punused) -{ - system ("sleep 10"); - - return NULL; -} - -int main (void) -{ - void * result; - pthread_t t; - - signal (SIGINT, sig_handler); - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - sleep (5); - assert (pthread_cancel (t) == 0); - assert (pthread_join (t, &result) == 0); - assert (result == PTHREAD_CANCELED); - - assert ((void *)signal (SIGINT, NULL) == sig_handler); - - /* Wait until child process has terminated */ - sleep (10); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel12.c b/winsup/testsuite/winsup.api/pthread/cancel12.c deleted file mode 100644 index 12273d676..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel12.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * File: cancel12.c - * - * Test Synopsis: Test if system is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static void sig_handler(int sig) -{ -} - -static void *Thread(void *punused) -{ - signal (SIGINT, sig_handler); - - system ("sleep 5"); - - assert ((void *)signal (SIGINT, NULL) == sig_handler); - - return NULL; -} - -int main (void) -{ - void * result; - pthread_t t; - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - assert (pthread_join (t, &result) == 0); - assert (result == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel2.c b/winsup/testsuite/winsup.api/pthread/cancel2.c deleted file mode 100644 index 14889313e..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel2.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * File: cancel2.c - * - * Test Synopsis: Test SEH or C++ cancel exception handling within - * application exception blocks. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_self, pthread_mutex_lock/unlock - * pthread_testcancel, pthread_cancel, pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -static pthread_mutex_t waitLock = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; - -void * -mythread(void * arg) -{ - int result = 0; - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Set to known state and type */ - - assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0); - - switch (bag->threadnum % 2) - { - case 0: - assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0); - result = 0; - break; - case 1: - assert(pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) == 0); - result = 1; - break; - } - - /* Wait for go from main */ - assert(pthread_mutex_lock(&waitLock) == 0); - assert(pthread_mutex_unlock(&waitLock) == 0); - sched_yield(); - - for (;;) - { - pthread_testcancel(); - } - - return (void *) result; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - assert((t[0] = pthread_self()) != NULL); - assert(pthread_mutex_lock(&waitLock) == 0); - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - Sleep(500); - - assert(pthread_mutex_unlock(&waitLock) == 0); - - Sleep(500); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_cancel(t[i]) == 0); - } - - /* - * Give threads time to run. - */ - Sleep(NUMTHREADS * 100); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - if (!threadbag[i].started) - { - failed |= !threadbag[i].started; - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print output on failure. - */ - failed = 0; - for (i = 1; i <= NUMTHREADS; i++) - { - int fail = 0; - int result = 0; - - assert(pthread_join(t[i], (void **) &result) == 0); - fail = (result != (int) PTHREAD_CANCELED); - if (fail) - { - fprintf(stderr, "Thread %d: started %d: location %d: cancel type %s\n", - i, - threadbag[i].started, - result, - ((result % 2) == 0) ? "ASYNCHRONOUS" : "DEFERRED"); - } - failed |= fail; - } - - assert(!failed); - - /* - * Success. - */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/cancel3.c b/winsup/testsuite/winsup.api/pthread/cancel3.c deleted file mode 100644 index 3ac03e4b6..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel3.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * File: cancel3.c - * - * Test Synopsis: Test asynchronous cancelation. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_self, pthread_mutex_lock/unlock - * pthread_testcancel, pthread_cancel, pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ - int count; -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -void * -mythread(void * arg) -{ - int result = ((int)PTHREAD_CANCELED + 1); - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Set to known state and type */ - - assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0); - - assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0); - - /* - * We wait up to 10 seconds, waking every 0.1 seconds, - * for a cancelation to be applied to us. - */ - for (bag->count = 0; bag->count < 100; bag->count++) - Sleep(100); - - return (void *) result; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - assert((t[0] = pthread_self()) != NULL); - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - Sleep(500); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_cancel(t[i]) == 0); - } - - /* - * Give threads time to run. - */ - Sleep(NUMTHREADS * 100); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - if (!threadbag[i].started) - { - failed |= !threadbag[i].started; - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print output on failure. - */ - failed = 0; - for (i = 1; i <= NUMTHREADS; i++) - { - int fail = 0; - int result = 0; - - /* - * The thread does not contain any cancelation points, so - * a return value of PTHREAD_CANCELED confirms that async - * cancelation succeeded. - */ - assert(pthread_join(t[i], (void **) &result) == 0); - - fail = (result != (int) PTHREAD_CANCELED); - - if (fail) - { - fprintf(stderr, "Thread %d: started %d: count %d\n", - i, - threadbag[i].started, - threadbag[i].count); - } - failed = (failed || fail); - } - - assert(!failed); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel4.c b/winsup/testsuite/winsup.api/pthread/cancel4.c deleted file mode 100644 index d6b2ffadf..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel4.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * File: cancel4.c - * - * Test Synopsis: Test cancelation does not occur in deferred - * cancelation threads with no cancelation points. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - pthread_create - * pthread_self - * pthread_cancel - * pthread_join - * pthread_setcancelstate - * pthread_setcanceltype - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ - int count; -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -void * -mythread(void * arg) -{ - int result = ((int)PTHREAD_CANCELED + 1); - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Set to known state and type */ - - assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0); - - assert(pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) == 0); - - /* - * We wait up to 10 seconds, waking every 0.1 seconds, - * for a cancelation to be applied to us. - */ - for (bag->count = 0; bag->count < 100; bag->count++) - Sleep(100); - - return (void *) result; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - assert((t[0] = pthread_self()) != NULL); - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - Sleep(500); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_cancel(t[i]) == 0); - } - - /* - * Give threads time to run. - */ - Sleep(NUMTHREADS * 100); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - if (!threadbag[i].started) - { - failed |= !threadbag[i].started; - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print output on failure. - */ - failed = 0; - for (i = 1; i <= NUMTHREADS; i++) - { - int fail = 0; - int result = 0; - - /* - * The thread does not contain any cancelation points, so - * a return value of PTHREAD_CANCELED indicates that async - * cancelation occurred. - */ - assert(pthread_join(t[i], (void **) &result) == 0); - - fail = (result == (int) PTHREAD_CANCELED); - - if (fail) - { - fprintf(stderr, "Thread %d: started %d: count %d\n", - i, - threadbag[i].started, - threadbag[i].count); - } - failed = (failed || fail); - } - - assert(!failed); - - /* - * Success. - */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/cancel5.c b/winsup/testsuite/winsup.api/pthread/cancel5.c deleted file mode 100644 index 9dd579543..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel5.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * File: cancel5.c - * - * Test Synopsis: Test calling pthread_cancel from the main thread - * without calling pthread_self() in main. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_self, pthread_mutex_lock/unlock - * pthread_testcancel, pthread_cancel, pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ - int count; -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -void * -mythread(void * arg) -{ - int result = ((int)PTHREAD_CANCELED + 1); - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Set to known state and type */ - - assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0); - - assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0); - - /* - * We wait up to 10 seconds, waking every 0.1 seconds, - * for a cancelation to be applied to us. - */ - for (bag->count = 0; bag->count < 100; bag->count++) - Sleep(100); - - return (void *) result; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - Sleep(500); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_cancel(t[i]) == 0); - } - - /* - * Give threads time to run. - */ - Sleep(NUMTHREADS * 100); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - if (!threadbag[i].started) - { - failed |= !threadbag[i].started; - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print output on failure. - */ - failed = 0; - for (i = 1; i <= NUMTHREADS; i++) - { - int fail = 0; - int result = 0; - - /* - * The thread does not contain any cancelation points, so - * a return value of PTHREAD_CANCELED confirms that async - * cancelation succeeded. - */ - assert(pthread_join(t[i], (void **) &result) == 0); - - fail = (result != (int) PTHREAD_CANCELED); - - if (fail) - { - fprintf(stderr, "Thread %d: started %d: count %d\n", - i, - threadbag[i].started, - threadbag[i].count); - } - failed = (failed || fail); - } - - assert(!failed); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel6.c b/winsup/testsuite/winsup.api/pthread/cancel6.c deleted file mode 100644 index 8f0bdd849..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel6.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * File: cancel6.c - * - * Test Synopsis: Test if pause is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static void *Thread(void *punused) -{ - pause (); - - return NULL; -} - -int main (void) -{ - void * result; - pthread_t t; - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - assert (pthread_cancel (t) == 0); - assert (pthread_join (t, &result) == 0); - assert (result == PTHREAD_CANCELED); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel7.c b/winsup/testsuite/winsup.api/pthread/cancel7.c deleted file mode 100644 index 7a631f695..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel7.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * File: cancel7.c - * - * Test Synopsis: Test if sleep is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static int has5secsleeped = 0; - -static void *Thread(void *punused) -{ - assert (pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL) == 0); - /* thread should sleep 5 seconds and not get canceled */ - sleep(5); - has5secsleeped = 1; - assert (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) == 0); - /* thread should cancel here */ - sleep (5); - - return NULL; -} - -int main (void) -{ - void * result; - pthread_t t; - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - assert (pthread_cancel (t) == 0); - assert (pthread_join (t, &result) == 0); - assert (has5secsleeped == 1); - assert (result == PTHREAD_CANCELED); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel8.c b/winsup/testsuite/winsup.api/pthread/cancel8.c deleted file mode 100644 index fb30fd93b..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel8.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * File: cancel8.c - * - * Test Synopsis: Test if usleep is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static int has5secsleeped = 0; - -static void *Thread(void *punused) -{ - assert (pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL) == 0); - /* thread should usleep 5 seconds and not get canceled */ - usleep(5000000); - has5secsleeped = 1; - assert (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) == 0); - /* thread should cancel here */ - usleep(5000000); - - return NULL; -} - -int main (void) -{ - void * result; - pthread_t t; - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - assert (pthread_cancel (t) == 0); - assert (pthread_join (t, &result) == 0); - assert (has5secsleeped == 1); - assert (result == PTHREAD_CANCELED); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cancel9.c b/winsup/testsuite/winsup.api/pthread/cancel9.c deleted file mode 100644 index 1cbf62d2c..000000000 --- a/winsup/testsuite/winsup.api/pthread/cancel9.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * File: cancel9.c - * - * Test Synopsis: Test if waitpid is a cancellation point. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_cancel, pthread_setcancelstate - * pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include -#include - -static pid_t pid; - -static void *Thread(void *punused) -{ - int res; - - pid = fork (); - assert (pid != -1); - switch (pid) - { - case 0: - sleep (10); - break; - default: - assert (waitpid (pid, &res, 0) != -1); - } - - return NULL; -} - -int main (void) -{ - int res; - - void * result; - pthread_t t; - - assert (pthread_create (&t, NULL, Thread, NULL) == 0); - sleep (5); - assert (pthread_cancel (t) == 0); - assert (pthread_join (t, &result) == 0); - assert (result == PTHREAD_CANCELED); - assert (waitpid (pid, &res, 0) != -1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/cleanup2.c b/winsup/testsuite/winsup.api/pthread/cleanup2.c deleted file mode 100644 index bcbaad3a7..000000000 --- a/winsup/testsuite/winsup.api/pthread/cleanup2.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * File: cleanup2.c - * - * Test Synopsis: Test cleanup handler executes (when thread is not canceled). - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_self, pthread_mutex_lock/unlock - * pthread_testcancel, pthread_cancel, pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ - int count; -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -static int pop_count = 0; - -static void -increment_pop_count(void * arg) -{ - int * c = (int *) arg; - - (*c)++; -} - -void * -mythread(void * arg) -{ - int result = 0; - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - pthread_cleanup_push(increment_pop_count, (void *) &pop_count); - - sched_yield(); - - pthread_cleanup_pop(1); - - return (void *) result; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - assert((t[0] = pthread_self()) != NULL); - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - Sleep(1000); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - if (!threadbag[i].started) - { - failed |= !threadbag[i].started; - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print output on failure. - */ - failed = 0; - for (i = 1; i <= NUMTHREADS; i++) - { - int fail = 0; - int result = 0; - - assert(pthread_join(t[i], (void **) &result) == 0); - - fail = (result != 0); - - if (fail) - { - fprintf(stderr, "Thread %d: started %d: result: %d\n", - i, - threadbag[i].started, - result); - } - failed = (failed || fail); - } - - assert(!failed); - - assert(pop_count == NUMTHREADS); - - /* - * Success. - */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/cleanup3.c b/winsup/testsuite/winsup.api/pthread/cleanup3.c deleted file mode 100644 index f8201faa0..000000000 --- a/winsup/testsuite/winsup.api/pthread/cleanup3.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * File: cleanup3.c - * - * Test Synopsis: Test cleanup handler does not execute (when thread is - * not canceled). - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - have working pthread_create, pthread_self, pthread_mutex_lock/unlock - * pthread_testcancel, pthread_cancel, pthread_join - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 10 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ - int count; -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -static int pop_count = 0; - -static void -increment_pop_count(void * arg) -{ - int * c = (int *) arg; - - (*c)++; -} - -void * -mythread(void * arg) -{ - int result = 0; - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - pthread_cleanup_push(increment_pop_count, (void *) &pop_count); - - sched_yield(); - - pop_count--; - - pthread_cleanup_pop(0); - - return (void *) result; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - assert((t[0] = pthread_self()) != NULL); - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - Sleep(1000); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - if (!threadbag[i].started) - { - failed |= !threadbag[i].started; - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. Set "failed" and only print output on failure. - */ - failed = 0; - for (i = 1; i <= NUMTHREADS; i++) - { - int fail = 0; - int result = 0; - - assert(pthread_join(t[i], (void **) &result) == 0); - - fail = (result != 0); - - if (fail) - { - fprintf(stderr, "Thread %d: started %d: result: %d\n", - i, - threadbag[i].started, - result); - } - failed = (failed || fail); - } - - assert(!failed); - - assert(pop_count == -(NUMTHREADS)); - - /* - * Success. - */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/condvar1.c b/winsup/testsuite/winsup.api/pthread/condvar1.c deleted file mode 100644 index daa0f420e..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar1.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * File: condvar1.c - * - * Test Synopsis: - * - Test initialisation and destruction of a CV. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Creates and then imediately destroys a CV. Does not - * test the CV. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_init returns 0, and - * - pthread_cond_destroy returns 0. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_init returns non-zero, or - * - pthread_cond_destroy returns non-zero. - * - Process returns non-zero exit status. - */ - -#include "test.h" - -static pthread_cond_t cv = NULL; - -int -main() -{ - assert(cv == NULL); - - assert(pthread_cond_init(&cv, NULL) == 0); - - assert(cv != NULL); - - assert(pthread_cond_destroy(&cv) == 0); - - assert(cv == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar2.c b/winsup/testsuite/winsup.api/pthread/condvar2.c deleted file mode 100644 index 309f5dfdf..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar2.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * File: condvar2.c - * - * Test Synopsis: - * - Test timed wait on a CV. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Because the CV is never signaled, we expect the wait to time out. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait does not return ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -pthread_cond_t cv; -pthread_mutex_t mutex; - -int -main() -{ - struct timespec abstime = { 0, 0 }; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - int result; - - assert(pthread_cond_init(&cv, NULL) == 0); - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - assert(pthread_mutex_lock(&mutex) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert(pthread_cond_timedwait(&cv, &mutex, &abstime) == ETIMEDOUT); - - assert(pthread_mutex_unlock(&mutex) == 0); - - result = pthread_cond_destroy(&cv); - assert(result == 0); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar2_1.c b/winsup/testsuite/winsup.api/pthread/condvar2_1.c deleted file mode 100644 index da3416203..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar2_1.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * File: condvar2_1.c - * - * Test Synopsis: - * - Test timeout of multiple waits on a CV with no signal/broadcast. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Because the CV is never signaled, we expect the waits to time out. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait does not return ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -static pthread_cond_t cv; -static pthread_mutex_t mutex; -static struct timespec abstime = { 0, 0 }; - -enum { - NUMTHREADS = 60 -}; - -void * -mythread(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_cond_timedwait(&cv, &mutex, &abstime) == ETIMEDOUT); - - assert(pthread_mutex_unlock(&mutex) == 0); - - return arg; -} - -int -main() -{ - int i; - pthread_t t[NUMTHREADS + 1]; - int result = 0; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert(pthread_cond_init(&cv, NULL) == 0); - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert(pthread_mutex_lock(&mutex) == 0); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_create(&t[i], NULL, mythread, (void *) i) == 0); - } - - assert(pthread_mutex_unlock(&mutex) == 0); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_join(t[i], (void **) &result) == 0); - assert(result == i); - } - - result = pthread_cond_destroy(&cv); - assert(result == 0); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar3.c b/winsup/testsuite/winsup.api/pthread/condvar3.c deleted file mode 100644 index 249e260aa..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar3.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * File: condvar3.c - * - * Test Synopsis: - * - Test basic function of a CV - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - The primary thread takes the lock before creating any threads. - * The secondary thread blocks on the lock allowing the primary - * thread to enter the cv wait state which releases the lock. - * The secondary thread then takes the lock and signals the waiting - * primary thread. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns 0. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -static pthread_cond_t cv; -static pthread_mutex_t mutex; -static int shared = 0; - -enum { - NUMTHREADS = 2 /* Including the primary thread. */ -}; - -void * -mythread(void * arg) -{ - int result = 0; - - assert(pthread_mutex_lock(&mutex) == 0); - - shared++; - - assert(pthread_mutex_unlock(&mutex) == 0); - - if ((result = pthread_cond_signal(&cv)) != 0) - { - printf("Error = %s\n", error_string[result]); - } - assert(result == 0); - - return (void *) 0; -} - -int -main() -{ - pthread_t t[NUMTHREADS]; - struct timespec abstime = { 0, 0 }; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert((t[0] = pthread_self()) != NULL); - - assert(pthread_cond_init(&cv, NULL) == 0); - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - assert(pthread_mutex_lock(&mutex) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - assert(pthread_create(&t[1], NULL, mythread, (void *) 1) == 0); - - abstime.tv_sec += 5; - - while (! (shared > 0)) - assert(pthread_cond_timedwait(&cv, &mutex, &abstime) == 0); - - assert(shared > 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_cond_destroy(&cv) == 0); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar3_1.c b/winsup/testsuite/winsup.api/pthread/condvar3_1.c deleted file mode 100644 index b08b04889..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar3_1.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * File: condvar3_1.c - * - * Test Synopsis: - * - Test timeout of multiple waits on a CV with some signaled. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Because some CVs are never signaled, we expect their waits to time out. - * Some are signaled, the rest time out. Pthread_cond_destroy() will fail - * unless all are accounted for, either signaled or timedout. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait does not return ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -static pthread_cond_t cv; -static pthread_cond_t cv1; -static pthread_mutex_t mutex; -static struct timespec abstime = { 0, 0 }; -static int timedout = 0; -static int signaled = 0; -static int awoken = 0; -static int waiting = 0; - -enum { - NUMTHREADS = 60 -}; - -void * -mythread(void * arg) -{ - int result; - - assert(pthread_mutex_lock(&mutex) == 0); - - if ( ++waiting == NUMTHREADS) - assert(pthread_cond_signal(&cv1) == 0); - - result = pthread_cond_timedwait(&cv, &mutex, &abstime); - if (result == ETIMEDOUT) - { - timedout++; - } - else - { - awoken++; - } - - assert(pthread_mutex_unlock(&mutex) == 0); - - return arg; -} - -int -main() -{ - int i; - pthread_t t[NUMTHREADS + 1]; - int result = 0; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert(pthread_cond_init(&cv, NULL) == 0); - assert(pthread_cond_init(&cv1, NULL) == 0); - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert(pthread_mutex_lock(&mutex) == 0); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_create(&t[i], NULL, mythread, (void *) i) == 0); - } - - do { - assert(pthread_cond_wait(&cv1,&mutex) == 0); - } while ( NUMTHREADS != waiting ); - - assert(pthread_mutex_unlock(&mutex) == 0); - - for (i = NUMTHREADS/3; i <= 2*NUMTHREADS/3; i++) - { - assert(pthread_cond_signal(&cv) == 0); - signaled++; - } - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_join(t[i], (void **) &result) == 0); - assert(result == i); - } - - printf("awk = %d\n", awoken); - printf("sig = %d\n", signaled); - printf("tot = %d\n", timedout); - - assert(signaled == awoken); - assert(timedout == NUMTHREADS - signaled); - - result = pthread_cond_destroy(&cv); - assert(result == 0); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar3_2.c b/winsup/testsuite/winsup.api/pthread/condvar3_2.c deleted file mode 100644 index 57e7eb439..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar3_2.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * File: condvar3_2.c - * - * Test Synopsis: - * - Test timeout of multiple waits on a CV with remainder broadcast awoken. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Because some CVs are never signaled, we expect their waits to time out. - * Some time out, the rest are broadcast signaled. Pthread_cond_destroy() will fail - * unless all are accounted for, either signaled or timedout. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait does not return ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -static pthread_cond_t cv; -static pthread_mutex_t mutex; -static struct timespec abstime = { 0, 0 }; -static struct timespec abstime2 = { 0, 0 }; -static int timedout = 0; -static int awoken = 0; - -enum { - NUMTHREADS = 60 -}; - -void * -mythread(void * arg) -{ - int result; - - assert(pthread_mutex_lock(&mutex) == 0); - - abstime2.tv_sec = abstime.tv_sec; - - if ((int) arg % 3 == 0) - { - abstime2.tv_sec += 2; - } - - result = pthread_cond_timedwait(&cv, &mutex, &abstime2); - if (result == ETIMEDOUT) - { - timedout++; - } - else - { - awoken++; - } - - assert(pthread_mutex_unlock(&mutex) == 0); - - return arg; -} - -int -main() -{ - int i; - pthread_t t[NUMTHREADS + 1]; - int result = 0; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert(pthread_cond_init(&cv, NULL) == 0); - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = abstime.tv_sec = currSysTime.time + 5; - abstime.tv_nsec = abstime2.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - assert(pthread_mutex_lock(&mutex) == 0); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_create(&t[i], NULL, mythread, (void *) i) == 0); - } - - assert(pthread_mutex_unlock(&mutex) == 0); - - for (i = 1; i <= NUMTHREADS; i++) - { - assert(pthread_join(t[i], (void **) &result) == 0); - assert(result == i); - /* - * Approximately 2/3rds of the threads are expected to time out. - * Signal the remainder after some threads have woken up and exited - * and while some are still waking up after timeout. - * Also tests that redundant broadcasts don't return errors. - */ - if (awoken > NUMTHREADS/3) - { - assert(pthread_cond_broadcast(&cv) == 0); - } - } - - assert(awoken == NUMTHREADS - timedout); - - result = pthread_cond_destroy(&cv); - assert(result == 0); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar3_3.c b/winsup/testsuite/winsup.api/pthread/condvar3_3.c deleted file mode 100644 index f6bcca9fa..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar3_3.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * File: condvar3_3.c - * - * Test Synopsis: - * - Test timeouts and lost signals on a CV. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait does not return ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -/* Timur Aydin (taydin@snet.net) */ - -#include "test.h" - -#include - -pthread_cond_t cnd; -pthread_mutex_t mtx; - -int main() -{ - int rc; - - struct timespec abstime = { 0, 0 }; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert(pthread_cond_init(&cnd, 0) == 0); - assert(pthread_mutex_init(&mtx, 0) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - abstime.tv_sec += 1; - - /* Here pthread_cond_timedwait should time out after one second. */ - - assert(pthread_mutex_lock(&mtx) == 0); - - assert((rc = pthread_cond_timedwait(&cnd, &mtx, &abstime)) == ETIMEDOUT); - - assert(pthread_mutex_unlock(&mtx) == 0); - - /* Here, the condition variable is signaled, but there are no - threads waiting on it. The signal should be lost and - the next pthread_cond_timedwait should time out too. */ - - assert(pthread_mutex_lock(&mtx) == 0); - - assert((rc = pthread_cond_signal(&cnd)) == 0); - - assert(pthread_mutex_unlock(&mtx) == 0); - - assert(pthread_mutex_lock(&mtx) == 0); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - abstime.tv_sec += 1; - - assert((rc = pthread_cond_timedwait(&cnd, &mtx, &abstime)) == ETIMEDOUT); - - assert(pthread_mutex_unlock(&mtx) == 0); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar4.c b/winsup/testsuite/winsup.api/pthread/condvar4.c deleted file mode 100644 index 7a2007a4a..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar4.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * File: condvar4.c - * - * Test Synopsis: - * - Test PTHREAD_COND_INITIALIZER. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Test basic CV function but starting with a static initialised - * CV. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns 0. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -typedef struct cvthing_t_ cvthing_t; - -struct cvthing_t_ { - pthread_cond_t notbusy; - pthread_mutex_t lock; - int shared; -}; - -static cvthing_t cvthing = { - PTHREAD_COND_INITIALIZER, - PTHREAD_MUTEX_INITIALIZER, - 0 -}; - -enum { - NUMTHREADS = 2 -}; - -void * -mythread(void * arg) -{ - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - assert(pthread_cond_signal(&cvthing.notbusy) == 0); - - return (void *) 0; -} - -int -main() -{ - pthread_t t[NUMTHREADS]; - struct timespec abstime = { 0, 0 }; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - cvthing.shared = 0; - - assert((t[0] = pthread_self()) != NULL); - - assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); - - assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - assert(cvthing.lock != PTHREAD_MUTEX_INITIALIZER); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == ETIMEDOUT); - - assert(cvthing.notbusy != PTHREAD_COND_INITIALIZER); - - assert(pthread_create(&t[1], NULL, mythread, (void *) 1) == 0); - - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - while (! (cvthing.shared > 0)) - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == 0); - - assert(cvthing.shared > 0); - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - assert(pthread_mutex_destroy(&cvthing.lock) == 0); - - assert(cvthing.lock == NULL); - - assert(pthread_cond_destroy(&cvthing.notbusy) == 0); - - assert(cvthing.notbusy == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar5.c b/winsup/testsuite/winsup.api/pthread/condvar5.c deleted file mode 100644 index b493ab136..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar5.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * File: condvar5.c - * - * Test Synopsis: - * - Test pthread_cond_broadcast. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Test broadcast with one waiting CV. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - pthread_cond_timedwait returns 0. - * - Process returns zero exit status. - * - * Fail Criteria: - * - pthread_cond_timedwait returns ETIMEDOUT. - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -typedef struct cvthing_t_ cvthing_t; - -struct cvthing_t_ { - pthread_cond_t notbusy; - pthread_mutex_t lock; - int shared; -}; - -static cvthing_t cvthing = { - PTHREAD_COND_INITIALIZER, - PTHREAD_MUTEX_INITIALIZER, - 0 -}; - -enum { - NUMTHREADS = 2 -}; - -void * -mythread(void * arg) -{ - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - assert(pthread_cond_broadcast(&cvthing.notbusy) == 0); - - return (void *) 0; -} - -int -main() -{ - pthread_t t[NUMTHREADS]; - struct timespec abstime = { 0, 0 }; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - cvthing.shared = 0; - - assert((t[0] = pthread_self()) != NULL); - - assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); - - assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - assert(cvthing.lock != PTHREAD_MUTEX_INITIALIZER); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == ETIMEDOUT); - - assert(cvthing.notbusy != PTHREAD_COND_INITIALIZER); - - assert(pthread_create(&t[1], NULL, mythread, (void *) 1) == 0); - - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - while (! (cvthing.shared > 0)) - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == 0); - - assert(cvthing.shared > 0); - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - assert(pthread_mutex_destroy(&cvthing.lock) == 0); - - assert(cvthing.lock == NULL); - - assert(pthread_cond_destroy(&cvthing.notbusy) == 0); - - assert(cvthing.notbusy == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar6.c b/winsup/testsuite/winsup.api/pthread/condvar6.c deleted file mode 100644 index f011bea13..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar6.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * File: - * - * Test Synopsis: - * - Test pthread_cond_broadcast. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Test broadcast with NUMTHREADS (=5) waiting CVs. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 5 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -typedef struct cvthing_t_ cvthing_t; - -struct cvthing_t_ { - pthread_cond_t notbusy; - pthread_mutex_t lock; - int shared; -}; - -static cvthing_t cvthing = { - PTHREAD_COND_INITIALIZER, - PTHREAD_MUTEX_INITIALIZER, - 0 -}; - -static pthread_mutex_t start_flag = PTHREAD_MUTEX_INITIALIZER; - -static struct timespec abstime = { 0, 0 }; - -static int awoken; - -void * -mythread(void * arg) -{ - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Wait for the start gun */ - assert(pthread_mutex_lock(&start_flag) == 0); - assert(pthread_mutex_unlock(&start_flag) == 0); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - while (! (cvthing.shared > 0)) - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == 0); - - assert(cvthing.shared > 0); - - awoken++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - return (void *) 0; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - cvthing.shared = 0; - - assert((t[0] = pthread_self()) != NULL); - - assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); - - assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER); - - assert(pthread_mutex_lock(&start_flag) == 0); - - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert((t[0] = pthread_self()) != NULL); - - awoken = 0; - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - - assert(pthread_mutex_unlock(&start_flag) == 0); - - /* - * Give threads time to start. - */ - Sleep(2000); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - assert(pthread_cond_broadcast(&cvthing.notbusy) == 0); - - /* - * Give threads time to complete. - */ - Sleep(2000); - - /* - * Cleanup the CV. - */ - - assert(pthread_mutex_destroy(&cvthing.lock) == 0); - - assert(cvthing.lock == NULL); - - assert(pthread_cond_destroy(&cvthing.notbusy) == 0); - - assert(cvthing.notbusy == NULL); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - failed = !threadbag[i].started; - - if (failed) - { - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. - */ - - assert(awoken == NUMTHREADS); - - /* - * Success. - */ - return 0; -} - - diff --git a/winsup/testsuite/winsup.api/pthread/condvar7.c b/winsup/testsuite/winsup.api/pthread/condvar7.c deleted file mode 100644 index 8e9808f48..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar7.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * File: condvar7.c - * - * - * Test Synopsis: - * - Test pthread_cond_broadcast with thread cancelation. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Test broadcast with NUMTHREADS (=5) waiting CVs, one is canceled while waiting. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 5 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -typedef struct cvthing_t_ cvthing_t; - -struct cvthing_t_ { - pthread_cond_t notbusy; - pthread_mutex_t lock; - int shared; -}; - -static cvthing_t cvthing = { - PTHREAD_COND_INITIALIZER, - PTHREAD_MUTEX_INITIALIZER, - 0 -}; - -static pthread_mutex_t start_flag = PTHREAD_MUTEX_INITIALIZER; - -static struct timespec abstime = { 0, 0 }; - -static int awoken; - -void * -mythread(void * arg) -{ - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Wait for the start gun */ - assert(pthread_mutex_lock(&start_flag) == 0); - assert(pthread_mutex_unlock(&start_flag) == 0); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - -#ifdef _MSC_VER -#pragma inline_depth(0) -#endif - pthread_cleanup_push((void *) pthread_mutex_unlock, (void *) &cvthing.lock); - - while (! (cvthing.shared > 0)) - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == 0); - - pthread_cleanup_pop(0); -#ifdef _MSC_VER -#pragma inline_depth() -#endif - - assert(cvthing.shared > 0); - - awoken++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - return (void *) 0; -} - -int -main() -{ - int failed = 0; - int i; - pthread_t t[NUMTHREADS + 1]; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - cvthing.shared = 0; - - assert((t[0] = pthread_self()) != NULL); - - assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); - - assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER); - - assert(pthread_mutex_lock(&start_flag) == 0); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 10; - - assert((t[0] = pthread_self()) != NULL); - - awoken = 0; - - for (i = 1; i <= NUMTHREADS; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - - assert(pthread_mutex_unlock(&start_flag) == 0); - - /* - * Give threads time to start. - */ - Sleep(1000); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - /* - * Cancel one of the threads. - */ - assert(pthread_cancel(t[3]) == 0); - Sleep(500); - - /* - * Signal all remaining waiting threads. - */ - assert(pthread_cond_broadcast(&cvthing.notbusy) == 0); - - /* - * Give threads time to complete. - */ - Sleep(2000); - - /* - * Cleanup the CV. - */ - - assert(pthread_mutex_destroy(&cvthing.lock) == 0); - - assert(cvthing.lock == NULL); - - assert(pthread_cond_destroy(&cvthing.notbusy) == 0); - - assert(cvthing.notbusy == NULL); - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - failed = !threadbag[i].started; - - if (failed) - { - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - assert(!failed); - - /* - * Check any results here. - */ - - assert(awoken == (NUMTHREADS - 1)); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar8.c b/winsup/testsuite/winsup.api/pthread/condvar8.c deleted file mode 100644 index 771d91cb5..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar8.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * File: condvar8.c - * - * Test Synopsis: - * - Test multiple pthread_cond_broadcasts. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Make NUMTHREADS threads wait on CV, broadcast signal them, and then repeat. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 5 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -typedef struct cvthing_t_ cvthing_t; - -struct cvthing_t_ { - pthread_cond_t notbusy; - pthread_mutex_t lock; - int shared; -}; - -static cvthing_t cvthing = { - PTHREAD_COND_INITIALIZER, - PTHREAD_MUTEX_INITIALIZER, - 0 -}; - -static pthread_mutex_t start_flag = PTHREAD_MUTEX_INITIALIZER; - -static struct timespec abstime = { 0, 0 }; - -static int awoken; - -static void * -mythread(void * arg) -{ - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Wait for the start gun */ - assert(pthread_mutex_lock(&start_flag) == 0); - assert(pthread_mutex_unlock(&start_flag) == 0); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - pthread_cleanup_push((__cleanup_routine_type)pthread_mutex_unlock, - (void *) &cvthing.lock); - - while (! (cvthing.shared > 0)) - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == 0); - - pthread_cleanup_pop(0); - - assert(cvthing.shared > 0); - - awoken++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - return (void *) 0; -} - -int -main() -{ - int failed = 0; - int i; - int first, last; - pthread_t t[NUMTHREADS + 1]; - - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert((t[0] = pthread_self()) != NULL); - - assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); - - assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER); - - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 10; - - assert((t[0] = pthread_self()) != NULL); - - awoken = 0; - - for (first = 1, last = NUMTHREADS / 2; - first < NUMTHREADS; - first = last + 1, last = NUMTHREADS) - { - assert(pthread_mutex_lock(&start_flag) == 0); - - for (i = first; i <= last; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - assert(pthread_detach(t[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - cvthing.shared = 0; - - assert(pthread_mutex_unlock(&start_flag) == 0); - - /* - * Give threads time to start. - */ - Sleep(1000); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - assert(pthread_cond_broadcast(&cvthing.notbusy) == 0); - - /* - * Give threads time to complete. - */ - Sleep(1000); - - assert(awoken == (i - 1)); - } - - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - failed = !threadbag[i].started; - - if (failed) - { - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - /* - * Cleanup the CV. - */ - - assert(pthread_mutex_destroy(&cvthing.lock) == 0); - - assert(cvthing.lock == NULL); - - assert(pthread_cond_destroy(&cvthing.notbusy) == 0); - - assert(cvthing.notbusy == NULL); - - assert(!failed); - - /* - * Check any results here. - */ - - assert(awoken == NUMTHREADS); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/condvar9.c b/winsup/testsuite/winsup.api/pthread/condvar9.c deleted file mode 100644 index 294556266..000000000 --- a/winsup/testsuite/winsup.api/pthread/condvar9.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * File: condvar9.c - * - * - * Test Synopsis: - * - Test multiple pthread_cond_broadcasts with thread cancelation. - * - * Test Method (Validation or Falsification): - * - Validation - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - Make NUMTHREADS threads wait on CV, broadcast signal them, cancel them - * and then repeat. - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" -#include - -/* - * Create NUMTHREADS threads in addition to the Main thread. - */ -enum { - NUMTHREADS = 9 -}; - -typedef struct bag_t_ bag_t; -struct bag_t_ { - int threadnum; - int started; - /* Add more per-thread state variables here */ -}; - -static bag_t threadbag[NUMTHREADS + 1]; - -typedef struct cvthing_t_ cvthing_t; - -struct cvthing_t_ { - pthread_cond_t notbusy; - pthread_mutex_t lock; - int shared; -}; - -static cvthing_t cvthing = { - PTHREAD_COND_INITIALIZER, - PTHREAD_MUTEX_INITIALIZER, - 0 -}; - -static pthread_mutex_t start_flag = PTHREAD_MUTEX_INITIALIZER; - -static struct timespec abstime = { 0, 0 }; - -static int awoken; -static int not_canceled; - -static void * -mythread(void * arg) -{ - bag_t * bag = (bag_t *) arg; - - assert(bag == &threadbag[bag->threadnum]); - assert(bag->started == 0); - bag->started = 1; - - /* Wait for the start gun */ - assert(pthread_mutex_lock(&start_flag) == 0); - assert(pthread_mutex_unlock(&start_flag) == 0); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - /* - * pthread_cond_timedwait is a cancelation point and we - * going to cancel one deliberately. - */ -#ifdef _MSC_VER -#pragma inline_depth(0) -#endif - pthread_cleanup_push((void *) pthread_mutex_unlock, (void *) &cvthing.lock); - - while (! (cvthing.shared > 0)) - assert(pthread_cond_timedwait(&cvthing.notbusy, &cvthing.lock, &abstime) == 0); - - assert(cvthing.shared > 0); - - awoken++; - - pthread_testcancel(); - - pthread_cleanup_pop(0); -#ifdef _MSC_VER -#pragma inline_depth() -#endif - - not_canceled++; - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - return (void *) 0; -} - -int -main() -{ - int failed = 0; - int i; - int first, last; - pthread_t t[NUMTHREADS + 1]; - struct timeb currSysTime; - const DWORD NANOSEC_PER_MILLISEC = 1000000; - - assert((t[0] = pthread_self()) != NULL); - - assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); - - assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER); - - /* get current system time */ - ftime(&currSysTime); - - abstime.tv_sec = currSysTime.time; - abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - - abstime.tv_sec += 5; - - assert((t[0] = pthread_self()) != NULL); - - awoken = 0; - not_canceled = 0; - - for (first = 1, last = NUMTHREADS / 2; - first < NUMTHREADS; - first = last + 1, last = NUMTHREADS) - { - assert(pthread_mutex_lock(&start_flag) == 0); - - for (i = first; i <= last; i++) - { - threadbag[i].started = 0; - threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); - assert(pthread_detach(t[i]) == 0); - } - - /* - * Code to control or munipulate child threads should probably go here. - */ - cvthing.shared = 0; - - assert(pthread_mutex_unlock(&start_flag) == 0); - - /* - * Give threads time to start. - */ - Sleep(1000); - - assert(pthread_mutex_lock(&cvthing.lock) == 0); - - cvthing.shared++; - - assert(pthread_cond_broadcast(&cvthing.notbusy) == 0); - for (i = first; i <= last; i++) - assert(pthread_cancel(t[i]) == 0); - - assert(pthread_mutex_unlock(&cvthing.lock) == 0); - - /* - * Give threads time to complete. - */ - Sleep(1000); - } - - - /* - * Standard check that all threads started. - */ - for (i = 1; i <= NUMTHREADS; i++) - { - failed = !threadbag[i].started; - - if (failed) - { - fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); - } - } - - /* - * Cleanup the CV. - */ - - assert(pthread_mutex_destroy(&cvthing.lock) == 0); - - assert(cvthing.lock == NULL); - - assert(pthread_cond_destroy(&cvthing.notbusy) == 0); - - assert(cvthing.notbusy == NULL); - - assert(!failed); - - /* - * Check any results here. - */ - - assert(awoken == NUMTHREADS); - assert(not_canceled == 0); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/count1.c b/winsup/testsuite/winsup.api/pthread/count1.c deleted file mode 100644 index ae30ed0a2..000000000 --- a/winsup/testsuite/winsup.api/pthread/count1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * count1.c - * - * Description: - * Test some basic assertions about the number of threads at runtime. - */ - -#include "test.h" - -#if ! defined (__MINGW32__) || defined (__MSVCRT__) -#define NUMTHREADS (60) -#else -#define NUMTHREADS (59) -#endif - -static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; -static pthread_t threads[NUMTHREADS]; -static unsigned numThreads = 0; - -void * -myfunc(void *arg) -{ - pthread_mutex_lock(&lock); - numThreads++; - pthread_mutex_unlock(&lock); - - Sleep(1000); - return 0; -} -int -main() -{ - int i; - int maxThreads = sizeof(threads) / sizeof(pthread_t); - - /* - * Spawn NUMTHREADS threads. Each thread should increment the - * numThreads variable, sleep for one second. - */ - for (i = 0; i < maxThreads; i++) - { - assert(pthread_create(&threads[i], NULL, myfunc, 0) == 0); - } - - /* - * Wait for all the threads to exit. - */ - for (i = 0; i < maxThreads; i++) - { - assert(pthread_join(threads[i], NULL) == 0); - } - - /* - * Check the number of threads created. - */ - assert((int) numThreads == maxThreads); - - /* - * Success. - */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/create1.c b/winsup/testsuite/winsup.api/pthread/create1.c deleted file mode 100644 index 192e52d9d..000000000 --- a/winsup/testsuite/winsup.api/pthread/create1.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * create1.c - * - * Description: - * Create a thread and check that it ran. - * - * Depends on API functions: None. - */ - -#include "test.h" - -static int washere = 0; - -void * func(void * arg) -{ - washere = 1; - return 0; -} - -int -main() -{ - pthread_t t; - - assert(pthread_create(&t, NULL, func, NULL) == 0); - - /* A dirty hack, but we cannot rely on pthread_join in this - primitive test. */ - Sleep(2000); - - assert(washere == 1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/create2.c b/winsup/testsuite/winsup.api/pthread/create2.c deleted file mode 100644 index 40e637b9d..000000000 --- a/winsup/testsuite/winsup.api/pthread/create2.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * File: create2.c - * - * Test Synopsis: - * - Test that threads have a Win32 handle when started. - * - * Test Method (Validation or Falsification): - * - Statistical, not absolute (depends on sample size). - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -const int NUMTHREADS = 10000; - -static int washere = 0; - -void * func(void * arg) -{ - washere = 1; - return (void *) 0; -} - -int -main() -{ - pthread_t t; - pthread_attr_t attr; - void * result = NULL; - int i; - - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - for (i = 0; i < NUMTHREADS; i++) - { - washere = 0; - assert(pthread_create(&t, &attr, func, NULL) == 0); - pthread_join(t, &result); - assert(washere == 1); - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/equal1.c b/winsup/testsuite/winsup.api/pthread/equal1.c deleted file mode 100644 index 617a95664..000000000 --- a/winsup/testsuite/winsup.api/pthread/equal1.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Test for pthread_equal. - * - * Depends on functions: pthread_create(). - */ - -#include "test.h" - -void * func(void * arg) -{ - Sleep(2000); - return 0; -} - -int -main() -{ - pthread_t t1, t2; - - assert(pthread_create(&t1, NULL, func, (void *) 1) == 0); - - assert(pthread_create(&t2, NULL, func, (void *) 2) == 0); - - assert(pthread_equal(t1, t2) == 0); - - assert(pthread_equal(t1,t1) != 0); - - /* This is a hack. We don't want to rely on pthread_join - yet if we can help it. */ - Sleep(4000); - - /* Success. */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/exit1.c b/winsup/testsuite/winsup.api/pthread/exit1.c deleted file mode 100644 index 06b7692de..000000000 --- a/winsup/testsuite/winsup.api/pthread/exit1.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Test for pthread_exit(). - * - * Depends on API functions: None. - */ - -#include "test.h" - -int -main(int argc, char * argv[]) -{ - /* A simple test first. */ - pthread_exit((void *) 0); - - /* Not reached */ - assert(0); - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/exit2.c b/winsup/testsuite/winsup.api/pthread/exit2.c deleted file mode 100644 index 684305b40..000000000 --- a/winsup/testsuite/winsup.api/pthread/exit2.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Test for pthread_exit(). - * - * Depends on API functions: - * pthread_create() - * pthread_exit() - */ - -#include "test.h" - -void * -func(void * arg) -{ - pthread_exit(arg); - - /* Never reached. */ - assert(0); -} - -int -main(int argc, char * argv[]) -{ - pthread_t t; - - assert(pthread_create(&t, NULL, func, (void *) NULL) == 0); - - Sleep(1000); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/exit3.c b/winsup/testsuite/winsup.api/pthread/exit3.c deleted file mode 100644 index 0b6ec31c5..000000000 --- a/winsup/testsuite/winsup.api/pthread/exit3.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Test for pthread_exit(). - * - * Depends on API functions: pthread_create(). - */ - -#include "test.h" - -void * -func(void * arg) -{ - pthread_exit(arg); - - /* Never reached. */ - assert(0); -} - -int -main(int argc, char * argv[]) -{ - pthread_t id[4]; - int i; - - /* Create a few threads and then exit. */ - for (i = 0; i < 4; i++) - { - assert(pthread_create(&id[i], NULL, func, (void *) i) == 0); - } - - Sleep(1000); - - /* Success. */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/inherit1.c b/winsup/testsuite/winsup.api/pthread/inherit1.c deleted file mode 100644 index a909eb763..000000000 --- a/winsup/testsuite/winsup.api/pthread/inherit1.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * File: inherit1.c - * - * Test Synopsis: - * - Test thread priority inheritance. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -void * func(void * arg) -{ - int policy; - struct sched_param param; - - assert(pthread_getschedparam(pthread_self(), &policy, ¶m) == 0); - return (void *) param.sched_priority; -} - -int -main() -{ - pthread_t t; - pthread_t mainThread = pthread_self(); - pthread_attr_t attr; - void * result = NULL; - struct sched_param param; - struct sched_param mainParam; - int maxPrio; - int minPrio; - int prio; - int policy; - int inheritsched = -1; - - assert((maxPrio = sched_get_priority_max(SCHED_OTHER)) != -1); - assert((minPrio = sched_get_priority_min(SCHED_OTHER)) != -1); - - assert(pthread_attr_init(&attr) == 0); - assert(pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED) == 0); - assert(pthread_attr_getinheritsched(&attr, &inheritsched) == 0); - assert(inheritsched == PTHREAD_INHERIT_SCHED); - - for (prio = minPrio; prio < maxPrio; prio++) - { - mainParam.sched_priority = prio; - - /* Change the main thread priority */ - assert(pthread_setschedparam(mainThread, SCHED_OTHER, &mainParam) == 0); - assert(pthread_getschedparam(mainThread, &policy, &mainParam) == 0); - assert(policy == SCHED_OTHER); - assert(mainParam.sched_priority == prio); - - for (param.sched_priority = prio; - param.sched_priority <= maxPrio; - param.sched_priority++) - { - /* The new thread create should ignore this new priority */ - assert(pthread_attr_setschedparam(&attr, ¶m) == 0); - assert(pthread_create(&t, &attr, func, NULL) == 0); - pthread_join(t, &result); - assert((int) result == mainParam.sched_priority); - } - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/join0.c b/winsup/testsuite/winsup.api/pthread/join0.c deleted file mode 100644 index 54b0bee6b..000000000 --- a/winsup/testsuite/winsup.api/pthread/join0.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Test for pthread_join(). - * - * Depends on API functions: pthread_create(), pthread_exit(). - */ - -#include "test.h" - -void * -func(void * arg) -{ - Sleep(2000); - - pthread_exit(arg); - - /* Never reached. */ - exit(1); -} - -int -main(int argc, char * argv[]) -{ - pthread_t id; - int result; - - /* Create a single thread and wait for it to exit. */ - assert(pthread_create(&id, NULL, func, (void *) 123) == 0); - - assert(pthread_join(id, (void **) &result) == 0); - -#if ! defined (__MINGW32__) || defined (__MSVCRT__) - assert(result == 123); -#else -# warning pthread_join not fully supported in this configuration. - assert(result == 0); -#endif - - /* Success. */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/join1.c b/winsup/testsuite/winsup.api/pthread/join1.c deleted file mode 100644 index d74e0c484..000000000 --- a/winsup/testsuite/winsup.api/pthread/join1.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Test for pthread_join(). - * - * Depends on API functions: pthread_create(), pthread_join(), pthread_exit(). - */ - -#include "test.h" - -void * -func(void * arg) -{ - int i = (int) arg; - - Sleep(i * 500); - - pthread_exit(arg); - - /* Never reached. */ - exit(1); -} - -int -main(int argc, char * argv[]) -{ - pthread_t id[4]; - int i; - int result; - - /* Create a few threads and then exit. */ - for (i = 0; i < 4; i++) - { - assert(pthread_create(&id[i], NULL, func, (void *) i) == 0); - } - - /* Some threads will finish before they are joined, some after. */ - Sleep(1000); - - for (i = 0; i < 4; i++) - { - assert(pthread_join(id[i], (void **) &result) == 0); -#if ! defined (__MINGW32__) || defined (__MSVCRT__) - assert(result == i); -#else -# warning pthread_join not fully supported in this configuration. - assert(result == 0); -#endif - } - - /* Success. */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/join2.c b/winsup/testsuite/winsup.api/pthread/join2.c deleted file mode 100644 index cdc8ca2d9..000000000 --- a/winsup/testsuite/winsup.api/pthread/join2.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Test for pthread_join() returning return value from threads. - * - * Depends on API functions: pthread_create(). - */ - -#include "test.h" - -void * -func(void * arg) -{ - Sleep(1000); - return arg; -} - -int -main(int argc, char * argv[]) -{ - pthread_t id[4]; - int i; - int result; - - /* Create a few threads and then exit. */ - for (i = 0; i < 4; i++) - { - assert(pthread_create(&id[i], NULL, func, (void *) i) == 0); - } - - for (i = 0; i < 4; i++) - { - assert(pthread_join(id[i], (void **) &result) == 0); -#if ! defined (__MINGW32__) || defined (__MSVCRT__) - /* CRTDLL _beginthread doesn't support return value, so - the assertion is guaranteed to fail. */ - assert(result == i); -#endif - } - - /* Success. */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mainthreadexits.c b/winsup/testsuite/winsup.api/pthread/mainthreadexits.c deleted file mode 100644 index b3a3653b8..000000000 --- a/winsup/testsuite/winsup.api/pthread/mainthreadexits.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include -#include - -static void * Thread (void *); - -static pthread_t main_thread; -static pthread_t secondThread; -static int result = 2; - -int main(void) -{ - main_thread = pthread_self (); - - if (pthread_create (&secondThread, NULL, Thread, NULL)) - exit (1); - sleep (5); - pthread_exit (&result); - /* If pthread_exit doesm't (which would be a bug) then we do */ - return 1; -} - -static void * Thread (void *not_used) -{ - void *myresult; - /* We should be able to join this */ - if (pthread_join (main_thread, &myresult)) - exit (1); - - if (*(int *)myresult != 2) - exit (1); - - exit (0); -} -/* -This valid code doesn't work at all. The mainthread object in MTinterface -is not properly initialized, the cancel_event is NULL and the win32_obj_id -is NULL because myself->hProcess is NULL when MTinterface is initialized -(and i don't think that a process handle can be used as thread handle). -Even if the handles would be valid the pthread_join call would try to -delete a thread object that is created static which would result in a -corrupted heap. - -Concept test Contributed by Thomas Pfaff -Scriptable test by Robert Collins - -*/ diff --git a/winsup/testsuite/winsup.api/pthread/mutex1.c b/winsup/testsuite/winsup.api/pthread/mutex1.c deleted file mode 100644 index b7f6b6f15..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex1.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * mutex1.c - * - * Create a simple mutex object, lock it, and then unlock it again. - * This is the simplest test of the pthread mutex family that we can do. - * - * Depends on API functions: - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() - * pthread_mutex_destroy() - */ - -#include "test.h" - -pthread_mutex_t mutex = NULL; - -int -main() -{ - assert(mutex == NULL); - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex1d.c b/winsup/testsuite/winsup.api/pthread/mutex1d.c deleted file mode 100644 index 354b106d1..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex1d.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * mutex1d.c - * - * As for mutex1.c but with type set to PTHREAD_MUTEX_DEFAULT. - * - * Create a simple mutex object, lock it, unlock it, then destroy it. - * This is the simplest test of the pthread mutex family that we can do. - * - * Depends on API functions: - * pthread_mutexattr_settype() - * pthread_mutex_init() - * pthread_mutex_destroy() - */ - -#include "test.h" - -pthread_mutex_t mutex = NULL; -pthread_mutexattr_t mxAttr; - -int -main() -{ - assert(pthread_mutexattr_init(&mxAttr) == 0); - - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_DEFAULT) == 0); - - assert(mutex == NULL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex1e.c b/winsup/testsuite/winsup.api/pthread/mutex1e.c deleted file mode 100644 index 2feb16c08..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex1e.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * mutex1e.c - * - * As for mutex1.c but with type set to PTHREAD_MUTEX_ERRORCHECK. - * - * Create a simple mutex object, lock it, unlock it, then destroy it. - * This is the simplest test of the pthread mutex family that we can do. - * - * Depends on API functions: - * pthread_mutexattr_settype() - * pthread_mutex_init() - * pthread_mutex_destroy() - */ - -#include "test.h" - -pthread_mutex_t mutex = NULL; -pthread_mutexattr_t mxAttr; - -int -main() -{ - assert(pthread_mutexattr_init(&mxAttr) == 0); - - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_ERRORCHECK) == 0); - - assert(mutex == NULL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex1n.c b/winsup/testsuite/winsup.api/pthread/mutex1n.c deleted file mode 100644 index 9af3d5f5c..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex1n.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * mutex1n.c - * - * As for mutex1.c but with type set to PTHREAD_MUTEX_NORMAL. - * - * Create a simple mutex object, lock it, unlock it, then destroy it. - * This is the simplest test of the pthread mutex family that we can do. - * - * Depends on API functions: - * pthread_mutexattr_settype() - * pthread_mutex_init() - * pthread_mutex_destroy() - */ - -#include "test.h" - -pthread_mutex_t mutex = NULL; -pthread_mutexattr_t mxAttr; - -int -main() -{ - assert(pthread_mutexattr_init(&mxAttr) == 0); - - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_NORMAL) == 0); - - assert(mutex == NULL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex1r.c b/winsup/testsuite/winsup.api/pthread/mutex1r.c deleted file mode 100644 index b5131bb0e..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex1r.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * mutex1r.c - * - * As for mutex1.c but with type set to PTHREAD_MUTEX_RECURSIVE. - * - * Create a simple mutex object, lock it, unlock it, then destroy it. - * This is the simplest test of the pthread mutex family that we can do. - * - * Depends on API functions: - * pthread_mutexattr_settype() - * pthread_mutex_init() - * pthread_mutex_destroy() - */ - -#include "test.h" - -pthread_mutex_t mutex = NULL; -pthread_mutexattr_t mxAttr; - -int -main() -{ - assert(pthread_mutexattr_init(&mxAttr) == 0); - - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_RECURSIVE) == 0); - - assert(mutex == NULL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex2.c b/winsup/testsuite/winsup.api/pthread/mutex2.c deleted file mode 100644 index 731c47fab..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex2.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * mutex2.c - * - * Declare a static mutex object, lock it, - * and then unlock it again. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - -int -main() -{ - assert(mutex == PTHREAD_MUTEX_INITIALIZER); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(mutex != PTHREAD_MUTEX_INITIALIZER); - - assert(mutex != NULL); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex3.c b/winsup/testsuite/winsup.api/pthread/mutex3.c deleted file mode 100644 index 07e75b187..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex3.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * mutex3.c - * - * Declare a static mutex object, lock it, trylock it, - * and then unlock it again. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; - -static int washere = 0; - -void * func(void * arg) -{ - assert(pthread_mutex_trylock(&mutex1) == EBUSY); - - washere = 1; - - return 0; -} - -int -main() -{ - pthread_t t; - - assert(pthread_mutex_lock(&mutex1) == 0); - - assert(pthread_create(&t, NULL, func, NULL) == 0); - assert(pthread_join(t, NULL) == 0); - - assert(pthread_mutex_unlock(&mutex1) == 0); - - assert(washere == 1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex4.c b/winsup/testsuite/winsup.api/pthread/mutex4.c deleted file mode 100644 index 8a983fee9..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex4.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * mutex4.c - * - * Thread A locks mutex - thread B tries to unlock. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int wasHere = 0; - -static pthread_mutex_t mutex1; - -void * unlocker(void * arg) -{ - int expectedResult = (int) arg; - - wasHere++; - assert(pthread_mutex_unlock(&mutex1) == expectedResult); - wasHere++; - return NULL; -} - -int -main() -{ - pthread_t t; - pthread_mutexattr_t ma; - - assert(pthread_mutexattr_init(&ma) == 0); - - wasHere = 0; - assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ERRORCHECK) == 0); - assert(pthread_mutex_init(&mutex1, &ma) == 0); - assert(pthread_mutex_lock(&mutex1) == 0); - assert(pthread_create(&t, NULL, unlocker, (void *) EPERM) == 0); - assert(pthread_join(t, NULL) == 0); - assert(pthread_mutex_unlock(&mutex1) == 0); - assert(pthread_mutex_destroy(&mutex1) == 0); - assert(wasHere == 2); - - wasHere = 0; - assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ERRORCHECK) == 0); - assert(pthread_mutex_init(&mutex1, &ma) == 0); - assert(pthread_mutex_lock(&mutex1) == 0); - assert(pthread_create(&t, NULL, unlocker, (void *) EPERM) == 0); - assert(pthread_join(t, NULL) == 0); - assert(pthread_mutex_unlock(&mutex1) == 0); - assert(pthread_mutex_destroy(&mutex1) == 0); - assert(wasHere == 2); - - wasHere = 0; - assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE) == 0); - assert(pthread_mutex_init(&mutex1, &ma) == 0); - assert(pthread_mutex_lock(&mutex1) == 0); - assert(pthread_create(&t, NULL, unlocker, (void *) EPERM) == 0); - assert(pthread_join(t, NULL) == 0); - assert(pthread_mutex_unlock(&mutex1) == 0); - assert(pthread_mutex_destroy(&mutex1) == 0); - assert(wasHere == 2); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex5.c b/winsup/testsuite/winsup.api/pthread/mutex5.c deleted file mode 100644 index 7029da12f..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex5.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * mutex5.c - * - * Confirm the equality/inequality of the various mutex types, - * and the default not-set value. - */ - -#include "test.h" - -static pthread_mutexattr_t mxAttr; - -int -main() -{ - int mxType = -1; - int success = 0; /* Use to quell GNU compiler warnings. */ - - assert(success = PTHREAD_MUTEX_DEFAULT == PTHREAD_MUTEX_NORMAL); - assert(success = PTHREAD_MUTEX_DEFAULT != PTHREAD_MUTEX_RECURSIVE); - assert(success = PTHREAD_MUTEX_RECURSIVE != PTHREAD_MUTEX_ERRORCHECK); - - if (success == success) - { - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_ERRORCHECK); - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex6d.c b/winsup/testsuite/winsup.api/pthread/mutex6d.c deleted file mode 100644 index f39c1ac53..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex6d.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * mutex6d.c - * - * Tests PTHREAD_MUTEX_DEFAULT mutex type. - * Thread locks mutex twice (recursive lock). - * The thread should deadlock. - * - * Depends on API functions: - * pthread_create() - * pthread_mutexattr_init() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - - /* Should wait here (deadlocked) */ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_DEFAULT) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_NORMAL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - Sleep(1000); - - assert(lockCount == 1); - - /* - * Should succeed even though we don't own the lock - * because FAST mutexes don't check ownership. - */ - assert(pthread_mutex_unlock(&mutex) == 0); - - Sleep (1000); - - assert(lockCount == 2); - - exit(0); - - /* Never reached */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex6e.c b/winsup/testsuite/winsup.api/pthread/mutex6e.c deleted file mode 100644 index e22550f7a..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex6e.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * mutex6e.c - * - * Tests PTHREAD_MUTEX_ERRORCHECK mutex type. - * Thread locks mutex twice (recursive lock). - * This should fail with an EDEADLK error. - * The second unlock attempt should fail with an EPERM error. - * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_lock(&mutex) == EDEADLK); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == EPERM); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int result = 0; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_ERRORCHECK) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_ERRORCHECK); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - assert(pthread_join(t, (void **) &result) == 0); - assert(result == 555); - - assert(lockCount == 2); - - assert(pthread_mutex_destroy(&mutex) == 0); - assert(pthread_mutexattr_destroy(&mxAttr) == 0); - - exit(0); - - /* Never reached */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/mutex6n.c b/winsup/testsuite/winsup.api/pthread/mutex6n.c deleted file mode 100644 index 38cbba034..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex6n.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * mutex6n.c - * - * Tests PTHREAD_MUTEX_NORMAL mutex type. - * Thread locks mutex twice (recursive lock). - * The thread should deadlock. - * - * Depends on API functions: - * pthread_create() - * pthread_mutexattr_init() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - - /* Should wait here (deadlocked) */ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_NORMAL) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_NORMAL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - Sleep(1000); - - assert(lockCount == 1); - - /* - * Should succeed even though we don't own the lock - * because FAST mutexes don't check ownership. - */ - assert(pthread_mutex_unlock(&mutex) == 0); - - Sleep (1000); - - assert(lockCount == 2); - - exit(0); - - /* Never reached */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/mutex6r.c b/winsup/testsuite/winsup.api/pthread/mutex6r.c deleted file mode 100644 index 586cc841b..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex6r.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * mutex6r.c - * - * Tests PTHREAD_MUTEX_RECURSIVE mutex type. - * Thread locks mutex twice (recursive lock). - * Both locks and unlocks should succeed. - * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == 0); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int result = 0; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_RECURSIVE) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_RECURSIVE); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - assert(pthread_join(t, (void **) &result) == 0); - assert(result == 555); - - assert(lockCount == 2); - - assert(pthread_mutex_destroy(&mutex) == 0); - assert(pthread_mutexattr_destroy(&mxAttr) == 0); - - exit(0); - - /* Never reached */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex7.c b/winsup/testsuite/winsup.api/pthread/mutex7.c deleted file mode 100644 index d2c9f8bee..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex7.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * mutex7.c - * - * Test the default (type not set) mutex type. - * Should be the same as PTHREAD_MUTEX_ERRORCHECK. - * Thread locks then trylocks mutex (attempted recursive lock). - * The thread should lock first time and EBUSY second time. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_trylock(&mutex) == EBUSY); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == EPERM); - - return 0; -} - -int -main() -{ - pthread_t t; - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - Sleep(1000); - - assert(lockCount == 2); - - exit(0); - - /* Never reached */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex7d.c b/winsup/testsuite/winsup.api/pthread/mutex7d.c deleted file mode 100644 index 906d0f043..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex7d.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * mutex7d.c - * - * Test the default (type not set) mutex type. - * Should be the same as PTHREAD_MUTEX_ERRORCHECK. - * Thread locks then trylocks mutex (attempted recursive lock). - * The thread should lock first time and EBUSY second time. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_trylock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_trylock(&mutex) == EBUSY); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == EPERM); - - return 0; -} - -int -main() -{ - int result = 0; - pthread_t t; - - assert(pthread_mutex_init(&mutex, NULL) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - assert(pthread_join(t, (void **) &result) == 0); - - assert(lockCount == 2); - - exit(0); - - /* Never reached */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex7e.c b/winsup/testsuite/winsup.api/pthread/mutex7e.c deleted file mode 100644 index 05722512d..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex7e.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * mutex7e.c - * - * Tests PTHREAD_MUTEX_ERRORCHECK mutex type. - * Thread locks and then trylocks mutex (attempted recursive lock). - * Trylock should fail with an EBUSY error. - * The second unlock attempt should fail with an EPERM error. - * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_trylock(&mutex) == EBUSY); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == EPERM); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int result = 0; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_ERRORCHECK) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_ERRORCHECK); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - assert(pthread_join(t, (void **) &result) == 0); - assert(result == 555); - - assert(lockCount == 2); - - assert(pthread_mutex_destroy(&mutex) == 0); - assert(pthread_mutexattr_destroy(&mxAttr) == 0); - - exit(0); - - /* Never reached */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/mutex7n.c b/winsup/testsuite/winsup.api/pthread/mutex7n.c deleted file mode 100644 index e9a36fec0..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex7n.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * mutex7n.c - * - * Tests PTHREAD_MUTEX_NORMAL mutex type. - * Thread locks then trylocks mutex (attempted recursive lock). - * The thread should lock first time and EBUSY second time. - * - * Depends on API functions: - * pthread_create() - * pthread_mutexattr_init() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_trylock(&mutex) == EBUSY); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == EPERM); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_NORMAL) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_NORMAL); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - Sleep(1000); - - assert(lockCount == 2); - - exit(0); - - /* Never reached */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/mutex7r.c b/winsup/testsuite/winsup.api/pthread/mutex7r.c deleted file mode 100644 index 6f9ed744b..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex7r.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * mutex7r.c - * - * Tests PTHREAD_MUTEX_RECURSIVE mutex type. - * Thread locks mutex then trylocks mutex (recursive lock twice). - * Both locks and unlocks should succeed. - * - * Depends on API functions: - * pthread_create() - * pthread_join() - * pthread_mutexattr_init() - * pthread_mutexattr_destroy() - * pthread_mutexattr_settype() - * pthread_mutexattr_gettype() - * pthread_mutex_init() - * pthread_mutex_destroy() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -static pthread_mutex_t mutex; -static pthread_mutexattr_t mxAttr; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_trylock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == 0); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - int result = 0; - int mxType = -1; - - assert(pthread_mutexattr_init(&mxAttr) == 0); - assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_RECURSIVE) == 0); - assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); - assert(mxType == PTHREAD_MUTEX_RECURSIVE); - - assert(pthread_mutex_init(&mutex, &mxAttr) == 0); - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - assert(pthread_join(t, (void **) &result) == 0); - assert(result == 555); - - assert(lockCount == 2); - - assert(pthread_mutex_destroy(&mutex) == 0); - assert(pthread_mutexattr_destroy(&mxAttr) == 0); - - exit(0); - - /* Never reached */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex8e.c b/winsup/testsuite/winsup.api/pthread/mutex8e.c deleted file mode 100644 index 7108b02af..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex8e.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * mutex8e.c - * - * Tests PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -pthread_mutex_t mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; - -int -main() -{ - assert(mutex == PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(mutex != PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == EDEADLK); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/mutex8n.c b/winsup/testsuite/winsup.api/pthread/mutex8n.c deleted file mode 100644 index 46fc9c676..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex8n.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * mutex8n.c - * - * Tests PTHREAD_NORMAL_MUTEX_INITIALIZER_NP. - * Thread locks mutex twice (recursive lock). - * The thread should deadlock. - * - * Depends on API functions: - * pthread_create() - * pthread_mutex_init() - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -static int lockCount = 0; - -pthread_mutex_t mutex = PTHREAD_NORMAL_MUTEX_INITIALIZER_NP; - -void * locker(void * arg) -{ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - - /* Should wait here (deadlocked) */ - assert(pthread_mutex_lock(&mutex) == 0); - lockCount++; - assert(pthread_mutex_unlock(&mutex) == 0); - - return (void *) 555; -} - -int -main() -{ - pthread_t t; - - assert(pthread_create(&t, NULL, locker, NULL) == 0); - - Sleep(1000); - - assert(lockCount == 1); - - /* - * Should succeed even though we don't own the lock - * because FAST mutexes don't check ownership. - */ - assert(pthread_mutex_unlock(&mutex) == 0); - - Sleep (1000); - - assert(lockCount == 2); - - exit(0); - - /* Never reached */ - return 0; -} - diff --git a/winsup/testsuite/winsup.api/pthread/mutex8r.c b/winsup/testsuite/winsup.api/pthread/mutex8r.c deleted file mode 100644 index ecaccd3ec..000000000 --- a/winsup/testsuite/winsup.api/pthread/mutex8r.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * mutex8r.c - * - * Tests PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP. - * - * Depends on API functions: - * pthread_mutex_lock() - * pthread_mutex_unlock() - */ - -#include "test.h" - -pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; - -int -main() -{ - assert(mutex == PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(mutex != PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP); - - assert(mutex != NULL); - - assert(pthread_mutex_lock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_unlock(&mutex) == 0); - - assert(pthread_mutex_destroy(&mutex) == 0); - - assert(mutex == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/once1.c b/winsup/testsuite/winsup.api/pthread/once1.c deleted file mode 100644 index 91dc03832..000000000 --- a/winsup/testsuite/winsup.api/pthread/once1.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * once1.c - * - * Create a static pthread_once and test that it calls myfunc once. - * - * Depends on API functions: - * pthread_once() - * pthread_create() - */ - -#include "test.h" - -pthread_once_t once = PTHREAD_ONCE_INIT; - -static int washere = 0; - -void -myfunc(void) -{ - washere++; -} - -void * -mythread(void * arg) -{ - assert(pthread_once(&once, myfunc) == 0); - - return 0; -} - -int -main() -{ - pthread_t t1, t2; - - assert(pthread_create(&t1, NULL, mythread, NULL) == 0); - - assert(pthread_create(&t2, NULL, mythread, NULL) == 0); - - Sleep(2000); - - assert(washere == 1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/priority1.c b/winsup/testsuite/winsup.api/pthread/priority1.c deleted file mode 100644 index a31102895..000000000 --- a/winsup/testsuite/winsup.api/pthread/priority1.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * File: priority1.c - * - * Test Synopsis: - * - Test thread priority explicit setting using thread attribute. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -void * func(void * arg) -{ - int policy; - struct sched_param param; - - assert(pthread_getschedparam(pthread_self(), &policy, ¶m) == 0); - assert(policy == SCHED_OTHER); - return (void *) param.sched_priority; -} - -int -main() -{ - pthread_t t; - pthread_attr_t attr; - void * result = NULL; - struct sched_param param; - int maxPrio = sched_get_priority_max(SCHED_OTHER); - int minPrio = sched_get_priority_min(SCHED_OTHER); - - assert(pthread_attr_init(&attr) == 0); - assert(pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) == 0); - - for (param.sched_priority = minPrio; - param.sched_priority <= maxPrio; - param.sched_priority++) - { - assert(pthread_attr_setschedparam(&attr, ¶m) == 0); - assert(pthread_create(&t, &attr, func, NULL) == 0); - pthread_join(t, &result); - assert((int) result == param.sched_priority); - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/priority2.c b/winsup/testsuite/winsup.api/pthread/priority2.c deleted file mode 100644 index 4dcf3859f..000000000 --- a/winsup/testsuite/winsup.api/pthread/priority2.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * File: priority2.c - * - * Test Synopsis: - * - Test thread priority setting after creation. - * - * Test Method (Validation or Falsification): - * - - * - * Requirements Tested: - * - - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Description: - * - - * - * Environment: - * - - * - * Input: - * - None. - * - * Output: - * - File name, Line number, and failed expression on failure. - * - No output on success. - * - * Assumptions: - * - - * - * Pass Criteria: - * - Process returns zero exit status. - * - * Fail Criteria: - * - Process returns non-zero exit status. - */ - -#include "test.h" - -pthread_mutex_t startMx = PTHREAD_MUTEX_INITIALIZER; - -void * func(void * arg) -{ - int policy; - struct sched_param param; - - assert(pthread_mutex_lock(&startMx) == 0); - assert(pthread_getschedparam(pthread_self(), &policy, ¶m) == 0); - assert(pthread_mutex_unlock(&startMx) == 0); - assert(policy == SCHED_OTHER); - return (void *) param.sched_priority; -} - -int -main() -{ - pthread_t t; - void * result = NULL; - struct sched_param param; - int maxPrio = sched_get_priority_max(SCHED_OTHER); - int minPrio = sched_get_priority_min(SCHED_OTHER); - - for (param.sched_priority = minPrio; - param.sched_priority <= maxPrio; - param.sched_priority++) - { - assert(pthread_mutex_lock(&startMx) == 0); - assert(pthread_create(&t, NULL, func, NULL) == 0); - assert(pthread_setschedparam(t, SCHED_OTHER, ¶m) == 0); - assert(pthread_mutex_unlock(&startMx) == 0); - pthread_join(t, &result); - assert((int) result == param.sched_priority); - } - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock1.c b/winsup/testsuite/winsup.api/pthread/rwlock1.c deleted file mode 100644 index 25e29f6ac..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock1.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * rwlock1.c - * - * Create a simple rwlock object and then destroy it. - * - * Depends on API functions: - * pthread_rwlock_init() - * pthread_rwlock_destroy() - */ - -#include "test.h" - -pthread_rwlock_t rwlock = NULL; - -int -main() -{ - assert(rwlock == NULL); - - assert(pthread_rwlock_init(&rwlock, NULL) == 0); - - assert(rwlock != NULL); - - assert(pthread_rwlock_destroy(&rwlock) == 0); - - assert(rwlock == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock2.c b/winsup/testsuite/winsup.api/pthread/rwlock2.c deleted file mode 100644 index cfb32282c..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock2.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * rwlock2.c - * - * Declare a static rwlock object, lock it, - * and then unlock it again. - * - * Depends on API functions: - * pthread_rwlock_rdlock() - * pthread_rwlock_unlock() - */ - -#include "test.h" - -pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER; - -int -main() -{ - assert(rwlock == PTHREAD_RWLOCK_INITIALIZER); - - assert(pthread_rwlock_rdlock(&rwlock) == 0); - - assert(rwlock != PTHREAD_RWLOCK_INITIALIZER); - - assert(rwlock != NULL); - - assert(pthread_rwlock_unlock(&rwlock) == 0); - - assert(pthread_rwlock_destroy(&rwlock) == 0); - - assert(rwlock == NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock3.c b/winsup/testsuite/winsup.api/pthread/rwlock3.c deleted file mode 100644 index 0703c1a2d..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock3.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * rwlock3.c - * - * - * Declare a static rwlock object, wrlock it, trywrlock it, - * and then unlock it again. - * - * Depends on API functions: - * pthread_rwlock_wrlock() - * pthread_rwlock_trywrlock() - * pthread_rwlock_unlock() - */ - -#include "test.h" - -pthread_rwlock_t rwlock1 = PTHREAD_RWLOCK_INITIALIZER; - -static int washere = 0; - -void * func(void * arg) -{ - assert(pthread_rwlock_trywrlock(&rwlock1) == EBUSY); - - washere = 1; - - return 0; -} - -int -main() -{ - pthread_t t; - - assert(pthread_rwlock_wrlock(&rwlock1) == 0); - - assert(pthread_create(&t, NULL, func, NULL) == 0); - - Sleep(2000); - - assert(pthread_rwlock_unlock(&rwlock1) == 0); - - assert(washere == 1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock4.c b/winsup/testsuite/winsup.api/pthread/rwlock4.c deleted file mode 100644 index 8cae52e6f..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock4.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * rwlock4.c - * - * Declare a static rwlock object, rdlock it, trywrlock it, - * and then unlock it again. - * - * Depends on API functions: - * pthread_rwlock_rdlock() - * pthread_rwlock_trywrlock() - * pthread_rwlock_unlock() - */ - -#include "test.h" - -pthread_rwlock_t rwlock1 = PTHREAD_RWLOCK_INITIALIZER; - -static int washere = 0; - -void * func(void * arg) -{ - assert(pthread_rwlock_trywrlock(&rwlock1) == EBUSY); - - washere = 1; - - return 0; -} - -int -main() -{ - pthread_t t; - - assert(pthread_rwlock_rdlock(&rwlock1) == 0); - - assert(pthread_create(&t, NULL, func, NULL) == 0); - - Sleep(2000); - - assert(pthread_rwlock_unlock(&rwlock1) == 0); - - assert(washere == 1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock5.c b/winsup/testsuite/winsup.api/pthread/rwlock5.c deleted file mode 100644 index 3ada946e3..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock5.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * rwlock5.c - * - * - * Declare a static rwlock object, rdlock it, tryrdlock it, - * and then unlock it again. - * - * Depends on API functions: - * pthread_rwlock_rdlock() - * pthread_rwlock_tryrdlock() - * pthread_rwlock_unlock() - */ - -#include "test.h" - -pthread_rwlock_t rwlock1 = PTHREAD_RWLOCK_INITIALIZER; - -static int washere = 0; - -void * func(void * arg) -{ - assert(pthread_rwlock_tryrdlock(&rwlock1) == 0); - - assert(pthread_rwlock_unlock(&rwlock1) == 0); - - washere = 1; - - return 0; -} - -int -main() -{ - pthread_t t; - - assert(pthread_rwlock_rdlock(&rwlock1) == 0); - - assert(pthread_create(&t, NULL, func, NULL) == 0); - - Sleep(2000); - - assert(pthread_rwlock_unlock(&rwlock1) == 0); - - assert(washere == 1); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock6.c b/winsup/testsuite/winsup.api/pthread/rwlock6.c deleted file mode 100644 index d5f2320d0..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock6.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * rwlock6.c - * - * Check writer and reader locking - * - * Depends on API functions: - * pthread_rwlock_rdlock() - * pthread_rwlock_wrlock() - * pthread_rwlock_unlock() - */ - -#include "test.h" - -static pthread_rwlock_t rwlock1 = PTHREAD_RWLOCK_INITIALIZER; - -static int bankAccount = 0; - -void * wrfunc(void * arg) -{ - int ba; - - assert(pthread_rwlock_wrlock(&rwlock1) == 0); - Sleep(2000); - bankAccount += 10; - ba = bankAccount; - assert(pthread_rwlock_unlock(&rwlock1) == 0); - - return ((void *) ba); -} - -void * rdfunc(void * arg) -{ - int ba; - - assert(pthread_rwlock_rdlock(&rwlock1) == 0); - ba = bankAccount; - assert(pthread_rwlock_unlock(&rwlock1) == 0); - - return ((void *) ba); -} - -int -main() -{ - pthread_t wrt1; - pthread_t wrt2; - pthread_t rdt; - int wr1Result = 0; - int wr2Result = 0; - int rdResult = 0; - - bankAccount = 0; - - assert(pthread_create(&wrt1, NULL, wrfunc, NULL) == 0); - Sleep(500); - assert(pthread_create(&rdt, NULL, rdfunc, NULL) == 0); - Sleep(500); - assert(pthread_create(&wrt2, NULL, wrfunc, NULL) == 0); - - assert(pthread_join(wrt1, (void **) &wr1Result) == 0); - assert(pthread_join(rdt, (void **) &rdResult) == 0); - assert(pthread_join(wrt2, (void **) &wr2Result) == 0); - - assert(wr1Result == 10); - assert(rdResult == 20); - assert(wr2Result == 20); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/rwlock7.c b/winsup/testsuite/winsup.api/pthread/rwlock7.c deleted file mode 100644 index ded882d9f..000000000 --- a/winsup/testsuite/winsup.api/pthread/rwlock7.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * rwlock7.c - * - * Hammer on a bunch of rwlocks to test robustness and fairness. - * Printed stats should be roughly even for each thread. - */ - -#include "test.h" -#include -#include - -#ifdef __GNUC__ -#include -#endif - -#define THREADS 5 -#define DATASIZE 15 -#define ITERATIONS 1000000 - -#define rand_r( _seed ) \ - ( _seed == _seed? rand() : rand() ) - -/* - * Keep statistics for each thread. - */ -typedef struct thread_tag { - int thread_num; - pthread_t thread_id; - int updates; - int reads; - int interval; -} thread_t; - -/* - * Read-write lock and shared data - */ -typedef struct data_tag { - pthread_rwlock_t lock; - int data; - int updates; -} data_t; - -static thread_t threads[THREADS]; -static data_t data[DATASIZE]; - -/* - * Thread start routine that uses read-write locks - */ -void *thread_routine (void *arg) -{ - thread_t *self = (thread_t*)arg; - int repeats = 0; - int iteration; - int element = 0; - - for (iteration = 0; iteration < ITERATIONS; iteration++) - { - if (iteration % (ITERATIONS / 10) == 0) - { - putchar('.'); - fflush(stdout); - } - /* - * Each "self->interval" iterations, perform an - * update operation (write lock instead of read - * lock). - */ - if ((iteration % self->interval) == 0) - { - assert(pthread_rwlock_wrlock (&data[element].lock) == 0); - data[element].data = self->thread_num; - data[element].updates++; - self->updates++; - assert(pthread_rwlock_unlock (&data[element].lock) == 0); - } else { - /* - * Look at the current data element to see whether - * the current thread last updated it. Count the - * times, to report later. - */ - assert(pthread_rwlock_rdlock (&data[element].lock) == 0); - - self->reads++; - - if (data[element].data == self->thread_num) - { - repeats++; - } - - assert(pthread_rwlock_unlock (&data[element].lock) == 0); - } - - element++; - - if (element >= DATASIZE) - { - element = 0; - } - } - - if (repeats > 0) - { - printf ("\nThread %d found unchanged elements %d times", - self->thread_num, repeats); - fflush(stdout); - } - - return NULL; -} - -int -main (int argc, char *argv[]) -{ - int count; - int data_count; - int thread_updates = 0; - int data_updates = 0; - int seed = 1; - - struct timeb currSysTime1; - struct timeb currSysTime2; - - /* - * Initialize the shared data. - */ - for (data_count = 0; data_count < DATASIZE; data_count++) - { - data[data_count].data = 0; - data[data_count].updates = 0; - - assert(pthread_rwlock_init (&data[data_count].lock, NULL) == 0); - } - - ftime(&currSysTime1); - - /* - * Create THREADS threads to access shared data. - */ - for (count = 0; count < THREADS; count++) - { - threads[count].thread_num = count; - threads[count].updates = 0; - threads[count].reads = 0; - while (!(threads[count].interval = rand_r (&seed) % 71)) - continue; - - assert(pthread_create (&threads[count].thread_id, - NULL, thread_routine, (void*)&threads[count]) == 0); - } - - /* - * Wait for all threads to complete, and collect - * statistics. - */ - for (count = 0; count < THREADS; count++) - { - assert(pthread_join (threads[count].thread_id, NULL) == 0); - thread_updates += threads[count].updates; - printf ("%02d: interval %d, updates %d, reads %d\n", - count, threads[count].interval, - threads[count].updates, threads[count].reads); - } - - putchar('\n'); - fflush(stdout); - - /* - * Collect statistics for the data. - */ - for (data_count = 0; data_count < DATASIZE; data_count++) - { - data_updates += data[data_count].updates; - printf ("data %02d: value %d, %d updates\n", - data_count, data[data_count].data, data[data_count].updates); - assert(pthread_rwlock_destroy (&data[data_count].lock) == 0); - } - - printf ("%d thread updates, %d data updates\n", - thread_updates, data_updates); - - ftime(&currSysTime2); - - printf( "\nstart: %ld/%d, stop: %ld/%d, duration:%ld\n", - currSysTime1.time,currSysTime1.millitm, - currSysTime2.time,currSysTime2.millitm, - (currSysTime2.time*1000+currSysTime2.millitm) - - (currSysTime1.time*1000+currSysTime1.millitm)); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/self1.c b/winsup/testsuite/winsup.api/pthread/self1.c deleted file mode 100644 index d46081830..000000000 --- a/winsup/testsuite/winsup.api/pthread/self1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * self1.c - * - * Test for pthread_self(). - * - * Depends on API functions: - * pthread_self() - * - * Implicitly depends on: - * pthread_getspecific() - * pthread_setspecific() - */ - -#include "test.h" - -int -main(int argc, char * argv[]) -{ - /* - * This should always succeed unless the system has no - * resources (memory) left. - */ - assert(pthread_self() != NULL); - - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/self2.c b/winsup/testsuite/winsup.api/pthread/self2.c deleted file mode 100644 index 83339f101..000000000 --- a/winsup/testsuite/winsup.api/pthread/self2.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * self2.c - * - * Test for pthread_self(). - * - * Depends on API functions: - * pthread_create() - * pthread_self() - * - * Implicitly depends on: - * pthread_getspecific() - * pthread_setspecific() - */ - -#include "test.h" -#include - -static pthread_t me; - -void * -entry(void * arg) -{ - me = pthread_self(); - - return arg; -} - -int -main() -{ - pthread_t t; - - assert(pthread_create(&t, NULL, entry, NULL) == 0); - - Sleep(2000); - - /* - * Not much more we can do here but bytewise compare t with - * what pthread_self returned. - */ - assert(t == me); - assert(memcmp((const void *) t, (const void *) me, sizeof t) == 0); - - /* Success. */ - return 0; -} diff --git a/winsup/testsuite/winsup.api/pthread/test.h b/winsup/testsuite/winsup.api/pthread/test.h deleted file mode 100644 index 0e7246420..000000000 --- a/winsup/testsuite/winsup.api/pthread/test.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * test.h - * - * Useful definitions and declarations for tests. - */ - -#ifndef _PTHREAD_TEST_H_ -#define _PTHREAD_TEST_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* #define assert(x) do { fprint (stderr, "assertion failed\n"); exit(1) } while (0) */ - -const char * error_string[] = { - "ZERO_or_EOK", - "EPERM", - "ENOFILE_or_ENOENT", - "ESRCH", - "EINTR", - "EIO", - "ENXIO", - "E2BIG", - "ENOEXEC", - "EBADF", - "ECHILD", - "EAGAIN", - "ENOMEM", - "EACCES", - "EFAULT", - "UNKNOWN_15", - "EBUSY", - "EEXIST", - "EXDEV", - "ENODEV", - "ENOTDIR", - "EISDIR", - "EINVAL", - "ENFILE", - "EMFILE", - "ENOTTY", - "UNKNOWN_26", - "EFBIG", - "ENOSPC", - "ESPIPE", - "EROFS", - "EMLINK", - "EPIPE", - "EDOM", - "ERANGE", - "UNKNOWN_35", - "EDEADLOCK_or_EDEADLK", - "UNKNOWN_37", - "ENAMETOOLONG", - "ENOLCK", - "ENOSYS", - "ENOTEMPTY", - "EILSEQ", -}; - -/* - * The Mingw32 assert macro calls the CRTDLL _assert function - * which pops up a dialog. We want to run in batch mode so - * we define our own assert macro. - */ -#ifdef assert -# undef assert -#endif - -#ifdef NDEBUG - -# define assert(e) ((void)0) - -#else /* NDEBUG */ - -#ifndef ASSERT_TRACE -# define ASSERT_TRACE 0 -#else -# undef ASSERT_TRACE -# define ASSERT_TRACE 1 -#endif - -# define assert(e) \ - ((e) ? ((ASSERT_TRACE) ? fprintf(stderr, \ - "Assertion succeeded: (%s), file %s, line %d\n", \ - #e, __FILE__, (int) __LINE__), \ - fflush(stderr) : \ - 0) : \ - (fprintf(stderr, "Assertion failed: (%s), file %s, line %d\n", \ - #e, __FILE__, (int) __LINE__), exit(1), 0)) - -#endif /* NDEBUG */ - - -#endif diff --git a/winsup/testsuite/winsup.api/pthread/threadidafterfork.c b/winsup/testsuite/winsup.api/pthread/threadidafterfork.c deleted file mode 100644 index 473eaecfd..000000000 --- a/winsup/testsuite/winsup.api/pthread/threadidafterfork.c +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include -#include -#include -#include - -static void * TestThread ( void * ); - -int main (void) -{ - pthread_t t; - - pthread_create (&t, NULL, TestThread, NULL); - pthread_join (t, NULL); - - return 0; -} - -static void * TestThread ( void *not_used ) -{ - pthread_t iAm = pthread_self(); - int status; - switch (fork ()) - { - case -1: - exit(1); - case 0: - if (iAm != pthread_self()) - exit (1); - else - exit (0); - break; - default: - wait (&status); - if (status != 0) - exit (1); - } - exit(0); -} - -/* -The forked child will not get the same thread handle as its parent, it -will get the thread handle from the main thread instead. The child will -not terminate because the threadcount is still 2 after the fork (it is -set to 1 in MTinterface::Init and then set back to 2 after the childs -memory gets overwritten by the parent). - -concept test by Thomas Pfaff -scritable test by Robert Collins -*/ diff --git a/winsup/testsuite/winsup.api/pthread/tsd1.c b/winsup/testsuite/winsup.api/pthread/tsd1.c deleted file mode 100644 index a65cf66c8..000000000 --- a/winsup/testsuite/winsup.api/pthread/tsd1.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * tsd1.c - * - * Test Thread Specific Data (TSD) key creation and destruction. - * - * Description: - * - - * - * Test Method (validation or falsification): - * - validation - * - * Requirements Tested: - * - keys are created for each existing thread including the main thread - * - keys are created for newly created threads - * - keys are thread specific - * - destroy routine is called on each thread exit including the main thread - * - * Features Tested: - * - - * - * Cases Tested: - * - - * - * Environment: - * - - * - * Input: - * - none - * - * Output: - * - text to stdout - * - * Assumptions: - * - already validated: pthread_create() - * pthread_once() - * - main thread also has a POSIX thread identity - * - * Pass Criteria: - * - stdout matches file reference/tsd1.out - * - * Fail Criteria: - * - fails to match file reference/tsd1.out - * - output identifies failed component - */ - -#include -#include "test.h" - -static pthread_key_t key = NULL; -static int accesscount[10]; -static int thread_set[10]; -static int thread_destroyed[10]; - -static void -destroy_key(void * arg) -{ - int * j = (int *) arg; - - (*j)++; - - assert(*j == 2); - - thread_destroyed[j - accesscount] = 1; -} - -static void -setkey(void * arg) -{ - int * j = (int *) arg; - - thread_set[j - accesscount] = 1; - - assert(*j == 0); - - assert(pthread_getspecific(key) == NULL); - - assert(pthread_setspecific(key, arg) == 0); - - assert(pthread_getspecific(key) == arg); - - (*j)++; - - assert(*j == 1); -} - -static void * -mythread(void * arg) -{ - while (key == NULL) - { - sched_yield(); - } - - setkey(arg); - - return 0; - - /* Exiting the thread will call the key destructor. */ -} - -int -main() -{ - int i; - int fail = 0; - pthread_t thread[10]; - - for (i = 1; i < 5; i++) - { - accesscount[i] = thread_set[i] = thread_destroyed[i] = 0; - assert(pthread_create(&thread[i], NULL, mythread, (void *)&accesscount[i]) == 0); - } - - Sleep(2000); - - /* - * Here we test that existing threads will get a key created - * for them. - */ - assert(pthread_key_create(&key, destroy_key) == 0); - - /* - * Test main thread key. - */ - accesscount[0] = 0; - setkey((void *) &accesscount[0]); - - /* - * Here we test that new threads will get a key created - * for them. - */ - for (i = 5; i < 10; i++) - { - accesscount[i] = thread_set[i] = thread_destroyed[i] = 0; - assert(pthread_create(&thread[i], NULL, mythread, (void *)&accesscount[i]) == 0); - } - - /* - * Wait for all threads to complete. - */ - for (i = 1; i < 10; i++) - { - int result = 0; - - assert(pthread_join(thread[i], (void **) &result) == 0); - } - - assert(pthread_key_delete(key) == 0); - - for (i = 1; i < 10; i++) - { - /* - * The counter is incremented once when the key is set to - * a value, and again when the key is destroyed. If the key - * doesn't get set for some reason then it will still be - * NULL and the destroy function will not be called, and - * hence accesscount will not equal 2. - */ - if (accesscount[i] != 2) - { - fail++; - fprintf(stderr, "Thread %d key, set = %d, destroyed = %d\n", - i, thread_set[i], thread_destroyed[i]); - } - } - - fflush(stderr); - - return (fail); -} diff --git a/winsup/testsuite/winsup.api/resethand.c b/winsup/testsuite/winsup.api/resethand.c deleted file mode 100644 index 7d58dcd2c..000000000 --- a/winsup/testsuite/winsup.api/resethand.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include -#include -#include - -int doit = 0; -void -ouch (int sig) -{ - if (doit++ > 0) - kill (getpid (), SIGTERM); -} - -int -main (int argc, char **argv) -{ - static struct sigaction act; - if (argc == 1) - act.sa_flags = SA_RESETHAND; - act.sa_handler = ouch; - sigaction (SIGSEGV, &act, NULL); - int pid = fork (); - int status; - if (pid > 0) - waitpid (pid, &status, 0); - else - { - int *i = 0; - *i = 9; - exit (0x42); - } - status &= ~0x80; // remove core dump flag - printf ("pid %d exited with status %p\n", pid, (void *) status); - exit (argc == 1 ? !(status == SIGSEGV) : !(status == SIGTERM)); -} diff --git a/winsup/testsuite/winsup.api/samples/sample-fail.c b/winsup/testsuite/winsup.api/samples/sample-fail.c deleted file mode 100644 index d0d3e4a6a..000000000 --- a/winsup/testsuite/winsup.api/samples/sample-fail.c +++ /dev/null @@ -1,5 +0,0 @@ -int -main() -{ - return 1; -} diff --git a/winsup/testsuite/winsup.api/samples/sample-miscompile.c b/winsup/testsuite/winsup.api/samples/sample-miscompile.c deleted file mode 100644 index bc0d21d2e..000000000 --- a/winsup/testsuite/winsup.api/samples/sample-miscompile.c +++ /dev/null @@ -1 +0,0 @@ -foo bar grill diff --git a/winsup/testsuite/winsup.api/samples/sample-pass.c b/winsup/testsuite/winsup.api/samples/sample-pass.c deleted file mode 100644 index 8e8f518aa..000000000 --- a/winsup/testsuite/winsup.api/samples/sample-pass.c +++ /dev/null @@ -1,5 +0,0 @@ -int -main() -{ - return 0; -} diff --git a/winsup/testsuite/winsup.api/semtest.c b/winsup/testsuite/winsup.api/semtest.c deleted file mode 100644 index dfb8c08eb..000000000 --- a/winsup/testsuite/winsup.api/semtest.c +++ /dev/null @@ -1,348 +0,0 @@ -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. - * - * 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. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 THE NETBSD FOUNDATION, INC. AND 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 THE FOUNDATION OR 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. - * - * Obtained from: $NetBSD: semtest.c,v 1.4 2002/07/20 08:36:25 grant Exp $ - * $FreeBSD: /repoman/r/ncvs/src/tools/regression/sysvsem/semtest.c,v 1.1 2002/08/15 06:34:37 alfred Exp $ - */ - -/* - * Test the SVID-compatible Semaphore facility. - */ - -/* - * CV, 2003-11-17: Add to Cygwin testsuite. - */ -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID = "semtest"; /* Test program identifier. */ -int TST_TOTAL = 54; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int main (int, char *[]); -void print_semid_ds (struct semid_ds *, mode_t); -void sigsys_handler (int); -void sigchld_handler(int); -void cleanup (void); -void waiter (void); - -int sender_semid = -1; -pid_t child_pid; -int child_count; -int signal_was_sigchld; - -key_t semkey; - -/* - * This is the original semun union used by the sysvsem utility. - * It is deliberately kept here under #if 0'ed condition for future - * reference. PLEASE DO NOT REMOVE. The {SET,GET}ALL in FreeBSD - * are signed values, so the default version in sys/sem.h suffices. - */ -#if 1 /*0*/ -union semun { - int val; /* value for SETVAL */ - struct semid_ds *buf; /* buffer for IPC_{STAT,SET} */ - u_short *array; /* array for GETALL & SETALL */ -}; -#endif - -int -main(int argc, char *argv[]) -{ - struct sigaction sa; - union semun sun; - struct semid_ds s_ds; - sigset_t sigmask; - int i; - - Tst_count = 0; - - /* - * Install a SIGSYS handler so that we can exit gracefully if - * System V Semaphore support isn't in the kernel. - */ - sa.sa_handler = sigsys_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGSYS, &sa, NULL) == -1) - tst_brkm (TBROK, cleanup, "sigaction SIGSYS"); - - /* - * Install and SIGCHLD handler to deal with all possible exit - * conditions of the receiver. - */ - sa.sa_handler = sigchld_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGCHLD, &sa, NULL) == -1) - tst_brkm (TBROK, cleanup, "sigaction SIGCHLD"); - - semkey = ftok("/", 4160); - tst_resm (semkey == (key_t)-1 ? TFAIL : TPASS, - "ftok(\"/\") returns valid value"); - - /* - * Initialize child_pid to ourselves to that the cleanup function - * works before we create the receiver. - */ - child_pid = getpid(); - - sender_semid = semget(semkey, 1, IPC_CREAT | 0640); - tst_resm (sender_semid == -1 ? TFAIL : TPASS, "sender calls semget"); - - sun.buf = &s_ds; - tst_resm (semctl(sender_semid, 0, IPC_STAT, sun) == -1 ? TFAIL : TPASS, - "semctl IPC_STAT"); - - print_semid_ds(&s_ds, 0640); - - s_ds.sem_perm.mode = (s_ds.sem_perm.mode & ~0777) | 0600; - - sun.buf = &s_ds; - tst_resm (semctl(sender_semid, 0, IPC_SET, sun) == -1 ? TFAIL : TPASS, - "semctl IPC_SET"); - - memset(&s_ds, 0, sizeof(s_ds)); - - sun.buf = &s_ds; - tst_resm (semctl(sender_semid, 0, IPC_STAT, sun) == -1 ? TFAIL : TPASS, - "semctl IPC_STAT"); - - tst_resm ((s_ds.sem_perm.mode & 0777) != 0600 ? TFAIL : TPASS, - "IPC_SET of mode holds"); - - print_semid_ds(&s_ds, 0600); - - for (child_count = 0; child_count < 5; child_count++) { - switch ((child_pid = fork())) { - case -1: - tst_brkm (TBROK, cleanup, "fork"); - /* NOTREACHED */ - - case 0: - Tst_count += 22 + child_count * 4; - tst_resm (TPASS, "fork"); - waiter(); - break; - - default: - break; - } - } - - /* - * Wait for all of the waiters to be attempting to acquire the - * semaphore. - */ - for (;;) { - i = semctl(sender_semid, 0, GETNCNT); - if (i == -1) - tst_brkm (TBROK, cleanup, "semctl GETNCNT"); - if (i == 5) - break; - } - - /* - * Now set the thundering herd in motion by initializing the - * semaphore to the value 1. - */ - sun.val = 1; - tst_resm (semctl(sender_semid, 0, SETVAL, sun) == -1 ? TFAIL : TPASS, - "sender: semctl SETVAL to 1"); - - /* - * Suspend forever; when we get SIGCHLD, the handler will exit. - */ - sigemptyset(&sigmask); - for (;;) { - (void) sigsuspend(&sigmask); - if (signal_was_sigchld) - signal_was_sigchld = 0; - else - break; - } - - /* - * ...and any other signal is an unexpected error. - */ - - tst_brkm (TBROK, cleanup, "sender: received unexpected signal"); - exit (1); -} - -void -sigsys_handler(int signo) -{ - - tst_brkm (TBROK, cleanup, - "System V Semaphore support is not present in the kernel"); -} - -void -sigchld_handler(int signo) -{ - union semun sun; - struct semid_ds s_ds; - int cstatus; - - /* - * Reap the child; if it exited successfully, then we're on the - * right track! - */ - if (wait(&cstatus) == -1) - tst_brkm (TBROK, cleanup, "wait"); - - if (WIFEXITED(cstatus) == 0) - tst_brkm (TBROK, cleanup, "receiver exited abnormally"); - - if (WEXITSTATUS(cstatus) != 0) - tst_brkm (TBROK, cleanup, "receiver exited with status %d", - WEXITSTATUS(cstatus)); - - /* - * If we get here, the child has exited normally, and we should - * decrement the child count. If the child_count reaches 0, we - * should exit. - */ - - sun.buf = &s_ds; - tst_resm (semctl(sender_semid, 0, IPC_STAT, sun) == -1 ? TFAIL : TPASS, - "semctl IPC_STAT"); - - print_semid_ds(&s_ds, 0600); - - if (--child_count != 0) { - signal_was_sigchld = 1; - return; - } - - cleanup (); -} - -void -cleanup() -{ - - /* - * If we're the sender, and it exists, remove the message queue. - */ - if (child_pid != 0 && sender_semid != -1) { - tst_resm (semctl(sender_semid, 0, IPC_RMID) == -1 - ? TFAIL : TPASS, "semctl IPC_RMID"); - } - tst_exit (); -} - -void -print_semid_ds(struct semid_ds *sp, mode_t mode) -{ - uid_t uid = geteuid(); - gid_t gid = getegid(); - - printf("PERM: uid %d, gid %d, cuid %d, cgid %d, mode 0%o\n", - (int)sp->sem_perm.uid, (int)sp->sem_perm.gid, - (int)sp->sem_perm.cuid, (int)sp->sem_perm.cgid, - sp->sem_perm.mode & 0777); - - printf("nsems %u\n", sp->sem_nsems); - - printf("otime: %s", ctime(&sp->sem_otime)); - printf("ctime: %s", ctime(&sp->sem_ctime)); - - /* - * Sanity check a few things. - */ - - tst_resm (sp->sem_perm.uid != uid || sp->sem_perm.cuid != uid - ? TFAIL : TPASS, "uid matches"); - - tst_resm (sp->sem_perm.gid != gid || sp->sem_perm.cgid != gid - ? TFAIL : TPASS, "gid matches"); - - tst_resm ((sp->sem_perm.mode & 0777) != mode - ? TFAIL : TPASS, "mode matches"); -} - -void -waiter() -{ - struct sembuf s; - int semid; - - tst_resm ((semid = semget(semkey, 1, 0)) == -1 ? TFAIL : TPASS, - "waiter: semget"); - - /* - * Attempt to acquire the semaphore. - */ - s.sem_num = 0; - s.sem_op = -1; - s.sem_flg = SEM_UNDO; - - tst_resm (semop(semid, &s, 1) == -1 ? TFAIL : TPASS, - "waiter: semop -1"); - - printf("WOO! GOT THE SEMAPHORE!\n"); - sleep(1); - - /* - * Release the semaphore and exit. - */ - s.sem_num = 0; - s.sem_op = 1; - s.sem_flg = SEM_UNDO; - - tst_resm (semop(semid, &s, 1) == -1 ? TFAIL : TPASS, - "waiter: semop +1"); - - /* Allow parent to receive message before getting SIGCHLD. */ - sleep (1); - exit(0); -} diff --git a/winsup/testsuite/winsup.api/shmtest.c b/winsup/testsuite/winsup.api/shmtest.c deleted file mode 100644 index 54a2493a8..000000000 --- a/winsup/testsuite/winsup.api/shmtest.c +++ /dev/null @@ -1,293 +0,0 @@ -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. - * - * 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. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 THE NETBSD FOUNDATION, INC. AND 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 THE FOUNDATION OR 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. - * - * Obtained from: $NetBSD: shmtest.c,v 1.3 2002/07/20 08:36:26 grant Exp $ - * $FreeBSD: /repoman/r/ncvs/src/tools/regression/sysvshm/shmtest.c,v 1.1 2002/08/15 06:34:37 alfred Exp $ - */ - -/* - * Test the SVID-compatible Shared Memory facility. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -const char *TCID = "shmtest"; /* Test program identifier. */ -int TST_TOTAL = 22; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -int main __P((int, char *[])); -void print_shmid_ds __P((struct shmid_ds *, mode_t)); -void sigsys_handler __P((int)); -void sigchld_handler __P((int)); -void cleanup __P((void)); -void receiver __P((void)); - -const char *m_str = "The quick brown fox jumped over the lazy dog."; - -int sender_shmid = -1; -pid_t child_pid; - -key_t shmkey; - -size_t pgsize; - -int -main(argc, argv) - int argc; - char *argv[]; -{ - struct sigaction sa; - struct shmid_ds s_ds; - sigset_t sigmask; - char *shm_buf; - - Tst_count = 0; - - /* - * Install a SIGSYS handler so that we can exit gracefully if - * System V Shared Memory support isn't in the kernel. - */ - sa.sa_handler = sigsys_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGSYS, &sa, NULL) == -1) - tst_brkm (TBROK, cleanup, "sigaction SIGSYS"); - - /* - * Install and SIGCHLD handler to deal with all possible exit - * conditions of the receiver. - */ - sa.sa_handler = sigchld_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if (sigaction(SIGCHLD, &sa, NULL) == -1) - tst_brkm (TBROK, cleanup, "sigaction SIGCHLD"); - - pgsize = sysconf(_SC_PAGESIZE); - - shmkey = ftok("/", 4160); - tst_resm (shmkey == (key_t)-1 ? TFAIL : TPASS, - "ftok(\"/\") returns valid value"); - - /* - * Initialize child_pid to ourselves to that the cleanup function - * works before we create the receiver. - */ - child_pid = getpid(); - - sender_shmid = shmget(shmkey, pgsize, IPC_CREAT | 0640); - tst_resm (sender_shmid == -1 ? TFAIL : TPASS, "sender calls shmget"); - - tst_resm (shmctl(sender_shmid, IPC_STAT, &s_ds) == -1 ? TFAIL : TPASS, - "shmctl IPC_STAT"); - - print_shmid_ds(&s_ds, 0640); - - s_ds.shm_perm.mode = (s_ds.shm_perm.mode & ~0777) | 0600; - - tst_resm (shmctl(sender_shmid, IPC_SET, &s_ds) == -1 ? TFAIL : TPASS, - "shmctl IPC_SET"); - - memset(&s_ds, 0, sizeof(s_ds)); - - tst_resm (shmctl(sender_shmid, IPC_STAT, &s_ds) == -1 ? TFAIL : TPASS, - "shmctl IPC_STAT"); - - tst_resm ((s_ds.shm_perm.mode & 0777) != 0600 ? TFAIL : TPASS, - "IPC_SET of mode holds"); - - print_shmid_ds(&s_ds, 0600); - - tst_resm ((shm_buf = shmat(sender_shmid, NULL, 0)) == (void *) -1 - ? TFAIL : TPASS, "sender: shmat"); - - /* - * Write the test pattern into the shared memory buffer. - */ - strcpy(shm_buf, m_str); - - switch ((child_pid = fork())) { - case -1: - tst_brkm (TBROK, cleanup, "fork"); - /* NOTREACHED */ - - case 0: - tst_resm (TPASS, "fork"); - receiver(); - break; - - default: - Tst_count += 4; - break; - } - - /* - * Suspend forever; when we get SIGCHLD, the handler will exit. - */ - sigemptyset(&sigmask); - (void) sigsuspend(&sigmask); - - /* - * ...and any other signal is an unexpected error. - */ - tst_brkm (TBROK, cleanup, "sender: received unexpected signal"); - exit (1); -} - -void -sigsys_handler(signo) - int signo; -{ - - tst_brkm (TBROK, cleanup, - "System V Shared Memory support is not present in the kernel"); -} - -void -sigchld_handler(signo) - int signo; -{ - struct shmid_ds s_ds; - int cstatus; - - /* - * Reap the child; if it exited successfully, then the test passed! - */ - if (waitpid(child_pid, &cstatus, 0) != child_pid) - tst_brkm (TBROK, cleanup, "waitpid"); - - if (WIFEXITED(cstatus) == 0) - tst_brkm (TBROK, cleanup, "receiver exited abnormally"); - - if (WEXITSTATUS(cstatus) != 0) - tst_brkm (TBROK, cleanup, "receiver exited with status %d", - WEXITSTATUS(cstatus)); - - /* - * If we get here, the child has exited normally, and thus - * we should exit normally too. First, tho, we print out - * the final stats for the message queue. - */ - - tst_resm (shmctl(sender_shmid, IPC_STAT, &s_ds) == -1 ? TFAIL : TPASS, - "shmctl IPC_STAT"); - - print_shmid_ds(&s_ds, 0600); - - cleanup (); -} - -void -cleanup() -{ - - /* - * If we're the sender, and it exists, remove the shared memory area. - */ - if (child_pid != 0 && sender_shmid != -1) { - tst_resm (shmctl(sender_shmid, IPC_RMID, NULL) == -1 - ? TFAIL : TPASS, "shmctl IPC_RMID"); - } - tst_exit (); -} - -void -print_shmid_ds(sp, mode) - struct shmid_ds *sp; - mode_t mode; -{ - uid_t uid = geteuid(); - gid_t gid = getegid(); - - printf("PERM: uid %d, gid %d, cuid %d, cgid %d, mode 0%o\n", - (int)sp->shm_perm.uid, (int)sp->shm_perm.gid, - (int)sp->shm_perm.cuid, (int)sp->shm_perm.cgid, - sp->shm_perm.mode & 0777); - - printf("segsz %lu, lpid %d, cpid %d, nattch %u\n", - (u_long)sp->shm_segsz, sp->shm_lpid, sp->shm_cpid, - sp->shm_nattch); - - printf("atime: %s", ctime(&sp->shm_atime)); - printf("dtime: %s", ctime(&sp->shm_dtime)); - printf("ctime: %s", ctime(&sp->shm_ctime)); - - /* - * Sanity check a few things. - */ - - tst_resm (sp->shm_perm.uid != uid || sp->shm_perm.cuid != uid - ? TFAIL : TPASS, "uid matches"); - - tst_resm (sp->shm_perm.gid != gid || sp->shm_perm.cgid != gid - ? TFAIL : TPASS, "gid matches"); - - tst_resm ((sp->shm_perm.mode & 0777) != mode ? TFAIL : TPASS, - "mode matches"); -} - -void -receiver() -{ - int shmid; - void *shm_buf; - - tst_resm ((shmid = shmget(shmkey, pgsize, 0)) == -1 ? TFAIL : TPASS, - "receiver: shmget"); - - tst_resm ((shm_buf = shmat(shmid, NULL, 0)) == (void *) -1 - ? TFAIL : TPASS, "receiver: shmat"); - - printf("%s\n", (const char *)shm_buf); - tst_resm (strcmp((const char *)shm_buf, m_str) != 0 ? TFAIL : TPASS, - "receiver: data is correct"); - - exit(0); -} diff --git a/winsup/testsuite/winsup.api/sigchld.c b/winsup/testsuite/winsup.api/sigchld.c deleted file mode 100644 index b12876d4a..000000000 --- a/winsup/testsuite/winsup.api/sigchld.c +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -#include -#include - -int no_signal_caught = 1; - -void handler ( int signo ) -{ - no_signal_caught = 0; -} - -int -main() -{ - pid_t pid; - signal ( SIGCHLD, handler ); - pid = fork(); - if ( pid == 0 ) exit ( 0 ); - sleep ( 2 ); - exit ( no_signal_caught ); -} diff --git a/winsup/testsuite/winsup.api/signal-into-win32-api.c b/winsup/testsuite/winsup.api/signal-into-win32-api.c deleted file mode 100755 index 57ab8b5c8..000000000 --- a/winsup/testsuite/winsup.api/signal-into-win32-api.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Test if signal is delivered to the application which is - * currently inside of native syscall - */ - -#include -#include -#include -#include -#include - -int saw_sigchld = 0; -int sleep_stage = -1; - -void -handle_child (int signo) -{ - printf ( "saw SIGCHLD, %d", sleep_stage); - saw_sigchld = 1; -} - -int -main (int argc, char** argv) -{ - pid_t pid; - if (argc > 1) - { - Sleep (200); - return 0; - } - - signal (SIGCHLD, handle_child); - pid = fork (); - if (pid < 0) - { - perror ( "fork" ); - return 2; - } - else if (pid == 0) - execl ( argv[0], argv[0], "child", NULL ); - else - { - sleep_stage = 0; - Sleep (3000); - sleep_stage = 1; - sleep (10); - sleep_stage = 2; - if (!saw_sigchld) - { - printf ( "oops\n" ); - kill (pid, SIGTERM); - return 1; - } - else - return 0; - } - exit (0); -} diff --git a/winsup/testsuite/winsup.api/systemcall.c b/winsup/testsuite/winsup.api/systemcall.c deleted file mode 100644 index 91dd748c0..000000000 --- a/winsup/testsuite/winsup.api/systemcall.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - int fd, pid, n; - int fds[2]; - static char buf[4096]; - - close (0); - if ((fd = open ("/dev/null", O_WRONLY)) != 0) - { - fprintf (stderr, "couldn't redirect stdin to /dev/null, fd %d - %s\n", fd, strerror (errno)); - exit (1); - } - - close (1); - if ((fd = open ("/dev/null", O_WRONLY)) != 1) - { - fprintf (stderr, "couldn't redirect stdout to /dev/null, fd %d - %s\n", fd, strerror (errno)); - exit (1); - } - if (pipe (fds)) - { - fprintf (stderr, "pipe call failed - %s\n", strerror (errno)); - exit (1); - } - if ((pid = fork ()) == 0) - { - close (fds[0]); - if (dup2 (fds[1], 2) != 2) - { - fprintf (stderr, "couldn't redirect stderr to pipe - %s\n", strerror (errno)); - exit (1); - } - exit (system ("ls")); - } - else if (pid < 0) - { - perror ("couldn't fork"); - exit (1); - } - - close (fds[1]); - if (read (fds[0], buf, 4096) != 0) - { - fprintf (stderr, "system() call failed?\n%s\n", buf); - exit (1); - } - - if (waitpid (pid, &n, 0) < 0) - { - perror ("waitpid failed"); - exit (1); - } - if (n != 0) - { - fprintf (stderr, "system() call returned %p\n", (void *) n); - exit (1); - } - exit (0); -} diff --git a/winsup/testsuite/winsup.api/user_malloc.c b/winsup/testsuite/winsup.api/user_malloc.c deleted file mode 100644 index 8685f86ab..000000000 --- a/winsup/testsuite/winsup.api/user_malloc.c +++ /dev/null @@ -1,216 +0,0 @@ -/* Test of external malloc, calloc, realloc and free capability */ - -#if 1 -#include "test.h" -#include "usctest.h" -#else -enum {TPASS, TFAIL, TBROK, TINFO}; -#define tst_resm(xxx, yyy...) printf(yyy), printf(" RES %d\n", xxx) -#define tst_brkm(xxx, yyy, zzz...) printf(zzz), printf(" RES %d\n", xxx) -#define tst_exit() -int Tst_count; -#endif - -#include -#include -#include -#include -#include -#include - -const char *TCID = "malloc"; /* Test program identifier. */ -int TST_TOTAL = 2; /* Total number of test cases. */ -extern int Tst_count; /* Test Case counter for tst_* routines */ - -/* Main test. - Verbose mode if argc > 0 - Note that malloc and friends are also called by Cygwin before main, - and that malloc can call getenv. */ - -int malloc_error = 0, realloc_error = 0, free_error = 0; -int calloc_count = 0, malloc_count = 0, realloc_count = 0, free_count = 0; - -void -cleanup (void) -{ - tst_exit(); -} - -int -syncwithchild (pid_t pid, int expected_exit_status) -{ - int status; - - if (waitpid (pid, &status, 0) != pid) - { - tst_brkm (TBROK, cleanup, "Wait for child: %s", strerror (errno)); - return 1; - } - if (!WIFEXITED (status)) - { - tst_brkm (TBROK, cleanup, "Child had abnormal exit"); - return 1; - } - if (WEXITSTATUS (status) != expected_exit_status) - { - tst_brkm (TFAIL, cleanup, "Child had exit status %d != %d", - WEXITSTATUS (status), expected_exit_status); - return 1; - } - return 0; -} - -#if 0 -void * mallocX (size_t size); -void * callocX (size_t nmemb, size_t size); -void * reallocX (void * ptr, size_t size); -void freeX(void *); - -#define malloc mallocX -#define calloc callocX -#define realloc reallocX -#define free freeX -#endif - -int main (int argc, char * argv[]) -{ - void * ptr; - int error = 0; - pid_t pid; - - Tst_count = 0; - - tst_resm(TINFO, "Testing if external malloc works. ppid %d", getppid()); - - ptr = malloc (16); - ptr = calloc (1, 16); - ptr = realloc (ptr, 24); - free (ptr); - - error = (malloc_count == 0 || calloc_count == 0 || realloc_count == 0 || free_count == 0); - - if (error || argc > 1) - { - printf ("malloc_count %d, calloc_count %d, realloc_count %d, free_count %d\n", - malloc_count, calloc_count, realloc_count, free_count); - printf ("malloc_error %d, realloc_error %d, free_error %d\n", - malloc_error, realloc_error, free_error); - } - tst_resm (!error ? TPASS : TFAIL, "Running in pid %d", getpid()); - - /* If run from Windows, run also from Cygwin */ - if (getppid() == 1) - { - tst_resm(TINFO, "Ready to test if malloc works from Cygwin"); - - if ((pid = fork()) == 0) - { - tst_resm(TINFO, "Ready to exec with pid %d\n", getpid()); - error = execl(argv[0], argv[0], argc > 1? argv[1]:NULL, NULL); - exit(error); - } - else if (pid < 0) - tst_brkm (TBROK, cleanup, "Fork failed: %s", strerror (errno)); - else - { - error = syncwithchild (pid, 0); - tst_resm (!error ? TPASS : TFAIL, "Running in pid %d", pid); - } - } - - tst_exit (); -} - -/**************************************** -Actual malloc & friends implementation -****************************************/ - -typedef unsigned long long ull; - -#define SIZE (1024*1024ULL) /* long long */ -ull buffer[SIZE]; -ull * current = buffer; - -static int is_valid (void * ptr) -{ - unsigned int iptr = (unsigned int) ptr; - ull * ullptr = (ull *) ptr; - - iptr = (iptr / sizeof(ull)) * sizeof(ull); - if (iptr != (int) ptr) - return 0; - if (--ullptr < buffer || ullptr[0] > SIZE || ullptr + ullptr[0] > current) - return 0; - return 1; -} - -void * malloc (size_t size) -{ - ull llsize = (size + 2 * sizeof (ull) - 1) / sizeof (ull); - static char * envptr; - void * ret; - - /* Make sure getenv works */ - if (!envptr) - envptr = getenv ("PATH"); - - malloc_count++; - if (current + llsize >= buffer + SIZE) - { - malloc_error++; - errno = ENOMEM; - return NULL; - } - *current = llsize; - ret = (void *) (current + 1); - current += llsize; - - return ret; -} - -void * calloc (size_t nmemb, size_t size) -{ - calloc_count++; - void * ptr = malloc (nmemb * size); - malloc_count--; - if (ptr) - memset(ptr, 0, nmemb * size); - return ptr; -} - -void * realloc (void * ptr, size_t size) -{ - const ull ullsize = (size + 2 * sizeof (ull) - 1) / sizeof (ull); - ull * const ullptr = (ull *) ptr; - void * newptr; - - realloc_count++; - - if (ptr) - { - if (!is_valid (ptr)) - { - realloc_error++; - errno = ENOMEM; - return NULL; - } - if (ullptr[-1] >= ullsize) - return ptr; - } - - newptr = malloc (size); - malloc_count--; - - if (ptr && newptr) - memcpy (newptr, ptr, size); - - return newptr; -} - -void free (void * x) -{ - free_count++; - if (x && ! is_valid (x)) - free_error++; -} - diff --git a/winsup/testsuite/winsup.api/waitpid.c b/winsup/testsuite/winsup.api/waitpid.c deleted file mode 100644 index ee2925c4c..000000000 --- a/winsup/testsuite/winsup.api/waitpid.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - int pid, n; - if ((pid = fork ()) == 0) - exit (0); - sleep (2); - if ((n = waitpid (pid, NULL, 0)) != pid) - { - printf ("wait pid failed, pid %d, n %d, errno %d\n", pid, n, errno); - exit(1); - } - else - { - printf ("wait pid succeeded, pid %d, n %d, errno %d\n", pid, n, errno); - exit (0); - } -} diff --git a/winsup/testsuite/winsup.api/winsup.exp b/winsup/testsuite/winsup.api/winsup.exp deleted file mode 100644 index 639096267..000000000 --- a/winsup/testsuite/winsup.api/winsup.exp +++ /dev/null @@ -1,85 +0,0 @@ -source "site.exp" -source "$srcdir/winsup.api/known_bugs.tcl" - -if { ! [isnative] } { - verbose "skipping winsup.api because it's not native" - return -} - -set rv "" - -set ltp_includes "-I$ltp_includes" -set ltp_libs "$rootme/libltp.a" - -set add_includes $ltp_includes -set add_libs $ltp_libs - -set test_filter "" - -if { [info exists env(CYGWIN_TESTSUITE_TESTS)] } { - set test_filter "$env(CYGWIN_TESTSUITE_TESTS)" -} - -proc ws_spawn {cmd args} { - global rv - verbose "running $cmd\n" - catch "exec $cmd" rv - verbose send "catchCode = $rv\n" -} - -verbose "Filter: $test_filter" - -foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.{cc,c}]] { - if { $test_filter != "" && ! [regexp $test_filter $src] } { - verbose -log "Skipping $src" - continue - } - - regsub "^$srcdir/$subdir/" $src "" testcase - regsub ".c$" $testcase "" base - regsub ".*/" $base "" basename - regsub "/" $base "-" base - - if { [lsearch -exact $xfail_list $basename] >= 0 } { - set xfail_expected 1 - setup_xfail "*-*-*" - } else { - set xfail_expected 0 - clear_xfail - } - - if [ file exists "$srcdir/$subdir/$basename.exp" ] then { - source "$srcdir/$subdir/$basename.exp" - } else { - ws_spawn "$CC -nodefaultlibs -mwin32 $CFLAGS $src $add_includes $add_libs $runtime_root/binmode.o -lgcc $runtime_root/libcygwin0.a -lkernel32 -luser32 -o $base.exe" - if { $rv != "" } { - verbose -log "$rv" - fail "$testcase (compile)" - } else { - if { $verbose } { - set redirect_output "./$base.log" - } else { - set redirect_output /dev/null - } - ws_spawn "$rootme/cygrun ./$base.exe > $redirect_output" - if { $rv != "" } { - verbose -log "$testcase: $rv" - fail "$testcase (execute)" - if { $xfail_expected } { - catch { file delete "$base.exe" } err - if { $err != "" } { - note "error deleting $base.exe: $err" - } - } - } else { - pass "$testcase" - if { ! $xfail_expected } { - catch { file delete "$base.exe" } err - if { $err != "" } { - note "error deleting $base.exe: $err" - } - } - } - } - } -} -- cgit v1.2.3