summaryrefslogtreecommitdiffstats
path: root/general
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2009-02-22 14:43:02 -0500
committerSteve Dickson <steved@redhat.com>2009-02-22 14:43:02 -0500
commit43d64aa2dabf5029aac3e503a875a3cda6c5d253 (patch)
tree34b0d7d90205ca9f6a26c319638d80d44ee03bd7 /general
downloadcthon04-43d64aa2dabf5029aac3e503a875a3cda6c5d253.tar.gz
cthon04-43d64aa2dabf5029aac3e503a875a3cda6c5d253.tar.xz
cthon04-43d64aa2dabf5029aac3e503a875a3cda6c5d253.zip
Inital Commit
Diffstat (limited to 'general')
-rw-r--r--general/Makefile32
-rw-r--r--general/large.c443
-rw-r--r--general/large4.sh13
-rw-r--r--general/makefile.tst41
-rw-r--r--general/mkdummy16
-rw-r--r--general/nroff.in179
-rw-r--r--general/rmdummy7
-rwxr-xr-xgeneral/runtests37
-rw-r--r--general/runtests.wrk145
-rw-r--r--general/stat.c196
10 files changed, 1109 insertions, 0 deletions
diff --git a/general/Makefile b/general/Makefile
new file mode 100644
index 0000000..c26fd77
--- /dev/null
+++ b/general/Makefile
@@ -0,0 +1,32 @@
+#
+# @(#)Makefile 1.5 2003/12/29 Connectathon Testsuite
+# 1.3 Lachman ONC Test Suite source
+#
+
+DESTDIR=/no/such/path
+FILES=Makefile runtests runtests.wrk *.sh *.c mkdummy rmdummy \
+ nroff.in makefile.tst
+
+LARGE_SRC=large1.c large2.c large3.c
+
+all: $(LARGE_SRC)
+ if test ! -x runtests; then chmod a+x runtests; fi
+
+large1.c: large.c
+ rm -f large1.c
+ cp large.c large1.c
+
+large2.c: large.c
+ rm -f large2.c
+ cp large.c large2.c
+
+large3.c: large.c
+ rm -f large3.c
+ cp large.c large3.c
+
+clean:
+ rm -f *.time *.o stat $(LARGE_SRC)
+
+copy dist: all
+ cd $(DESTDIR); rm -f $(FILES)
+ cp $(FILES) $(DESTDIR)
diff --git a/general/large.c b/general/large.c
new file mode 100644
index 0000000..5dd2950
--- /dev/null
+++ b/general/large.c
@@ -0,0 +1,443 @@
+/* @(#)large.c 1.3 2002/12/13 Connectathon Testsuite */
+/*
+ * cc - front end for C compiler
+ */
+#include <sys/param.h>
+#ifndef major
+#include <sys/types.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#include <signal.h>
+#ifdef SVR4
+#include <dirent.h>
+#else
+#include <sys/dir.h>
+#endif
+
+#undef MAXNAMLEN
+#define MAXNAMLEN 256
+
+/* return type for signal handlers */
+#if defined(SVR4) || defined (TRU64)
+#define SIGHAND_T void
+#else
+#define SIGHAND_T int
+#endif
+
+char *cpp = "/lib/cpp";
+char *ccom = "/lib/ccom";
+char *c2 = "/lib/c2";
+char *as = "/bin/as";
+char *ld = "/bin/ld";
+char *crt0 = "/lib/crt0.o";
+
+char tmp0[30]; /* big enough for /tmp/ctm%05.5d */
+char *tmp1, *tmp2, *tmp3, *tmp4, *tmp5;
+char *outfile;
+char *savestr(), *strspl(), *setsuf();
+SIGHAND_T idexit();
+char **av, **clist, **llist, **plist;
+int cflag, eflag, oflag, pflag, sflag, wflag, Rflag, exflag, proflag;
+int gflag, Gflag;
+char *dflag;
+int exfail;
+char *passes;
+char *npassname;
+
+int nc, nl, np, nxo, na;
+
+#define cunlink(s) if (s) unlink(s)
+
+main(argc, argv)
+ char **argv;
+{
+ char *t;
+ char *assource;
+ int i, j, c;
+
+ /* ld currently adds upto 5 args; 10 is room to spare */
+ av = (char **)calloc(argc+10, sizeof (char **));
+ clist = (char **)calloc(argc, sizeof (char **));
+ llist = (char **)calloc(argc, sizeof (char **));
+ plist = (char **)calloc(argc, sizeof (char **));
+ for (i = 1; i < argc; i++) {
+ if (*argv[i] == '-') switch (argv[i][1]) {
+
+ case 'S':
+ sflag++;
+ cflag++;
+ continue;
+ case 'o':
+ if (++i < argc) {
+ outfile = argv[i];
+ switch (getsuf(outfile)) {
+
+ case 'c':
+ case 'o':
+ error("-o would overwrite %s",
+ outfile);
+ exit(8);
+ }
+ }
+ continue;
+ case 'R':
+ Rflag++;
+ continue;
+ case 'O':
+ oflag++;
+ continue;
+ case 'p':
+ proflag++;
+ crt0 = "/lib/mcrt0.o";
+ if (argv[i][2] == 'g')
+ crt0 = "/usr/lib/gcrt0.o";
+ continue;
+ case 'g':
+ if (argv[i][2] == 'o') {
+ Gflag++; /* old format for -go */
+ } else {
+ gflag++; /* new format for -g */
+ }
+ continue;
+ case 'w':
+ wflag++;
+ continue;
+ case 'E':
+ exflag++;
+ case 'P':
+ pflag++;
+ if (argv[i][1]=='P')
+ fprintf(stderr,
+ "cc: warning: -P option obsolete; you should use -E instead\n");
+ plist[np++] = argv[i];
+ case 'c':
+ cflag++;
+ continue;
+ case 'D':
+ case 'I':
+ case 'U':
+ case 'C':
+ plist[np++] = argv[i];
+ continue;
+ case 't':
+ if (passes)
+ error("-t overwrites earlier option", 0);
+ passes = argv[i]+2;
+ if (passes[0]==0)
+ passes = "012p";
+ continue;
+ case 'f':
+ fprintf(stderr,
+ "cc: warning: -f option obsolete (unnecessary)\n");
+ continue;
+ case 'B':
+ if (npassname)
+ error("-B overwrites earlier option", 0);
+ npassname = argv[i]+2;
+ if (npassname[0]==0)
+ npassname = "/usr/c/o";
+ continue;
+ case 'd':
+ dflag = argv[i];
+ continue;
+ }
+ t = argv[i];
+ c = getsuf(t);
+ if (c=='c' || c=='s' || exflag) {
+ clist[nc++] = t;
+ t = setsuf(t, 'o');
+ }
+ if (nodup(llist, t)) {
+ llist[nl++] = t;
+ if (getsuf(t)=='o')
+ nxo++;
+ }
+ }
+ if (gflag || Gflag) {
+ if (oflag)
+ fprintf(stderr, "cc: warning: -g disables -O\n");
+ oflag = 0;
+ }
+ if (npassname && passes ==0)
+ passes = "012p";
+ if (passes && npassname==0)
+ npassname = "/usr/new";
+ if (passes)
+ for (t=passes; *t; t++) {
+ switch (*t) {
+
+ case '0':
+ ccom = strspl(npassname, "ccom");
+ continue;
+ case '2':
+ c2 = strspl(npassname, "c2");
+ continue;
+ case 'p':
+ cpp = strspl(npassname, "cpp");
+ continue;
+ }
+ }
+ if (nc==0)
+ goto nocom;
+ if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+ signal(SIGINT, idexit);
+ if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
+ signal(SIGTERM, idexit);
+ if (pflag==0)
+ sprintf(tmp0, "/tmp/ctm%05.5d", getpid());
+ tmp1 = strspl(tmp0, "1");
+ tmp2 = strspl(tmp0, "2");
+ tmp3 = strspl(tmp0, "3");
+ if (pflag==0)
+ tmp4 = strspl(tmp0, "4");
+ if (oflag)
+ tmp5 = strspl(tmp0, "5");
+ for (i=0; i<nc; i++) {
+ if (nc > 1) {
+ printf("%s:\n", clist[i]);
+ fflush(stdout);
+ }
+ if (getsuf(clist[i]) == 's') {
+ assource = clist[i];
+ goto assemble;
+ } else
+ assource = tmp3;
+ if (pflag)
+ tmp4 = setsuf(clist[i], 'i');
+ av[0] = "cpp"; av[1] = clist[i]; av[2] = exflag ? "-" : tmp4;
+ na = 3;
+ for (j = 0; j < np; j++)
+ av[na++] = plist[j];
+ av[na++] = 0;
+ if (callsys(cpp, av)) {
+ exfail++;
+ eflag++;
+ }
+ if (pflag || exfail) {
+ cflag++;
+ continue;
+ }
+ if (sflag)
+ assource = tmp3 = setsuf(clist[i], 's');
+ av[0] = "ccom"; av[1] = tmp4; av[2] = oflag?tmp5:tmp3; na = 3;
+ if (proflag)
+ av[na++] = "-XP";
+ if (gflag) {
+ av[na++] = "-Xg";
+ } else if (Gflag) {
+ av[na++] = "-XG";
+ }
+ if (wflag)
+ av[na++] = "-w";
+ av[na] = 0;
+ if (callsys(ccom, av)) {
+ cflag++;
+ eflag++;
+ continue;
+ }
+ if (oflag) {
+ av[0] = "c2"; av[1] = tmp5; av[2] = tmp3; av[3] = 0;
+ if (callsys(c2, av)) {
+ unlink(tmp3);
+ tmp3 = assource = tmp5;
+ } else
+ unlink(tmp5);
+ }
+ if (sflag)
+ continue;
+ assemble:
+ cunlink(tmp1); cunlink(tmp2); cunlink(tmp4);
+ av[0] = "as"; av[1] = "-o"; av[2] = setsuf(clist[i], 'o');
+ na = 3;
+ if (Rflag)
+ av[na++] = "-R";
+ if (dflag)
+ av[na++] = dflag;
+ av[na++] = assource;
+ av[na] = 0;
+ if (callsys(as, av) > 1) {
+ cflag++;
+ eflag++;
+ continue;
+ }
+ }
+nocom:
+ if (cflag==0 && nl!=0) {
+ i = 0;
+ av[0] = "ld"; av[1] = "-X"; av[2] = crt0; na = 3;
+ if (outfile) {
+ av[na++] = "-o";
+ av[na++] = outfile;
+ }
+ while (i < nl)
+ av[na++] = llist[i++];
+ if (gflag || Gflag)
+ av[na++] = "-lg";
+ if (proflag)
+ av[na++] = "-lc_p";
+ else
+ av[na++] = "-lc";
+ av[na++] = 0;
+ eflag |= callsys(ld, av);
+ if (nc==1 && nxo==1 && eflag==0)
+ unlink(setsuf(clist[0], 'o'));
+ }
+ dexit();
+}
+
+SIGHAND_T
+idexit()
+{
+
+ eflag = 100;
+ dexit();
+}
+
+dexit()
+{
+
+ if (!pflag) {
+ cunlink(tmp1);
+ cunlink(tmp2);
+ if (sflag==0)
+ cunlink(tmp3);
+ cunlink(tmp4);
+ cunlink(tmp5);
+ }
+ exit(eflag);
+}
+
+error(s, x)
+ char *s, *x;
+{
+ FILE *diag = exflag ? stderr : stdout;
+
+ fprintf(diag, "cc: ");
+ fprintf(diag, s, x);
+ putc('\n', diag);
+ exfail++;
+ cflag++;
+ eflag++;
+}
+
+getsuf(as)
+char as[];
+{
+ register int c;
+ register char *s;
+ register int t;
+
+ s = as;
+ c = 0;
+ while (t = *s++)
+ if (t=='/')
+ c = 0;
+ else
+ c++;
+ s -= 3;
+ if (c <= MAXNAMLEN && c > 2 && *s++ == '.')
+ return (*s);
+ return (0);
+}
+
+char *
+setsuf(as, ch)
+ char *as;
+{
+ register char *s, *s1;
+
+ s = s1 = savestr(as);
+ while (*s)
+ if (*s++ == '/')
+ s1 = s;
+ s[-1] = ch;
+ return (s1);
+}
+
+callsys(f, v)
+ char *f, **v;
+{
+ int t, status;
+
+ t = fork();
+ if (t == -1) {
+ printf("No more processes\n");
+ return (100);
+ }
+ if (t == 0) {
+ execv(f, v);
+ printf("Can't find %s\n", f);
+ fflush(stdout);
+ _exit(100);
+ }
+ while (t != wait(&status))
+ ;
+ if ((t=(status&0377)) != 0 && t!=14) {
+ if (t!=2) {
+ printf("Fatal error in %s\n", f);
+ eflag = 8;
+ }
+ dexit();
+ }
+ return ((status>>8) & 0377);
+}
+
+nodup(l, os)
+ char **l, *os;
+{
+ register char *t, *s;
+ register int c;
+
+ s = os;
+ if (getsuf(s) != 'o')
+ return (1);
+ while (t = *l++) {
+ while (c = *s++)
+ if (c != *t++)
+ break;
+ if (*t==0 && c==0)
+ return (0);
+ s = os;
+ }
+ return (1);
+}
+
+#define NSAVETAB 1024
+char *savetab;
+int saveleft;
+
+char *
+savestr(cp)
+ register char *cp;
+{
+ register int len;
+
+ len = strlen(cp) + 1;
+ if (len > saveleft) {
+ saveleft = NSAVETAB;
+ if (len > saveleft)
+ saveleft = len;
+ savetab = (char *)malloc(saveleft);
+ if (savetab == 0) {
+ fprintf(stderr, "ran out of memory (savestr)\n");
+ exit(1);
+ }
+ }
+ strncpy(savetab, cp, len);
+ cp = savetab;
+ savetab += len;
+ saveleft -= len;
+ return (cp);
+}
+
+char *
+strspl(left, right)
+ char *left, *right;
+{
+ char buf[BUFSIZ];
+
+ strcpy(buf, left);
+ strcat(buf, right);
+ return (savestr(buf));
+}
diff --git a/general/large4.sh b/general/large4.sh
new file mode 100644
index 0000000..7c3117f
--- /dev/null
+++ b/general/large4.sh
@@ -0,0 +1,13 @@
+:
+#! /bin/sh
+#
+# @(#)large4.sh 1.2 97/01/03 Connectathon Testsuite
+# 1.4 Lachman ONC Test Suite source
+#
+
+$CC $CFLAGS -o large large.c&
+$CC $CFLAGS -o large1 large1.c&
+$CC $CFLAGS -o large2 large2.c&
+$CC $CFLAGS -o large3 large3.c&
+wait
+rm large large1 large2 large3
diff --git a/general/makefile.tst b/general/makefile.tst
new file mode 100644
index 0000000..78deca9
--- /dev/null
+++ b/general/makefile.tst
@@ -0,0 +1,41 @@
+#
+# @(#)makefile.tst 1.1 97/01/03 Connectathon Testsuite
+#
+HDRS = /usr/include/stdio.h /usr/include/ctype.h \
+ /usr/include/time.h /usr/include/pwd.h \
+ /usr/include/signal.h /usr/include/setjmp.h
+XOBJ = dummy1.o dummy2.o dummy3.o dummy4.o dummy5.o \
+ dummy6.o dummy7.o dummy8.o dummy9.o dummy10.o \
+ dummy11.o dummy12.o dummy13.o dummy14.o dummy15.o \
+ dummy16.o dummy17.o dummy18.o dummy19.o dummy20.o \
+ dummy21.o dummy22.o dummy23.o dummy24.o dummy25.o
+.c.o: ; echo $@ > /dev/null
+
+x: $(XOBJ)
+ echo done > /dev/null
+
+dummy1.o: dummy1.c $(HDRS)
+dummy2.o: dummy2.c $(HDRS)
+dummy3.o: dummy3.c $(HDRS)
+dummy4.o: dummy4.c $(HDRS)
+dummy5.o: dummy5.c $(HDRS)
+dummy6.o: dummy6.c $(HDRS)
+dummy7.o: dummy7.c $(HDRS)
+dummy8.o: dummy8.c $(HDRS)
+dummy9.o: dummy9.c $(HDRS)
+dummy10.o: dummy10.c $(HDRS)
+dummy11.o: dummy11.c $(HDRS)
+dummy12.o: dummy12.c $(HDRS)
+dummy13.o: dummy13.c $(HDRS)
+dummy14.o: dummy14.c $(HDRS)
+dummy15.o: dummy15.c $(HDRS)
+dummy16.o: dummy16.c $(HDRS)
+dummy17.o: dummy17.c $(HDRS)
+dummy18.o: dummy18.c $(HDRS)
+dummy19.o: dummy19.c $(HDRS)
+dummy20.o: dummy20.c $(HDRS)
+dummy21.o: dummy21.c $(HDRS)
+dummy22.o: dummy22.c $(HDRS)
+dummy23.o: dummy23.c $(HDRS)
+dummy24.o: dummy24.c $(HDRS)
+dummy25.o: dummy25.c $(HDRS)
diff --git a/general/mkdummy b/general/mkdummy
new file mode 100644
index 0000000..78b3fc9
--- /dev/null
+++ b/general/mkdummy
@@ -0,0 +1,16 @@
+:
+#! /bin/sh
+#
+# @(#)mkdummy 1.2 97/01/03 Connectathon Testsuite
+#
+
+bases=" 1 2 3 4 5 6 7 8 9 10
+ 11 12 13 14 15 16 17 18 19 20
+ 21 22 23 24 25"
+rm -rf dummy*
+for i in $bases; do
+ touch dummy$i.o
+done
+for i in $bases; do
+ touch dummy$i.c
+done
diff --git a/general/nroff.in b/general/nroff.in
new file mode 100644
index 0000000..522ac80
--- /dev/null
+++ b/general/nroff.in
@@ -0,0 +1,179 @@
+.\" @(#)nroff.in 1.1 97/01/03 Connectathon Testsuite
+.DA
+.ds RF Company Confidential
+.ds LF Sun Microsystems
+.nr PS 12
+.nr VS 14
+.ps 12
+.vs 14
+.TL
+Fortran Benchmarks from General Electric
+.AU
+Evan Adams
+.LP
+Walter Sawka from the New York office sent a memo
+on June 21, 1983 detailing fortran performance.
+It included the source and results to three fortran
+benchmarks.
+.LP
+I ran the benchmarks on the following configurations:
+.TS
+center;
+l l l l.
+CPU Unix Fortran Memory
+.sp 4p
+Sun 1 Version 7 SVS 1 Meg
+Sun 1.5 Sun 0.4 Berkeley 2 Meg
+Sun 2 Sun 0.3 Berkeley 2 Meg
+Sun 2 Sun 0.3 Berkeley/Optimizer 2 Meg
+VAX 750 4.1cBSD Berkeley/Optimizer 4 Meg
+.TE
+.LP
+The benchmarks are:
+.IP 1)
+Matrix inversion of double precision values.
+.IP 2)
+A bubble sort of integers.
+.IP 3)
+A prime number generator.
+.LP
+.TS
+center;
+ c|c|c s|c s|
+ c|c|c s|c s|
+ c|c|c s|c s|
+ c|c|c s|c s|
+|l|n|n|n|n|n|.
+ _ _ _ _ _
+.sp 4p
+ Matrix Inversion Bubble Sort Prime Numbers
+.sp 4p
+ _ _ _ _ _
+.sp 4p
+ Dimension Number of Elements Highest N
+.sp 4p
+_ _ _ _ _ _
+.sp 4p
+Configuration 50 1000 2000 10000 50000
+.sp 4p
+=
+.sp 3p
+Version 7 91.7 23.1 88.9 24.3 180.1
+.sp 3p
+_
+.sp 3p
+Sun 1.5 74.9 29.0 112.7 49.0/28.5\(dg 290.3/188.6\(dg
+.sp 3p
+_
+.sp 3p
+Sun 2 60.5 22.8 88.0 39.1/22.7\(dg 231.4/150.6\(dg
+.sp 3p
+_
+.sp 3p
+Sun 2 (OPT) 55.9 15.8 59.9 38.3/22.7\(dg 227.6/150.6\(dg
+.sp 3p
+_
+.sp 3p
+Apollo 68000 61 30 122 19 164
+.sp 3p
+_
+.sp 3p
+Apollo DN300 51 25 94 16 130
+.sp 3p
+_
+.sp 3p
+Apollo (PE) 28 22 88 14 127
+.sp 3p
+_
+.sp 3p
+VAX (OPT) 19.3 12.1 46.4 14.5 87.2
+.sp 3p
+_
+.TE
+.LP
+\(dg using a single precision square root function
+.LP
+All times are in seconds.
+The times for the Apollo machines are from Walt's memo.
+His memo claims the times are elapsed (wall clock) time.
+This seems silly since most of the programs prompt for some information.
+The times for V7 and 4.2 are user time as given by the /bin/time command.
+The Apollo is a 68000 at 10Mhz,
+the Apollo DN300 is a 68010 at 10MHz, and
+the Apollo (PE) is a 68000 at 10Mhz with the performance enhancement option.
+.LP
+The Apollo numbers for the prime number generator
+with a highest N of 10000 look suspect.
+I find it difficult to believe that the Apollo (PE)
+beat the VAX in this benchmark while it was
+consistently beaten badly in the other benchmarks.
+.LP
+Berkeley fortran fared poorly in the prime number generator.
+This program makes many calls to the square root function.
+The square root function is part of the math library and is written
+in C.
+To take the square root of a single precision number
+it is converted to doubled precision and passed to sqrt().
+A double precision square root is calculated and returned where
+it is promptly converted to single precision.
+Approximately 75% of the execution time was spent in sqrt() and its
+descendants.
+.LP
+I wrote a single precision sqrt() routine in
+fortran and the prime number generator ran 43% faster on
+the Sun 2.
+.LP
+The fortran optimizer mainly improves array references within
+inner loops.
+The bubble sort improves by 30%; the prime number generator
+does not change at all.
+.LP
+It should also be noted that the system times on the 4.2 systems were
+2 to 7 times greater than the system times for the version 7 system.
+On version 7, the system time averaged 2.4% of the user time.
+On the Sun 2, the system time averaged 8.2% of the user time.
+.SH
+Conclusions
+.LP
+The same object code ran on the Sun 1.5 and the Sun 2.
+The Sun 2 execution times averaged 20.6% less than the Sun 1.5.
+There was speculation that the Sun 2 performance would improve
+by as much as 30% as compared to Sun 1.5.
+Some people may be disappointed by these numbers.
+.LP
+The Sun 2 with the fortran optimizer beats the best Apollo
+time by 28% for the sorting program.
+I believe that the Apollo performance enhancement option includes
+hardware floating point.
+Still, the Sun 2 is 9% slower than the Apollo DN300 on the matrix
+inversion program and a factor of two slower on the prime number
+generator.
+Taking into account the double precision/single precision problem
+for the prime number generator, the Sun 2 is 13% slower
+than the Apollo DN300.
+.LP
+The fortran optimizer is still in a developement stage and
+is not very reliable yet.
+It is not ready for release!
+.SH
+Future
+.LP
+The benchmark numbers give us a reflection of where
+we are at today.
+The ultimate goal is
+.IP 1)
+A Sun 2 CPU,
+.IP 2)
+Unix 4.2BSD (not 4.1c),
+.IP 3)
+the SKY floating point board,
+.IP 4)
+the fortran optimizer,
+.IP 5)
+a single precision and double precision math library, and
+.IP 6)
+an improved fortran I/O library.
+.LP
+Development is in progress for everything but the libraries.
+It is conjecture, but with each of these components in place
+we should beat Apollo consistently.
diff --git a/general/rmdummy b/general/rmdummy
new file mode 100644
index 0000000..bd93e68
--- /dev/null
+++ b/general/rmdummy
@@ -0,0 +1,7 @@
+:
+#! /bin/sh
+#
+# @(#)rmdummy 1.2 97/01/03 Connectathon Testsuite
+#
+
+rm -rf dummy*
diff --git a/general/runtests b/general/runtests
new file mode 100755
index 0000000..2b7ae0b
--- /dev/null
+++ b/general/runtests
@@ -0,0 +1,37 @@
+:
+#!/bin/sh
+#
+# @(#)runtests 1.4 2001/12/07 Connectathon Testsuite
+#
+
+# If the initialization file is present, assume we are in the distribution
+# tree and that we must copy the tests to the test directory. Otherwise,
+# we are in the test directory and can just run the tests
+
+InitFile="../tests.init"
+
+if test -f $InitFile
+then
+ . $InitFile
+ export PATH CC CFLAGS LIBS
+ echo "GENERAL TESTS: directory $NFSTESTDIR"
+ mkdir $NFSTESTDIR
+ if test ! -d $NFSTESTDIR
+ then
+ echo "Can't make directory $NFSTESTDIR"
+ exit 1
+ fi
+ make copy DESTDIR=$NFSTESTDIR
+ if test $? -ne 0
+ then
+ exit 1
+ fi
+ cd $NFSTESTDIR
+else
+ NFSTESTDIR=`pwd`
+ export PATH
+ echo "GENERAL TESTS: directory $NFSTESTDIR"
+ make
+fi
+
+exec sh runtests.wrk FROM_RUNTESTS
diff --git a/general/runtests.wrk b/general/runtests.wrk
new file mode 100644
index 0000000..24df09a
--- /dev/null
+++ b/general/runtests.wrk
@@ -0,0 +1,145 @@
+#!/bin/sh
+#
+# @(#)runtests.wrk 1.9 2003/12/30 Connectathon Testsuite
+# 1.4 Lachman ONC Test Suite source
+#
+# This script is intended to be invoked from 'runtests'
+# Don't run it manually
+
+case x$1 in
+ xFROM_RUNTESTS)
+ ;;
+ *)
+ echo "$0 must be run from 'runtests' - Don't run manually"
+ exit 1
+ ;;
+esac
+
+errexit='cat $FILE; exit 1'
+
+TIME=time
+# if the default time command doesn't return the right format,
+# you may have to use the following lines
+case `uname` in
+[lL]inux*)
+ TIME=/usr/bin/time
+ ;;
+*)
+ TIME=/bin/time
+ ;;
+esac
+if [ ! -f $TIME ]
+then
+ TIME=/usr/bin/time
+ if [ ! -f $TIME ]
+ then
+ echo "Where is the time command?"
+ exit 1
+ fi
+fi
+
+chmod 777 large4.sh mkdummy rmdummy
+umask 0
+
+# Newer compilers tend to produce warning messages for the source code
+# that is used for the general tests. This confuses "stat". There
+# are a couple ways we could fix this (e.g., make "stat" ignore
+# compiler warnings). But since the general tests as a whole probably
+# should be replaced by something that is less Unix-centric, we'll
+# just hack around the problem by supressing compiler warnings.
+CFLAGS="$CFLAGS -w"
+export CFLAGS
+
+echo ""
+echo "Small Compile"
+rm -f smcomp.time
+FILE=smcomp.time
+set -x
+$TIME $CC $CFLAGS -o stat stat.c -lm 2>> smcomp.time || eval $errexit
+$TIME $CC $CFLAGS -o stat stat.c -lm 2>> smcomp.time || eval $errexit
+$TIME $CC $CFLAGS -o stat stat.c -lm 2>> smcomp.time || eval $errexit
+$TIME $CC $CFLAGS -o stat stat.c -lm 2>> smcomp.time || eval $errexit
+$TIME $CC $CFLAGS -o stat stat.c -lm 2>> smcomp.time || eval $errexit
+ls smcomp.time
+set -e
+./stat smcomp.time
+set +e
+
+echo ""
+echo "Tbl"
+rm -f tbl.time
+$TIME tbl nroff.in > nroff.tbl 2>> tbl.time || cat tbl.time
+$TIME tbl nroff.in > nroff.tbl 2>> tbl.time || cat tbl.time
+$TIME tbl nroff.in > nroff.tbl 2>> tbl.time || cat tbl.time
+$TIME tbl nroff.in > nroff.tbl 2>> tbl.time || cat tbl.time
+$TIME tbl nroff.in > nroff.tbl 2>> tbl.time || cat tbl.time
+set -e
+# Filter excessive noise from GNU tbl. Should be harmless for other
+# versions of tbl.
+egrep -v '^tbl:.*$' <tbl.time >tbl.new
+mv -f tbl.new tbl.time
+./stat tbl.time
+set +e
+
+echo ""
+echo "Nroff"
+rm -f nroff.time
+$TIME nroff < nroff.tbl > nroff.out 2>> nroff.time || cat nroff.time
+$TIME nroff < nroff.tbl > nroff.out 2>> nroff.time || cat nroff.time
+$TIME nroff < nroff.tbl > nroff.out 2>> nroff.time || cat nroff.time
+$TIME nroff < nroff.tbl > nroff.out 2>> nroff.time || cat nroff.time
+$TIME nroff < nroff.tbl > nroff.out 2>> nroff.time || cat nroff.time
+rm nroff.out nroff.tbl
+set -e
+./stat nroff.time
+set +e
+
+echo ""
+echo "Large Compile"
+rm -f lrgcomp.time
+FILE=lrgcomp.time
+$TIME $CC $CFLAGS -o large large.c 2>> lrgcomp.time || eval $errexit
+$TIME $CC $CFLAGS -o large large.c 2>> lrgcomp.time || eval $errexit
+$TIME $CC $CFLAGS -o large large.c 2>> lrgcomp.time || eval $errexit
+$TIME $CC $CFLAGS -o large large.c 2>> lrgcomp.time || eval $errexit
+$TIME $CC $CFLAGS -o large large.c 2>> lrgcomp.time || eval $errexit
+rm large
+set -e
+./stat lrgcomp.time
+set +e
+
+echo ""
+echo "Four simultaneous large compiles"
+rm -f 4lrg.time
+FILE=4lrg.time
+$TIME ./large4.sh 2>> 4lrg.time || eval $errexit
+$TIME ./large4.sh 2>> 4lrg.time || eval $errexit
+$TIME ./large4.sh 2>> 4lrg.time || eval $errexit
+$TIME ./large4.sh 2>> 4lrg.time || eval $errexit
+$TIME ./large4.sh 2>> 4lrg.time || eval $errexit
+set -e
+./stat 4lrg.time
+set +e
+
+echo ""
+echo "Makefile"
+mkdummy
+rm -f makefile.time
+FILE=makefile.time
+$TIME make -e -f makefile.tst > /dev/null 2>> makefile.time || eval $errexit
+$TIME make -e -f makefile.tst > /dev/null 2>> makefile.time || eval $errexit
+$TIME make -e -f makefile.tst > /dev/null 2>> makefile.time || eval $errexit
+$TIME make -e -f makefile.tst > /dev/null 2>> makefile.time || eval $errexit
+$TIME make -e -f makefile.tst > /dev/null 2>> makefile.time || eval $errexit
+rmdummy
+# Remove warnings (e.g., due to clock skew) that might confuse "stat".
+grep -iv warning: makefile.time | grep -v 'make: ' > makefile.time2
+mv makefile.time2 makefile.time
+set -e
+./stat makefile.time
+set +e
+
+echo ""
+echo "General tests complete"
+
+exit 0
diff --git a/general/stat.c b/general/stat.c
new file mode 100644
index 0000000..c4e4fc0
--- /dev/null
+++ b/general/stat.c
@@ -0,0 +1,196 @@
+/* @(#)stat.c 1.1 97/01/03 Connectathon Testsuite */
+/* 1.3 Lachman ONC Test Suite source */
+
+#include <stdio.h>
+#include <math.h>
+
+/*
+ * crunch through time stat files. This program will handle two
+ * formats: BSD
+ * 1.7 real 0.0 user 0.4 sys
+ * and ATT
+ * real 1.4
+ * user 0.0
+ * sys 0.2
+ *
+ * ATT format may break out minutes -- 2:03.2
+ */
+#define MAXINDEX 100
+double real[MAXINDEX];
+double user[MAXINDEX];
+double sys[MAXINDEX];
+char *Prog, *File;
+
+int getattfmt();
+void prtstat();
+
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ FILE *fp;
+ int i, n;
+ char c, *fmt;
+ int attfmt = 0; /* set if using att time format */
+
+ Prog = argv[0];
+ if (argc == 1) {
+ fprintf(stderr, "Usage: %s datafile\n", Prog);
+ exit(1);
+ }
+ File = argv[1];
+ fp = fopen(File, "r");
+ if (fp == NULL) {
+ fprintf(stderr, "%s: unable to open %s\n",
+ Prog, File);
+ exit(1);
+ }
+ if ((i = fgetc(fp)) == EOF) {
+ fprintf(stderr, "%s: %s is empty\n",
+ Prog, File);
+ exit(1);
+ }
+ c = i & 0x7f;
+ if (c == '\n' || c == '\r' || c == 'r')
+ attfmt = 1;
+ else
+ fmt = "%lf %*s %lf %*s %lf %*s"; /* BSD fmt */
+ if (ungetc(c, fp) == EOF) {
+ fprintf(stderr, "%s: can't push char back to %s\n",
+ Prog, File);
+ exit(1);
+ }
+
+ if (attfmt) {
+ for (n = 0; getattfmt(fp, n, 1); n++) {
+ (void) getattfmt(fp, n, 2);
+ (void) getattfmt(fp, n, 3);
+ }
+ } else {
+ n = 0;
+ while (fscanf(fp, fmt, &real[n], &user[n], &sys[n]) == 3)
+ n++;
+ }
+ if (n == 0) {
+ fprintf(stderr, "%s: no data in %s\n",
+ Prog, File);
+#ifdef SVR3
+ exit(0);
+#else
+ exit(1);
+#endif
+ }
+ prtstat(real, n);
+ printf(" real");
+ prtstat(user, n);
+ printf(" user");
+ prtstat(sys, n);
+ printf(" sys\n");
+
+ exit(0);
+}
+
+/*
+ * which: 1: real, 2:user, 3:sys
+ *
+ * returns 0 if no more data, else 1
+ */
+int
+getattfmt(fp, n, which)
+ FILE *fp;
+ int n, which;
+{
+ char buf[BUFSIZ];
+ char *p;
+ char *fmt;
+ double *dp;
+ int min, err = 0;
+
+ if (n < 0 || n >= MAXINDEX) {
+ fprintf(stderr, "%s: illegal index=%d in getattfmt\n",
+ Prog, n);
+ exit(1);
+ }
+
+ switch (which) {
+ case 1: /* real */
+ dp = &real[n];
+ break;
+ case 2: /* user */
+ dp = &user[n];
+ break;
+ case 3: /* sys */
+ dp = &sys[n];
+ break;
+ default:
+ fprintf(stderr, "%s: illegal which=%d in getattfmt\n",
+ Prog, which);
+ exit(1);
+ }
+
+ while (fgets(buf, BUFSIZ, fp)) {
+ /* null out newline */
+ for (p = buf; *p != '\0' && *p != '\n'; p++)
+ ;
+ if (*p == '\n')
+ *p = '\0';
+
+ /* look for blank line and skip it */
+ for (p = buf; *p != '\0' && (*p == ' ' || *p == '\t'); p++)
+ ;
+ if (*p == '\0')
+ continue;
+
+ min = 0;
+ for (p = buf; *p != '\0' && *p != ':'; p++)
+ ;
+ if (*p == ':') {
+ fmt = "%*s %d:%lf";
+ if (sscanf(buf, fmt, &min, dp) != 2)
+ err = 1;
+ } else {
+ fmt = "%*s %lf";
+ if (sscanf(buf, fmt, dp) != 1)
+ err = 1;
+ }
+ if (err) {
+ fprintf(stderr, "%s: bad data format in %s (%s)\n",
+ Prog, File, buf);
+ exit(1);
+ }
+ if (min > 0)
+ *dp += (double)(min * 60);
+ return (1);
+ }
+
+ /* EOF */
+ if (which == 1)
+ return (0);
+
+ fprintf(stderr, "%s: premature EOF in %s\n", Prog, File);
+ exit(1);
+}
+
+void
+prtstat(array, n)
+ double array[];
+ int n;
+{
+ double avg, sd;
+ int i;
+
+ avg = 0;
+ for (i = 0; i < n; i++)
+ avg += array[i];
+ avg = avg / (float) n;
+
+ sd = 0;
+ for (i = 0; i < n; i++)
+ sd += (array[i] - avg)*(array[i] - avg);
+ if (n > 1) {
+ sd = sd / (float) (n - 1);
+ sd = sqrt(sd);
+ } else
+ sd = 0.0;
+ printf("\t%.1f (%.1f)", avg, sd);
+}