diff options
| author | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
| commit | 37da2899f40661e3e9631e497da8dc59b971cbd0 (patch) | |
| tree | cbc6d4680e347d906f5fa7fca73214418741df72 /appl/lib/itslib.b | |
| parent | 54bc8ff236ac10b3eaa928fd6bcfc0cdb2ba46ae (diff) | |
20060303a
Diffstat (limited to 'appl/lib/itslib.b')
| -rw-r--r-- | appl/lib/itslib.b | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/appl/lib/itslib.b b/appl/lib/itslib.b new file mode 100644 index 00000000..d574965d --- /dev/null +++ b/appl/lib/itslib.b @@ -0,0 +1,45 @@ +implement Itslib; + +include "sys.m"; + sys: Sys; +include "itslib.m"; +include "env.m"; + env: Env; + + +init(): ref Tconfig +{ + sys = load Sys Sys->PATH; + tc := ref Tconfig(-1, sys->fildes(2)); + env = load Env Env->PATH; + if (env == nil) + sys->fprint(sys->fildes(2), "Failed to load %s\n", Env->PATH); + else { + vstr := env->getenv(ENV_VERBOSITY); + mstr := env->getenv(ENV_MFD); + if (vstr != nil && mstr != nil) { + tc.verbosity = int vstr; + tc.mfd = sys->fildes(int mstr); + } + } + if (tc.verbosity >= 0) + tc.report(S_STIME, 0, sys->sprint("%d", sys->millisec())); + else + sys->fprint(sys->fildes(2), "Test is running standalone\n"); + return tc; +} + +Tconfig.report(tc: self ref Tconfig, sev: int, verb: int, msg: string) +{ + if (sev < 0 || sev > S_ETIME) { + sys->fprint(sys->fildes(2), "Tconfig.report: Bad severity code: %d\n", sev); + sev = 0; + } + if (tc.mfd != nil && sys->fprint(tc.mfd, "%d%d%s\n", sev, verb, msg) <=0) + tc.mfd = nil; # Master test process was probably killed +} + +Tconfig.done(tc: self ref Tconfig) +{ + tc.report(S_ETIME, 0, sys->sprint("%d", sys->millisec())); +} |
