ref: d2a4d99cee1cbff164e6b80560a0930043ba38a4
parent: bcae988a72a65bdc6597b3116a6a247e3df98487
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Sep 11 14:03:00 EDT 2015
Update BIO tests and bootstrap.
--- a/lib/bio/test/bio-create.myr
+++ b/lib/bio/test/bio-create.myr
@@ -6,8 +6,8 @@
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)
}
--- a/lib/bio/test/bio-delim.myr
+++ b/lib/bio/test/bio-delim.myr
@@ -6,8 +6,8 @@
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 */
--- a/lib/bio/test/bio-endianrd.myr
+++ b/lib/bio/test/bio-endianrd.myr
@@ -4,7 +4,7 @@
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 @@
/* 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 @@
/* 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);
--- a/lib/bio/test/bio-endianwr.myr
+++ b/lib/bio/test/bio-endianwr.myr
@@ -9,8 +9,8 @@
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 */
--- a/lib/bio/test/bio-peek.myr
+++ b/lib/bio/test/bio-peek.myr
@@ -7,8 +7,8 @@
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")
--- a/lib/bio/test/bio-read.myr
+++ b/lib/bio/test/bio-read.myr
@@ -8,8 +8,8 @@
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 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")
+ -> ""
;;
}
--- a/lib/bio/test/bio-unitwr.myr
+++ b/lib/bio/test/bio-unitwr.myr
@@ -4,8 +4,8 @@
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, 'ה')
--- a/lib/bio/test/bio-write.myr
+++ b/lib/bio/test/bio-write.myr
@@ -8,8 +8,8 @@
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 */
--- a/lib/bio/test/runtest.sh
+++ b/lib/bio/test/runtest.sh
@@ -4,7 +4,7 @@
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 {
--- a/mk/bootstrap/bootstrap+Linux-x86_64.sh
+++ b/mk/bootstrap/bootstrap+Linux-x86_64.sh
@@ -96,18 +96,6 @@
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