From c5bc62141c72c9e825f537bdd8f34bf19121f781 Mon Sep 17 00:00:00 2001 From: cvs2svn <> Date: Sun, 22 Sep 2002 12:04:18 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'pre-no-this'. Sprout from master 2002-09-22 12:04:15 UTC Conrad Scott '2002-09-22 Conrad Scott ' Delete: COPYING COPYING.LIB COPYING.LIBGLOSS COPYING.NEWLIB ChangeLog MAINTAINERS Makefile.in README README-maintainer-mode config-ml.in config.guess config.if config.sub config/ChangeLog config/acinclude.m4 config/mh-a68bsd config/mh-aix386 config/mh-apollo68 config/mh-armpic config/mh-cxux config/mh-cygwin config/mh-decstation config/mh-delta88 config/mh-dgux config/mh-dgux386 config/mh-djgpp config/mh-elfalphapic config/mh-hp300 config/mh-hpux config/mh-hpux8 config/mh-i370pic config/mh-ia64pic config/mh-interix config/mh-irix5 config/mh-irix6 config/mh-lynxrs6k config/mh-m68kpic config/mh-mingw32 config/mh-ncr3000 config/mh-ncrsvr43 config/mh-necv4 config/mh-openedition config/mh-papic config/mh-ppcpic config/mh-riscos config/mh-s390pic config/mh-sco config/mh-solaris config/mh-sparcpic config/mh-sysv config/mh-sysv4 config/mh-sysv5 config/mh-x86pic config/mpw-mh-mpw config/mpw/ChangeLog config/mpw/MoveIfChange config/mpw/README config/mpw/forward-include config/mpw/g-mpw-make.sed config/mpw/mpw-touch config/mpw/mpw-true config/mpw/null-command config/mpw/open-brace config/mpw/tr-7to8-src config/mpw/true config/mt-aix43 config/mt-alphaieee config/mt-d30v config/mt-linux config/mt-netware config/mt-ospace config/mt-v810 config/mt-wince configure configure.in djunpack.bat etc/ChangeLog etc/Makefile.in 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 etc/configure etc/configure.in etc/configure.texi etc/fdl.texi etc/make-stds.texi etc/standards.texi etc/texi2pod.pl gettext.m4 include/COPYING include/ChangeLog 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/bin-bugs.h include/bout.h include/coff/ChangeLog include/coff/a29k.h 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/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/xcoff.h include/coff/z8k.h include/demangle.h include/dis-asm.h include/dyn-string.h include/elf/ChangeLog include/elf/alpha.h include/elf/arc.h include/elf/arm.h include/elf/avr.h include/elf/common.h include/elf/cris.h include/elf/d10v.h include/elf/d30v.h include/elf/dlx.h include/elf/dwarf.h include/elf/dwarf2.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/m32r.h include/elf/m68hc11.h include/elf/m68k.h include/elf/mcore.h include/elf/mips.h include/elf/mmix.h include/elf/mn10200.h include/elf/mn10300.h include/elf/openrisc.h include/elf/or32.h include/elf/pj.h include/elf/ppc.h include/elf/reloc-macros.h include/elf/s390.h include/elf/sh.h include/elf/sparc.h include/elf/v850.h include/elf/vax.h include/elf/x86-64.h include/elf/xstormy16.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/remote-sim.h include/gdb/signals.h include/gdb/sim-arm.h include/gdb/sim-d10v.h include/gdb/sim-h8300.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/md5.h include/mpw/ChangeLog include/mpw/README include/mpw/dir.h include/mpw/dirent.h include/mpw/fcntl.h include/mpw/grp.h include/mpw/mpw.h include/mpw/pwd.h include/mpw/spin.h include/mpw/stat.h include/mpw/sys/file.h include/mpw/sys/param.h include/mpw/sys/resource.h include/mpw/sys/stat.h include/mpw/sys/time.h include/mpw/sys/types.h include/mpw/utime.h include/mpw/varargs.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/a29k.h include/opcode/alpha.h include/opcode/arc.h include/opcode/arm.h include/opcode/avr.h include/opcode/cgen.h include/opcode/convex.h include/opcode/cris.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/mips.h include/opcode/mmix.h include/opcode/mn10200.h include/opcode/mn10300.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/s390.h include/opcode/sparc.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/progress.h include/regs/ChangeLog include/safe-ctype.h include/sort.h include/splay-tree.h include/symcat.h include/ternary.h include/xregex.h include/xregex2.h install-sh libgloss/ChangeLog libgloss/Makefile.in libgloss/README libgloss/arm/Makefile.in libgloss/arm/coff-iq80310.specs libgloss/arm/coff-redboot.ld libgloss/arm/coff-redboot.specs libgloss/arm/configure libgloss/arm/configure.in libgloss/arm/elf-iq80310.specs libgloss/arm/elf-redboot.ld libgloss/arm/elf-redboot.specs libgloss/arm/redboot-crt0.S libgloss/arm/redboot-syscalls.c libgloss/arm/syscall.h libgloss/close.c libgloss/config/default.mh libgloss/config/default.mt libgloss/config/dos.mh libgloss/config/mips.mt libgloss/config/mn10200.mt libgloss/config/mn10300.mt libgloss/config/ppc.mh libgloss/configure libgloss/configure.in libgloss/d30v/Makefile.in libgloss/d30v/configure libgloss/d30v/configure.in libgloss/d30v/crt0.S libgloss/d30v/inbyte.c libgloss/d30v/outbyte.c libgloss/d30v/syscalls.c libgloss/debug.c libgloss/debug.h libgloss/doc/Makefile.in libgloss/doc/configure libgloss/doc/configure.in libgloss/doc/porting.texi libgloss/fr30/Makefile.in libgloss/fr30/configure libgloss/fr30/configure.in libgloss/fr30/crt0.s libgloss/fr30/syscalls.c libgloss/frv/Makefile.in libgloss/frv/configure libgloss/frv/configure.in libgloss/frv/crt0.S libgloss/frv/fstat.c libgloss/frv/getpid.c libgloss/frv/isatty.c libgloss/frv/kill.c libgloss/frv/print.c libgloss/frv/putnum.c libgloss/frv/sbrk.c libgloss/frv/sim-close.S libgloss/frv/sim-exit.S libgloss/frv/sim-inbyte.c libgloss/frv/sim-lseek.S libgloss/frv/sim-open.S libgloss/frv/sim-read.S libgloss/frv/sim-time.c libgloss/frv/sim-unlink.S libgloss/frv/sim-write.S libgloss/frv/stat.c libgloss/fstat.c libgloss/getpid.c libgloss/glue.h libgloss/hp74x/Makefile.in libgloss/hp74x/README libgloss/hp74x/checksum.c libgloss/hp74x/configure libgloss/hp74x/configure.in libgloss/hp74x/crt0.s libgloss/hp74x/debugger.h libgloss/hp74x/debugger.s libgloss/hp74x/diagnose.h libgloss/hp74x/hppa-defs.h libgloss/hp74x/hppa.ld libgloss/hp74x/io.c libgloss/hp74x/iva_table.h libgloss/hp74x/iva_table.s libgloss/hp74x/pa_stub.c libgloss/hp74x/test.c libgloss/i386/Makefile.in libgloss/i386/configure libgloss/i386/configure.in libgloss/i386/cygmon-crt0.S libgloss/i386/cygmon-gmon.c libgloss/i386/cygmon-gmon.h libgloss/i386/cygmon-salib.c libgloss/i386/cygmon-syscall.h libgloss/i386/cygmon.ld libgloss/i960/Makefile.in libgloss/i960/asm.h libgloss/i960/configure libgloss/i960/configure.in libgloss/i960/crt0.c libgloss/i960/mon-read.c libgloss/i960/mon-syscalls.S libgloss/i960/mon-write.c libgloss/i960/mon960.c libgloss/i960/mon960.ld libgloss/i960/syscall.h libgloss/isatty.c libgloss/kill.c libgloss/libnosys/Makefile.in libgloss/libnosys/acconfig.h libgloss/libnosys/close.c libgloss/libnosys/config.h.in libgloss/libnosys/configure libgloss/libnosys/configure.in libgloss/libnosys/environ.c libgloss/libnosys/execve.c libgloss/libnosys/fork.c libgloss/libnosys/fstat.c libgloss/libnosys/getpid.c libgloss/libnosys/gettod.c libgloss/libnosys/isatty.c libgloss/libnosys/kill.c libgloss/libnosys/link.c libgloss/libnosys/lseek.c libgloss/libnosys/open.c libgloss/libnosys/read.c libgloss/libnosys/sbrk.c libgloss/libnosys/stat.c libgloss/libnosys/times.c libgloss/libnosys/unlink.c libgloss/libnosys/wait.c libgloss/libnosys/warning.h libgloss/libnosys/write.c libgloss/lseek.c libgloss/m32r/Makefile.in libgloss/m32r/chmod.c libgloss/m32r/close.c libgloss/m32r/configure libgloss/m32r/configure.in libgloss/m32r/crt0.S libgloss/m32r/eit.h libgloss/m32r/eva-stub.ld libgloss/m32r/eva.ld libgloss/m32r/exit.c libgloss/m32r/fstat.c libgloss/m32r/getpid.c libgloss/m32r/isatty.c libgloss/m32r/kill.c libgloss/m32r/lseek.c libgloss/m32r/m32r-lib.c libgloss/m32r/mon.specs libgloss/m32r/open.c libgloss/m32r/raise.c libgloss/m32r/read.c libgloss/m32r/sbrk.c libgloss/m32r/stat.c libgloss/m32r/trap0.S libgloss/m32r/trapmon0.c libgloss/m32r/unlink.c libgloss/m32r/utime.c libgloss/m32r/write.c libgloss/m68hc11/Makefile.in libgloss/m68hc11/configure libgloss/m68hc11/configure.in libgloss/m68hc11/crt0.S libgloss/m68hc11/sci-inout.S libgloss/m68hc11/sim-valid-m68hc11.ld libgloss/m68hc11/sim-valid-m68hc12.ld libgloss/m68hc11/syscalls.c libgloss/m68k/Makefile.in libgloss/m68k/README libgloss/m68k/asm.h libgloss/m68k/bcc.ld libgloss/m68k/configure libgloss/m68k/configure.in libgloss/m68k/cpu32bug.S libgloss/m68k/cpu32bug.h libgloss/m68k/crt0.S libgloss/m68k/dbug-exit.S libgloss/m68k/dbug-inbyte.S libgloss/m68k/dbug-outbyte.S libgloss/m68k/dtor.C libgloss/m68k/idp-inbyte.c libgloss/m68k/idp-outbyte.c libgloss/m68k/idp.ld libgloss/m68k/idpgdb.ld libgloss/m68k/leds.c libgloss/m68k/leds.h libgloss/m68k/mc68681reg.h libgloss/m68k/mc68ec.c libgloss/m68k/mvme-stub.c libgloss/m68k/mvme.S libgloss/m68k/mvme135-asm.S libgloss/m68k/mvme135.ld libgloss/m68k/mvme162.ld libgloss/m68k/mvme162lx-asm.S libgloss/m68k/sbc5204.ld libgloss/m68k/sbc5206.ld libgloss/m68k/sim-abort.c libgloss/m68k/sim-crt0.S libgloss/m68k/sim-errno.c libgloss/m68k/sim-funcs.c libgloss/m68k/sim-inbyte.c libgloss/m68k/sim-print.c libgloss/m68k/sim-sbrk.c libgloss/m68k/sim.ld libgloss/m68k/simulator.S libgloss/m68k/test.c libgloss/mcore/Makefile.in libgloss/mcore/close.c libgloss/mcore/cmb-exit.c libgloss/mcore/cmb-inbyte.c libgloss/mcore/cmb-outbyte.c libgloss/mcore/configure libgloss/mcore/configure.in libgloss/mcore/crt0.S libgloss/mcore/elf-cmb.ld libgloss/mcore/elf-cmb.specs libgloss/mcore/fstat.c libgloss/mcore/getpid.c libgloss/mcore/kill.c libgloss/mcore/lseek.c libgloss/mcore/open.c libgloss/mcore/pe-cmb.ld libgloss/mcore/pe-cmb.specs libgloss/mcore/print.c libgloss/mcore/putnum.c libgloss/mcore/raise.c libgloss/mcore/read.c libgloss/mcore/sbrk.c libgloss/mcore/stat.c libgloss/mcore/syscalls.S libgloss/mcore/unlink.c libgloss/mcore/write.c libgloss/mips/Makefile.in libgloss/mips/array-io.c libgloss/mips/array.ld libgloss/mips/cfe.c libgloss/mips/cfe.ld libgloss/mips/cfe_api.c libgloss/mips/cfe_api.h libgloss/mips/cfe_api_int.h libgloss/mips/cfe_error.h libgloss/mips/cfe_prestart.S libgloss/mips/cma101.c libgloss/mips/configure libgloss/mips/configure.in libgloss/mips/crt0.S libgloss/mips/ddb-kseg0.ld libgloss/mips/ddb.ld libgloss/mips/dtor.C libgloss/mips/dve.ld libgloss/mips/dvemon.c libgloss/mips/entry.S libgloss/mips/idt.ld libgloss/mips/idt32.ld libgloss/mips/idt64.ld libgloss/mips/idtecoff.ld libgloss/mips/idtmon.S libgloss/mips/jmr3904-io.c libgloss/mips/jmr3904app-java.ld libgloss/mips/jmr3904app.ld libgloss/mips/jmr3904dram-java.ld libgloss/mips/jmr3904dram.ld libgloss/mips/lsi.ld libgloss/mips/lsi33k-stub.c libgloss/mips/lsi33k-stub.h libgloss/mips/lsipmon.S libgloss/mips/nullmon.c libgloss/mips/nullmon.ld libgloss/mips/pmon.S libgloss/mips/pmon.ld libgloss/mips/regs.S libgloss/mips/syscalls.c libgloss/mips/test.c libgloss/mips/vr4300.S libgloss/mips/vr5xxx.S libgloss/mn10200/Makefile.in libgloss/mn10200/_exit.c libgloss/mn10200/access.c libgloss/mn10200/chmod.c libgloss/mn10200/chown.c libgloss/mn10200/close.c libgloss/mn10200/configure libgloss/mn10200/configure.in libgloss/mn10200/creat.c libgloss/mn10200/crt0.S libgloss/mn10200/crt1.c libgloss/mn10200/eval.ld libgloss/mn10200/execv.c libgloss/mn10200/execve.c libgloss/mn10200/fork.c libgloss/mn10200/fstat.c libgloss/mn10200/getpid.c libgloss/mn10200/gettime.c libgloss/mn10200/isatty.c libgloss/mn10200/kill.c libgloss/mn10200/lseek.c libgloss/mn10200/open.c libgloss/mn10200/pipe.c libgloss/mn10200/read.c libgloss/mn10200/sbrk.c libgloss/mn10200/sim.ld libgloss/mn10200/stat.c libgloss/mn10200/test.c libgloss/mn10200/time.c libgloss/mn10200/times.c libgloss/mn10200/trap.S libgloss/mn10200/trap.h libgloss/mn10200/unlink.c libgloss/mn10200/utime.c libgloss/mn10200/wait.c libgloss/mn10200/write.c libgloss/mn10300/Makefile.in libgloss/mn10300/_exit.c libgloss/mn10300/access.c libgloss/mn10300/chmod.c libgloss/mn10300/chown.c libgloss/mn10300/close.c libgloss/mn10300/configure libgloss/mn10300/configure.in libgloss/mn10300/creat.c libgloss/mn10300/crt0-eval.S libgloss/mn10300/crt0.S libgloss/mn10300/crt0_cygmon.S libgloss/mn10300/crt0_redboot.S libgloss/mn10300/crt1.c libgloss/mn10300/cygmon.c libgloss/mn10300/eval.ld libgloss/mn10300/execv.c libgloss/mn10300/execve.c libgloss/mn10300/fork.c libgloss/mn10300/fstat.c libgloss/mn10300/getpid.c libgloss/mn10300/gettime.c libgloss/mn10300/isatty.c libgloss/mn10300/kill.c libgloss/mn10300/lseek.c libgloss/mn10300/open.c libgloss/mn10300/pipe.c libgloss/mn10300/read.c libgloss/mn10300/sbrk.c libgloss/mn10300/sim.ld libgloss/mn10300/stat.c libgloss/mn10300/test.c libgloss/mn10300/time.c libgloss/mn10300/times.c libgloss/mn10300/trap.S libgloss/mn10300/trap.h libgloss/mn10300/unlink.c libgloss/mn10300/utime.c libgloss/mn10300/wait.c libgloss/mn10300/write.c libgloss/open.c libgloss/pa/Makefile.in libgloss/pa/README libgloss/pa/configure libgloss/pa/configure.in libgloss/pa/crt0.S libgloss/pa/hp-milli.s libgloss/pa/op50n-io.S libgloss/pa/op50n.h libgloss/pa/op50n.ld libgloss/pa/op50nled.c libgloss/pa/setjmp.S libgloss/pa/test.c libgloss/pa/w89k-io.c libgloss/pa/w89k.h libgloss/pa/w89k.ld libgloss/print.c libgloss/putnum.c libgloss/read.c libgloss/rs6000/Makefile.in libgloss/rs6000/ads-exit.S libgloss/rs6000/ads-io.c libgloss/rs6000/ads.ld libgloss/rs6000/configure libgloss/rs6000/configure.in libgloss/rs6000/crt0.S libgloss/rs6000/mbx-exit.c libgloss/rs6000/mbx-inbyte.c libgloss/rs6000/mbx-outbyte.c libgloss/rs6000/mbx-print.c libgloss/rs6000/mbx.ld libgloss/rs6000/mbx.specs libgloss/rs6000/mcount.S libgloss/rs6000/mvme-errno.c libgloss/rs6000/mvme-exit.S libgloss/rs6000/mvme-inbyte.S libgloss/rs6000/mvme-outbyte.S libgloss/rs6000/mvme-print.c libgloss/rs6000/mvme-read.c libgloss/rs6000/sim-abort.c libgloss/rs6000/sim-crt0.S libgloss/rs6000/sim-errno.c libgloss/rs6000/sim-inbyte.c libgloss/rs6000/sim-print.c libgloss/rs6000/sim-sbrk.c libgloss/rs6000/simulator.S libgloss/rs6000/sol-cfuncs.c libgloss/rs6000/sol-syscall.S libgloss/rs6000/test.c libgloss/rs6000/yellowknife.ld libgloss/sbrk.c libgloss/sh/sh1lcevb.ld libgloss/sh/sh2lcevb.ld libgloss/sh/sh3bb.ld libgloss/sh/sh3lcevb.ld libgloss/sparc/Makefile.in libgloss/sparc/asm.h libgloss/sparc/cache.c libgloss/sparc/configure libgloss/sparc/configure.in libgloss/sparc/crt0-701.S libgloss/sparc/crt0.S libgloss/sparc/cygmon-crt0.S libgloss/sparc/cygmon-salib.c libgloss/sparc/cygmon-sparc64-ld.src libgloss/sparc/cygmon.ld.src libgloss/sparc/dtor.C libgloss/sparc/elfsim.ld libgloss/sparc/erc32-crt0.S libgloss/sparc/erc32-io.c libgloss/sparc/erc32-stub.c libgloss/sparc/erc32.ld libgloss/sparc/ex930.ld libgloss/sparc/ex931.ld libgloss/sparc/ex934.ld libgloss/sparc/fixctors.c libgloss/sparc/libsys/Makefile.in libgloss/sparc/libsys/_exit.S libgloss/sparc/libsys/cerror.S libgloss/sparc/libsys/configure libgloss/sparc/libsys/configure.in libgloss/sparc/libsys/isatty.c libgloss/sparc/libsys/libsys-crt0.S libgloss/sparc/libsys/sbrk.S libgloss/sparc/libsys/syscall.h libgloss/sparc/libsys/syscallasm.h libgloss/sparc/libsys/template.S libgloss/sparc/libsys/template_r.S libgloss/sparc/salib-701.c libgloss/sparc/salib.c libgloss/sparc/slite.h libgloss/sparc/sparc-stub.c libgloss/sparc/sparc86x.ld libgloss/sparc/sparcl-stub.c libgloss/sparc/sparclet-stub.c libgloss/sparc/sparclite.h libgloss/sparc/sysc-701.c libgloss/sparc/syscalls.c libgloss/sparc/test.c libgloss/sparc/traps.S libgloss/sparc/tsc701.ld libgloss/stat.c libgloss/syscall.h libgloss/testsuite/Makefile.in libgloss/testsuite/config/hppa.mt libgloss/testsuite/config/m68k.mt libgloss/testsuite/config/mips.mt libgloss/testsuite/config/support.c libgloss/testsuite/configure.in libgloss/testsuite/lib/libgloss.exp libgloss/testsuite/libgloss.all/.gdbinit libgloss/testsuite/libgloss.all/Makefile.in libgloss/testsuite/libgloss.all/array.c libgloss/testsuite/libgloss.all/configure.in libgloss/testsuite/libgloss.all/div.c libgloss/testsuite/libgloss.all/double.c libgloss/testsuite/libgloss.all/float.c libgloss/testsuite/libgloss.all/func.c libgloss/testsuite/libgloss.all/io.c libgloss/testsuite/libgloss.all/math.c libgloss/testsuite/libgloss.all/memory.c libgloss/testsuite/libgloss.all/misc.c libgloss/testsuite/libgloss.all/printf.c libgloss/testsuite/libgloss.all/struct.c libgloss/testsuite/libgloss.all/varargs.c libgloss/testsuite/libgloss.all/varargs2.c libgloss/unlink.c libgloss/v850/sys/syscall.h libgloss/wince/Makefile.am libgloss/wince/Makefile.in libgloss/wince/aclocal.m4 libgloss/wince/configure libgloss/wince/configure.in libgloss/write.c libgloss/xstormy16/Makefile.in libgloss/xstormy16/close.c libgloss/xstormy16/configure libgloss/xstormy16/configure.in libgloss/xstormy16/crt0.s libgloss/xstormy16/crt0_stub.s libgloss/xstormy16/crti.s libgloss/xstormy16/crtn.s libgloss/xstormy16/eva_app.c libgloss/xstormy16/eva_app.ld libgloss/xstormy16/eva_stub.ld libgloss/xstormy16/fstat.c libgloss/xstormy16/getpid.c libgloss/xstormy16/kill.c libgloss/xstormy16/lseek.c libgloss/xstormy16/open.c libgloss/xstormy16/sim_high.ld libgloss/xstormy16/sim_malloc_start.s libgloss/xstormy16/stat.c libgloss/xstormy16/syscalls.S libgloss/xstormy16/syscalls.m4 libgloss/xstormy16/unlink.c libgloss/xstormy16/xstormy16_stub.c libtool.m4 ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh ltconfig ltmain.sh makefile.vms missing mkdep mkinstalldirs move-if-change mpw-README mpw-build.in mpw-config.in mpw-configure mpw-install newlib/ChangeLog newlib/MAINTAINERS newlib/Makefile.am newlib/Makefile.in newlib/Makefile.shared newlib/NEWS newlib/README newlib/acinclude.m4 newlib/aclocal.m4 newlib/configure newlib/configure.host newlib/configure.in newlib/doc/Makefile.am newlib/doc/Makefile.in newlib/doc/aclocal.m4 newlib/doc/ansidecl.h newlib/doc/configure newlib/doc/configure.in newlib/doc/doc.str newlib/doc/makedoc.c newlib/libc/Makefile.am newlib/libc/Makefile.in newlib/libc/aclocal.m4 newlib/libc/argz/Makefile.am newlib/libc/argz/Makefile.in newlib/libc/argz/argz_add.c newlib/libc/argz/argz_add_sep.c newlib/libc/argz/argz_append.c newlib/libc/argz/argz_count.c newlib/libc/argz/argz_create.c newlib/libc/argz/argz_create_sep.c newlib/libc/argz/argz_delete.c newlib/libc/argz/argz_extract.c newlib/libc/argz/argz_insert.c newlib/libc/argz/argz_next.c newlib/libc/argz/argz_replace.c newlib/libc/argz/argz_stringify.c newlib/libc/argz/buf_findstr.c newlib/libc/argz/buf_findstr.h newlib/libc/argz/dummy.c newlib/libc/argz/envz_add.c newlib/libc/argz/envz_entry.c newlib/libc/argz/envz_get.c newlib/libc/argz/envz_merge.c newlib/libc/argz/envz_remove.c newlib/libc/argz/envz_strip.c newlib/libc/configure newlib/libc/configure.in newlib/libc/ctype/Makefile.am newlib/libc/ctype/Makefile.in newlib/libc/ctype/_tolower.c newlib/libc/ctype/_toupper.c newlib/libc/ctype/ctype.tex newlib/libc/ctype/ctype_.c newlib/libc/ctype/isalnum.c newlib/libc/ctype/isalpha.c newlib/libc/ctype/isascii.c newlib/libc/ctype/isblank.c newlib/libc/ctype/iscntrl.c newlib/libc/ctype/isdigit.c newlib/libc/ctype/islower.c newlib/libc/ctype/isprint.c newlib/libc/ctype/ispunct.c newlib/libc/ctype/isspace.c newlib/libc/ctype/isupper.c newlib/libc/ctype/iswalnum.c newlib/libc/ctype/iswalpha.c newlib/libc/ctype/iswblank.c newlib/libc/ctype/iswcntrl.c newlib/libc/ctype/iswctype.c newlib/libc/ctype/iswdigit.c newlib/libc/ctype/iswgraph.c newlib/libc/ctype/iswlower.c newlib/libc/ctype/iswprint.c newlib/libc/ctype/iswpunct.c newlib/libc/ctype/iswspace.c newlib/libc/ctype/iswupper.c newlib/libc/ctype/iswxdigit.c newlib/libc/ctype/isxdigit.c newlib/libc/ctype/jp2uc.c newlib/libc/ctype/jp2uc.h newlib/libc/ctype/local.h newlib/libc/ctype/toascii.c newlib/libc/ctype/tolower.c newlib/libc/ctype/toupper.c newlib/libc/ctype/towctrans.c newlib/libc/ctype/towlower.c newlib/libc/ctype/towupper.c newlib/libc/ctype/utf8alpha.h newlib/libc/ctype/utf8print.h newlib/libc/ctype/utf8punct.h newlib/libc/ctype/wctrans.c newlib/libc/ctype/wctype.c newlib/libc/errno/Makefile.am newlib/libc/errno/Makefile.in newlib/libc/errno/errno.c newlib/libc/include/_ansi.h newlib/libc/include/_syslist.h newlib/libc/include/alloca.h newlib/libc/include/ar.h newlib/libc/include/argz.h newlib/libc/include/assert.h newlib/libc/include/ctype.h newlib/libc/include/dirent.h newlib/libc/include/envz.h newlib/libc/include/errno.h newlib/libc/include/fastmath.h newlib/libc/include/fcntl.h newlib/libc/include/grp.h newlib/libc/include/ieeefp.h newlib/libc/include/langinfo.h newlib/libc/include/limits.h newlib/libc/include/locale.h newlib/libc/include/machine/ansi.h newlib/libc/include/machine/fastmath.h newlib/libc/include/machine/ieeefp.h newlib/libc/include/machine/malloc.h newlib/libc/include/machine/setjmp-dj.h newlib/libc/include/machine/setjmp.h newlib/libc/include/machine/stdlib.h newlib/libc/include/machine/termios.h newlib/libc/include/machine/time.h newlib/libc/include/machine/types.h newlib/libc/include/malloc.h newlib/libc/include/math.h newlib/libc/include/newlib.h newlib/libc/include/paths.h newlib/libc/include/process.h newlib/libc/include/pthread.h newlib/libc/include/pwd.h newlib/libc/include/reent.h newlib/libc/include/regdef.h newlib/libc/include/search.h newlib/libc/include/setjmp.h newlib/libc/include/signal.h newlib/libc/include/stdio.h newlib/libc/include/stdlib.h newlib/libc/include/string.h newlib/libc/include/sys/_types.h newlib/libc/include/sys/cdefs.h newlib/libc/include/sys/config.h newlib/libc/include/sys/dirent.h newlib/libc/include/sys/errno.h newlib/libc/include/sys/fcntl.h newlib/libc/include/sys/features.h newlib/libc/include/sys/file.h newlib/libc/include/sys/lock.h newlib/libc/include/sys/param.h newlib/libc/include/sys/queue.h newlib/libc/include/sys/reent.h newlib/libc/include/sys/resource.h newlib/libc/include/sys/sched.h newlib/libc/include/sys/signal.h newlib/libc/include/sys/stat-dj.h newlib/libc/include/sys/stat.h newlib/libc/include/sys/stdio.h newlib/libc/include/sys/syslimits.h newlib/libc/include/sys/time.h newlib/libc/include/sys/timeb.h newlib/libc/include/sys/times.h newlib/libc/include/sys/types.h newlib/libc/include/sys/unistd.h newlib/libc/include/sys/utime.h newlib/libc/include/sys/wait.h newlib/libc/include/termios.h newlib/libc/include/time.h newlib/libc/include/unctrl.h newlib/libc/include/unistd.h newlib/libc/include/utime.h newlib/libc/include/utmp.h newlib/libc/include/wchar.h newlib/libc/include/wctype.h newlib/libc/libc.texinfo newlib/libc/locale/Makefile.am newlib/libc/locale/Makefile.in newlib/libc/locale/fix_grouping.c newlib/libc/locale/ldpart.c newlib/libc/locale/ldpart.h newlib/libc/locale/lmessages.c newlib/libc/locale/lmessages.h newlib/libc/locale/lmonetary.c newlib/libc/locale/lmonetary.h newlib/libc/locale/lnumeric.c newlib/libc/locale/lnumeric.h newlib/libc/locale/locale.c newlib/libc/locale/locale.tex newlib/libc/locale/nl_langinfo.3 newlib/libc/locale/nl_langinfo.c newlib/libc/locale/setlocale.h newlib/libc/locale/timelocal.c newlib/libc/locale/timelocal.h newlib/libc/machine/Makefile.am newlib/libc/machine/Makefile.in newlib/libc/machine/a29k/Makefile.am newlib/libc/machine/a29k/Makefile.in newlib/libc/machine/a29k/aclocal.m4 newlib/libc/machine/a29k/configure newlib/libc/machine/a29k/configure.in newlib/libc/machine/aclocal.m4 newlib/libc/machine/arm/Makefile.am newlib/libc/machine/arm/Makefile.in newlib/libc/machine/arm/aclocal.m4 newlib/libc/machine/arm/configure newlib/libc/machine/arm/configure.in newlib/libc/machine/configure newlib/libc/machine/configure.in newlib/libc/machine/d10v/Makefile.am newlib/libc/machine/d10v/Makefile.in newlib/libc/machine/d10v/aclocal.m4 newlib/libc/machine/d10v/configure newlib/libc/machine/d10v/configure.in newlib/libc/machine/d10v/setjmp.S newlib/libc/machine/d30v/Makefile.am newlib/libc/machine/d30v/Makefile.in newlib/libc/machine/d30v/aclocal.m4 newlib/libc/machine/d30v/configure newlib/libc/machine/d30v/configure.in newlib/libc/machine/d30v/setjmp.S newlib/libc/machine/fr30/Makefile.am newlib/libc/machine/fr30/Makefile.in newlib/libc/machine/fr30/aclocal.m4 newlib/libc/machine/fr30/configure newlib/libc/machine/fr30/configure.in newlib/libc/machine/fr30/setjmp.S newlib/libc/machine/frv/Makefile.am newlib/libc/machine/frv/Makefile.in newlib/libc/machine/frv/aclocal.m4 newlib/libc/machine/frv/configure newlib/libc/machine/frv/configure.in newlib/libc/machine/frv/setjmp.S newlib/libc/machine/h8300/Makefile.am newlib/libc/machine/h8300/Makefile.in newlib/libc/machine/h8300/aclocal.m4 newlib/libc/machine/h8300/configure newlib/libc/machine/h8300/configure.in newlib/libc/machine/h8300/defines.h newlib/libc/machine/h8300/memcpy.S newlib/libc/machine/h8300/memset.S newlib/libc/machine/h8300/reg_memcpy.S newlib/libc/machine/h8300/reg_memset.S newlib/libc/machine/h8300/setjmp.S newlib/libc/machine/h8300/strcmp.S newlib/libc/machine/h8500/Makefile.am newlib/libc/machine/h8500/Makefile.in newlib/libc/machine/h8500/aclocal.m4 newlib/libc/machine/h8500/cmpsi.c newlib/libc/machine/h8500/configure newlib/libc/machine/h8500/configure.in newlib/libc/machine/h8500/divhi3.S newlib/libc/machine/h8500/divsi3.c newlib/libc/machine/h8500/mulhi3.c newlib/libc/machine/h8500/mulsi3.c newlib/libc/machine/h8500/negsi2.c newlib/libc/machine/h8500/psi.S newlib/libc/machine/h8500/setjmp.S newlib/libc/machine/h8500/shifts.c newlib/libc/machine/hppa/DEFS.h newlib/libc/machine/hppa/Makefile.am newlib/libc/machine/hppa/Makefile.in newlib/libc/machine/hppa/aclocal.m4 newlib/libc/machine/hppa/configure newlib/libc/machine/hppa/configure.in newlib/libc/machine/hppa/memchr.S newlib/libc/machine/hppa/memcmp.S newlib/libc/machine/hppa/memcpy.S newlib/libc/machine/hppa/memset.S newlib/libc/machine/hppa/pcc_prefix.s newlib/libc/machine/hppa/setjmp.S newlib/libc/machine/hppa/strcat.S newlib/libc/machine/hppa/strcmp.S newlib/libc/machine/hppa/strcpy.S newlib/libc/machine/hppa/strlen.S newlib/libc/machine/hppa/strncat.S newlib/libc/machine/hppa/strncmp.S newlib/libc/machine/hppa/strncpy.S newlib/libc/machine/i386/Makefile.am newlib/libc/machine/i386/Makefile.in newlib/libc/machine/i386/aclocal.m4 newlib/libc/machine/i386/configure newlib/libc/machine/i386/configure.in newlib/libc/machine/i386/f_atan2.S newlib/libc/machine/i386/f_atan2f.S newlib/libc/machine/i386/f_exp.c newlib/libc/machine/i386/f_expf.c newlib/libc/machine/i386/f_frexp.S newlib/libc/machine/i386/f_frexpf.S newlib/libc/machine/i386/f_ldexp.S newlib/libc/machine/i386/f_ldexpf.S newlib/libc/machine/i386/f_log.S newlib/libc/machine/i386/f_log10.S newlib/libc/machine/i386/f_log10f.S newlib/libc/machine/i386/f_logf.S newlib/libc/machine/i386/f_math.h newlib/libc/machine/i386/f_pow.c newlib/libc/machine/i386/f_powf.c newlib/libc/machine/i386/f_tan.S newlib/libc/machine/i386/f_tanf.S newlib/libc/machine/i386/i386mach.h newlib/libc/machine/i386/memchr.S newlib/libc/machine/i386/memcmp.S newlib/libc/machine/i386/memcpy.S newlib/libc/machine/i386/memmove.S newlib/libc/machine/i386/memset.S newlib/libc/machine/i386/setjmp.S newlib/libc/machine/i386/strchr.S newlib/libc/machine/i386/strlen.S newlib/libc/machine/i960/Makefile.am newlib/libc/machine/i960/Makefile.in newlib/libc/machine/i960/aclocal.m4 newlib/libc/machine/i960/configure newlib/libc/machine/i960/configure.in newlib/libc/machine/i960/memccpy.S newlib/libc/machine/i960/memccpy_ca.S newlib/libc/machine/i960/memchr.S newlib/libc/machine/i960/memchr_ca.S newlib/libc/machine/i960/memcmp.S newlib/libc/machine/i960/memcmp_ca.S newlib/libc/machine/i960/memcpy.S newlib/libc/machine/i960/memcpy_ca.S newlib/libc/machine/i960/memset.S newlib/libc/machine/i960/setjmp.S newlib/libc/machine/i960/strchr.S newlib/libc/machine/i960/strchr_ca.S newlib/libc/machine/i960/strcmp.S newlib/libc/machine/i960/strcmp_ca.S newlib/libc/machine/i960/strcpy.S newlib/libc/machine/i960/strcpy_ca.S newlib/libc/machine/i960/strcspn.S newlib/libc/machine/i960/strdup.S newlib/libc/machine/i960/strlen.S newlib/libc/machine/i960/strlen_ca.S newlib/libc/machine/i960/strncat.S newlib/libc/machine/i960/strncat_ca.S newlib/libc/machine/i960/strncmp.S newlib/libc/machine/i960/strncmp_ca.S newlib/libc/machine/i960/strncpy.S newlib/libc/machine/i960/strncpy_ca.S newlib/libc/machine/i960/strpbrk.S newlib/libc/machine/i960/strrchr.S newlib/libc/machine/m32r/Makefile.am newlib/libc/machine/m32r/Makefile.in newlib/libc/machine/m32r/aclocal.m4 newlib/libc/machine/m32r/configure newlib/libc/machine/m32r/configure.in newlib/libc/machine/m32r/setjmp.S newlib/libc/machine/m68hc11/Makefile.am newlib/libc/machine/m68hc11/Makefile.in newlib/libc/machine/m68hc11/aclocal.m4 newlib/libc/machine/m68hc11/configure newlib/libc/machine/m68hc11/configure.in newlib/libc/machine/m68hc11/setjmp.S newlib/libc/machine/m68k/Makefile.am newlib/libc/machine/m68k/Makefile.in newlib/libc/machine/m68k/aclocal.m4 newlib/libc/machine/m68k/configure newlib/libc/machine/m68k/configure.in newlib/libc/machine/m68k/setjmp.S newlib/libc/machine/m68k/strcpy.c newlib/libc/machine/m68k/strlen.c newlib/libc/machine/m88k/Makefile.am newlib/libc/machine/m88k/Makefile.in newlib/libc/machine/m88k/aclocal.m4 newlib/libc/machine/m88k/configure newlib/libc/machine/m88k/configure.in newlib/libc/machine/m88k/setjmp.S newlib/libc/machine/mips/Makefile.am newlib/libc/machine/mips/Makefile.in newlib/libc/machine/mips/aclocal.m4 newlib/libc/machine/mips/configure newlib/libc/machine/mips/configure.in newlib/libc/machine/mips/machine/regdef.h newlib/libc/machine/mips/memcpy.c newlib/libc/machine/mips/memset.c newlib/libc/machine/mips/setjmp.S newlib/libc/machine/mips/strcmp.c newlib/libc/machine/mips/strlen.c newlib/libc/machine/mips/strncpy.c newlib/libc/machine/mn10200/Makefile.am newlib/libc/machine/mn10200/Makefile.in newlib/libc/machine/mn10200/aclocal.m4 newlib/libc/machine/mn10200/configure newlib/libc/machine/mn10200/configure.in newlib/libc/machine/mn10200/setjmp.S newlib/libc/machine/mn10300/Makefile.am newlib/libc/machine/mn10300/Makefile.in newlib/libc/machine/mn10300/aclocal.m4 newlib/libc/machine/mn10300/configure newlib/libc/machine/mn10300/configure.in newlib/libc/machine/mn10300/memchr.S newlib/libc/machine/mn10300/memcmp.S newlib/libc/machine/mn10300/memcpy.S newlib/libc/machine/mn10300/memset.S newlib/libc/machine/mn10300/setjmp.S newlib/libc/machine/mn10300/strchr.S newlib/libc/machine/mn10300/strcmp.S newlib/libc/machine/mn10300/strcpy.S newlib/libc/machine/mn10300/strlen.S newlib/libc/machine/necv70/Makefile.am newlib/libc/machine/necv70/Makefile.in newlib/libc/machine/necv70/aclocal.m4 newlib/libc/machine/necv70/configure newlib/libc/machine/necv70/configure.in newlib/libc/machine/necv70/fastmath.s newlib/libc/machine/necv70/machine/registers.h newlib/libc/machine/necv70/necv70.tex newlib/libc/machine/necv70/setjmp.s newlib/libc/machine/powerpc/Makefile.am newlib/libc/machine/powerpc/Makefile.in newlib/libc/machine/powerpc/aclocal.m4 newlib/libc/machine/powerpc/atosfix16.c newlib/libc/machine/powerpc/atosfix32.c newlib/libc/machine/powerpc/atosfix64.c newlib/libc/machine/powerpc/atoufix16.c newlib/libc/machine/powerpc/atoufix32.c newlib/libc/machine/powerpc/atoufix64.c newlib/libc/machine/powerpc/configure newlib/libc/machine/powerpc/configure.in newlib/libc/machine/powerpc/fix64.h newlib/libc/machine/powerpc/machine/malloc.h newlib/libc/machine/powerpc/machine/stdlib.h newlib/libc/machine/powerpc/setjmp.S newlib/libc/machine/powerpc/simdldtoa.c newlib/libc/machine/powerpc/strtosfix16.c newlib/libc/machine/powerpc/strtosfix32.c newlib/libc/machine/powerpc/strtosfix64.c newlib/libc/machine/powerpc/strtoufix16.c newlib/libc/machine/powerpc/strtoufix32.c newlib/libc/machine/powerpc/strtoufix64.c newlib/libc/machine/powerpc/times.c newlib/libc/machine/powerpc/ufix64toa.c newlib/libc/machine/powerpc/vec_calloc.c newlib/libc/machine/powerpc/vec_free.c newlib/libc/machine/powerpc/vec_malloc.c newlib/libc/machine/powerpc/vec_mallocr.c newlib/libc/machine/powerpc/vec_realloc.c newlib/libc/machine/powerpc/vfprintf.c newlib/libc/machine/powerpc/vfscanf.c newlib/libc/machine/sh/Makefile.am newlib/libc/machine/sh/Makefile.in newlib/libc/machine/sh/aclocal.m4 newlib/libc/machine/sh/asm.h newlib/libc/machine/sh/configure newlib/libc/machine/sh/configure.in newlib/libc/machine/sh/memcpy.S newlib/libc/machine/sh/memset.S newlib/libc/machine/sh/setjmp.S newlib/libc/machine/sh/strcmp.S newlib/libc/machine/sh/strcpy.S newlib/libc/machine/sh/strlen.S newlib/libc/machine/sparc/Makefile.am newlib/libc/machine/sparc/Makefile.in newlib/libc/machine/sparc/aclocal.m4 newlib/libc/machine/sparc/configure newlib/libc/machine/sparc/configure.in newlib/libc/machine/sparc/machine/sparclet.h newlib/libc/machine/sparc/scan.c newlib/libc/machine/sparc/setjmp.S newlib/libc/machine/sparc/shuffle.c newlib/libc/machine/tic80/Makefile.am newlib/libc/machine/tic80/Makefile.in newlib/libc/machine/tic80/aclocal.m4 newlib/libc/machine/tic80/configure newlib/libc/machine/tic80/configure.in newlib/libc/machine/tic80/setjmp.S newlib/libc/machine/v850/Makefile.am newlib/libc/machine/v850/Makefile.in newlib/libc/machine/v850/aclocal.m4 newlib/libc/machine/v850/configure newlib/libc/machine/v850/configure.in newlib/libc/machine/v850/setjmp.S newlib/libc/machine/w65/Makefile.am newlib/libc/machine/w65/Makefile.in newlib/libc/machine/w65/aclocal.m4 newlib/libc/machine/w65/cmpsi.c newlib/libc/machine/w65/configure newlib/libc/machine/w65/configure.in newlib/libc/machine/w65/divsi3.c newlib/libc/machine/w65/lshrhi.s newlib/libc/machine/w65/mulsi3.c newlib/libc/machine/w65/sdivhi3.s newlib/libc/machine/w65/smulhi3.s newlib/libc/machine/w65/udivhi3.s newlib/libc/machine/w65/umodhi3.s newlib/libc/machine/xscale/Makefile.am newlib/libc/machine/xscale/Makefile.in newlib/libc/machine/xscale/aclocal.m4 newlib/libc/machine/xscale/configure newlib/libc/machine/xscale/configure.in newlib/libc/machine/xscale/machine/profile.h newlib/libc/machine/xscale/memchr.c newlib/libc/machine/xscale/memcmp.c newlib/libc/machine/xscale/memcpy.c newlib/libc/machine/xscale/memmove.c newlib/libc/machine/xscale/memset.c newlib/libc/machine/xscale/strchr.c newlib/libc/machine/xscale/strcmp.c newlib/libc/machine/xscale/strcpy.c newlib/libc/machine/xscale/strlen.c newlib/libc/machine/xscale/xscale.h newlib/libc/machine/xstormy16/Makefile.am newlib/libc/machine/xstormy16/Makefile.in newlib/libc/machine/xstormy16/aclocal.m4 newlib/libc/machine/xstormy16/configure newlib/libc/machine/xstormy16/configure.in newlib/libc/machine/xstormy16/mallocr.c newlib/libc/machine/xstormy16/setjmp.S newlib/libc/machine/xstormy16/tiny-malloc.c newlib/libc/machine/z8k/Makefile.am newlib/libc/machine/z8k/Makefile.in newlib/libc/machine/z8k/aclocal.m4 newlib/libc/machine/z8k/args.h newlib/libc/machine/z8k/configure newlib/libc/machine/z8k/configure.in newlib/libc/machine/z8k/setjmp.S newlib/libc/misc/Makefile.am newlib/libc/misc/Makefile.in newlib/libc/misc/dprintf.c newlib/libc/misc/ffs.c newlib/libc/misc/misc.tex newlib/libc/misc/unctrl.c newlib/libc/posix/Makefile.am newlib/libc/posix/Makefile.in newlib/libc/posix/closedir.c newlib/libc/posix/creat.c newlib/libc/posix/execl.c newlib/libc/posix/execle.c newlib/libc/posix/execlp.c newlib/libc/posix/execv.c newlib/libc/posix/execve.c newlib/libc/posix/execvp.c newlib/libc/posix/isatty.c newlib/libc/posix/opendir.c newlib/libc/posix/popen.c newlib/libc/posix/readdir.c newlib/libc/posix/readdir_r.c newlib/libc/posix/rewinddir.c newlib/libc/posix/scandir.c newlib/libc/posix/seekdir.c newlib/libc/posix/telldir.c newlib/libc/reent/Makefile.am newlib/libc/reent/Makefile.in newlib/libc/reent/closer.c newlib/libc/reent/execr.c newlib/libc/reent/fcntlr.c newlib/libc/reent/fstat64r.c newlib/libc/reent/fstatr.c newlib/libc/reent/getreent.c newlib/libc/reent/impure.c newlib/libc/reent/linkr.c newlib/libc/reent/lseek64r.c newlib/libc/reent/lseekr.c newlib/libc/reent/open64r.c newlib/libc/reent/openr.c newlib/libc/reent/readr.c newlib/libc/reent/reent.c newlib/libc/reent/reent.tex newlib/libc/reent/sbrkr.c newlib/libc/reent/signalr.c newlib/libc/reent/signgam.c newlib/libc/reent/statr.c newlib/libc/reent/timer.c newlib/libc/reent/unlinkr.c newlib/libc/reent/writer.c newlib/libc/saber newlib/libc/search/Makefile.am newlib/libc/search/Makefile.in newlib/libc/search/bsearch.c newlib/libc/search/db_local.h newlib/libc/search/extern.h newlib/libc/search/hash.c newlib/libc/search/hash.h newlib/libc/search/hash_bigkey.c newlib/libc/search/hash_buf.c newlib/libc/search/hash_func.c newlib/libc/search/hash_log2.c newlib/libc/search/hash_page.c newlib/libc/search/hcreate.3 newlib/libc/search/hcreate.c newlib/libc/search/hcreate_r.c newlib/libc/search/page.h newlib/libc/search/qsort.c newlib/libc/search/tdelete.c newlib/libc/search/tdestroy.c newlib/libc/search/tfind.c newlib/libc/search/tsearch.3 newlib/libc/search/tsearch.c newlib/libc/search/twalk.c newlib/libc/signal/Makefile.am newlib/libc/signal/Makefile.in newlib/libc/signal/raise.c newlib/libc/signal/signal.c newlib/libc/signal/signal.tex newlib/libc/stdio/Makefile.am newlib/libc/stdio/Makefile.in newlib/libc/stdio/asprintf.c newlib/libc/stdio/clearerr.c newlib/libc/stdio/fclose.c newlib/libc/stdio/fcloseall.c newlib/libc/stdio/fdopen.c newlib/libc/stdio/feof.c newlib/libc/stdio/ferror.c newlib/libc/stdio/fflush.c newlib/libc/stdio/fgetc.c newlib/libc/stdio/fgetpos.c newlib/libc/stdio/fgets.c newlib/libc/stdio/fileno.c newlib/libc/stdio/findfp.c newlib/libc/stdio/fiprintf.c newlib/libc/stdio/flags.c newlib/libc/stdio/floatio.h newlib/libc/stdio/fopen.c newlib/libc/stdio/fprintf.c newlib/libc/stdio/fputc.c newlib/libc/stdio/fputs.c newlib/libc/stdio/fread.c newlib/libc/stdio/freopen.c newlib/libc/stdio/fscanf.c newlib/libc/stdio/fseek.c newlib/libc/stdio/fseeko.c newlib/libc/stdio/fsetpos.c newlib/libc/stdio/ftell.c newlib/libc/stdio/ftello.c newlib/libc/stdio/fvwrite.c newlib/libc/stdio/fvwrite.h newlib/libc/stdio/fwalk.c newlib/libc/stdio/fwrite.c newlib/libc/stdio/getc.c newlib/libc/stdio/getc_u.c newlib/libc/stdio/getchar.c newlib/libc/stdio/getchar_u.c newlib/libc/stdio/getdelim.c newlib/libc/stdio/getline.c newlib/libc/stdio/gets.c newlib/libc/stdio/getw.c newlib/libc/stdio/iprintf.c newlib/libc/stdio/local.h newlib/libc/stdio/makebuf.c newlib/libc/stdio/mktemp.c newlib/libc/stdio/perror.c newlib/libc/stdio/printf.c newlib/libc/stdio/putc.c newlib/libc/stdio/putc_u.c newlib/libc/stdio/putchar.c newlib/libc/stdio/putchar_u.c newlib/libc/stdio/puts.c newlib/libc/stdio/putw.c newlib/libc/stdio/refill.c newlib/libc/stdio/remove.c newlib/libc/stdio/rename.c newlib/libc/stdio/rewind.c newlib/libc/stdio/rget.c newlib/libc/stdio/scanf.c newlib/libc/stdio/setbuf.c newlib/libc/stdio/setbuffer.c newlib/libc/stdio/setlinebuf.c newlib/libc/stdio/setvbuf.c newlib/libc/stdio/siprintf.c newlib/libc/stdio/snprintf.c newlib/libc/stdio/sprintf.c newlib/libc/stdio/sscanf.c newlib/libc/stdio/stdio.c newlib/libc/stdio/stdio.tex newlib/libc/stdio/tmpfile.c newlib/libc/stdio/tmpnam.c newlib/libc/stdio/ungetc.c newlib/libc/stdio/vasprintf.c newlib/libc/stdio/vfieeefp.h newlib/libc/stdio/vfprintf.c newlib/libc/stdio/vfscanf.c newlib/libc/stdio/vprintf.c newlib/libc/stdio/vscanf.c newlib/libc/stdio/vsnprintf.c newlib/libc/stdio/vsprintf.c newlib/libc/stdio/vsscanf.c newlib/libc/stdio/wbuf.c newlib/libc/stdio/wsetup.c newlib/libc/stdio64/Makefile.am newlib/libc/stdio64/Makefile.in newlib/libc/stdio64/dummy.c newlib/libc/stdio64/fgetpos64.c newlib/libc/stdio64/fopen64.c newlib/libc/stdio64/freopen64.c newlib/libc/stdio64/fseeko64.c newlib/libc/stdio64/fsetpos64.c newlib/libc/stdio64/ftello64.c newlib/libc/stdio64/local64.h newlib/libc/stdio64/stdio64.c newlib/libc/stdio64/stdio64.tex newlib/libc/stdio64/tmpfile64.c newlib/libc/stdlib/Makefile.am newlib/libc/stdlib/Makefile.in newlib/libc/stdlib/_Exit.c newlib/libc/stdlib/__adjust.c newlib/libc/stdlib/__exp10.c newlib/libc/stdlib/__ten_mu.c newlib/libc/stdlib/a64l.c newlib/libc/stdlib/abort.c newlib/libc/stdlib/abs.c newlib/libc/stdlib/assert.c newlib/libc/stdlib/atexit.c newlib/libc/stdlib/atexit.h newlib/libc/stdlib/atof.c newlib/libc/stdlib/atoff.c newlib/libc/stdlib/atoi.c newlib/libc/stdlib/atol.c newlib/libc/stdlib/btowc.c newlib/libc/stdlib/calloc.c newlib/libc/stdlib/div.c newlib/libc/stdlib/drand48.c newlib/libc/stdlib/dtoa.c newlib/libc/stdlib/dtoastub.c newlib/libc/stdlib/ecvtbuf.c newlib/libc/stdlib/efgcvt.c newlib/libc/stdlib/environ.c newlib/libc/stdlib/envlock.c newlib/libc/stdlib/envlock.h newlib/libc/stdlib/eprintf.c newlib/libc/stdlib/erand48.c newlib/libc/stdlib/exit.c newlib/libc/stdlib/getenv.c newlib/libc/stdlib/getenv_r.c newlib/libc/stdlib/getopt.c newlib/libc/stdlib/getsubopt.3 newlib/libc/stdlib/getsubopt.c newlib/libc/stdlib/jrand48.c newlib/libc/stdlib/l64a.c newlib/libc/stdlib/labs.c newlib/libc/stdlib/lcong48.c newlib/libc/stdlib/ldiv.c newlib/libc/stdlib/ldtoa.c newlib/libc/stdlib/local.h newlib/libc/stdlib/lrand48.c newlib/libc/stdlib/malign.c newlib/libc/stdlib/malloc.c newlib/libc/stdlib/mallocr.c newlib/libc/stdlib/mbctype.h newlib/libc/stdlib/mblen.c newlib/libc/stdlib/mblen_r.c newlib/libc/stdlib/mbrlen.c newlib/libc/stdlib/mbrtowc.c newlib/libc/stdlib/mbsinit.c newlib/libc/stdlib/mbsrtowcs.c newlib/libc/stdlib/mbstowcs.c newlib/libc/stdlib/mbstowcs_r.c newlib/libc/stdlib/mbtowc.c newlib/libc/stdlib/mbtowc_r.c newlib/libc/stdlib/mlock.c newlib/libc/stdlib/mprec.c newlib/libc/stdlib/mprec.h newlib/libc/stdlib/mrand48.c newlib/libc/stdlib/msize.c newlib/libc/stdlib/mstats.c newlib/libc/stdlib/mtrim.c newlib/libc/stdlib/nrand48.c newlib/libc/stdlib/on_exit.c newlib/libc/stdlib/putenv.c newlib/libc/stdlib/putenv_r.c newlib/libc/stdlib/rand.c newlib/libc/stdlib/rand48.c newlib/libc/stdlib/rand48.h newlib/libc/stdlib/rand_r.c newlib/libc/stdlib/realloc.c newlib/libc/stdlib/seed48.c newlib/libc/stdlib/setenv.c newlib/libc/stdlib/setenv_r.c newlib/libc/stdlib/srand48.c newlib/libc/stdlib/std.h newlib/libc/stdlib/stdlib.tex newlib/libc/stdlib/strtod.c newlib/libc/stdlib/strtol.c newlib/libc/stdlib/strtoll.c newlib/libc/stdlib/strtoll_r.c newlib/libc/stdlib/strtoul.c newlib/libc/stdlib/strtoull.c newlib/libc/stdlib/strtoull_r.c newlib/libc/stdlib/system.c newlib/libc/stdlib/valloc.c newlib/libc/stdlib/wcrtomb.c newlib/libc/stdlib/wcsrtombs.c newlib/libc/stdlib/wcstombs.c newlib/libc/stdlib/wcstombs_r.c newlib/libc/stdlib/wctob.c newlib/libc/stdlib/wctomb.c newlib/libc/stdlib/wctomb_r.c newlib/libc/string/Makefile.am newlib/libc/string/Makefile.in newlib/libc/string/bcmp.c newlib/libc/string/bcopy.c newlib/libc/string/bzero.c newlib/libc/string/index.c newlib/libc/string/memccpy.c newlib/libc/string/memchr.c newlib/libc/string/memcmp.c newlib/libc/string/memcpy.c newlib/libc/string/memmove.c newlib/libc/string/mempcpy.c newlib/libc/string/memset.c newlib/libc/string/rindex.c newlib/libc/string/strcasecmp.c newlib/libc/string/strcat.c newlib/libc/string/strchr.c newlib/libc/string/strcmp.c newlib/libc/string/strcoll.c newlib/libc/string/strcpy.c newlib/libc/string/strcspn.c newlib/libc/string/strdup.c newlib/libc/string/strdup_r.c newlib/libc/string/strerror.c newlib/libc/string/strerror_r.c newlib/libc/string/strings.tex newlib/libc/string/strlcat.c newlib/libc/string/strlcpy.c newlib/libc/string/strlen.c newlib/libc/string/strlwr.c newlib/libc/string/strncasecmp.c newlib/libc/string/strncat.c newlib/libc/string/strncmp.c newlib/libc/string/strncpy.c newlib/libc/string/strndup.c newlib/libc/string/strndup_r.c newlib/libc/string/strnlen.c newlib/libc/string/strpbrk.c newlib/libc/string/strrchr.c newlib/libc/string/strsep.c newlib/libc/string/strspn.c newlib/libc/string/strstr.c newlib/libc/string/strtok.c newlib/libc/string/strtok_r.c newlib/libc/string/strupr.c newlib/libc/string/strxfrm.c newlib/libc/string/swab.c newlib/libc/string/u_strerr.c newlib/libc/string/wcscat.c newlib/libc/string/wcschr.c newlib/libc/string/wcscmp.c newlib/libc/string/wcscpy.c newlib/libc/string/wcscspn.c newlib/libc/string/wcslcat.c newlib/libc/string/wcslcpy.c newlib/libc/string/wcslen.c newlib/libc/string/wcsncat.c newlib/libc/string/wcsncmp.c newlib/libc/string/wcsncpy.c newlib/libc/string/wcspbrk.c newlib/libc/string/wcsrchr.c newlib/libc/string/wcsspn.c newlib/libc/string/wcsstr.c newlib/libc/string/wcstrings.tex newlib/libc/string/wmemchr.c newlib/libc/string/wmemcmp.c newlib/libc/string/wmemcpy.c newlib/libc/string/wmemmove.c newlib/libc/string/wmemset.c newlib/libc/sys.tex newlib/libc/sys/Makefile.am newlib/libc/sys/Makefile.in newlib/libc/sys/a29khif/Makefile.am newlib/libc/sys/a29khif/Makefile.in newlib/libc/sys/a29khif/_alloc.s newlib/libc/sys/a29khif/_close.s newlib/libc/sys/a29khif/_cycles.s newlib/libc/sys/a29khif/_exit.s newlib/libc/sys/a29khif/_fstat.s newlib/libc/sys/a29khif/_getpsiz.s newlib/libc/sys/a29khif/_gettz.s newlib/libc/sys/a29khif/_ioctl.s newlib/libc/sys/a29khif/_iostat.s newlib/libc/sys/a29khif/_iowait.s newlib/libc/sys/a29khif/_isatty.s newlib/libc/sys/a29khif/_lseek.s newlib/libc/sys/a29khif/_open.s newlib/libc/sys/a29khif/_query.s newlib/libc/sys/a29khif/_read.s newlib/libc/sys/a29khif/_sbrk.s newlib/libc/sys/a29khif/_setim.s newlib/libc/sys/a29khif/_settrap.s newlib/libc/sys/a29khif/_setvec.s newlib/libc/sys/a29khif/_tmpnam.s newlib/libc/sys/a29khif/_write.s newlib/libc/sys/a29khif/aclocal.m4 newlib/libc/sys/a29khif/alloc.s newlib/libc/sys/a29khif/clock.s newlib/libc/sys/a29khif/configure newlib/libc/sys/a29khif/configure.in newlib/libc/sys/a29khif/crt0.s newlib/libc/sys/a29khif/getargs.s newlib/libc/sys/a29khif/getenv.s newlib/libc/sys/a29khif/getpid.c newlib/libc/sys/a29khif/kill.c newlib/libc/sys/a29khif/read.s newlib/libc/sys/a29khif/remove.s newlib/libc/sys/a29khif/rename.s newlib/libc/sys/a29khif/signal.s newlib/libc/sys/a29khif/stubs.s newlib/libc/sys/a29khif/sys/cpudef.h newlib/libc/sys/a29khif/sys/fpsymbol.h newlib/libc/sys/a29khif/sys/intrinsi.h newlib/libc/sys/a29khif/sys/macros.h newlib/libc/sys/a29khif/sys/proreg.h newlib/libc/sys/a29khif/sys/romdcl.h newlib/libc/sys/a29khif/sys/smartmac.h newlib/libc/sys/a29khif/sys/sysmac.h newlib/libc/sys/a29khif/systime.s newlib/libc/sys/a29khif/vec.s newlib/libc/sys/aclocal.m4 newlib/libc/sys/arc/Makefile.am newlib/libc/sys/arc/Makefile.in newlib/libc/sys/arc/aclocal.m4 newlib/libc/sys/arc/configure newlib/libc/sys/arc/configure.in newlib/libc/sys/arc/crt0.S newlib/libc/sys/arc/isatty.c newlib/libc/sys/arc/mem-layout.c newlib/libc/sys/arc/sbrk.c newlib/libc/sys/arc/sys/syscall.h newlib/libc/sys/arc/syscalls.c newlib/libc/sys/arm/Makefile.am newlib/libc/sys/arm/Makefile.in newlib/libc/sys/arm/access.c newlib/libc/sys/arm/aclocal.m4 newlib/libc/sys/arm/configure newlib/libc/sys/arm/configure.in newlib/libc/sys/arm/crt0.S newlib/libc/sys/arm/libcfunc.c newlib/libc/sys/arm/setjmp.S newlib/libc/sys/arm/swi.h newlib/libc/sys/arm/sys/param.h newlib/libc/sys/arm/syscalls.c newlib/libc/sys/arm/trap.S newlib/libc/sys/configure newlib/libc/sys/configure.in newlib/libc/sys/cygwin/Makefile.am newlib/libc/sys/cygwin/Makefile.in newlib/libc/sys/cygwin/aclocal.m4 newlib/libc/sys/cygwin/configure newlib/libc/sys/cygwin/configure.in newlib/libc/sys/cygwin/crt0.c newlib/libc/sys/cygwin/include/unistd.h newlib/libc/sys/cygwin/sys/dirent.h newlib/libc/sys/cygwin/sys/param.h newlib/libc/sys/cygwin/sys/utime.h newlib/libc/sys/cygwin/sys/utmp.h newlib/libc/sys/d10v/Makefile.am newlib/libc/sys/d10v/Makefile.in newlib/libc/sys/d10v/aclocal.m4 newlib/libc/sys/d10v/configure newlib/libc/sys/d10v/configure.in newlib/libc/sys/d10v/creat.c newlib/libc/sys/d10v/crt0.S newlib/libc/sys/d10v/sys/syscall.h newlib/libc/sys/d10v/syscalls.c newlib/libc/sys/d10v/trap.S newlib/libc/sys/decstation/Makefile.am newlib/libc/sys/decstation/Makefile.in newlib/libc/sys/decstation/_main.c newlib/libc/sys/decstation/aclocal.m4 newlib/libc/sys/decstation/configure newlib/libc/sys/decstation/configure.in newlib/libc/sys/decstation/sys/dirent.h newlib/libc/sys/go32/Makefile.am newlib/libc/sys/go32/Makefile.in newlib/libc/sys/go32/_exit.s newlib/libc/sys/go32/_main.c newlib/libc/sys/go32/abort.c newlib/libc/sys/go32/access.c newlib/libc/sys/go32/aclocal.m4 newlib/libc/sys/go32/bdos.c newlib/libc/sys/go32/bdosptr.c newlib/libc/sys/go32/brk.s newlib/libc/sys/go32/chdir.s newlib/libc/sys/go32/chmod.c newlib/libc/sys/go32/chown.c newlib/libc/sys/go32/clock.S newlib/libc/sys/go32/close.s newlib/libc/sys/go32/configure newlib/libc/sys/go32/configure.in newlib/libc/sys/go32/copying.dj newlib/libc/sys/go32/creat.s newlib/libc/sys/go32/crlf2nl.c newlib/libc/sys/go32/crt0.S newlib/libc/sys/go32/dir.c newlib/libc/sys/go32/dir.h newlib/libc/sys/go32/djtime.h newlib/libc/sys/go32/dos.h newlib/libc/sys/go32/dosmem.S newlib/libc/sys/go32/dpmi.c newlib/libc/sys/go32/dpmi.h newlib/libc/sys/go32/dup.s newlib/libc/sys/go32/dup2.s newlib/libc/sys/go32/exec.c newlib/libc/sys/go32/fchmod.c newlib/libc/sys/go32/findfirs.s newlib/libc/sys/go32/findnext.s newlib/libc/sys/go32/fixpath.c newlib/libc/sys/go32/fstat.s newlib/libc/sys/go32/fsync.s newlib/libc/sys/go32/ftruncat.c newlib/libc/sys/go32/gerrno.s newlib/libc/sys/go32/getcwd.c newlib/libc/sys/go32/getdate.c newlib/libc/sys/go32/getdtabl.c newlib/libc/sys/go32/getgid.c newlib/libc/sys/go32/getkey.s newlib/libc/sys/go32/getpages.c newlib/libc/sys/go32/getpid.c newlib/libc/sys/go32/getrusag.c newlib/libc/sys/go32/gettime.c newlib/libc/sys/go32/gettimeo.c newlib/libc/sys/go32/gettimeo.s newlib/libc/sys/go32/getuid.c newlib/libc/sys/go32/getwd.s newlib/libc/sys/go32/go32.h newlib/libc/sys/go32/go32func.c newlib/libc/sys/go32/infoblk.c newlib/libc/sys/go32/inportb.s newlib/libc/sys/go32/inportl.s newlib/libc/sys/go32/inportsb.s newlib/libc/sys/go32/inportsl.s newlib/libc/sys/go32/inportsw.s newlib/libc/sys/go32/inportw.s newlib/libc/sys/go32/int86x.s newlib/libc/sys/go32/intdos.c newlib/libc/sys/go32/intdosx.c newlib/libc/sys/go32/isatty.s newlib/libc/sys/go32/kbhit.s newlib/libc/sys/go32/kill.c newlib/libc/sys/go32/link.s newlib/libc/sys/go32/longjmp.S newlib/libc/sys/go32/lseek.s newlib/libc/sys/go32/lstat.s newlib/libc/sys/go32/mkdir.s newlib/libc/sys/go32/open.s newlib/libc/sys/go32/outportb.s newlib/libc/sys/go32/outportl.s newlib/libc/sys/go32/outportw.s newlib/libc/sys/go32/outprtsb.s newlib/libc/sys/go32/outprtsl.s newlib/libc/sys/go32/outprtsw.s newlib/libc/sys/go32/pc.h newlib/libc/sys/go32/read.s newlib/libc/sys/go32/readv.c newlib/libc/sys/go32/rename.s newlib/libc/sys/go32/rmdir.s newlib/libc/sys/go32/sbrk.s newlib/libc/sys/go32/screen.S newlib/libc/sys/go32/setjmp.S newlib/libc/sys/go32/setmode.s newlib/libc/sys/go32/setstack.S newlib/libc/sys/go32/settimeo.s newlib/libc/sys/go32/sleep.c newlib/libc/sys/go32/stat.c newlib/libc/sys/go32/stat.s newlib/libc/sys/go32/stat_ast.s newlib/libc/sys/go32/sys/dir.h newlib/libc/sys/go32/sys/dirent.h newlib/libc/sys/go32/sys/dos.h newlib/libc/sys/go32/sys/dpmi.h newlib/libc/sys/go32/sys/errno.h newlib/libc/sys/go32/sys/fcntl.h newlib/libc/sys/go32/sys/file.h newlib/libc/sys/go32/sys/go32.h newlib/libc/sys/go32/sys/param.h newlib/libc/sys/go32/sys/pc.h newlib/libc/sys/go32/sys/register.h newlib/libc/sys/go32/sys/resource.h newlib/libc/sys/go32/sys/setjmp.h newlib/libc/sys/go32/sys/stdc.h newlib/libc/sys/go32/sys/uio.h newlib/libc/sys/go32/syserr.c newlib/libc/sys/go32/system.s newlib/libc/sys/go32/tell.s newlib/libc/sys/go32/time.c newlib/libc/sys/go32/truncate.c newlib/libc/sys/go32/turbo.s newlib/libc/sys/go32/umask.c newlib/libc/sys/go32/unlink.s newlib/libc/sys/go32/utime.c newlib/libc/sys/go32/utimes.c newlib/libc/sys/go32/write.s newlib/libc/sys/go32/writestub.c newlib/libc/sys/go32/writev.c newlib/libc/sys/h8300hms/Makefile.am newlib/libc/sys/h8300hms/Makefile.in newlib/libc/sys/h8300hms/_exit.c newlib/libc/sys/h8300hms/aclocal.m4 newlib/libc/sys/h8300hms/configure newlib/libc/sys/h8300hms/configure.in newlib/libc/sys/h8300hms/crt0.S newlib/libc/sys/h8300hms/crt1.c newlib/libc/sys/h8300hms/misc.c newlib/libc/sys/h8300hms/read.c newlib/libc/sys/h8300hms/sbrk.c newlib/libc/sys/h8300hms/sys/file.h newlib/libc/sys/h8300hms/sys/syscall.h newlib/libc/sys/h8300hms/syscalls.c newlib/libc/sys/h8300hms/write.c newlib/libc/sys/h8500hms/Makefile.am newlib/libc/sys/h8500hms/Makefile.in newlib/libc/sys/h8500hms/aclocal.m4 newlib/libc/sys/h8500hms/configure newlib/libc/sys/h8500hms/configure.in newlib/libc/sys/h8500hms/crt0.c newlib/libc/sys/h8500hms/misc.c newlib/libc/sys/h8500hms/syscalls.c newlib/libc/sys/linux/Makefile.am newlib/libc/sys/linux/Makefile.in newlib/libc/sys/linux/aclocal.m4 newlib/libc/sys/linux/aio.c newlib/libc/sys/linux/aio64.c newlib/libc/sys/linux/argp/Makefile.am newlib/libc/sys/linux/argp/Makefile.in newlib/libc/sys/linux/argp/argp-ba.c newlib/libc/sys/linux/argp/argp-eexst.c newlib/libc/sys/linux/argp/argp-fmtstream.c newlib/libc/sys/linux/argp/argp-fmtstream.h newlib/libc/sys/linux/argp/argp-fs-xinl.c newlib/libc/sys/linux/argp/argp-help.c newlib/libc/sys/linux/argp/argp-namefrob.h newlib/libc/sys/linux/argp/argp-parse.c newlib/libc/sys/linux/argp/argp-pv.c newlib/libc/sys/linux/argp/argp-pvh.c newlib/libc/sys/linux/argp/argp-xinl.c newlib/libc/sys/linux/bp-checks.h newlib/libc/sys/linux/brk.c newlib/libc/sys/linux/calloc.c newlib/libc/sys/linux/callocr.c newlib/libc/sys/linux/cfreer.c newlib/libc/sys/linux/cfspeed.c newlib/libc/sys/linux/clock_getres.c newlib/libc/sys/linux/clock_gettime.c newlib/libc/sys/linux/clock_settime.c newlib/libc/sys/linux/cmath/Makefile.am newlib/libc/sys/linux/cmath/Makefile.in newlib/libc/sys/linux/cmath/math_private.h newlib/libc/sys/linux/cmath/s_cacos.c newlib/libc/sys/linux/cmath/s_cacosf.c newlib/libc/sys/linux/cmath/s_cacosh.c newlib/libc/sys/linux/cmath/s_cacoshf.c newlib/libc/sys/linux/cmath/s_cacoshl.c newlib/libc/sys/linux/cmath/s_cacosl.c newlib/libc/sys/linux/cmath/s_casin.c newlib/libc/sys/linux/cmath/s_casinf.c newlib/libc/sys/linux/cmath/s_casinh.c newlib/libc/sys/linux/cmath/s_casinhf.c newlib/libc/sys/linux/cmath/s_casinhl.c newlib/libc/sys/linux/cmath/s_casinl.c newlib/libc/sys/linux/cmath/s_catan.c newlib/libc/sys/linux/cmath/s_catanf.c newlib/libc/sys/linux/cmath/s_catanh.c newlib/libc/sys/linux/cmath/s_catanhf.c newlib/libc/sys/linux/cmath/s_catanhl.c newlib/libc/sys/linux/cmath/s_catanl.c newlib/libc/sys/linux/cmath/s_cbrtl.c newlib/libc/sys/linux/cmath/s_ccos.c newlib/libc/sys/linux/cmath/s_ccosf.c newlib/libc/sys/linux/cmath/s_ccosh.c newlib/libc/sys/linux/cmath/s_ccoshf.c newlib/libc/sys/linux/cmath/s_ccoshl.c newlib/libc/sys/linux/cmath/s_ccosl.c newlib/libc/sys/linux/cmath/s_cexp.c newlib/libc/sys/linux/cmath/s_cexpf.c newlib/libc/sys/linux/cmath/s_cexpl.c newlib/libc/sys/linux/cmath/s_clog.c newlib/libc/sys/linux/cmath/s_clog10.c newlib/libc/sys/linux/cmath/s_clog10f.c newlib/libc/sys/linux/cmath/s_clog10l.c newlib/libc/sys/linux/cmath/s_clogf.c newlib/libc/sys/linux/cmath/s_clogl.c newlib/libc/sys/linux/cmath/s_cpow.c newlib/libc/sys/linux/cmath/s_cpowf.c newlib/libc/sys/linux/cmath/s_cpowl.c newlib/libc/sys/linux/cmath/s_cproj.c newlib/libc/sys/linux/cmath/s_cprojf.c newlib/libc/sys/linux/cmath/s_cprojl.c newlib/libc/sys/linux/cmath/s_csin.c newlib/libc/sys/linux/cmath/s_csinf.c newlib/libc/sys/linux/cmath/s_csinh.c newlib/libc/sys/linux/cmath/s_csinhf.c newlib/libc/sys/linux/cmath/s_csinhl.c newlib/libc/sys/linux/cmath/s_csinl.c newlib/libc/sys/linux/cmath/s_csqrt.c newlib/libc/sys/linux/cmath/s_csqrtf.c newlib/libc/sys/linux/cmath/s_csqrtl.c newlib/libc/sys/linux/cmath/s_ctan.c newlib/libc/sys/linux/cmath/s_ctanf.c newlib/libc/sys/linux/cmath/s_ctanh.c newlib/libc/sys/linux/cmath/s_ctanhf.c newlib/libc/sys/linux/cmath/s_ctanhl.c newlib/libc/sys/linux/cmath/s_ctanl.c newlib/libc/sys/linux/config.h newlib/libc/sys/linux/configure newlib/libc/sys/linux/configure.in newlib/libc/sys/linux/confstr.c newlib/libc/sys/linux/confstr.h newlib/libc/sys/linux/crt1.c newlib/libc/sys/linux/ctermid.c newlib/libc/sys/linux/fclean.c newlib/libc/sys/linux/flockfile.c newlib/libc/sys/linux/fpathconf.c newlib/libc/sys/linux/free.c newlib/libc/sys/linux/freer.c newlib/libc/sys/linux/fstab.c newlib/libc/sys/linux/fstatvfs.c newlib/libc/sys/linux/fstatvfs64.c newlib/libc/sys/linux/ftok.c newlib/libc/sys/linux/ftw.c newlib/libc/sys/linux/ftw64.c newlib/libc/sys/linux/funlockfile.c newlib/libc/sys/linux/getdate.c newlib/libc/sys/linux/getdate_err.c newlib/libc/sys/linux/gethostname.c newlib/libc/sys/linux/getopt.c newlib/libc/sys/linux/getopt1.c newlib/libc/sys/linux/getreent.c newlib/libc/sys/linux/getrlimit64.c newlib/libc/sys/linux/getwd.c newlib/libc/sys/linux/hp-timing.h newlib/libc/sys/linux/ids.c newlib/libc/sys/linux/include/argp.h newlib/libc/sys/linux/include/bp-sym.h newlib/libc/sys/linux/include/cmathcalls.h newlib/libc/sys/linux/include/complex.h newlib/libc/sys/linux/include/getopt.h newlib/libc/sys/linux/include/limits.h newlib/libc/sys/linux/include/malloc.h newlib/libc/sys/linux/include/mcheck.h newlib/libc/sys/linux/include/mqueue.h newlib/libc/sys/linux/include/paths.h newlib/libc/sys/linux/include/pthread.h newlib/libc/sys/linux/include/setjmp.h newlib/libc/sys/linux/include/stdint.h newlib/libc/sys/linux/include/time.h newlib/libc/sys/linux/include/unistd.h newlib/libc/sys/linux/inode.c newlib/libc/sys/linux/internal_statvfs.c newlib/libc/sys/linux/io.c newlib/libc/sys/linux/io64.c newlib/libc/sys/linux/ipc.c newlib/libc/sys/linux/kernel_sigaction.h newlib/libc/sys/linux/libc-internal.h newlib/libc/sys/linux/libc-symbols.h newlib/libc/sys/linux/libc-tsd.h newlib/libc/sys/linux/libintl.h newlib/libc/sys/linux/linux.c newlib/libc/sys/linux/linux_fsinfo.h newlib/libc/sys/linux/machine/Makefile.am newlib/libc/sys/linux/machine/Makefile.in newlib/libc/sys/linux/machine/aclocal.m4 newlib/libc/sys/linux/machine/configure newlib/libc/sys/linux/machine/configure.in newlib/libc/sys/linux/machine/hp-timing.h newlib/libc/sys/linux/machine/i386/Makefile.am newlib/libc/sys/linux/machine/i386/Makefile.in newlib/libc/sys/linux/machine/i386/aclocal.m4 newlib/libc/sys/linux/machine/i386/configure newlib/libc/sys/linux/machine/i386/configure.in newlib/libc/sys/linux/machine/i386/crt0.c newlib/libc/sys/linux/machine/i386/dl-procinfo.c newlib/libc/sys/linux/machine/i386/dl-procinfo.h newlib/libc/sys/linux/machine/i386/get_clockfreq.c newlib/libc/sys/linux/machine/i386/getpagesize.c newlib/libc/sys/linux/machine/i386/hp-timing.c newlib/libc/sys/linux/machine/i386/hp-timing.h newlib/libc/sys/linux/machine/i386/huge_val.h newlib/libc/sys/linux/machine/i386/i386mach.h newlib/libc/sys/linux/machine/i386/include/setjmp.h newlib/libc/sys/linux/machine/i386/include/termios.h newlib/libc/sys/linux/machine/i386/setjmp.S newlib/libc/sys/linux/machine/i386/sigaction.c newlib/libc/sys/linux/machine/i386/sigstack.h newlib/libc/sys/linux/machine/i386/socketcall.h newlib/libc/sys/linux/machine/i386/syscall.h newlib/libc/sys/linux/machine/i386/sysdep.h newlib/libc/sys/linux/machine/i386/weakalias.h newlib/libc/sys/linux/malign.c newlib/libc/sys/linux/malignr.c newlib/libc/sys/linux/mallinfor.c newlib/libc/sys/linux/malloc.c newlib/libc/sys/linux/mallocr.c newlib/libc/sys/linux/malloptr.c newlib/libc/sys/linux/mallstatsr.c newlib/libc/sys/linux/mcheck.c newlib/libc/sys/linux/mhooks.h newlib/libc/sys/linux/mmap.c newlib/libc/sys/linux/mntent.c newlib/libc/sys/linux/mntent_r.c newlib/libc/sys/linux/mq_close.c newlib/libc/sys/linux/mq_getattr.c newlib/libc/sys/linux/mq_notify.c newlib/libc/sys/linux/mq_open.c newlib/libc/sys/linux/mq_receive.c newlib/libc/sys/linux/mq_send.c newlib/libc/sys/linux/mq_setattr.c newlib/libc/sys/linux/mq_unlink.c newlib/libc/sys/linux/mqlocal.h newlib/libc/sys/linux/msize.c newlib/libc/sys/linux/msizer.c newlib/libc/sys/linux/mstats.c newlib/libc/sys/linux/mtrim.c newlib/libc/sys/linux/mtrimr.c newlib/libc/sys/linux/ntp_gettime.c newlib/libc/sys/linux/pathconf.c newlib/libc/sys/linux/pread.c newlib/libc/sys/linux/pread64.c newlib/libc/sys/linux/process.c newlib/libc/sys/linux/prof-freq.c newlib/libc/sys/linux/profile.c newlib/libc/sys/linux/psignal.c newlib/libc/sys/linux/pvallocr.c newlib/libc/sys/linux/pwrite.c newlib/libc/sys/linux/pwrite64.c newlib/libc/sys/linux/raise.c newlib/libc/sys/linux/readdir64.c newlib/libc/sys/linux/realloc.c newlib/libc/sys/linux/reallocr.c newlib/libc/sys/linux/realpath.c newlib/libc/sys/linux/rename.c newlib/libc/sys/linux/resource.c newlib/libc/sys/linux/scandir64.c newlib/libc/sys/linux/sched.c newlib/libc/sys/linux/select.c newlib/libc/sys/linux/seteuid.c newlib/libc/sys/linux/sethostname.c newlib/libc/sys/linux/setrlimit64.c newlib/libc/sys/linux/shared.ld newlib/libc/sys/linux/shm_open.c newlib/libc/sys/linux/shm_unlink.c newlib/libc/sys/linux/sig.c newlib/libc/sys/linux/sigaction.c newlib/libc/sys/linux/siglongjmp.c newlib/libc/sys/linux/signal.c newlib/libc/sys/linux/sigqueue.c newlib/libc/sys/linux/sigset.c newlib/libc/sys/linux/sigwait.c newlib/libc/sys/linux/sleep.c newlib/libc/sys/linux/socket.c newlib/libc/sys/linux/sockops.h newlib/libc/sys/linux/stack.c newlib/libc/sys/linux/statvfs.c newlib/libc/sys/linux/statvfs64.c newlib/libc/sys/linux/strsignal.c newlib/libc/sys/linux/strverscmp.c newlib/libc/sys/linux/sys/_types.h newlib/libc/sys/linux/sys/cdefs.h newlib/libc/sys/linux/sys/dirent.h newlib/libc/sys/linux/sys/errno.h newlib/libc/sys/linux/sys/fcntl.h newlib/libc/sys/linux/sys/features.h newlib/libc/sys/linux/sys/file.h newlib/libc/sys/linux/sys/ioctl.h newlib/libc/sys/linux/sys/linux_time.h newlib/libc/sys/linux/sys/resource.h newlib/libc/sys/linux/sys/select.h newlib/libc/sys/linux/sys/signal.h newlib/libc/sys/linux/sys/stat.h newlib/libc/sys/linux/sys/stdio.h newlib/libc/sys/linux/sys/termios.h newlib/libc/sys/linux/sys/time.h newlib/libc/sys/linux/sys/types.h newlib/libc/sys/linux/sys/unistd.h newlib/libc/sys/linux/sys/utime.h newlib/libc/sys/linux/sys/utmp.h newlib/libc/sys/linux/sys/utsname.h newlib/libc/sys/linux/sys/wait.h newlib/libc/sys/linux/sysconf.c newlib/libc/sys/linux/sysctl.c newlib/libc/sys/linux/systat.c newlib/libc/sys/linux/system.c newlib/libc/sys/linux/tcdrain.c newlib/libc/sys/linux/tcsendbrk.c newlib/libc/sys/linux/termios.c newlib/libc/sys/linux/thread-m.h newlib/libc/sys/linux/time.c newlib/libc/sys/linux/ttyname_r.c newlib/libc/sys/linux/usleep.c newlib/libc/sys/linux/utimes.c newlib/libc/sys/linux/vallocr.c newlib/libc/sys/linux/versionsort.c newlib/libc/sys/linux/versionsort64.c newlib/libc/sys/linux/wait.c newlib/libc/sys/m88kbug/Makefile.am newlib/libc/sys/m88kbug/Makefile.in newlib/libc/sys/m88kbug/aclocal.m4 newlib/libc/sys/m88kbug/configure newlib/libc/sys/m88kbug/configure.in newlib/libc/sys/m88kbug/crt0.c newlib/libc/sys/m88kbug/sys/systraps.h newlib/libc/sys/m88kbug/syscalls.c newlib/libc/sys/mmixware/Makefile.am newlib/libc/sys/mmixware/Makefile.in newlib/libc/sys/mmixware/_exit.c newlib/libc/sys/mmixware/access.c newlib/libc/sys/mmixware/aclocal.m4 newlib/libc/sys/mmixware/chmod.c newlib/libc/sys/mmixware/chown.c newlib/libc/sys/mmixware/close.c newlib/libc/sys/mmixware/configure newlib/libc/sys/mmixware/configure.in newlib/libc/sys/mmixware/creat.c newlib/libc/sys/mmixware/crt0.c newlib/libc/sys/mmixware/execv.c newlib/libc/sys/mmixware/execve.c newlib/libc/sys/mmixware/fork.c newlib/libc/sys/mmixware/fstat.c newlib/libc/sys/mmixware/getpid.c newlib/libc/sys/mmixware/gettime.c newlib/libc/sys/mmixware/isatty.c newlib/libc/sys/mmixware/kill.c newlib/libc/sys/mmixware/link.c newlib/libc/sys/mmixware/lseek.c newlib/libc/sys/mmixware/open.c newlib/libc/sys/mmixware/pipe.c newlib/libc/sys/mmixware/read.c newlib/libc/sys/mmixware/sbrk.c newlib/libc/sys/mmixware/setjmp.S newlib/libc/sys/mmixware/stat.c newlib/libc/sys/mmixware/sys/syscall.h newlib/libc/sys/mmixware/time.c newlib/libc/sys/mmixware/times.c newlib/libc/sys/mmixware/unlink.c newlib/libc/sys/mmixware/utime.c newlib/libc/sys/mmixware/wait.c newlib/libc/sys/mmixware/write.c newlib/libc/sys/netware/Makefile.am newlib/libc/sys/netware/Makefile.in newlib/libc/sys/netware/aclocal.m4 newlib/libc/sys/netware/configure newlib/libc/sys/netware/configure.in newlib/libc/sys/netware/crt0.c newlib/libc/sys/netware/getpid.c newlib/libc/sys/netware/link.c newlib/libc/sys/rtems/Makefile.am newlib/libc/sys/rtems/Makefile.in newlib/libc/sys/rtems/aclocal.m4 newlib/libc/sys/rtems/configure newlib/libc/sys/rtems/configure.in newlib/libc/sys/rtems/crt0.c newlib/libc/sys/rtems/dummysys.c newlib/libc/sys/rtems/include/limits.h newlib/libc/sys/rtems/sys/dirent.h newlib/libc/sys/sh/Makefile.am newlib/libc/sys/sh/Makefile.in newlib/libc/sys/sh/aclocal.m4 newlib/libc/sys/sh/configure newlib/libc/sys/sh/configure.in newlib/libc/sys/sh/creat.c newlib/libc/sys/sh/crt0.S newlib/libc/sys/sh/sys/syscall.h newlib/libc/sys/sh/syscalls.c newlib/libc/sys/sh/trap.S newlib/libc/sys/sparc64/Makefile.am newlib/libc/sys/sparc64/Makefile.in newlib/libc/sys/sparc64/_exit.S newlib/libc/sys/sparc64/_main.c newlib/libc/sys/sparc64/aclocal.m4 newlib/libc/sys/sparc64/cerror.S newlib/libc/sys/sparc64/closedir.c newlib/libc/sys/sparc64/configure newlib/libc/sys/sparc64/configure.in newlib/libc/sys/sparc64/creat.c newlib/libc/sys/sparc64/crt0.S newlib/libc/sys/sparc64/dup2.S newlib/libc/sys/sparc64/execve.S newlib/libc/sys/sparc64/ieee.c newlib/libc/sys/sparc64/isatty.c newlib/libc/sys/sparc64/lstat.S newlib/libc/sys/sparc64/opendir.c newlib/libc/sys/sparc64/readdir.c newlib/libc/sys/sparc64/rewinddir.c newlib/libc/sys/sparc64/sbrk.S newlib/libc/sys/sparc64/scandir.c newlib/libc/sys/sparc64/seekdir.c newlib/libc/sys/sparc64/sigsetjmp.S newlib/libc/sys/sparc64/stat.S newlib/libc/sys/sparc64/sys/dirent.h newlib/libc/sys/sparc64/sys/fcntl.h newlib/libc/sys/sparc64/sys/file.h newlib/libc/sys/sparc64/sys/stat.h newlib/libc/sys/sparc64/sys/syscall.h newlib/libc/sys/sparc64/sys/syscallasm.h newlib/libc/sys/sparc64/sys/termios.h newlib/libc/sys/sparc64/sys/time.h newlib/libc/sys/sparc64/sys/utime.h newlib/libc/sys/sparc64/sys/utmp.h newlib/libc/sys/sparc64/sys/wait.h newlib/libc/sys/sparc64/telldir.c newlib/libc/sys/sparc64/template.S newlib/libc/sys/sparc64/template_r.S newlib/libc/sys/sparc64/utime.S newlib/libc/sys/sparc64/utime2.c newlib/libc/sys/sparc64/wait.S newlib/libc/sys/sun4/Makefile.am newlib/libc/sys/sun4/Makefile.in newlib/libc/sys/sun4/_main.c newlib/libc/sys/sun4/aclocal.m4 newlib/libc/sys/sun4/configure newlib/libc/sys/sun4/configure.in newlib/libc/sys/sun4/ieee.c newlib/libc/sys/sun4/sys/dirent.h newlib/libc/sys/sun4/sys/file.h newlib/libc/sys/sun4/sys/termios.h newlib/libc/sys/sun4/sys/utime.h newlib/libc/sys/sun4/sys/utmp.h newlib/libc/sys/sun4/sys/wait.h newlib/libc/sys/sysmec/Makefile.am newlib/libc/sys/sysmec/Makefile.in newlib/libc/sys/sysmec/_exit.c newlib/libc/sys/sysmec/access.c newlib/libc/sys/sysmec/aclocal.m4 newlib/libc/sys/sysmec/chmod.c newlib/libc/sys/sysmec/chown.c newlib/libc/sys/sysmec/close.c newlib/libc/sys/sysmec/configure newlib/libc/sys/sysmec/configure.in newlib/libc/sys/sysmec/creat.c newlib/libc/sys/sysmec/crt0.S newlib/libc/sys/sysmec/crt1.c newlib/libc/sys/sysmec/execv.c newlib/libc/sys/sysmec/execve.c newlib/libc/sys/sysmec/fork.c newlib/libc/sys/sysmec/fstat.c newlib/libc/sys/sysmec/getpid.c newlib/libc/sys/sysmec/gettime.c newlib/libc/sys/sysmec/isatty.c newlib/libc/sys/sysmec/kill.c newlib/libc/sys/sysmec/lseek.c newlib/libc/sys/sysmec/open.c newlib/libc/sys/sysmec/pipe.c newlib/libc/sys/sysmec/read.c newlib/libc/sys/sysmec/sbrk.c newlib/libc/sys/sysmec/stat.c newlib/libc/sys/sysmec/sys/syscall.h newlib/libc/sys/sysmec/time.c newlib/libc/sys/sysmec/times.c newlib/libc/sys/sysmec/trap.S newlib/libc/sys/sysmec/unlink.c newlib/libc/sys/sysmec/utime.c newlib/libc/sys/sysmec/wait.c newlib/libc/sys/sysmec/write.c newlib/libc/sys/sysnec810/Makefile.am newlib/libc/sys/sysnec810/Makefile.in newlib/libc/sys/sysnec810/aclocal.m4 newlib/libc/sys/sysnec810/configure newlib/libc/sys/sysnec810/configure.in newlib/libc/sys/sysnec810/crt0.s newlib/libc/sys/sysnec810/io.s newlib/libc/sys/sysnec810/misc.c newlib/libc/sys/sysnec810/sbrk.c newlib/libc/sys/sysnec810/write.c newlib/libc/sys/sysnecv850/Makefile.am newlib/libc/sys/sysnecv850/Makefile.in newlib/libc/sys/sysnecv850/_exit.c newlib/libc/sys/sysnecv850/access.c newlib/libc/sys/sysnecv850/aclocal.m4 newlib/libc/sys/sysnecv850/chmod.c newlib/libc/sys/sysnecv850/chown.c newlib/libc/sys/sysnecv850/close.c newlib/libc/sys/sysnecv850/configure newlib/libc/sys/sysnecv850/configure.in newlib/libc/sys/sysnecv850/creat.c newlib/libc/sys/sysnecv850/crt0.S newlib/libc/sys/sysnecv850/crt1.c newlib/libc/sys/sysnecv850/execv.c newlib/libc/sys/sysnecv850/execve.c newlib/libc/sys/sysnecv850/fork.c newlib/libc/sys/sysnecv850/fstat.c newlib/libc/sys/sysnecv850/getpid.c newlib/libc/sys/sysnecv850/gettime.c newlib/libc/sys/sysnecv850/isatty.c newlib/libc/sys/sysnecv850/kill.c newlib/libc/sys/sysnecv850/link.c newlib/libc/sys/sysnecv850/lseek.c newlib/libc/sys/sysnecv850/open.c newlib/libc/sys/sysnecv850/pipe.c newlib/libc/sys/sysnecv850/read.c newlib/libc/sys/sysnecv850/sbrk.c newlib/libc/sys/sysnecv850/stat.c newlib/libc/sys/sysnecv850/sys/syscall.h newlib/libc/sys/sysnecv850/time.c newlib/libc/sys/sysnecv850/times.c newlib/libc/sys/sysnecv850/trap.S newlib/libc/sys/sysnecv850/unlink.c newlib/libc/sys/sysnecv850/utime.c newlib/libc/sys/sysnecv850/wait.c newlib/libc/sys/sysnecv850/write.c newlib/libc/sys/sysvi386/Makefile.am newlib/libc/sys/sysvi386/Makefile.in newlib/libc/sys/sysvi386/_exit.s newlib/libc/sys/sysvi386/_longjmp.s newlib/libc/sys/sysvi386/_setjmp.s newlib/libc/sys/sysvi386/access.s newlib/libc/sys/sysvi386/aclocal.m4 newlib/libc/sys/sysvi386/alarm.s newlib/libc/sys/sysvi386/brk.s newlib/libc/sys/sysvi386/cerror.s newlib/libc/sys/sysvi386/chdir.s newlib/libc/sys/sysvi386/chmod.s newlib/libc/sys/sysvi386/close.s newlib/libc/sys/sysvi386/closedir.c newlib/libc/sys/sysvi386/configure newlib/libc/sys/sysvi386/configure.in newlib/libc/sys/sysvi386/crt0.c newlib/libc/sys/sysvi386/dup.c newlib/libc/sys/sysvi386/dup2.c newlib/libc/sys/sysvi386/exec.c newlib/libc/sys/sysvi386/execve.s newlib/libc/sys/sysvi386/fcntl.s newlib/libc/sys/sysvi386/fork.s newlib/libc/sys/sysvi386/fpathconf.s newlib/libc/sys/sysvi386/fps.s newlib/libc/sys/sysvi386/fpx.c newlib/libc/sys/sysvi386/fstat.s newlib/libc/sys/sysvi386/getdents.s newlib/libc/sys/sysvi386/getegid.s newlib/libc/sys/sysvi386/geteuid.s newlib/libc/sys/sysvi386/getgid.s newlib/libc/sys/sysvi386/getgroups.s newlib/libc/sys/sysvi386/getpid.s newlib/libc/sys/sysvi386/getuid.s newlib/libc/sys/sysvi386/ioctl.s newlib/libc/sys/sysvi386/isatty.c newlib/libc/sys/sysvi386/kill.s newlib/libc/sys/sysvi386/link.s newlib/libc/sys/sysvi386/lseek.s newlib/libc/sys/sysvi386/mkdir.s newlib/libc/sys/sysvi386/open.s newlib/libc/sys/sysvi386/opendir.c newlib/libc/sys/sysvi386/pathconf.s newlib/libc/sys/sysvi386/pause.s newlib/libc/sys/sysvi386/pipe.s newlib/libc/sys/sysvi386/read.s newlib/libc/sys/sysvi386/readdir.c newlib/libc/sys/sysvi386/rename.s newlib/libc/sys/sysvi386/rewinddir.c newlib/libc/sys/sysvi386/rmdir.s newlib/libc/sys/sysvi386/sbrk.c newlib/libc/sys/sysvi386/scandir.c newlib/libc/sys/sysvi386/seekdir.c newlib/libc/sys/sysvi386/setgid.s newlib/libc/sys/sysvi386/setuid.s newlib/libc/sys/sysvi386/sigaction.s newlib/libc/sys/sysvi386/signal.s newlib/libc/sys/sysvi386/sigprocmask.s newlib/libc/sys/sysvi386/sleep.c newlib/libc/sys/sysvi386/speed.c newlib/libc/sys/sysvi386/stat.s newlib/libc/sys/sysvi386/sys/dirent.h newlib/libc/sys/sysvi386/sys/param.h newlib/libc/sys/sysvi386/sys/setjmp.h newlib/libc/sys/sysvi386/sys/termio.h newlib/libc/sys/sysvi386/sys/termios.h newlib/libc/sys/sysvi386/sys/utime.h newlib/libc/sys/sysvi386/sys/utmp.h newlib/libc/sys/sysvi386/sys/wait.h newlib/libc/sys/sysvi386/sysconf.s newlib/libc/sys/sysvi386/tcgetattr.c newlib/libc/sys/sysvi386/tcline.c newlib/libc/sys/sysvi386/tcsetattr.c newlib/libc/sys/sysvi386/telldir.c newlib/libc/sys/sysvi386/time.s newlib/libc/sys/sysvi386/times.s newlib/libc/sys/sysvi386/unlink.s newlib/libc/sys/sysvi386/utime.s newlib/libc/sys/sysvi386/wait.s newlib/libc/sys/sysvi386/waitpid.s newlib/libc/sys/sysvi386/write.s newlib/libc/sys/sysvnecv70/Makefile.am newlib/libc/sys/sysvnecv70/Makefile.in newlib/libc/sys/sysvnecv70/aclocal.m4 newlib/libc/sys/sysvnecv70/cerror.s newlib/libc/sys/sysvnecv70/close.s newlib/libc/sys/sysvnecv70/configure newlib/libc/sys/sysvnecv70/configure.in newlib/libc/sys/sysvnecv70/crt0.s newlib/libc/sys/sysvnecv70/exit.s newlib/libc/sys/sysvnecv70/fps.s newlib/libc/sys/sysvnecv70/fpx.c newlib/libc/sys/sysvnecv70/fstat.s newlib/libc/sys/sysvnecv70/ioctl.s newlib/libc/sys/sysvnecv70/isatty.s newlib/libc/sys/sysvnecv70/lseek.s newlib/libc/sys/sysvnecv70/open.s newlib/libc/sys/sysvnecv70/read.s newlib/libc/sys/sysvnecv70/sbrk.s newlib/libc/sys/sysvnecv70/sysv60.s newlib/libc/sys/sysvnecv70/sysvnecv70.tex newlib/libc/sys/sysvnecv70/write.s newlib/libc/sys/tic80/Makefile.am newlib/libc/sys/tic80/Makefile.in newlib/libc/sys/tic80/aclocal.m4 newlib/libc/sys/tic80/configure newlib/libc/sys/tic80/configure.in newlib/libc/sys/tic80/crt0.c newlib/libc/sys/w65/Makefile.am newlib/libc/sys/w65/Makefile.in newlib/libc/sys/w65/aclocal.m4 newlib/libc/sys/w65/configure newlib/libc/sys/w65/configure.in newlib/libc/sys/w65/crt0.c newlib/libc/sys/w65/sys/syscall.h newlib/libc/sys/w65/syscalls.c newlib/libc/sys/w65/trap.c newlib/libc/sys/z8ksim/Makefile.am newlib/libc/sys/z8ksim/Makefile.in newlib/libc/sys/z8ksim/aclocal.m4 newlib/libc/sys/z8ksim/configure newlib/libc/sys/z8ksim/configure.in newlib/libc/sys/z8ksim/crt0.c newlib/libc/sys/z8ksim/glue.c newlib/libc/sys/z8ksim/sys/syscall.h newlib/libc/syscalls/Makefile.am newlib/libc/syscalls/Makefile.in newlib/libc/syscalls/sysclose.c newlib/libc/syscalls/sysexecve.c newlib/libc/syscalls/sysfcntl.c newlib/libc/syscalls/sysfork.c newlib/libc/syscalls/sysfstat.c newlib/libc/syscalls/sysgetpid.c newlib/libc/syscalls/sysgettod.c newlib/libc/syscalls/syskill.c newlib/libc/syscalls/syslink.c newlib/libc/syscalls/syslseek.c newlib/libc/syscalls/sysopen.c newlib/libc/syscalls/sysread.c newlib/libc/syscalls/syssbrk.c newlib/libc/syscalls/sysstat.c newlib/libc/syscalls/systimes.c newlib/libc/syscalls/sysunlink.c newlib/libc/syscalls/syswait.c newlib/libc/syscalls/syswrite.c newlib/libc/time/Makefile.am newlib/libc/time/Makefile.in newlib/libc/time/asctime.c newlib/libc/time/asctime_r.c newlib/libc/time/clock.c newlib/libc/time/ctime.c newlib/libc/time/ctime_r.c newlib/libc/time/difftime.c newlib/libc/time/gmtime.c newlib/libc/time/gmtime_r.c newlib/libc/time/lcltime.c newlib/libc/time/lcltime_r.c newlib/libc/time/local.h newlib/libc/time/mktime.c newlib/libc/time/mktm_r.c newlib/libc/time/strftime.c newlib/libc/time/strptime.c newlib/libc/time/time.c newlib/libc/time/time.tex newlib/libc/time/tzlock.c newlib/libc/time/tzset.c newlib/libc/time/tzset_r.c newlib/libc/unix/Makefile.am newlib/libc/unix/Makefile.in newlib/libc/unix/getcwd.c newlib/libc/unix/getlogin.c newlib/libc/unix/getpass.c newlib/libc/unix/getpwent.c newlib/libc/unix/getut.c newlib/libc/unix/pread.c newlib/libc/unix/pwrite.c newlib/libc/unix/sigset.c newlib/libc/unix/ttyname.c newlib/libm/Makefile.am newlib/libm/Makefile.in newlib/libm/aclocal.m4 newlib/libm/common/Makefile.am newlib/libm/common/Makefile.in newlib/libm/common/common.tex newlib/libm/common/fdlibm.h newlib/libm/common/s_cbrt.c newlib/libm/common/s_copysign.c newlib/libm/common/s_expm1.c newlib/libm/common/s_fdim.c newlib/libm/common/s_finite.c newlib/libm/common/s_fma.c newlib/libm/common/s_fmax.c newlib/libm/common/s_fmin.c newlib/libm/common/s_fpclassify.c newlib/libm/common/s_ilogb.c newlib/libm/common/s_infinity.c newlib/libm/common/s_lib_ver.c newlib/libm/common/s_log1p.c newlib/libm/common/s_logb.c newlib/libm/common/s_lrint.c newlib/libm/common/s_lround.c newlib/libm/common/s_matherr.c newlib/libm/common/s_modf.c newlib/libm/common/s_nan.c newlib/libm/common/s_nearbyint.c newlib/libm/common/s_nextafter.c newlib/libm/common/s_remquo.c newlib/libm/common/s_rint.c newlib/libm/common/s_round.c newlib/libm/common/s_scalbln.c newlib/libm/common/s_scalbn.c newlib/libm/common/s_signbit.c newlib/libm/common/s_trunc.c newlib/libm/common/sf_cbrt.c newlib/libm/common/sf_copysign.c newlib/libm/common/sf_expm1.c newlib/libm/common/sf_fdim.c newlib/libm/common/sf_finite.c newlib/libm/common/sf_fma.c newlib/libm/common/sf_fmax.c newlib/libm/common/sf_fmin.c newlib/libm/common/sf_ilogb.c newlib/libm/common/sf_infinity.c newlib/libm/common/sf_log1p.c newlib/libm/common/sf_logb.c newlib/libm/common/sf_lrint.c newlib/libm/common/sf_lround.c newlib/libm/common/sf_modf.c newlib/libm/common/sf_nan.c newlib/libm/common/sf_nearbyint.c newlib/libm/common/sf_nextafter.c newlib/libm/common/sf_remquo.c newlib/libm/common/sf_rint.c newlib/libm/common/sf_round.c newlib/libm/common/sf_scalbln.c newlib/libm/common/sf_scalbn.c newlib/libm/common/sf_trunc.c newlib/libm/config.h.in newlib/libm/configure newlib/libm/configure.in newlib/libm/libm.texinfo newlib/libm/machine/Makefile.am newlib/libm/machine/Makefile.in newlib/libm/machine/aclocal.m4 newlib/libm/machine/configure newlib/libm/machine/configure.in newlib/libm/machine/i386/Makefile.am newlib/libm/machine/i386/Makefile.in newlib/libm/machine/i386/aclocal.m4 newlib/libm/machine/i386/configure newlib/libm/machine/i386/configure.in newlib/libm/machine/i386/f_atan2.S newlib/libm/machine/i386/f_atan2f.S newlib/libm/machine/i386/f_exp.c newlib/libm/machine/i386/f_expf.c newlib/libm/machine/i386/f_frexp.S newlib/libm/machine/i386/f_frexpf.S newlib/libm/machine/i386/f_ldexp.S newlib/libm/machine/i386/f_ldexpf.S newlib/libm/machine/i386/f_log.S newlib/libm/machine/i386/f_log10.S newlib/libm/machine/i386/f_log10f.S newlib/libm/machine/i386/f_logf.S newlib/libm/machine/i386/f_math.h newlib/libm/machine/i386/f_pow.c newlib/libm/machine/i386/f_powf.c newlib/libm/machine/i386/f_tan.S newlib/libm/machine/i386/f_tanf.S newlib/libm/machine/i386/i386mach.h newlib/libm/math/Makefile.am newlib/libm/math/Makefile.in newlib/libm/math/e_acos.c newlib/libm/math/e_acosh.c newlib/libm/math/e_asin.c newlib/libm/math/e_atan2.c newlib/libm/math/e_atanh.c newlib/libm/math/e_cosh.c newlib/libm/math/e_exp.c newlib/libm/math/e_fmod.c newlib/libm/math/e_hypot.c newlib/libm/math/e_j0.c newlib/libm/math/e_j1.c newlib/libm/math/e_jn.c newlib/libm/math/e_log.c newlib/libm/math/e_log10.c newlib/libm/math/e_pow.c newlib/libm/math/e_rem_pio2.c newlib/libm/math/e_remainder.c newlib/libm/math/e_scalb.c newlib/libm/math/e_sinh.c newlib/libm/math/e_sqrt.c newlib/libm/math/ef_acos.c newlib/libm/math/ef_acosh.c newlib/libm/math/ef_asin.c newlib/libm/math/ef_atan2.c newlib/libm/math/ef_atanh.c newlib/libm/math/ef_cosh.c newlib/libm/math/ef_exp.c newlib/libm/math/ef_fmod.c newlib/libm/math/ef_hypot.c newlib/libm/math/ef_j0.c newlib/libm/math/ef_j1.c newlib/libm/math/ef_jn.c newlib/libm/math/ef_log.c newlib/libm/math/ef_log10.c newlib/libm/math/ef_pow.c newlib/libm/math/ef_rem_pio2.c newlib/libm/math/ef_remainder.c newlib/libm/math/ef_scalb.c newlib/libm/math/ef_sinh.c newlib/libm/math/ef_sqrt.c newlib/libm/math/er_gamma.c newlib/libm/math/er_lgamma.c newlib/libm/math/erf_gamma.c newlib/libm/math/erf_lgamma.c newlib/libm/math/k_cos.c newlib/libm/math/k_rem_pio2.c newlib/libm/math/k_sin.c newlib/libm/math/k_standard.c newlib/libm/math/k_tan.c newlib/libm/math/kf_cos.c newlib/libm/math/kf_rem_pio2.c newlib/libm/math/kf_sin.c newlib/libm/math/kf_tan.c newlib/libm/math/math.tex newlib/libm/math/s_asinh.c newlib/libm/math/s_atan.c newlib/libm/math/s_ceil.c newlib/libm/math/s_cos.c newlib/libm/math/s_erf.c newlib/libm/math/s_fabs.c newlib/libm/math/s_floor.c newlib/libm/math/s_frexp.c newlib/libm/math/s_infconst.c newlib/libm/math/s_isinf.c newlib/libm/math/s_isnan.c newlib/libm/math/s_ldexp.c newlib/libm/math/s_signif.c newlib/libm/math/s_sin.c newlib/libm/math/s_tan.c newlib/libm/math/s_tanh.c newlib/libm/math/sf_asinh.c newlib/libm/math/sf_atan.c newlib/libm/math/sf_ceil.c newlib/libm/math/sf_cos.c newlib/libm/math/sf_erf.c newlib/libm/math/sf_fabs.c newlib/libm/math/sf_floor.c newlib/libm/math/sf_frexp.c newlib/libm/math/sf_isinf.c newlib/libm/math/sf_isnan.c newlib/libm/math/sf_ldexp.c newlib/libm/math/sf_signif.c newlib/libm/math/sf_sin.c newlib/libm/math/sf_tan.c newlib/libm/math/sf_tanh.c newlib/libm/math/w_acos.c newlib/libm/math/w_acosh.c newlib/libm/math/w_asin.c newlib/libm/math/w_atan2.c newlib/libm/math/w_atanh.c newlib/libm/math/w_cabs.c newlib/libm/math/w_cosh.c newlib/libm/math/w_drem.c newlib/libm/math/w_exp.c newlib/libm/math/w_exp2.c newlib/libm/math/w_fmod.c newlib/libm/math/w_gamma.c newlib/libm/math/w_hypot.c newlib/libm/math/w_j0.c newlib/libm/math/w_j1.c newlib/libm/math/w_jn.c newlib/libm/math/w_lgamma.c newlib/libm/math/w_log.c newlib/libm/math/w_log10.c newlib/libm/math/w_pow.c newlib/libm/math/w_remainder.c newlib/libm/math/w_scalb.c newlib/libm/math/w_sincos.c newlib/libm/math/w_sinh.c newlib/libm/math/w_sqrt.c newlib/libm/math/w_tgamma.c newlib/libm/math/wf_acos.c newlib/libm/math/wf_acosh.c newlib/libm/math/wf_asin.c newlib/libm/math/wf_atan2.c newlib/libm/math/wf_atanh.c newlib/libm/math/wf_cabs.c newlib/libm/math/wf_cosh.c newlib/libm/math/wf_drem.c newlib/libm/math/wf_exp.c newlib/libm/math/wf_exp2.c newlib/libm/math/wf_fmod.c newlib/libm/math/wf_gamma.c newlib/libm/math/wf_hypot.c newlib/libm/math/wf_j0.c newlib/libm/math/wf_j1.c newlib/libm/math/wf_jn.c newlib/libm/math/wf_lgamma.c newlib/libm/math/wf_log.c newlib/libm/math/wf_log10.c newlib/libm/math/wf_pow.c newlib/libm/math/wf_remainder.c newlib/libm/math/wf_scalb.c newlib/libm/math/wf_sincos.c newlib/libm/math/wf_sinh.c newlib/libm/math/wf_sqrt.c newlib/libm/math/wf_tgamma.c newlib/libm/math/wr_gamma.c newlib/libm/math/wr_lgamma.c newlib/libm/math/wrf_gamma.c newlib/libm/math/wrf_lgamma.c newlib/libm/mathfp/Makefile.am newlib/libm/mathfp/Makefile.in newlib/libm/mathfp/e_acosh.c newlib/libm/mathfp/e_atanh.c newlib/libm/mathfp/e_hypot.c newlib/libm/mathfp/e_j0.c newlib/libm/mathfp/e_j1.c newlib/libm/mathfp/e_remainder.c newlib/libm/mathfp/e_scalb.c newlib/libm/mathfp/ef_acosh.c newlib/libm/mathfp/ef_atanh.c newlib/libm/mathfp/ef_hypot.c newlib/libm/mathfp/ef_j0.c newlib/libm/mathfp/ef_j1.c newlib/libm/mathfp/ef_remainder.c newlib/libm/mathfp/ef_scalb.c newlib/libm/mathfp/er_gamma.c newlib/libm/mathfp/er_lgamma.c newlib/libm/mathfp/erf_gamma.c newlib/libm/mathfp/erf_lgamma.c newlib/libm/mathfp/mathfp.tex newlib/libm/mathfp/s_acos.c newlib/libm/mathfp/s_asin.c newlib/libm/mathfp/s_asine.c newlib/libm/mathfp/s_asinh.c newlib/libm/mathfp/s_atan.c newlib/libm/mathfp/s_atan2.c newlib/libm/mathfp/s_atangent.c newlib/libm/mathfp/s_ceil.c newlib/libm/mathfp/s_cos.c newlib/libm/mathfp/s_cosh.c newlib/libm/mathfp/s_erf.c newlib/libm/mathfp/s_exp.c newlib/libm/mathfp/s_exp2.c newlib/libm/mathfp/s_fabs.c newlib/libm/mathfp/s_floor.c newlib/libm/mathfp/s_fmod.c newlib/libm/mathfp/s_frexp.c newlib/libm/mathfp/s_infconst.c newlib/libm/mathfp/s_isinf.c newlib/libm/mathfp/s_isnan.c newlib/libm/mathfp/s_ispos.c newlib/libm/mathfp/s_ldexp.c newlib/libm/mathfp/s_log.c newlib/libm/mathfp/s_log10.c newlib/libm/mathfp/s_logarithm.c newlib/libm/mathfp/s_mathcnst.c newlib/libm/mathfp/s_numtest.c newlib/libm/mathfp/s_pow.c newlib/libm/mathfp/s_signif.c newlib/libm/mathfp/s_sin.c newlib/libm/mathfp/s_sincos.c newlib/libm/mathfp/s_sine.c newlib/libm/mathfp/s_sineh.c newlib/libm/mathfp/s_sinf.c newlib/libm/mathfp/s_sinh.c newlib/libm/mathfp/s_sqrt.c newlib/libm/mathfp/s_tan.c newlib/libm/mathfp/s_tanh.c newlib/libm/mathfp/s_tgamma.c newlib/libm/mathfp/sf_acos.c newlib/libm/mathfp/sf_asin.c newlib/libm/mathfp/sf_asine.c newlib/libm/mathfp/sf_asinh.c newlib/libm/mathfp/sf_atan.c newlib/libm/mathfp/sf_atan2.c newlib/libm/mathfp/sf_atangent.c newlib/libm/mathfp/sf_ceil.c newlib/libm/mathfp/sf_cos.c newlib/libm/mathfp/sf_cosh.c newlib/libm/mathfp/sf_erf.c newlib/libm/mathfp/sf_exp.c newlib/libm/mathfp/sf_exp2.c newlib/libm/mathfp/sf_fabs.c newlib/libm/mathfp/sf_floor.c newlib/libm/mathfp/sf_fmod.c newlib/libm/mathfp/sf_frexp.c newlib/libm/mathfp/sf_isinf.c newlib/libm/mathfp/sf_isnan.c newlib/libm/mathfp/sf_ispos.c newlib/libm/mathfp/sf_ldexp.c newlib/libm/mathfp/sf_log.c newlib/libm/mathfp/sf_log10.c newlib/libm/mathfp/sf_logarithm.c newlib/libm/mathfp/sf_numtest.c newlib/libm/mathfp/sf_pow.c newlib/libm/mathfp/sf_signif.c newlib/libm/mathfp/sf_sin.c newlib/libm/mathfp/sf_sincos.c newlib/libm/mathfp/sf_sine.c newlib/libm/mathfp/sf_sineh.c newlib/libm/mathfp/sf_sinh.c newlib/libm/mathfp/sf_sqrt.c newlib/libm/mathfp/sf_tan.c newlib/libm/mathfp/sf_tanh.c newlib/libm/mathfp/sf_tgamma.c newlib/libm/mathfp/w_cabs.c newlib/libm/mathfp/w_drem.c newlib/libm/mathfp/w_jn.c newlib/libm/mathfp/wf_cabs.c newlib/libm/mathfp/wf_drem.c newlib/libm/mathfp/wf_jn.c newlib/libm/mathfp/zmath.h newlib/libm/test/Makefile.in newlib/libm/test/acos_vec.c newlib/libm/test/acosf_vec.c newlib/libm/test/acosh_vec.c newlib/libm/test/acoshf_vec.c newlib/libm/test/asin_vec.c newlib/libm/test/asinf_vec.c newlib/libm/test/asinh_vec.c newlib/libm/test/asinhf_vec.c newlib/libm/test/atan2_vec.c newlib/libm/test/atan2f_vec.c newlib/libm/test/atan_vec.c newlib/libm/test/atanf_vec.c newlib/libm/test/atanh_vec.c newlib/libm/test/atanhf_vec.c newlib/libm/test/ceil_vec.c newlib/libm/test/ceilf_vec.c newlib/libm/test/conv_vec.c newlib/libm/test/convert.c newlib/libm/test/cos_vec.c newlib/libm/test/cosf_vec.c newlib/libm/test/cosh_vec.c newlib/libm/test/coshf_vec.c newlib/libm/test/dcvt.c newlib/libm/test/dvec.c newlib/libm/test/erf_vec.c newlib/libm/test/erfc_vec.c newlib/libm/test/erfcf_vec.c newlib/libm/test/erff_vec.c newlib/libm/test/exp_vec.c newlib/libm/test/expf_vec.c newlib/libm/test/fabs_vec.c newlib/libm/test/fabsf_vec.c newlib/libm/test/floor_vec.c newlib/libm/test/floorf_vec.c newlib/libm/test/fmod_vec.c newlib/libm/test/fmodf_vec.c newlib/libm/test/gamma_vec.c newlib/libm/test/gammaf_vec.c newlib/libm/test/hypot_vec.c newlib/libm/test/hypotf_vec.c newlib/libm/test/iconv_vec.c newlib/libm/test/j0_vec.c newlib/libm/test/j0f_vec.c newlib/libm/test/j1_vec.c newlib/libm/test/j1f_vec.c newlib/libm/test/jn_vec.c newlib/libm/test/jnf_vec.c newlib/libm/test/log10_vec.c newlib/libm/test/log10f_vec.c newlib/libm/test/log1p_vec.c newlib/libm/test/log1pf_vec.c newlib/libm/test/log2_vec.c newlib/libm/test/log2f_vec.c newlib/libm/test/log_vec.c newlib/libm/test/logf_vec.c newlib/libm/test/math.c newlib/libm/test/math2.c newlib/libm/test/sin_vec.c newlib/libm/test/sinf_vec.c newlib/libm/test/sinh_vec.c newlib/libm/test/sinhf_vec.c newlib/libm/test/sprint_ivec.c newlib/libm/test/sprint_vec.c newlib/libm/test/sqrt_vec.c newlib/libm/test/sqrtf_vec.c newlib/libm/test/string.c newlib/libm/test/tan_vec.c newlib/libm/test/tanf_vec.c newlib/libm/test/tanh_vec.c newlib/libm/test/tanhf_vec.c newlib/libm/test/test.c newlib/libm/test/test.h newlib/libm/test/test_ieee.c newlib/libm/test/test_is.c newlib/libm/test/y0_vec.c newlib/libm/test/y0f_vec.c newlib/libm/test/y1_vec.c newlib/libm/test/y1f_vec.c newlib/libm/test/yn_vec.c newlib/libm/test/ynf_vec.c newlib/libtool.m4 newlib/newlib.hin newlib/stamp-h.in newlib/testsuite/config/default.exp newlib/testsuite/lib/checkoutput.exp newlib/testsuite/lib/flags.exp newlib/testsuite/lib/newlib.exp newlib/testsuite/lib/passfail.exp newlib/testsuite/newlib.locale/UTF-8.c newlib/testsuite/newlib.locale/UTF-8.exp newlib/testsuite/newlib.locale/locale.exp newlib/testsuite/newlib.search/hsearchtest.c newlib/testsuite/newlib.search/hsearchtest.exp newlib/testsuite/newlib.stdlib/atexit.c newlib/testsuite/newlib.stdlib/atexit.exp newlib/testsuite/newlib.string/string.exp newlib/testsuite/newlib.string/tstring.c setup.com symlink-tree texinfo/texinfo.tex winsup/CYGWIN_LICENSE winsup/ChangeLog winsup/MAINTAINERS winsup/Makefile.common winsup/Makefile.in winsup/bz2lib/CHANGES winsup/bz2lib/ChangeLog winsup/bz2lib/LICENSE winsup/bz2lib/Makefile winsup/bz2lib/Makefile-libbz2_so winsup/bz2lib/Makefile.in winsup/bz2lib/README winsup/bz2lib/README.COMPILATION.PROBLEMS winsup/bz2lib/Y2K_INFO winsup/bz2lib/aclocal.m4 winsup/bz2lib/blocksort.c winsup/bz2lib/bzip2.1 winsup/bz2lib/bzip2.1.preformatted winsup/bz2lib/bzip2.c winsup/bz2lib/bzip2.txt winsup/bz2lib/bzip2recover.c winsup/bz2lib/bzlib.c winsup/bz2lib/bzlib.h winsup/bz2lib/bzlib_private.h winsup/bz2lib/compress.c winsup/bz2lib/configure winsup/bz2lib/configure.in winsup/bz2lib/crctable.c winsup/bz2lib/decompress.c winsup/bz2lib/dlltest.c winsup/bz2lib/dlltest.dsp winsup/bz2lib/huffman.c winsup/bz2lib/libbz2.def winsup/bz2lib/libbz2.dsp winsup/bz2lib/makefile.msc winsup/bz2lib/manual.ps winsup/bz2lib/manual.texi winsup/bz2lib/manual_1.html winsup/bz2lib/manual_2.html winsup/bz2lib/manual_3.html winsup/bz2lib/manual_4.html winsup/bz2lib/manual_toc.html winsup/bz2lib/randtable.c winsup/bz2lib/sample1.bz2 winsup/bz2lib/sample1.ref winsup/bz2lib/sample2.bz2 winsup/bz2lib/sample2.ref winsup/bz2lib/sample3.bz2 winsup/bz2lib/sample3.ref winsup/bz2lib/spewG.c winsup/bz2lib/unzcrash.c winsup/bz2lib/words0 winsup/bz2lib/words1 winsup/bz2lib/words2 winsup/bz2lib/words3 winsup/configure winsup/configure.in winsup/cygserver/client.cc winsup/cygserver/cygserver.cc winsup/cygserver/ipc.h winsup/cygserver/process.cc winsup/cygserver/shm.cc winsup/cygserver/shm.h winsup/cygserver/transport.cc winsup/cygserver/transport_pipes.cc winsup/cygserver/transport_sockets.cc winsup/cygwin/CYGWIN_LICENSE 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/Makefile.in winsup/cygwin/ROADMAP winsup/cygwin/acconfig.h winsup/cygwin/ansi.sgml 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/longjmp.c winsup/cygwin/config/i386/makefrag winsup/cygwin/config/i386/profile.h winsup/cygwin/config/i386/setjmp.c winsup/cygwin/configure winsup/cygwin/configure.in winsup/cygwin/cygerrno.h winsup/cygwin/cygheap.cc winsup/cygwin/cygheap.h winsup/cygwin/cygmagic winsup/cygwin/cygmalloc.h winsup/cygwin/cygrun.c winsup/cygwin/cygserver.cc winsup/cygwin/cygserver_client.cc winsup/cygwin/cygserver_ipc.h winsup/cygwin/cygserver_process.cc winsup/cygwin/cygserver_shm.cc winsup/cygwin/cygserver_shm.h winsup/cygwin/cygserver_transport.cc winsup/cygwin/cygserver_transport_pipes.cc winsup/cygwin/cygserver_transport_sockets.cc winsup/cygwin/cygthread.cc winsup/cygwin/cygthread.h 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/delqueue.cc 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/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_floppy.cc winsup/cygwin/fhandler_mem.cc winsup/cygwin/fhandler_proc.cc winsup/cygwin/fhandler_process.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_windows.cc winsup/cygwin/fhandler_zero.cc winsup/cygwin/fork.cc winsup/cygwin/gcrt0.c winsup/cygwin/glob.c 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/how-autoload-works.txt winsup/cygwin/how-cygheap-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/telnet.h winsup/cygwin/include/asm/byteorder.h winsup/cygwin/include/asm/socket.h winsup/cygwin/include/asm/types.h winsup/cygwin/include/cygwin/acl.h winsup/cygwin/include/cygwin/core_dump.h winsup/cygwin/include/cygwin/cygserver.h winsup/cygwin/include/cygwin/cygserver_process.h winsup/cygwin/include/cygwin/cygserver_transport.h winsup/cygwin/include/cygwin/cygserver_transport_pipes.h winsup/cygwin/include/cygwin/cygserver_transport_sockets.h winsup/cygwin/include/cygwin/cygwin_dll.h winsup/cygwin/include/cygwin/grp.h winsup/cygwin/include/cygwin/icmp.h winsup/cygwin/include/cygwin/if.h winsup/cygwin/include/cygwin/in.h winsup/cygwin/include/cygwin/in_systm.h winsup/cygwin/include/cygwin/ipc.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/socket.h winsup/cygwin/include/cygwin/sockios.h winsup/cygwin/include/cygwin/stat.h winsup/cygwin/include/cygwin/types.h winsup/cygwin/include/cygwin/uio.h winsup/cygwin/include/cygwin/version.h winsup/cygwin/include/dlfcn.h winsup/cygwin/include/exceptions.h winsup/cygwin/include/fcntl.h winsup/cygwin/include/features.h winsup/cygwin/include/fnmatch.h winsup/cygwin/include/getopt.h winsup/cygwin/include/glob.h winsup/cygwin/include/icmp.h winsup/cygwin/include/io.h winsup/cygwin/include/lastlog.h winsup/cygwin/include/limits.h winsup/cygwin/include/mapi.h winsup/cygwin/include/memory.h winsup/cygwin/include/mntent.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/sched.h winsup/cygwin/include/semaphore.h winsup/cygwin/include/strings.h winsup/cygwin/include/sys/acl.h winsup/cygwin/include/sys/cdefs.h winsup/cygwin/include/sys/copying.dj winsup/cygwin/include/sys/cygwin.h winsup/cygwin/include/sys/file.h winsup/cygwin/include/sys/ioctl.h winsup/cygwin/include/sys/mman.h winsup/cygwin/include/sys/mount.h winsup/cygwin/include/sys/mtio.h winsup/cygwin/include/sys/poll.h winsup/cygwin/include/sys/procfs.h winsup/cygwin/include/sys/resource.h winsup/cygwin/include/sys/select.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/strace.h winsup/cygwin/include/sys/syslog.h winsup/cygwin/include/sys/sysmacros.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/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/init.cc winsup/cygwin/ioctl.cc winsup/cygwin/ipc.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/getopt.c 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/libc/fnmatch.c winsup/cygwin/localtime.cc winsup/cygwin/malloc.cc winsup/cygwin/malloc_wrapper.cc winsup/cygwin/mcount.c winsup/cygwin/misc-std.sgml winsup/cygwin/miscfuncs.cc winsup/cygwin/mkvers.sh winsup/cygwin/mmap.cc winsup/cygwin/msg.cc winsup/cygwin/net.cc winsup/cygwin/newsym 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/perthread.h winsup/cygwin/pinfo.cc winsup/cygwin/pinfo.h winsup/cygwin/pipe.cc winsup/cygwin/poll.cc winsup/cygwin/posix.sgml winsup/cygwin/profil.c winsup/cygwin/profil.h winsup/cygwin/pthread.cc winsup/cygwin/pwdgrp.h 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/regexp/COPYRIGHT winsup/cygwin/regexp/README winsup/cygwin/regexp/regexp.h winsup/cygwin/regexp/regmagic.h winsup/cygwin/regexp/v8_regerror.c winsup/cygwin/regexp/v8_regexp.c winsup/cygwin/regexp/v8_regsub.c winsup/cygwin/registry.cc winsup/cygwin/registry.h winsup/cygwin/resource.cc winsup/cygwin/rmsym winsup/cygwin/safe_memory.h winsup/cygwin/scandir.cc winsup/cygwin/sched.cc winsup/cygwin/sec_acl.cc winsup/cygwin/sec_helper.cc winsup/cygwin/security.cc winsup/cygwin/security.h winsup/cygwin/select.cc winsup/cygwin/select.h winsup/cygwin/sem.cc winsup/cygwin/shared.cc winsup/cygwin/shared.sgml winsup/cygwin/shared_info.h winsup/cygwin/shm.cc winsup/cygwin/signal.cc winsup/cygwin/sigproc.cc winsup/cygwin/sigproc.h winsup/cygwin/smallprint.c winsup/cygwin/spawn.cc winsup/cygwin/speclib winsup/cygwin/stackdump.sgml winsup/cygwin/strace.cc winsup/cygwin/string.h winsup/cygwin/strsep.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/thread.cc winsup/cygwin/thread.h winsup/cygwin/threaded_queue.cc winsup/cygwin/threaded_queue.h winsup/cygwin/times.cc 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/winbase.h winsup/cygwin/wincap.cc winsup/cygwin/wincap.h winsup/cygwin/window.cc winsup/cygwin/winsup.h winsup/cygwin/winver.rc winsup/cygwin/woutsup.h winsup/cygwin/wsock_event.h winsup/doc/ChangeLog winsup/doc/Makefile.in winsup/doc/calls.texinfo winsup/doc/changes.texinfo winsup/doc/configure winsup/doc/configure.in winsup/doc/copy.texinfo winsup/doc/cygwin-api.in.sgml winsup/doc/cygwin-ug-net.in.sgml winsup/doc/cygwin-ug.in.sgml winsup/doc/cygwinenv.sgml winsup/doc/dll.sgml winsup/doc/doctool.c winsup/doc/doctool.txt winsup/doc/faq.texinfo winsup/doc/fhandler-tut.txt winsup/doc/filemodes.sgml winsup/doc/gcc.sgml winsup/doc/gdb.sgml winsup/doc/history.texinfo winsup/doc/how-api.texinfo winsup/doc/how-programming.texinfo winsup/doc/how-resources.texinfo winsup/doc/how-using.texinfo winsup/doc/how.texinfo winsup/doc/install.texinfo winsup/doc/legal.sgml winsup/doc/ntsec.sgml winsup/doc/overview.sgml winsup/doc/overview2.sgml winsup/doc/pathnames.sgml winsup/doc/programming.sgml winsup/doc/readme.texinfo winsup/doc/relnotes.texinfo winsup/doc/setup-net.sgml winsup/doc/setup.sgml winsup/doc/setup2.sgml winsup/doc/textbinary.sgml winsup/doc/using.sgml winsup/doc/what.texinfo winsup/doc/who.texinfo winsup/doc/windres.sgml 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/Makefile.in winsup/mingw/README winsup/mingw/TODO winsup/mingw/config.guess winsup/mingw/config.sub winsup/mingw/configure winsup/mingw/configure.in winsup/mingw/crt1.c winsup/mingw/crtdll.def winsup/mingw/crtmt.c winsup/mingw/crtst.c winsup/mingw/ctype_old.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/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/inttypes.h winsup/mingw/include/io.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/setjmp.h winsup/mingw/include/share.h winsup/mingw/include/signal.h winsup/mingw/include/stdarg.h winsup/mingw/include/stddef.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/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/jamfile winsup/mingw/main.c winsup/mingw/mingwex/Makefile.in winsup/mingw/mingwex/_Exit.c winsup/mingw/mingwex/atoll.c winsup/mingw/mingwex/configure winsup/mingw/mingwex/configure.in winsup/mingw/mingwex/dirent.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/fwide.c winsup/mingw/mingwex/imaxabs.c winsup/mingw/mingwex/imaxdiv.c winsup/mingw/mingwex/lltoa.c winsup/mingw/mingwex/lltow.c winsup/mingw/mingwex/math/acosf.c winsup/mingw/mingwex/math/acosl.c winsup/mingw/mingwex/math/asinf.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/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/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/fabs.c winsup/mingw/mingwex/math/fabsf.c winsup/mingw/mingwex/math/fabsl.c 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/llrint.c winsup/mingw/mingwex/math/llrintf.c winsup/mingw/mingwex/math/llrintl.c winsup/mingw/mingwex/math/llround.c winsup/mingw/mingwex/math/llroundf.c winsup/mingw/mingwex/math/llroundl.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.c winsup/mingw/mingwex/math/lroundf.c winsup/mingw/mingwex/math/lroundl.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/powf.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.c winsup/mingw/mingwex/math/roundf.c winsup/mingw/mingwex/math/roundl.c winsup/mingw/mingwex/math/scalbn.S winsup/mingw/mingwex/math/scalbnf.S winsup/mingw/mingwex/math/scalbnl.S 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/trunc.c winsup/mingw/mingwex/math/truncf.c winsup/mingw/mingwex/math/truncl.c winsup/mingw/mingwex/mbsinit.c winsup/mingw/mingwex/mingw-fseek.c winsup/mingw/mingwex/sitest.c winsup/mingw/mingwex/snprintf.c winsup/mingw/mingwex/snwprintf.c winsup/mingw/mingwex/strtof.c winsup/mingw/mingwex/strtoimax.c winsup/mingw/mingwex/strtoumax.c winsup/mingw/mingwex/testwmem.c winsup/mingw/mingwex/ulltoa.c winsup/mingw/mingwex/ulltow.c winsup/mingw/mingwex/vsnprintf.c winsup/mingw/mingwex/vsnwprintf.c winsup/mingw/mingwex/wcstof.c winsup/mingw/mingwex/wcstoimax.c winsup/mingw/mingwex/wcstoumax.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-crtdll.def winsup/mingw/moldname-msvcrt.def winsup/mingw/moldname.def winsup/mingw/moldname.def.in winsup/mingw/msvcrt.def winsup/mingw/msvcrt20.def winsup/mingw/msvcrt40.def winsup/mingw/mthr.c winsup/mingw/mthr_init.c winsup/mingw/mthr_stub.c winsup/mingw/profile/Makefile.in winsup/mingw/profile/configure winsup/mingw/profile/configure.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/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/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/string_old.c winsup/mingw/test_headers.c winsup/subauth/ChangeLog winsup/subauth/Makefile.in winsup/subauth/configure winsup/subauth/configure.in winsup/subauth/cygsuba.c winsup/subauth/cygsuba.din winsup/testsuite/ChangeLog winsup/testsuite/Makefile.in winsup/testsuite/README winsup/testsuite/config/default.exp winsup/testsuite/configure winsup/testsuite/configure.in 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/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/nullgetcwd.c winsup/testsuite/winsup.api/pthread/cancel1.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/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/condvar8.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/mutex1.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/mutex6r.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/self1.c winsup/testsuite/winsup.api/pthread/self2.c winsup/testsuite/winsup.api/pthread/test.h winsup/testsuite/winsup.api/pthread/tsd1.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/sigchld.c winsup/testsuite/winsup.api/signal-into-win32-api.c winsup/testsuite/winsup.api/systemcall.c winsup/testsuite/winsup.api/waitpid.c winsup/testsuite/winsup.api/winsup.exp winsup/utils/ChangeLog winsup/utils/ChangeLog-2000 winsup/utils/Makefile.in winsup/utils/aclocal.m4 winsup/utils/configure winsup/utils/configure.in winsup/utils/cygcheck.cc winsup/utils/cygpath.cc winsup/utils/dump_setup.cc winsup/utils/dumper.cc winsup/utils/dumper.h winsup/utils/getfacl.c winsup/utils/kill.cc 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/ssp.c winsup/utils/ssp.txt winsup/utils/strace.cc winsup/utils/umount.cc winsup/utils/utils.sgml winsup/w32api/CONTRIBUTIONS winsup/w32api/ChangeLog winsup/w32api/Makefile.in winsup/w32api/README.w32api winsup/w32api/TODO 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/basetsd.h winsup/w32api/include/basetyps.h winsup/w32api/include/cderr.h winsup/w32api/include/cguid.h winsup/w32api/include/comcat.h winsup/w32api/include/commctrl.h winsup/w32api/include/commdlg.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/dlgs.h winsup/w32api/include/docobj.h winsup/w32api/include/exdisp.h winsup/w32api/include/exdispid.h winsup/w32api/include/httpext.h winsup/w32api/include/idispids.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/iprtrmib.h winsup/w32api/include/iptypes.h winsup/w32api/include/isguids.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/mmsystem.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/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/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/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/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/rapi.h winsup/w32api/include/ras.h winsup/w32api/include/raserror.h winsup/w32api/include/rassapi.h winsup/w32api/include/regstr.h winsup/w32api/include/richedit.h winsup/w32api/include/richole.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/schannel.h winsup/w32api/include/schnlsp.h winsup/w32api/include/scrnsave.h winsup/w32api/include/security.h winsup/w32api/include/setupapi.h winsup/w32api/include/shellapi.h winsup/w32api/include/shlguid.h winsup/w32api/include/shlobj.h winsup/w32api/include/shlwapi.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/subauth.h winsup/w32api/include/svcguid.h winsup/w32api/include/tlhelp32.h winsup/w32api/include/unknwn.h winsup/w32api/include/userenv.h winsup/w32api/include/w32api.h winsup/w32api/include/winbase.h winsup/w32api/include/wincon.h winsup/w32api/include/wincrypt.h winsup/w32api/include/windef.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/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/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/wtypes.h winsup/w32api/include/zmouse.h winsup/w32api/install-sh winsup/w32api/lib/Makefile.in winsup/w32api/lib/advapi32.def winsup/w32api/lib/cap.def winsup/w32api/lib/comctl32.def winsup/w32api/lib/comdlg32.def winsup/w32api/lib/crypt32.def winsup/w32api/lib/ctl3d32.def winsup/w32api/lib/d3dim.def winsup/w32api/lib/d3drm.def winsup/w32api/lib/d3dxof.def winsup/w32api/lib/ddraw.def winsup/w32api/lib/dinput.c winsup/w32api/lib/dinput.def winsup/w32api/lib/dlcapi.def winsup/w32api/lib/dplayx.def winsup/w32api/lib/dsetup.def winsup/w32api/lib/dsound.def winsup/w32api/lib/dxguid.c winsup/w32api/lib/gdi32.def winsup/w32api/lib/glaux.def winsup/w32api/lib/glu32.def winsup/w32api/lib/glut.def winsup/w32api/lib/glut32.def winsup/w32api/lib/imagehlp.def winsup/w32api/lib/imm32.def winsup/w32api/lib/iphlpapi.def winsup/w32api/lib/kernel32.c 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/mpr.def winsup/w32api/lib/msacm32.def winsup/w32api/lib/msimg32.def winsup/w32api/lib/msvcp60.def winsup/w32api/lib/mswsock.def winsup/w32api/lib/nddeapi.def winsup/w32api/lib/netapi32.def winsup/w32api/lib/ntdll.def winsup/w32api/lib/odbc32.def winsup/w32api/lib/odbccp32.def winsup/w32api/lib/ole32.def winsup/w32api/lib/oleaut32.def winsup/w32api/lib/olecli32.def winsup/w32api/lib/oledlg.def 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/psapi.def winsup/w32api/lib/rapi.def winsup/w32api/lib/rasapi32.def winsup/w32api/lib/res.rc winsup/w32api/lib/rpcdce4.def winsup/w32api/lib/rpcns4.def winsup/w32api/lib/rpcrt4.def winsup/w32api/lib/scrnsave.c winsup/w32api/lib/secur32.def 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/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/url.def winsup/w32api/lib/user32.def winsup/w32api/lib/userenv.def winsup/w32api/lib/uuid.c winsup/w32api/lib/vdmdbg.def winsup/w32api/lib/version.def winsup/w32api/lib/vfw32.def 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/wow32.def winsup/w32api/lib/ws2_32.def winsup/w32api/lib/wsock32.def winsup/w32api/lib/wst.def ylwrap --- winsup/testsuite/ChangeLog | 333 ---- winsup/testsuite/Makefile.in | 182 -- winsup/testsuite/README | 35 - winsup/testsuite/config/default.exp | 13 - winsup/testsuite/configure | 1193 ------------ winsup/testsuite/configure.in | 19 - 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 | 216 --- 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 | 74 - winsup/testsuite/libltp/lib/open_flags.c | 330 ---- winsup/testsuite/libltp/lib/parse_opts.c | 878 --------- 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 | 964 ---------- winsup/testsuite/libltp/lib/tst_sig.c | 220 --- winsup/testsuite/libltp/lib/tst_tmpdir.c | 351 ---- winsup/testsuite/libltp/lib/write_log.c | 468 ----- winsup/testsuite/winsup.api/checksignal.c | 79 - winsup/testsuite/winsup.api/crlf.c | 527 ----- winsup/testsuite/winsup.api/devzero.c | 113 -- winsup/testsuite/winsup.api/iospeed.c | 115 -- winsup/testsuite/winsup.api/known_bugs.tcl | 8 - winsup/testsuite/winsup.api/ltp/access01.c | 302 --- winsup/testsuite/winsup.api/ltp/access03.c | 507 ----- winsup/testsuite/winsup.api/ltp/access04.c | 243 --- winsup/testsuite/winsup.api/ltp/access05.c | 425 ---- 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 | 203 -- winsup/testsuite/winsup.api/ltp/asyncio02.c | 365 ---- winsup/testsuite/winsup.api/ltp/chdir02.c | 220 --- winsup/testsuite/winsup.api/ltp/chdir04.c | 189 -- winsup/testsuite/winsup.api/ltp/chmod01.c | 231 --- winsup/testsuite/winsup.api/ltp/chmod02.c | 260 --- winsup/testsuite/winsup.api/ltp/chown01.c | 244 --- winsup/testsuite/winsup.api/ltp/close01.c | 199 -- winsup/testsuite/winsup.api/ltp/close02.c | 142 -- winsup/testsuite/winsup.api/ltp/close08.c | 241 --- winsup/testsuite/winsup.api/ltp/creat01.c | 206 -- winsup/testsuite/winsup.api/ltp/creat03.c | 153 -- 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 | 292 --- 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 | 257 --- winsup/testsuite/winsup.api/ltp/execve01.c | 258 --- winsup/testsuite/winsup.api/ltp/execvp01.c | 257 --- winsup/testsuite/winsup.api/ltp/exit01.c | 163 -- winsup/testsuite/winsup.api/ltp/exit02.c | 227 --- winsup/testsuite/winsup.api/ltp/fchdir01.c | 248 --- winsup/testsuite/winsup.api/ltp/fchdir02.c | 159 -- 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 | 426 ---- winsup/testsuite/winsup.api/ltp/fcntl07B.c | 427 ---- winsup/testsuite/winsup.api/ltp/fcntl08.c | 250 --- winsup/testsuite/winsup.api/ltp/fcntl09.c | 272 --- winsup/testsuite/winsup.api/ltp/fcntl10.c | 278 --- winsup/testsuite/winsup.api/ltp/fork01.c | 317 --- winsup/testsuite/winsup.api/ltp/fork02.c | 142 -- winsup/testsuite/winsup.api/ltp/fork03.c | 164 -- winsup/testsuite/winsup.api/ltp/fork04.c | 405 ---- winsup/testsuite/winsup.api/ltp/fork06.c | 152 -- winsup/testsuite/winsup.api/ltp/fork07.c | 198 -- winsup/testsuite/winsup.api/ltp/fork09.c | 228 --- winsup/testsuite/winsup.api/ltp/fork10.c | 215 --- winsup/testsuite/winsup.api/ltp/fork11.c | 140 -- winsup/testsuite/winsup.api/ltp/fpathconf01.c | 257 --- winsup/testsuite/winsup.api/ltp/fstat01.c | 239 --- winsup/testsuite/winsup.api/ltp/fstat02.c | 245 --- winsup/testsuite/winsup.api/ltp/fstat03.c | 192 -- winsup/testsuite/winsup.api/ltp/fstat04.c | 245 --- winsup/testsuite/winsup.api/ltp/fsync01.c | 248 --- winsup/testsuite/winsup.api/ltp/ftruncate01.c | 244 --- winsup/testsuite/winsup.api/ltp/ftruncate02.c | 314 --- winsup/testsuite/winsup.api/ltp/ftruncate03.c | 325 ---- 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 | 158 -- winsup/testsuite/winsup.api/ltp/getgid03.c | 157 -- winsup/testsuite/winsup.api/ltp/getgroups01.c | 315 --- 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 | 240 --- 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 | 188 -- winsup/testsuite/winsup.api/ltp/getppid01.c | 219 --- winsup/testsuite/winsup.api/ltp/getppid02.c | 146 -- winsup/testsuite/winsup.api/ltp/getuid01.c | 219 --- winsup/testsuite/winsup.api/ltp/getuid02.c | 136 -- winsup/testsuite/winsup.api/ltp/getuid03.c | 137 -- winsup/testsuite/winsup.api/ltp/kill01.c | 161 -- winsup/testsuite/winsup.api/ltp/kill02.c | 858 --------- winsup/testsuite/winsup.api/ltp/kill03.c | 169 -- winsup/testsuite/winsup.api/ltp/kill04.c | 180 -- 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 | 256 --- winsup/testsuite/winsup.api/ltp/lseek02.c | 243 --- winsup/testsuite/winsup.api/ltp/lseek03.c | 290 --- winsup/testsuite/winsup.api/ltp/lseek04.c | 257 --- winsup/testsuite/winsup.api/ltp/lseek05.c | 253 --- winsup/testsuite/winsup.api/ltp/lseek06.c | 237 --- winsup/testsuite/winsup.api/ltp/lseek07.c | 288 --- winsup/testsuite/winsup.api/ltp/lseek08.c | 242 --- winsup/testsuite/winsup.api/ltp/lseek09.c | 269 --- winsup/testsuite/winsup.api/ltp/lseek10.c | 347 ---- winsup/testsuite/winsup.api/ltp/lstat02.c | 253 --- winsup/testsuite/winsup.api/ltp/mkdir01.c | 271 --- winsup/testsuite/winsup.api/ltp/mkdir08.c | 236 --- winsup/testsuite/winsup.api/ltp/mknod01.c | 274 --- winsup/testsuite/winsup.api/ltp/mmap001.c | 206 -- winsup/testsuite/winsup.api/ltp/mmap02.c | 294 --- winsup/testsuite/winsup.api/ltp/mmap03.c | 294 --- winsup/testsuite/winsup.api/ltp/mmap04.c | 295 --- winsup/testsuite/winsup.api/ltp/mmap05.c | 303 --- winsup/testsuite/winsup.api/ltp/mmap06.c | 237 --- winsup/testsuite/winsup.api/ltp/mmap07.c | 236 --- winsup/testsuite/winsup.api/ltp/mmap08.c | 236 --- winsup/testsuite/winsup.api/ltp/munmap01.c | 282 --- winsup/testsuite/winsup.api/ltp/munmap02.c | 307 --- winsup/testsuite/winsup.api/ltp/nice05.c | 220 --- winsup/testsuite/winsup.api/ltp/open02.c | 150 -- winsup/testsuite/winsup.api/ltp/open03.c | 243 --- winsup/testsuite/winsup.api/ltp/pathconf01.c | 246 --- winsup/testsuite/winsup.api/ltp/pause01.c | 229 --- winsup/testsuite/winsup.api/ltp/pipe01.c | 157 -- winsup/testsuite/winsup.api/ltp/pipe08.c | 159 -- winsup/testsuite/winsup.api/ltp/pipe09.c | 232 --- winsup/testsuite/winsup.api/ltp/pipe10.c | 168 -- winsup/testsuite/winsup.api/ltp/pipe11.c | 227 --- winsup/testsuite/winsup.api/ltp/poll01.c | 251 --- winsup/testsuite/winsup.api/ltp/read01.c | 280 --- winsup/testsuite/winsup.api/ltp/read04.c | 175 -- winsup/testsuite/winsup.api/ltp/readdir01.c | 351 ---- winsup/testsuite/winsup.api/ltp/readlink01.c | 230 --- winsup/testsuite/winsup.api/ltp/readlink02.c | 244 --- winsup/testsuite/winsup.api/ltp/readlink03.c | 361 ---- winsup/testsuite/winsup.api/ltp/rename01.c | 264 --- winsup/testsuite/winsup.api/ltp/rename02.c | 251 --- winsup/testsuite/winsup.api/ltp/rename08.c | 206 -- winsup/testsuite/winsup.api/ltp/rename10.c | 204 -- winsup/testsuite/winsup.api/ltp/rmdir01.c | 190 -- winsup/testsuite/winsup.api/ltp/rmdir04.c | 237 --- winsup/testsuite/winsup.api/ltp/rmdir05.c | 448 ----- winsup/testsuite/winsup.api/ltp/sbrk01.c | 280 --- 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 | 229 --- winsup/testsuite/winsup.api/ltp/setpgid01.c | 240 --- 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 | 665 ------- winsup/testsuite/winsup.api/ltp/stat01.c | 268 --- winsup/testsuite/winsup.api/ltp/stat02.c | 277 --- winsup/testsuite/winsup.api/ltp/stat03.c | 393 ---- winsup/testsuite/winsup.api/ltp/stat05.c | 241 --- winsup/testsuite/winsup.api/ltp/stat06.c | 378 ---- winsup/testsuite/winsup.api/ltp/symlink01.c | 2033 -------------------- winsup/testsuite/winsup.api/ltp/symlink02.c | 245 --- winsup/testsuite/winsup.api/ltp/symlink03.c | 404 ---- winsup/testsuite/winsup.api/ltp/symlink04.c | 239 --- winsup/testsuite/winsup.api/ltp/symlink05.c | 223 --- winsup/testsuite/winsup.api/ltp/sync01.c | 216 --- winsup/testsuite/winsup.api/ltp/sync02.c | 240 --- winsup/testsuite/winsup.api/ltp/time01.c | 218 --- winsup/testsuite/winsup.api/ltp/time02.c | 183 -- winsup/testsuite/winsup.api/ltp/times01.c | 222 --- winsup/testsuite/winsup.api/ltp/times02.c | 135 -- winsup/testsuite/winsup.api/ltp/times03.c | 246 --- 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 | 134 -- winsup/testsuite/winsup.api/ltp/umask03.c | 169 -- winsup/testsuite/winsup.api/ltp/uname01.c | 221 --- winsup/testsuite/winsup.api/ltp/unlink05.c | 246 --- winsup/testsuite/winsup.api/ltp/unlink06.c | 255 --- winsup/testsuite/winsup.api/ltp/unlink07.c | 329 ---- winsup/testsuite/winsup.api/ltp/unlink08.c | 433 ----- winsup/testsuite/winsup.api/ltp/vfork01.c | 402 ---- winsup/testsuite/winsup.api/ltp/wait02.c | 230 --- winsup/testsuite/winsup.api/ltp/wait401.c | 187 -- winsup/testsuite/winsup.api/ltp/wait402.c | 202 -- winsup/testsuite/winsup.api/ltp/write01.c | 250 --- winsup/testsuite/winsup.api/ltp/write02.c | 165 -- winsup/testsuite/winsup.api/ltp/write03.c | 193 -- winsup/testsuite/winsup.api/mmaptest01.c | 176 -- winsup/testsuite/winsup.api/mmaptest02.c | 189 -- winsup/testsuite/winsup.api/mmaptest03.c | 127 -- winsup/testsuite/winsup.api/mmaptest04.c | 100 - winsup/testsuite/winsup.api/nullgetcwd.c | 16 - winsup/testsuite/winsup.api/pthread/cancel1.c | 147 -- 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/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/condvar8.c | 221 --- 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 - winsup/testsuite/winsup.api/pthread/mutex1.c | 36 - 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/mutex6r.c | 68 - 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/self1.c | 26 - winsup/testsuite/winsup.api/pthread/self2.c | 46 - winsup/testsuite/winsup.api/pthread/test.h | 99 - winsup/testsuite/winsup.api/pthread/tsd1.c | 170 -- winsup/testsuite/winsup.api/samples/sample-fail.c | 4 - .../winsup.api/samples/sample-miscompile.c | 1 - winsup/testsuite/winsup.api/samples/sample-pass.c | 4 - winsup/testsuite/winsup.api/sigchld.c | 20 - .../testsuite/winsup.api/signal-into-win32-api.c | 57 - winsup/testsuite/winsup.api/systemcall.c | 65 - winsup/testsuite/winsup.api/waitpid.c | 22 - winsup/testsuite/winsup.api/winsup.exp | 81 - 284 files changed, 63606 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/config/default.exp delete mode 100644 winsup/testsuite/configure delete mode 100755 winsup/testsuite/configure.in 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/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/nullgetcwd.c delete mode 100644 winsup/testsuite/winsup.api/pthread/cancel1.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/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/condvar8.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/mutex1.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/mutex6r.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/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/tsd1.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/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/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 9c9770251..000000000 --- a/winsup/testsuite/ChangeLog +++ /dev/null @@ -1,333 +0,0 @@ -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 1658c362d..000000000 --- a/winsup/testsuite/Makefile.in +++ /dev/null @@ -1,182 +0,0 @@ -# Makefile.in for Cygwin's testsuite. -# Copyright 2000 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@ -prefix:=@prefix@ - -program_transform_name:=@program_transform_name@ -exec_prefix:=@exec_prefix@ -bindir:=@bindir@ -libdir:=@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:=@datadir@ -infodir:=@infodir@ -includedir:=@includedir@ - -TESTSUP_INCLUDES:=-I$(libltp_srcdir)/include - -INSTALL:=@INSTALL@ -INSTALL_PROGRAM:=@INSTALL_PROGRAM@ - -# -# --enable options from configure -# - -CC:=@CC@ -# FIXME: Which is it, CC or CC_FOR_TARGET? -CC_FOR_TARGET:=$(CC) -#CFLAGS:=@CFLAGS@ -MD -Wno-write-strings $(TESTSUP_INCLUDES) -ifneq (,$(CFLAGS)) - override CFLAGS+= -MD $(TESTSUP_INCLUDES) -else - CFLAGS:=@CFLAGS@ -MD $(TESTSUP_INCLUDES) -endif -CXXFLAGS:=@CXXFLAGS@ - -AR:=@AR@ -AR_FLAGS:=qv -RANLIB:=@RANLIB@ -LD:=@LD@ -DLLTOOL:=@DLLTOOL@ -WINDRES:=@WINDRES@ -AS:=@AS@ - -# -# Include common definitions for winsup directory -# -include $(srcdir)/../Makefile.common - -INSTALL_DATA:=$(SHELL) $(updir1)/install-sh -c - -# Setup the testing framework, if you have one -EXPECT = `if [ -f $${rootme}/../../expect/expect$(EXEEXT) ] ; then \ - echo $${rootme}/../../expect/expect$(EXEEXT) ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f ${srcdir}/../../dejagnu/runtest ] ; then \ - echo ${srcdir}/../../dejagnu/runtest ; \ - else echo runtest; fi` -RUNTESTFLAGS = - -ifdef VERBOSE - RUNTESTFLAGS = -v -endif - -RUNTIME=$(cygwin_build)/new-cygwin1.dll $(cygwin_build)/new-libcygwin.a $(cygwin_build)/cygrun.exe - -TESTSUP_LIB_NAME:=libltp.a -TESTSUP_OFILES:=${sort ${addsuffix .o,${basename ${notdir ${wildcard $(libltp_srcdir)/lib/*.c}}}}} - -.PHONY: all force dll_ofiles install all_target install_target all_host install_host - -.SUFFIXES: -.SUFFIXES: .c .cc .def .a .o .d - -all_host=@all_host@ -install_host=@install_host@ - -all: $(TESTSUP_LIB_NAME) - -force: - -install: - -install_host: - -clean: - -rm -f *.o *.dll *.a *.exp junk *.bak *.base *.exe testsuite/* - -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 \"\"" >> ./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 new-cygwin1.dll - -check: $(TESTSUP_LIB_NAME) $(RUNTIME) testsuite/site.exp - cd testsuite; \ - EXPECT=${EXPECT} ; export 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) diff --git a/winsup/testsuite/README b/winsup/testsuite/README deleted file mode 100644 index 346111e9a..000000000 --- a/winsup/testsuite/README +++ /dev/null @@ -1,35 +0,0 @@ -1999-12-23 DJ Delorie - -Here are some notes about adding and using this testsuite. - -First, all the programs are linked with new-libcygwin.a, which is just -like libcygwin.a, except that it wants new-cygwin1.dll, not -cygwin1.dll. The testsuite adds the winsup build directory to the -PATH so that new-cygwin1.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. diff --git a/winsup/testsuite/config/default.exp b/winsup/testsuite/config/default.exp deleted file mode 100644 index 695808fc9..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/new-cygwin1.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 c57fde2cc..000000000 --- a/winsup/testsuite/configure +++ /dev/null @@ -1,1193 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -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' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -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 - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # 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 ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$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" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) 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) - # 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 << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$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) - 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 ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - 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 "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# 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 - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=Makefile.in - -# 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_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - 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 "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# 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 "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:529: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:559: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -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 $# -gt 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 - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:610: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:642: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 653 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:684: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:689: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:717: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&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 $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:749: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:770: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:787: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:804: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:854: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:875: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -if test $host != $build; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:901: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" -fi -fi -AR="$ac_cv_prog_AR" -if test -n "$AR"; then - echo "$ac_t""$AR" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - - -trap '' 1 2 15 -cat > confcache <<\EOF -# 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. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# 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 \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS </dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@CC@%$CC%g -s%@CPP@%$CPP%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@AR@%$AR%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# 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_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # 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" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/winsup/testsuite/configure.in b/winsup/testsuite/configure.in deleted file mode 100755 index 6d198437d..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.12) -AC_INIT(Makefile.in) - -AC_PROG_CC -AC_PROG_CPP -AC_CHECK_TOOL(AR,ar) - -AC_OUTPUT(Makefile) 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 131311b44..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(char *cmd, 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 acfdfdf1b..000000000 --- a/winsup/testsuite/libltp/include/test.h +++ /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$ */ - -#ifndef __TEST_H__ -#define __TEST_H__ - -#include -#include -#include - -#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, 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(); -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 232e67a98..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 { - 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. - ***********************************************************************/ -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; - -#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 e974c871e..000000000 --- a/winsup/testsuite/libltp/lib/libtestsuite.c +++ /dev/null @@ -1,74 +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 -#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 c40181395..000000000 --- a/winsup/testsuite/libltp/lib/parse_opts.c +++ /dev/null @@ -1,878 +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 -#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 - -/* 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 6663da507..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) -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 -#include /* for I/O functions, BUFSIZ */ -#include /* for getenv() */ -#include /* for varargs stuff */ -#include /* for access() */ -#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(char *filename); - - -/* - * Define some static/global variables. - */ -static FILE *T_out = NULL; /* tst_res() output file descriptor */ -static 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, 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) -{ - 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(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 ef1e2cd70..000000000 --- a/winsup/testsuite/libltp/lib/tst_tmpdir.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 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 -#include /* for getenv() */ -#include /* for string functions */ -#include /* for sysconf(), getcwd(), rmdir() */ -#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 a8b5d3927..000000000 --- a/winsup/testsuite/winsup.api/checksignal.c +++ /dev/null @@ -1,79 +0,0 @@ -#include -#include -#include -#include -#include - -#include "test.h" -#include "usctest.h" - -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; - - Tst_count = 0; - - if (pipe (fds) < 0) - tst_brk (TBROK, NULL, NULL, "Create pipe"); - - /* 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"); - - /* 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"); - - /* Reset SA_RESTART flag again. */ - act.sa_handler = sig_handler; - act.sa_flags &= ~SA_RESTART; - while ((ret = sigaction (SIGALRM, &act, NULL)) == EINTR) - ; - if (ret) - tst_brk (TBROK, NULL, NULL, "Reset SA_RESTART"); - - /* 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, - "Set EINTR on interrupted read() call"); - - /* Check if another errno is correctly returned (here EBADF). */ - close (fds[0]); - 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 5dbc2227b..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 - -#ifndef O_BINARY -#define O_BINARY 0 -#endif -#ifndef O_TEXT -#define O_TEXT 0 -#endif - -int errors = 0; - -#define num_commands (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(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, 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, 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(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(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) -{ - char *readmode = "rb"; - char *writemode = "wb"; - FILE *file = 0; - int i, fd; - struct stat st; - char *str; - - while (argc > 1 && argv[1][0] == '-') - { - if (strcmp(argv[1], "-v") == 0) - verbose++; - argc--; - argv++; - } - - size = 0; - - for (pc=0; pc -#include -#include -#include -#include - -main() -{ - int fd, r, w, 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 d286f90bd..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("%6d", 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 1856608d9..000000000 --- a/winsup/testsuite/winsup.api/known_bugs.tcl +++ /dev/null @@ -1,8 +0,0 @@ -set xfail_list [list dup03 dup05 \ - fcntl05 fcntl07B fcntl09 fcntl10 \ - fsync01 gethostid01 lseek04 lseek10 mknod01 select03 \ - setgroups01 setregid01 setreuid01 setuid02 \ - ulimit01 unlink06 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 e003805a0..000000000 --- a/winsup/testsuite/winsup.api/ltp/access01.c +++ /dev/null @@ -1,302 +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 -#include -#include "test.h" -#include "usctest.h" -void setup(); -void cleanup(); - -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 -#include "test.h" -#include "usctest.h" - - -void setup(); -void cleanup(); - - -char *get_high_address(); - -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 20fa81187..000000000 --- a/winsup/testsuite/winsup.api/ltp/access04.c +++ /dev/null @@ -1,243 +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 -#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 - -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(); /* 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 935b19bd3..000000000 --- a/winsup/testsuite/winsup.api/ltp/access05.c +++ /dev/null @@ -1,425 +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 -#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 */ - char *pathname; - int a_mode; - 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 } -}; - -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(); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - char *file_name; /* name of the testfile */ - 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 ac754e326..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(); - - - -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 7c608da66..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 alarm_received(); - - - -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 */ - 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(); - - -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 7661ba978..000000000 --- a/winsup/testsuite/winsup.api/ltp/alarm07.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 - */ - -/* - * 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 -#include - -#include "test.h" -#include "usctest.h" - -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(); /* 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 b7ccb62f5..000000000 --- a/winsup/testsuite/winsup.api/ltp/asyncio02.c +++ /dev/null @@ -1,365 +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 -#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(); -int testrun(int flag, int bytes, int ti); - -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]; -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 b59fd9338..000000000 --- a/winsup/testsuite/winsup.api/ltp/chdir02.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 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(); - - - -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}; - -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 d220bb17f..000000000 --- a/winsup/testsuite/winsup.api/ltp/chdir04.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 - * 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 -#include - -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); - -main(int ac, char **av) -{ - int lc; /* loop counter */ - int i; - const char *msg; /* message returned from parse_opts */ - struct stat statbuf; - - /* 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 - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define TESTFILE "testfile" - -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(); /* 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 */ - int 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 41c3485e8..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(); - - - -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]; -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(); - - - -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; -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 1637c90eb..000000000 --- a/winsup/testsuite/winsup.api/ltp/close01.c +++ /dev/null @@ -1,199 +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 "test.h" -#include "usctest.h" - -void cleanup(void); -void setup(void); - -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; - char *type; -} TC[] = { - /* file descriptor for a regular file */ - {&newfd, "file"}, - - /* file descriptor for a pipe */ - {&pipefildes[0], "pipe"} -}; - -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 44f98b250..000000000 --- a/winsup/testsuite/winsup.api/ltp/close02.c +++ /dev/null @@ -1,142 +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); -void setup(void); - -int exp_enos[] = {EBADF, 0}; - -char *TCID = "close02()"; -int TST_TOTAL = 1; -extern int Tst_count; - -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 7c9567fdb..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(); - - - -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 7dd016f22..000000000 --- a/winsup/testsuite/winsup.api/ltp/creat01.c +++ /dev/null @@ -1,206 +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); -void functest1(void); -void functest2(void); - -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} -}; - -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 c5e5242bf..000000000 --- a/winsup/testsuite/winsup.api/ltp/creat03.c +++ /dev/null @@ -1,153 +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" - -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); - -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 0caa87973..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(); - - - -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 d065f9dc1..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(); - - -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 3aac3e9f8..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(); - - -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 -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - -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) { - for (; Nfds >0 ; Nfds--) { - if (close(Fd[Nfds-1]) == -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 85540db35..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(); - - -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 4f889cdcd..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(); - -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 b23716a0f..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(); - - - -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 f29d34f6a..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(); - - - -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", 0, 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 6bf97d4e1..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(); - - - -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", 0); - /* 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 b833e1c4f..000000000 --- a/winsup/testsuite/winsup.api/ltp/execv01.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 : 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 - -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -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 */ -char *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 1abe72f23..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(); - - - -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 */ -char *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 6f645d68d..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(); - - - -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 */ -char *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 729f49ac6..000000000 --- a/winsup/testsuite/winsup.api/ltp/exit01.c +++ /dev/null @@ -1,163 +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 "test.h" -#include "usctest.h" - -void cleanup(void); -void setup(void); - -char *TCID = "exit01"; -int TST_TOTAL = 1; -extern int Tst_count; - -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 b81ecbcb9..000000000 --- a/winsup/testsuite/winsup.api/ltp/exit02.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 - * 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); -void setup(void); - -char *TCID = "exit02"; -int TST_TOTAL = 1; -extern int Tst_count; - -#define READ 0 -#define WRITE 1 -#define MODE 0666 - -char filen[40]; - -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 83685d34d..000000000 --- a/winsup/testsuite/winsup.api/ltp/fchdir01.c +++ /dev/null @@ -1,248 +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); -void setup(void); - -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 - -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 c09d905b5..000000000 --- a/winsup/testsuite/winsup.api/ltp/fchdir02.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 - * 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); -void setup(void); - -char *TCID = "fchdir02"; -int TST_TOTAL = 1; -extern int Tst_count; - -int exp_enos[] = {9, 0}; /* 0 terminated list of expected errnos */ - -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 ffcf37f66..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(); - - - -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; -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 045f84892..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(); - - - -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 14fc1b61d..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(); - - - -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 93a9b9b1f..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(); - - - -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 d70843071..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(); - - - -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 86f492aa7..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(); - - - -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 c48e475ba..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl07.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 : 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 -#include -#include - -#include "test.h" -#include "usctest.h" -#include "search_path.h" - -void setup(); -void cleanup(); -void help(); - -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" -char *File1 = DEFAULT_FILE; - -#define DEFAULT_SUBPROG "test_open" -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 - }; - -char *testfdtypes[] = { - "regular file", - "write side of system pipe", - }; - -int test_open(char *arg); -int do_exec(char *prog, int fd, 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) */ - 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(char *prog, int fd, 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, 0); - - /* 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/fcntl07B.c b/winsup/testsuite/winsup.api/ltp/fcntl07B.c deleted file mode 100644 index 51b88c278..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl07B.c +++ /dev/null @@ -1,427 +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 -#include - -#include "test.h" -#include "usctest.h" -#include "search_path.h" - -void setup(); -void cleanup(); -void help(); - -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" -char *File1 = DEFAULT_FILE; - -#define DEFAULT_SUBPROG "test_open" -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 -#define FIFONAME "FiFo" - -int *testfds[] = { - &npipe_fd, 0 - }; - -char *testfdtypes[] = { - "named pipe" - }; - -int test_open(char *arg); -int do_exec(char *prog, int fd, 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) */ - 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(char *prog, int fd, 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, 0); - - /* 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; - - extern char *optarg; - extern int optind; - - 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 c4cbad461..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(); - -#ifndef O_NDELAY -#define O_NDELAY 0 -#endif - -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 f10df71fe..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl09.c +++ /dev/null @@ -1,272 +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(); - - - -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; - - flocks.l_type = F_RDLCK | F_WRLCK; - /* - * 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 8b23575b3..000000000 --- a/winsup/testsuite/winsup.api/ltp/fcntl10.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 : 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(); - - - -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; - - flocks.l_type = F_RDLCK | F_WRLCK; - /* - * 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 dfd412a5f..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork01.c +++ /dev/null @@ -1,317 +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 -#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" - - - -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 eaf3b6404..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork02.c +++ /dev/null @@ -1,142 +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 -#include "test.h" -#include "usctest.h" - -void setup(void); -void cleanup(void); - -char *TCID = "fork02"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -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 cda913273..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork03.c +++ /dev/null @@ -1,164 +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); - -char *TCID = "fork03"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -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 3725d9f0f..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork04.c +++ /dev/null @@ -1,405 +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 -#include -#include /*Includes signal information. */ -#include -#include "test.h" -#include "usctest.h" - -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 */ -char *environ_list[] = {"TERM","NoTSetzWq","TESTPROG"}; -#define NUMBER_OF_ENVIRON 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("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" - -char *TCID = "fork06"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -#define NUMFORKS 1000 - -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 d8487c13a..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork07.c +++ /dev/null @@ -1,198 +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 "test.h" -#include "usctest.h" - -char *TCID = "fork07"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -char pbuf[10]; -char fnamebuf[40]; - -main(int ac, char **av) -{ - int status, count, forks, pid1; - int ch_r_stat; - FILE *rea, *writ; - - 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 71a3f1d0b..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork09.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 - * 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 -#include /* for OPEN_MAX */ -#include "test.h" -#include "usctest.h" - -char *TCID = "fork01"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -char filname[40], childfile[40]; -int first; -FILE **fildeses; /* file streams */ -int mypid, nfiles; - -main(int ac, char **av) -{ - int pid, status, dtable, 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() -{ - int nf; - - /* - * 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 09de7c06f..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork10.c +++ /dev/null @@ -1,215 +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 "test.h" -#include "usctest.h" - -char *TCID = "fork04"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -char pidbuf[10]; -char fnamebuf[40]; - -main(int ac, char **av) -{ - int status, pid, fildes; - char parchar[2]; - char chilchar[2]; - long lseek(); - - 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 1fc200dd1..000000000 --- a/winsup/testsuite/winsup.api/ltp/fork11.c +++ /dev/null @@ -1,140 +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" - -char *TCID = "fork05"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -#define NUMFORKS 100 - -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 bc4f2b2ad..000000000 --- a/winsup/testsuite/winsup.api/ltp/fpathconf01.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 : 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 -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -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 -{ - 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(); - - - -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 f15e48e78..000000000 --- a/winsup/testsuite/winsup.api/ltp/fstat02.c +++ /dev/null @@ -1,245 +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 - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE 0644 -#define TESTFILE "testfile" -#define FILE_SIZE 1024 -#define BUF_SIZE 256 -#define MASK 0777 - -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(); /* 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 1f63cf106..000000000 --- a/winsup/testsuite/winsup.api/ltp/fstat03.c +++ /dev/null @@ -1,192 +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 -#include -#include - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH -#define TEST_FILE "testfile" - -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(); /* 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 0287fff36..000000000 --- a/winsup/testsuite/winsup.api/ltp/fstat04.c +++ /dev/null @@ -1,245 +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 - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE 0644 -#define TESTFILE "testfile" -#define FILE_SIZE 1024 -#define BUF_SIZE 256 -#define MASK 0777 - -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(); /* 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 57ddd5f98..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(); - - - -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; -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 2d3d797ec..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 */ - -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(); /* 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 8044c1de5..000000000 --- a/winsup/testsuite/winsup.api/ltp/ftruncate02.c +++ /dev/null @@ -1,314 +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 - -#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 */ - -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(); /* 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 2e80558e7..000000000 --- a/winsup/testsuite/winsup.api/ltp/ftruncate03.c +++ /dev/null @@ -1,325 +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 - -#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; - 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 } -}; - -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(); /* Main cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - 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 d2c8a5240..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(); - - - -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 b4840f52c..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(); - - - -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 fcde734a0..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(); - - - -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 290ef10c5..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgid02.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 - * 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); -void setup(void); - -char *TCID= "getgid02"; -int TST_TOTAL = 1; -extern int Tst_count; - -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 3059b0b36..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgid03.c +++ /dev/null @@ -1,157 +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); -void setup(void); - -char *TCID= "getgid01"; -int TST_TOTAL = 1; -extern int Tst_count; - -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 6b935f293..000000000 --- a/winsup/testsuite/winsup.api/ltp/getgroups01.c +++ /dev/null @@ -1,315 +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 -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - -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 b517c7617..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(); - - - -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 2d4a18755..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(); - - - -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 2f94db725..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(); - - - -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 d1a39a087..000000000 --- a/winsup/testsuite/winsup.api/ltp/getpgid01.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 - */ - -/* - * 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 -#include - -void setup(void); -void cleanup(void); - -char *TCID = "getpgid01"; -int TST_TOTAL = 1; -extern int Tst_count; - -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 */ -block1: - 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"); - -block2: - 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"); - -block3: - 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"); - -block4: - 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 afb80f261..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 -#include - -void setup(void); -void cleanup(void); - -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} -}; - -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 bd3a89117..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(); - - - -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 58d6b0579..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(); - - - -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 8561c1a09..000000000 --- a/winsup/testsuite/winsup.api/ltp/getpid02.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 - */ - -/* - * 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 -#include - -#include "test.h" -#include "usctest.h" - -void setup(); /* Main setup function of test */ -void cleanup(); /* cleanup function for the test */ - -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 9eab5dfc2..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(); - - - -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 9eeead13f..000000000 --- a/winsup/testsuite/winsup.api/ltp/getppid02.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 - * 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 - -char *TCID = "getppid01"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -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 58920ed34..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(); - - - -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 b35072518..000000000 --- a/winsup/testsuite/winsup.api/ltp/getuid02.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 - * 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 - -char *TCID = "getuid02"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -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 7c1075ca4..000000000 --- a/winsup/testsuite/winsup.api/ltp/getuid03.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 - * 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 - -char *TCID = "getuid01"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -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 d20d3a347..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill01.c +++ /dev/null @@ -1,161 +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); -void setup(void); - -char *TCID= "kill01()"; -int TST_TOTAL = 1; - -extern int Tst_count; - -#define TEST_SIG SIGKILL - -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 e618c8c71..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill02.c +++ /dev/null @@ -1,858 +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 -#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(); - -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; /*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 528a080b4..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill03.c +++ /dev/null @@ -1,169 +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); -void setup(void); - -char *TCID= "kill03()"; -int TST_TOTAL = 1; - -extern int Tst_count; - -int exp_enos[] = {EINVAL, 0}; - -#define TEST_SIG 2000 - -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 */ - - 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 2e0ff6593..000000000 --- a/winsup/testsuite/winsup.api/ltp/kill04.c +++ /dev/null @@ -1,180 +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); -void setup(void); - -char *TCID= "kill04()"; -int TST_TOTAL = 1; - -extern int Tst_count; - -int exp_enos[] = {ESRCH, 0}; - -#define TEST_SIG SIGKILL - -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 9d6b0a181..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 alarm_handler(int sig); - - - - -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 61294f16f..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(); - - - -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 7b4395853..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(); - - - -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 7f2390139..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(); - - -extern char *get_high_address(); - -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 { - char *file1; - char *desc1; - char *file2; - 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 */ - char *fname1, *fname2; - 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 5078a6a3f..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 help(); - - - -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 32756fedd..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek01.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 : 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 -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - - - -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 9ad906b5b..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek02.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 : 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 -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - - - -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 03c035cb9..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek03.c +++ /dev/null @@ -1,290 +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 -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); -void rec_sigsys(int); - -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 */ - - int 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 -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - - - -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 0d51643f0..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek05.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 : 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 -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - - - -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 0262260fc..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek06.c +++ /dev/null @@ -1,237 +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 -#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 - -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(); /* 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)) != 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 0acc28949..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek07.c +++ /dev/null @@ -1,288 +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 -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE "tmp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -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(); /* 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)) != - 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)) != - 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 061ac3152..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek08.c +++ /dev/null @@ -1,242 +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 -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE "tmp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -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 */ -size_t file_size; /* size of the temporary file */ - -void setup(); /* Main setup function of test */ -void cleanup(); /* 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 b36df715d..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek09.c +++ /dev/null @@ -1,269 +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 -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE "tmp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -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(); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - int rval; - 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 060f3b290..000000000 --- a/winsup/testsuite/winsup.api/ltp/lseek10.c +++ /dev/null @@ -1,347 +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 -#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 - -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; - 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(); /* 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 */ - 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 f6b97d78a..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(); - - - -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 80f9bb6cc..000000000 --- a/winsup/testsuite/winsup.api/ltp/mkdir01.c +++ /dev/null @@ -1,271 +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 -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - - -char *get_high_address(); - -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 8378aba34..000000000 --- a/winsup/testsuite/winsup.api/ltp/mkdir08.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 : 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 -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -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 32c7fe1e2..000000000 --- a/winsup/testsuite/winsup.api/ltp/mknod01.c +++ /dev/null @@ -1,274 +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 - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - - - -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 -#include -#include - -#include "test.h" -#include "usctest.h" - -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; - unsigned 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 35e944d74..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap02.c +++ /dev/null @@ -1,294 +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 -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -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(); /* 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)) < 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 6c66a4c45..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap03.c +++ /dev/null @@ -1,294 +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 -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -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(); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - 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 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)) < 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 4f9018f92..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap04.c +++ /dev/null @@ -1,295 +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 -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -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(); /* cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - 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 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)) < 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 e8186899f..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap05.c +++ /dev/null @@ -1,303 +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 -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -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(); /* 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 */ - 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)) != 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 bc3f20eb1..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap06.c +++ /dev/null @@ -1,237 +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 -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -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(); /* 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)) < 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 3d1f4341d..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap07.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 - */ - -/* - * 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 -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -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(); /* 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)) < 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 8b2c05091..000000000 --- a/winsup/testsuite/winsup.api/ltp/mmap08.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 - */ - -/* - * 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 -#include -#include - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -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(); /* 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)) != 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 5de98b6ff..000000000 --- a/winsup/testsuite/winsup.api/ltp/munmap01.c +++ /dev/null @@ -1,282 +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 - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -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(); /* 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 deadcc2f6..000000000 --- a/winsup/testsuite/winsup.api/ltp/munmap02.c +++ /dev/null @@ -1,307 +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 - -#include "test.h" -#include "usctest.h" - -#define TEMPFILE "mmapfile" - -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(); /* 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 602971f8a..000000000 --- a/winsup/testsuite/winsup.api/ltp/nice05.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 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 -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - - - -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 84640ce97..000000000 --- a/winsup/testsuite/winsup.api/ltp/open02.c +++ /dev/null @@ -1,150 +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 -#include - -char *TCID = "open02"; -int TST_TOTAL = 1; -extern int Tst_count; - -char pfilname[40] = ""; - -int exp_enos[] = {ENOENT, 0}; - -void cleanup(void); -void setup(void); - -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - struct stat statbuf; - int fildes; - unsigned short filmode; - - /* - * 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 b8dce9cee..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(); - - - -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 f87c6e239..000000000 --- a/winsup/testsuite/winsup.api/ltp/pathconf01.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 : 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 -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -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; -char *path = "/tmp"; - -struct pathconf_args -{ - 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(); - - - -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 699515da3..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe01.c +++ /dev/null @@ -1,157 +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 -#include "test.h" -#include "usctest.h" - -char *TCID = "pipe01"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int pipe_ret; /* exit status of pipe */ - 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 9cc935d39..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe08.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 - * 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 -#include "test.h" -#include "usctest.h" - -char *TCID = "pipe08"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); -void sighandler(int); - -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int pipe_ret; /* exit status of pipe */ - 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 2c7d9f4c2..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe09.c +++ /dev/null @@ -1,232 +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 -#include "test.h" -#include "usctest.h" - -#define PIPEWRTCNT 100 /* must be an even number */ - -char *TCID = "pipe09"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int i, red, wtstatus, ret_val; - int pipe_ret; /* exit stat of pipe */ - int pipefd[2]; /* fds for pipe read/write */ - char synbuf[BUFSIZ]; - 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 410622c37..000000000 --- a/winsup/testsuite/winsup.api/ltp/pipe10.c +++ /dev/null @@ -1,168 +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 -#include - -char *TCID = "pipe10"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int pipe_ret; /* exit status of pipe */ - 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 df7b24166..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" - -char *TCID = "pipe11"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -#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; - -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int pipe_ret; /* exit status of pipe */ - int fd[2]; /* fds for pipe read/write */ - int i; - int fork_ret, status, cond_numb = 0; - 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 >= 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 67e1f139a..000000000 --- a/winsup/testsuite/winsup.api/ltp/poll01.c +++ /dev/null @@ -1,251 +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 - -#include "test.h" -#include "usctest.h" - -#define BUF_SIZE 512 - -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(); /* 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)) - < 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)) != - 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 1a54afeb0..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(); - - - -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], *malloc(); -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 99dcdf68d..000000000 --- a/winsup/testsuite/winsup.api/ltp/read04.c +++ /dev/null @@ -1,175 +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 -#include "test.h" -#include "usctest.h" - -void cleanup(void); -void setup(void); - -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; - -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - - int n; - 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 e8b5bd5a5..000000000 --- a/winsup/testsuite/winsup.api/ltp/readdir01.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 : 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 -#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(); - -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 bb5f6e388..000000000 --- a/winsup/testsuite/winsup.api/ltp/readlink01.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 - */ - -/* - * 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 - -#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 - -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(); /* 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 c0ed6f154..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(); - - - -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 3279b903b..000000000 --- a/winsup/testsuite/winsup.api/ltp/readlink03.c +++ /dev/null @@ -1,361 +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 - -#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 - -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*/ - char *link; - 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 */ -extern void cleanup(); /* 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 */ - char *sym_file; /* symbolic link file name */ - 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 551efe722..000000000 --- a/winsup/testsuite/winsup.api/ltp/rename01.c +++ /dev/null @@ -1,264 +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 - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); -extern void do_file_setup(char *); - -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 { - char *name1; - char *name2; - 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(); - - - -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 e83923901..000000000 --- a/winsup/testsuite/winsup.api/ltp/rename08.c +++ /dev/null @@ -1,206 +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 - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); -extern void do_file_setup(char *); - -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 c1aae92b5..000000000 --- a/winsup/testsuite/winsup.api/ltp/rename10.c +++ /dev/null @@ -1,204 +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 - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); -extern void do_file_setup(char *); - -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 5b16a518b..000000000 --- a/winsup/testsuite/winsup.api/ltp/rmdir01.c +++ /dev/null @@ -1,190 +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 -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - -#define PERMS 0777 - -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 5cf84f770..000000000 --- a/winsup/testsuite/winsup.api/ltp/rmdir04.c +++ /dev/null @@ -1,237 +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 -#include "test.h" -#include "usctest.h" - -extern void setup(); -extern void cleanup(); - - - -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 b363735c0..000000000 --- a/winsup/testsuite/winsup.api/ltp/rmdir05.c +++ /dev/null @@ -1,448 +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 -#include "test.h" -#include "usctest.h" - - -void setup(); -void cleanup(); - - -extern char *get_high_address(); - -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 08fb0a184..000000000 --- a/winsup/testsuite/winsup.api/ltp/sbrk01.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 : 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 - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - - - -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 6ff0fe87b..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(); - -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 8b2669564..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(); - -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 d0959cb35..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(); - -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 50b339d03..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(); - - - -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 dc7bd1d47..000000000 --- a/winsup/testsuite/winsup.api/ltp/setgroups01.c +++ /dev/null @@ -1,229 +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 - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - - - -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 e580a34f7..000000000 --- a/winsup/testsuite/winsup.api/ltp/setpgid01.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 : 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(); - - - -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 e247f6c61..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(); - - - -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 67f3bae4a..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(); - - - -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 4437108c8..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(); - - - -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 65576af62..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(); - - - -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 38ba72b3c..000000000 --- a/winsup/testsuite/winsup.api/ltp/signal03.c +++ /dev/null @@ -1,665 +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 -#include - -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); -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; - -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 46b8262d5..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat01.c +++ /dev/null @@ -1,268 +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 - -#include "test.h" -#include "usctest.h" - -#define FILE_MODE 0644 -#define TESTFILE "testfile" -#define FILE_SIZE 1024 -#define BUF_SIZE 256 -#define MASK 0777 - -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(); /* 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 06bf73a35..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat02.c +++ /dev/null @@ -1,277 +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 - -#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 - -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(); /* 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 2d04ec4fc..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat03.c +++ /dev/null @@ -1,393 +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 -#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*/ - char *pathname; - 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 } -}; - -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(); /* 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 */ - char *file_name; /* ptr. for file name whose mode is modified*/ - 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 ba102e3cb..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(); - - - -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 90ee05a4c..000000000 --- a/winsup/testsuite/winsup.api/ltp/stat06.c +++ /dev/null @@ -1,378 +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 -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - -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 { - char *pathname; - struct stat *stbuf; - 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 */ - char *fname; - 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 dcd6a749b..000000000 --- a/winsup/testsuite/winsup.api/ltp/symlink01.c +++ /dev/null @@ -1,2033 +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 -#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 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 -{ - char *tcid; - int test_fail; - int errno_val; - int pass_msg; - int (*test_setup)(); - int (*ck_test)(); - 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 -{ - char *tcid; - char *syscall; - int test_cases; /* number of entries in test_objects array */ - struct all_test_cases *tc_ptr; - 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; -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; -{ - int 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:%d) and of\n\t\t\ -%s (ino:%d), 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() -{ - int 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(); - - - -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 9cdb74b18..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 - -#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" - -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*/ - char *file; - char *link; - 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 */ -extern void cleanup(); /* Cleanup function for the test */ - -int -main(int ac, char **av) -{ - int lc; /* loop counter */ - const char *msg; /* message returned from parse_opts */ - char *test_file; /* testfile name */ - char *sym_file; /* symbolic link file name */ - 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 8272d368c..000000000 --- a/winsup/testsuite/winsup.api/ltp/symlink04.c +++ /dev/null @@ -1,239 +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 -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" -#define SYMFILE "slink_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -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 */ -extern void cleanup(); /* 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 36aff558f..000000000 --- a/winsup/testsuite/winsup.api/ltp/symlink05.c +++ /dev/null @@ -1,223 +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 - -#include "test.h" -#include "usctest.h" - -#define TESTFILE "testfile" -#define SYMFILE "slink_file" - -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 */ -extern void cleanup(); /* 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 a32b24ba8..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(); - - - -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 443df02bf..000000000 --- a/winsup/testsuite/winsup.api/ltp/sync02.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: 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 -#include - -#include "test.h" -#include "usctest.h" - -#define TEMP_FILE "temp_file" -#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH - -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(); /* 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)) != \ - 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 570dedc6b..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(); - - - -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 827ed3201..000000000 --- a/winsup/testsuite/winsup.api/ltp/time02.c +++ /dev/null @@ -1,183 +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 - -#include "test.h" -#include "usctest.h" - -extern void setup(); /* setup function for the test */ -extern void cleanup(); /* cleanup function for the test */ - -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 0d8d1d0ca..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(); - - - -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 825046430..000000000 --- a/winsup/testsuite/winsup.api/ltp/times02.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 - * 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 - -char *TCID = "times02"; -int TST_TOTAL = 1; -extern int Tst_count; -int exp_enos[]={EFAULT, 0}; - -void setup(void); -void cleanup(void); - -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 a388c77f7..000000000 --- a/winsup/testsuite/winsup.api/ltp/times03.c +++ /dev/null @@ -1,246 +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 - -char *TCID = "times01"; -int TST_TOTAL = 1; -extern int Tst_count; -int exp_enos[]={0}; - -void setup(void); -void cleanup(void); - -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, pid1, 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) == -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) == -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) == -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) == -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 d8dc1b68e..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 */ - -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(); /* 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 b6e535cca..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 */ - -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(); /* 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 655c9e32e..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(); - - - -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(); - - - -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 f7d7c3bc8..000000000 --- a/winsup/testsuite/winsup.api/ltp/umask02.c +++ /dev/null @@ -1,134 +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" - -char *TCID = "umask02"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -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 8d032ca5c..000000000 --- a/winsup/testsuite/winsup.api/ltp/umask03.c +++ /dev/null @@ -1,169 +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 -#include "test.h" -#include "usctest.h" -#include -#include - -char *TCID = "umask01"; -int TST_TOTAL = 1; -extern int Tst_count; - -char filname[40]; - -void setup(void); -void cleanup(void); - -main(int argc, char **argv) -{ - int lc; - const char *msg; - - struct stat statbuf; - int 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 e2f8f8b0c..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(); - - - -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 63e97df89..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(); - - - -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 3d0690383..000000000 --- a/winsup/testsuite/winsup.api/ltp/unlink06.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 : 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 -#include "test.h" -#include "usctest.h" - -void setup(); -void create_file(); -void cleanup(); - - -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 889b60959..000000000 --- a/winsup/testsuite/winsup.api/ltp/unlink07.c +++ /dev/null @@ -1,329 +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 -#include /* for PATH_MAX */ -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - - -extern char *get_high_address(); - -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 { - char *pathname; - 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 */ - char *fname; - 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 a426aa03f..000000000 --- a/winsup/testsuite/winsup.api/ltp/unlink08.c +++ /dev/null @@ -1,433 +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 -#include "test.h" -#include "usctest.h" - -void setup(); -void cleanup(); - - - -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 { - char *pathname; - 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 */ - char *fname; - 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 41e48c461..000000000 --- a/winsup/testsuite/winsup.api/ltp/vfork01.c +++ /dev/null @@ -1,402 +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 -#include - -#include "test.h" -#include "usctest.h" - -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(); /* 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 8b4f41b09..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(); - - - -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 0d307e247..000000000 --- a/winsup/testsuite/winsup.api/ltp/wait401.c +++ /dev/null @@ -1,187 +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); -void setup(void); - -char *TCID= "wait401()"; -int TST_TOTAL = 1; -extern int Tst_count; - -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 43a5c22d3..000000000 --- a/winsup/testsuite/winsup.api/ltp/wait402.c +++ /dev/null @@ -1,202 +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); -void setup(void); - -char *TCID= "wait402()"; -int TST_TOTAL = 1; -extern int Tst_count; - -int exp_enos[] = {10, 0}; - -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 0fae9aea1..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(); - - - -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 1ee10fd9a..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 -#include "test.h" -#include "usctest.h" - -char *TCID = "write02()"; -int TST_TOTAL = 1; -extern int Tst_count; - -void cleanup(void); -void setup(void); - -char pfiln[40] = ""; - -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; - -block1: - 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 5343c6484..000000000 --- a/winsup/testsuite/winsup.api/ltp/write03.c +++ /dev/null @@ -1,193 +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 -#include - -/* 0 terminated list of expected errnos */ -int exp_enos[] = {14,0}; - -char *TCID = "write03"; -int TST_TOTAL = 1; -extern int Tst_count; - -void setup(void); -void cleanup(void); - -int fd = -1; -char filename[100]; - -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; - -block1: - 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 a48110eb7..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 - -#include "test.h" -#include "usctest.h" - -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 () -{ - int ret = 0; - - char fnam1[32]; - char fnam2[32]; - - int fd1; - char * buf1; - - int fd2; - char * buf2; - - char buf3[20]; - - int 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"); - 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 ec5bac7f7..000000000 --- a/winsup/testsuite/winsup.api/mmaptest02.c +++ /dev/null @@ -1,189 +0,0 @@ -#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 (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 544e3e43c..000000000 --- a/winsup/testsuite/winsup.api/mmaptest03.c +++ /dev/null @@ -1,127 +0,0 @@ -#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; - -/* 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 (char *str) -{ - printf ("%s: %s\n", str, strerror (errno)); - exit (1); -} - -void -sigsegv (int unused) -{ - sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0); - longjmp (r, 1); -} - -int -main(int argc, char **argv) -{ - int i, fd, status; - struct stat statbuf; - 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"); - - pid = fork(); - - if (pid == -1) - perror_exit ("fork failed"); - - if (setjmp (r)) - perror_exit (pid ? "SEGV in parent" : "SEGV in child"); - - c = buf1[0]; - c = buf2[0]; - - if (setjmp (r)) - perror_exit (pid ? "SEGV in parent's munmap" : "SEGV in child's munmap"); - - if (munmap(buf1, statbuf.st_size)) - perror_exit (pid ? "munmap failed in parent" : "munmap failed in child"); - - if (setjmp (r) == 0) - { - 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"); - - c = buf2[0]; - - if (setjmp (r)) - perror_exit (pid ? "SEGV in parent's munmap" : "SEGV in child's munmap"); - - if (munmap(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)) - 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 56c4a88b7..000000000 --- a/winsup/testsuite/winsup.api/mmaptest04.c +++ /dev/null @@ -1,100 +0,0 @@ -#include -#include -#include -#include - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -int -main () -{ - char *data, *data2, *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/nullgetcwd.c b/winsup/testsuite/winsup.api/nullgetcwd.c deleted file mode 100644 index f7d873261..000000000 --- a/winsup/testsuite/winsup.api/nullgetcwd.c +++ /dev/null @@ -1,16 +0,0 @@ -#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/cancel2.c b/winsup/testsuite/winsup.api/pthread/cancel2.c deleted file mode 100644 index 2d99c3414..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_MUTEX_INITIALIZER; - -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/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/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/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/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/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/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/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/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 a9a211dd7..000000000 --- a/winsup/testsuite/winsup.api/pthread/test.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * test.h - * - * Useful definitions and declarations for tests. - */ - -#ifndef _PTHREAD_TEST_H_ -#define _PTHREAD_TEST_H_ - -#include "pthread.h" -#include "sched.h" -#include "semaphore.h" -#include -#include -#include - -/* #define assert(x) do { fprint (stderr, "assertion failed\n"); exit(1) } while (0) */ - -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/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/samples/sample-fail.c b/winsup/testsuite/winsup.api/samples/sample-fail.c deleted file mode 100644 index d8beb90be..000000000 --- a/winsup/testsuite/winsup.api/samples/sample-fail.c +++ /dev/null @@ -1,4 +0,0 @@ -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 893a0b605..000000000 --- a/winsup/testsuite/winsup.api/samples/sample-pass.c +++ /dev/null @@ -1,4 +0,0 @@ -main() -{ - return 0; -} diff --git a/winsup/testsuite/winsup.api/sigchld.c b/winsup/testsuite/winsup.api/sigchld.c deleted file mode 100644 index a7d1069b7..000000000 --- a/winsup/testsuite/winsup.api/sigchld.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include - -int no_signal_caught = 1; - -void handler ( int signo ) -{ - no_signal_caught = 0; -} - -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 23437c407..000000000 --- a/winsup/testsuite/winsup.api/signal-into-win32-api.c +++ /dev/null @@ -1,57 +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", 0 ); - 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; - } -} diff --git a/winsup/testsuite/winsup.api/systemcall.c b/winsup/testsuite/winsup.api/systemcall.c deleted file mode 100644 index 026f430ff..000000000 --- a/winsup/testsuite/winsup.api/systemcall.c +++ /dev/null @@ -1,65 +0,0 @@ -#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 ()); - 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 ()); - exit (1); - } - if (pipe (fds)) - { - fprintf (stderr, "pipe call failed - %s\n", strerror ()); - 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 ()); - 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", n); - exit (1); - } - exit (0); -} diff --git a/winsup/testsuite/winsup.api/waitpid.c b/winsup/testsuite/winsup.api/waitpid.c deleted file mode 100644 index 9845cd1a4..000000000 --- a/winsup/testsuite/winsup.api/waitpid.c +++ /dev/null @@ -1,22 +0,0 @@ -#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 6d71fa912..000000000 --- a/winsup/testsuite/winsup.api/winsup.exp +++ /dev/null @@ -1,81 +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 [eval "exec $cmd"] rv - verbose send "catchCode = $rv\n" -} - -verbose "Filter: $test_filter" - -foreach src [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.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 - } - - ws_spawn "$CC -g3 -nodefaultlibs -mwin32 $CFLAGS $src $add_includes $add_libs $runtime_root/binmode.o -lgcc $runtime_root/new-libcygwin.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 "$runtime_root/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