diff options
author | Ori Bernstein <ori@eigenstate.org> | 2015-09-11 18:03:00 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2015-09-11 18:03:00 -0700 |
commit | d2a4d99cee1cbff164e6b80560a0930043ba38a4 (patch) | |
tree | ea77141cdee3de78b83f31bb504be38d10b312c4 | |
parent | bcae988a72a65bdc6597b3116a6a247e3df98487 (diff) | |
download | mc-d2a4d99cee1cbff164e6b80560a0930043ba38a4.tar.gz |
Update BIO tests and bootstrap.
-rw-r--r-- | lib/bio/test/bio-create.myr | 4 | ||||
-rw-r--r-- | lib/bio/test/bio-delim.myr | 4 | ||||
-rw-r--r-- | lib/bio/test/bio-endianrd.myr | 10 | ||||
-rw-r--r-- | lib/bio/test/bio-endianwr.myr | 4 | ||||
-rw-r--r-- | lib/bio/test/bio-peek.myr | 4 | ||||
-rw-r--r-- | lib/bio/test/bio-read.myr | 11 | ||||
-rw-r--r-- | lib/bio/test/bio-unitwr.myr | 4 | ||||
-rw-r--r-- | lib/bio/test/bio-write.myr | 4 | ||||
-rwxr-xr-x | lib/bio/test/runtest.sh | 2 | ||||
-rwxr-xr-x | mk/bootstrap/bootstrap+Linux-x86_64.sh | 12 |
10 files changed, 26 insertions, 33 deletions
diff --git a/lib/bio/test/bio-create.myr b/lib/bio/test/bio-create.myr index 6954e32..a15c9f0 100644 --- a/lib/bio/test/bio-create.myr +++ b/lib/bio/test/bio-create.myr @@ -6,8 +6,8 @@ const main = { std.mkdir("tmpout", 0o755); match bio.create("tmpout/test-create", bio.Wr, 0o644) - | `std.Some bio: f = bio - | `std.None: std.fatal(1, "Failed to open file\n") + | `std.Ok bio: f = bio + | `std.Fail m: std.fatal("Failed to open file: {}\n", m) ;; bio.close(f) } diff --git a/lib/bio/test/bio-delim.myr b/lib/bio/test/bio-delim.myr index 231c469..af9adf5 100644 --- a/lib/bio/test/bio-delim.myr +++ b/lib/bio/test/bio-delim.myr @@ -6,8 +6,8 @@ const main = { var d match bio.open("data/lines", bio.Rd) - | `std.Some bio: f = bio - | `std.None: std.fatal(1, "Unable to open data file\n") + | `std.Ok bio: f = bio + | `std.Fail m: std.fatal("Unable to open data file: {}\n", m) ;; /* read first line */ diff --git a/lib/bio/test/bio-endianrd.myr b/lib/bio/test/bio-endianrd.myr index 53743d8..6011496 100644 --- a/lib/bio/test/bio-endianrd.myr +++ b/lib/bio/test/bio-endianrd.myr @@ -4,7 +4,7 @@ use bio generic try = {opt : std.option(@a::(integral,numeric))-> @a::(integral,numeric) match opt | `std.Some val: -> val - | `std.None: std.fatal(1, "read failed") + | `std.None: std.fatal("read failed") ;; } const main = { @@ -16,8 +16,8 @@ const main = { /* use the expected write data as read data */ match bio.open("data/bio-endianwr-expected", bio.Rd) - | `std.Some bio: f = bio - | `std.None: std.fatal(1, "Unable to open data file") + | `std.Ok bio: f = bio + | `std.Fail m: std.fatal("Unable to open data file: {}\n", m) ;; /* byte */ @@ -47,7 +47,9 @@ const main = { /* end of file */ match bio.getle64(f) | `std.None: - | `std.Some v: std.die("read past end of file\n") + | `std.Some v: + std.die("read past end of file\n") + v = q /* shut up type inference */ ;; bio.close(f); diff --git a/lib/bio/test/bio-endianwr.myr b/lib/bio/test/bio-endianwr.myr index e44db49..b672571 100644 --- a/lib/bio/test/bio-endianwr.myr +++ b/lib/bio/test/bio-endianwr.myr @@ -9,8 +9,8 @@ const main = { var f match bio.create("tmpout/test-endianwr", bio.Wr, 0o644) - | `std.Some bio: f = bio - | `std.None: std.fatal(1, "Unable to open data file") + | `std.Ok bio: f = bio + | `std.Fail m: std.fatal("Unable to open data file: {}\n", m) ;; /* byte */ diff --git a/lib/bio/test/bio-peek.myr b/lib/bio/test/bio-peek.myr index 2125c9b..1f80f06 100644 --- a/lib/bio/test/bio-peek.myr +++ b/lib/bio/test/bio-peek.myr @@ -7,8 +7,8 @@ const main = { var buf : byte[64*1024] match bio.open("data/datafile", bio.Rd) - | `std.Some bio: f = bio - | `std.None: std.fatal(1, "Unable to open data file") + | `std.Ok bio: f = bio + | `std.Fail m: std.fatal("Unable to open data file: {}", m) ;; std.assert(peekb(f) == 0x30, "wrong byte value read from datafile") diff --git a/lib/bio/test/bio-read.myr b/lib/bio/test/bio-read.myr index eafdb4a..2112d42 100644 --- a/lib/bio/test/bio-read.myr +++ b/lib/bio/test/bio-read.myr @@ -8,8 +8,8 @@ const main = { var b match bio.open("data/datafile", bio.Rd) - | `std.Some bio: f = bio - | `std.None: std.fatal(1, "Unable to open data file") + | `std.Ok bio: f = bio + | `std.Fail m: std.fatal("Unable to open data file: {}", m) ;; /* read a 4 byte chunk j*/ @@ -40,7 +40,10 @@ const main = { const r = {f, buf match bio.read(f, buf) - | `std.Some b: -> b - | `std.None: std.put("eof\n") + | `std.Some b: + -> b + | `std.None: + std.put("eof\n") + -> "" ;; } diff --git a/lib/bio/test/bio-unitwr.myr b/lib/bio/test/bio-unitwr.myr index 8a1774c..1a78e97 100644 --- a/lib/bio/test/bio-unitwr.myr +++ b/lib/bio/test/bio-unitwr.myr @@ -4,8 +4,8 @@ use bio const main = { var f match bio.create("tmpout/test-unitwr", bio.Wr, 0o644) - | `std.Some bio: f = bio - | `std.None: std.fatal(1, "Unable to open data file") + | `std.Ok bio: f = bio + | `std.Fail m: std.fatal("Unable to open data file: {}\n", m) ;; bio.putb(f, 42) bio.putc(f, 'ה') diff --git a/lib/bio/test/bio-write.myr b/lib/bio/test/bio-write.myr index cbe7441..27a3f12 100644 --- a/lib/bio/test/bio-write.myr +++ b/lib/bio/test/bio-write.myr @@ -8,8 +8,8 @@ const main = { var buf : byte[64*1024] match bio.create("tmpout/test-write", bio.Wr, 0o644) - | `std.Some bio: f = bio - | `std.None: std.fatal(1, "Unable to open data file") + | `std.Ok bio: f = bio + | `std.Fail m: std.fatal("Unable to open data file: {}", m) ;; /* write a 5 byte chunk */ diff --git a/lib/bio/test/runtest.sh b/lib/bio/test/runtest.sh index 95f548f..f30ece2 100755 --- a/lib/bio/test/runtest.sh +++ b/lib/bio/test/runtest.sh @@ -4,7 +4,7 @@ NPASSES=0 function build { rm -f $1 $1.o $1.s $1.use - myrbuild $FLAGS -b $1 $1.myr $EXTRA_SRC + mbld $FLAGS -b $1 $1.myr $EXTRA_SRC } function pass { diff --git a/mk/bootstrap/bootstrap+Linux-x86_64.sh b/mk/bootstrap/bootstrap+Linux-x86_64.sh index 0691bd7..ca80d22 100755 --- a/mk/bootstrap/bootstrap+Linux-x86_64.sh +++ b/mk/bootstrap/bootstrap+Linux-x86_64.sh @@ -96,18 +96,6 @@ echo $pwd/6/6m -I ../sys -I ../std geti.myr ; $pwd/6/6m -I ../sys -I ../std get echo $pwd/muse/muse -o bio puti.use bio.use geti.use ; $pwd/muse/muse -o bio puti.use bio.use geti.use echo ar -rcs libbio.a puti.o bio.o geti.o ; ar -rcs libbio.a puti.o bio.o geti.o echo cd $pwd; cd $pwd -echo cd $pwd/lib/regex; cd $pwd/lib/regex -echo $pwd/6/6m -I . -I ../sys -I ../bio -I ../std redump.myr ; $pwd/6/6m -I . -I ../sys -I ../bio -I ../std redump.myr -echo ld -o redump $pwd/rt/_myrrt.o redump.o -L. -L../sys -L../bio -L../std -lregex -lbio -lstd -lsys ; ld -o redump $pwd/rt/_myrrt.o redump.o -L. -L../sys -L../bio -L../std -lregex -lbio -lstd -lsys -echo cd $pwd; cd $pwd -echo cd $pwd/lib/cryptohash; cd $pwd/lib/cryptohash -echo $pwd/6/6m -I ../sys -I ../std sha1.myr ; $pwd/6/6m -I ../sys -I ../std sha1.myr -echo $pwd/6/6m -I ../sys -I ../std sha512.myr ; $pwd/6/6m -I ../sys -I ../std sha512.myr -echo $pwd/6/6m -I ../sys -I ../std sha256.myr ; $pwd/6/6m -I ../sys -I ../std sha256.myr -echo $pwd/6/6m -I ../sys -I ../std md5.myr ; $pwd/6/6m -I ../sys -I ../std md5.myr -echo $pwd/muse/muse -o cryptohash md5.use sha1.use sha512.use sha256.use ; $pwd/muse/muse -o cryptohash md5.use sha1.use sha512.use sha256.use -echo ar -rcs libcryptohash.a md5.o sha1.o sha512.o sha256.o ; ar -rcs libcryptohash.a md5.o sha1.o sha512.o sha256.o -echo cd $pwd; cd $pwd echo cd $pwd/mbld; cd $pwd/mbld echo $pwd/6/6m -I $pwd/lib/regex -I $pwd/lib/bio -I $pwd/lib/std -I $pwd/lib/sys config.myr ; $pwd/6/6m -I $pwd/lib/regex -I $pwd/lib/bio -I $pwd/lib/std -I $pwd/lib/sys config.myr echo $pwd/6/6m -I $pwd/lib/regex -I $pwd/lib/bio -I $pwd/lib/std -I $pwd/lib/sys opts.myr ; $pwd/6/6m -I $pwd/lib/regex -I $pwd/lib/bio -I $pwd/lib/std -I $pwd/lib/sys opts.myr |