1infix ++
2val op++ = OS.Path.concat
3
4fun touch p = TextIO.closeOut (TextIO.openOut p)
5fun die s = (TextIO.output(TextIO.stdErr, s ^ "\n");
6             OS.Process.exit OS.Process.failure)
7
8fun safedel p = OS.FileSys.remove p handle OS.SysErr _ => ()
9fun contents p =
10  let
11    val strm = TextIO.openIn p
12  in
13    TextIO.inputAll strm before
14    TextIO.closeIn strm
15  end
16fun exists p = OS.FileSys.access(p, [])
17
18val testfiles = ["../depchain1/dir3/foo.uo", "../depchain1/dir2/dir1/bar.uo",
19                 "../depchain1/dir2/foo"]
20
21val _ = app touch testfiles
22val _ = case List.find (not o exists) testfiles of
23            NONE => ()
24          | SOME f => die ("Didn't manage to touch "^f)
25
26
27val dir = OS.FileSys.getDir()
28val _ = OS.Process.atExit
29          (fn () => (OS.FileSys.chDir dir;
30                     app safedel ("../depchain1/dir3/log" :: testfiles)))
31
32
33val _ = OS.FileSys.chDir "../depchain1/dir3"
34
35val res =
36    Systeml.systeml [Systeml.HOLDIR ++ "bin" ++ "Holmake", "-r", "cleanAll"]
37
38val _ = OS.Process.isSuccess res orelse die "Holmake didn't exit successfully"
39
40val _ = OS.FileSys.chDir dir
41
42val _ = case List.find exists testfiles of
43            NONE => ()
44          | SOME f => die ("Holmake left "^f^" still present")
45