summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/hello/Makefile11
-rwxr-xr-xtest/hello/bld.sh36
-rw-r--r--test/hello/hello.myr5
-rw-r--r--test/hello/sys.myr74
-rw-r--r--test/hello/syscall.s33
-rw-r--r--test/helloworld.myr7
-rwxr-xr-xtest/test.sh9
-rw-r--r--test/tests1
8 files changed, 12 insertions, 164 deletions
diff --git a/test/hello/Makefile b/test/hello/Makefile
deleted file mode 100644
index e2c9770..0000000
--- a/test/hello/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# don't build anything for 'all'
-all:
- ./bld.sh
-.PHONY: clean
-clean:
- @for i in `awk '{print $$1}' tests`; do \
- echo rm -f $$i; \
- rm -f $$i; \
- done
-
-install:
diff --git a/test/hello/bld.sh b/test/hello/bld.sh
deleted file mode 100755
index c1438d1..0000000
--- a/test/hello/bld.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-
-# We have no dependency handling yet, so this is done via
-# a shell script. Also, we want to rebuild everything for
-# testing purposes on every run as things stand.
-
-export PATH=.:$PATH
-export MC=../../8/8m
-export MU=../../util/muse
-export CC=cc
-export ASOPT="-g"
-
-function use {
- N=`basename $1 .myr`
-
- echo $MU $1 -o $N.use && \
- $MU $1 -o $N.use
-}
-
-function build {
- N=`basename $1 .myr`
-
- echo $MC $1 && \
- $MC $1 -I.
-}
-
-function assem {
- $CC $ASOPT -m32 -c $1
-}
-
-assem syscall.s
-use sys.myr
-build sys.myr
-build hello.myr
-
-$CC -m32 -o hello sys.o hello.o syscall.o
diff --git a/test/hello/hello.myr b/test/hello/hello.myr
deleted file mode 100644
index 5ae2610..0000000
--- a/test/hello/hello.myr
+++ /dev/null
@@ -1,5 +0,0 @@
-use "sys.use"
-
-const main = {
- sys.write(1, "Hello world\n")
-}
diff --git a/test/hello/sys.myr b/test/hello/sys.myr
deleted file mode 100644
index 94ee715..0000000
--- a/test/hello/sys.myr
+++ /dev/null
@@ -1,74 +0,0 @@
-pkg sys =
- type scno = int
- type fdopt = int
- type statbuf = struct
- dev : uint
- ino : uint
- mode : uint16
- nlink : uint16
- uid : uint16
- gid : uint16
- rdev : uint
- size : uint
- blksize : uint
- blocks : uint
- atime : uint
- atimens : uint
- mtime : uint
- mtimens : uint
- ctime : uint
- ctimens : uint
- _unused1: uint
- _unused2: uint
- ;;
-
- const Rdonly : fdopt = 0x0
- const Wronly : fdopt = 0x1
- const Rdwr : fdopt = 0x2
- const Append : fdopt = 0x80
- const Creat : fdopt = 0x40
- const Nofollow : fdopt = 0x20000
- const Ndelay : fdopt = 0x800
- const Trunc : fdopt = 0x200
-
- const Sysexit : scno = 1
- const Sysread : scno = 3
- const Syswrite : scno = 4
- const Sysopen : scno = 5
- const Sysclose : scno = 6
- const Syscreat : scno = 8
- const Syslseek : scno = 19
- const Sysfstat : scno = 108
- const Syskill : scno = 37
- const Sysgetpid : scno = 20
- const Sysmmap2 : scno = 192
- const Sysmunmap : scno = 91
-
- extern const syscall : (sc:scno, count:int, args:... -> int)
-
- const exit : (status:int -> int)
- const getpid : ( -> int)
- const kill : (pid:int, sig:int -> int)
- const open : (path:char[,], opts:fdopt -> int)
- const close : (fd:int -> int)
- const creat : (path:char[,], mode:int -> int)
- const read : (fd:int, buf:char[,] -> int)
- const write : (fd:int, buf:char[,] -> int)
- const lseek : (fd:int, off:uint, whence:int -> int)
- const fstat : (fd:int, sb:statbuf* -> int)
- const munmap : (addr:byte*, len:uint -> int)
- const mmap : (add:byte*, len:uint, prot:uint, flags:uint, fd:int, off:uint)
-;;
-
-const exit = {status; -> syscall(Sysexit, 1);}
-const getpid = {; -> syscall(Sysgetpid, 1);}
-const kill = {pid, sig; -> syscall(Syskill, 2, pid, sig);}
-const open = {path, opts:fdopt; -> syscall(Sysopen, 2, path castto(char*), opts);}
-const close = {fd; -> syscall(Sysclose, 1, fd);}
-const creat = {path, mode; -> syscall(Syscreat, 2, path castto(char*), mode);}
-const read = {fd, buf; -> syscall(Sysread, 3, fd, buf castto(char*), buf.len);}
-const write = {fd, buf; -> syscall(Syswrite, 3, fd, buf castto(char*), buf.len);}
-const lseek = {fd, off, whence; -> syscall(Syslseek, 2, fd, off, whence);}
-const fstat = {fd, sb; -> syscall(Sysfstat, 2, fd, sb);}
-const munmap = {addr, len; -> syscall(Sysmunmap, 2, addr, len);}
-const mmap = {addr, len, prot, flags, fd, off; -> syscall(Sysmmap2, 6, addr, len, prot, flags, fd, off);}
diff --git a/test/hello/syscall.s b/test/hello/syscall.s
deleted file mode 100644
index e173009..0000000
--- a/test/hello/syscall.s
+++ /dev/null
@@ -1,33 +0,0 @@
-.globl sys$syscall
-sys$syscall:
- pushl %ebp
- movl %esp,%ebp
- movl 12(%ebp),%eax #count
- shl $2,%eax
- jmp *.jmptab(%eax)
-.jmptab:
- .long .a0
- .long .a1
- .long .a2
- .long .a3
- .long .a4
- .long .a5
- .long .a6
- /*
- hack: 6 args uses %ebp, so we index
- relative to %esp. This means that if
- we actually start using stack space,
- this code will need adjustment
- */
-.a6: movl 36(%esp),%ebp
-.a5: movl 32(%esp),%edi
-.a4: movl 28(%esp),%esi
-.a3: movl 24(%esp),%edx
-.a2: movl 20(%esp),%ecx
-.a1: movl 16(%esp),%ebx
- /* 12(%esp) holds nargs */
-.a0: movl 8(%esp),%eax
- int $0x80
- movl %ebp,%esp
- popl %ebp
- ret
diff --git a/test/helloworld.myr b/test/helloworld.myr
new file mode 100644
index 0000000..940e20c
--- /dev/null
+++ b/test/helloworld.myr
@@ -0,0 +1,7 @@
+use std
+
+const main = {args : byte[:][:]
+ std.write(1, "Hello-世界\n")
+ -> 0
+}
+
diff --git a/test/test.sh b/test/test.sh
index f5b173b..9170f1b 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -8,20 +8,20 @@ NFAILURES=0
function use {
rm -f $1 $1.o $1.s $1.use
- echo $MU $1.myr -o $1.use && \
+ echo $MU -I ../libstd -o $1.use $1.myr && \
$MU $1.myr -o $1.use
}
function build {
rm -f $1 $1.o $1.s $1.use
- echo $MC $1.myr -I ../libstd && \
- $MC $1.myr -I ../libstd && \
+ echo $MC -I ../libstd $1.myr && \
+ $MC -I ../libstd $1.myr && \
echo $LD -o $1 $1.o -L../libstd -lstd && \
$LD -o $1 $1.o -L../libstd -lstd
}
function prints {
- if [ `./$1` -ne $2 ]; then
+ if [ "`./$1`" != "$2" ]; then
echo "FAIL: $1"
FAILED="$FAILED $1"
NFAILED=$[$NFAILED + 1]
@@ -54,7 +54,6 @@ ulimit -d 16382 # data segment: 16m
ulimit -f 16382 # file size
ulimit -l 1024 # locked memory
ulimit -m 32768 # total memory
-ulimit -n 32768 # open files
ulimit -s 8192 # 8 meg stack
ulimit -t 30 # 30 second CPU time
ulimit -v 32768 # virtual memory
diff --git a/test/tests b/test/tests
index d8ccf70..327a5af 100644
--- a/test/tests
+++ b/test/tests
@@ -71,6 +71,7 @@ B arraylit-ni E 2
B structlit E 42
B tuple E 42
B tyrec E 42
+B helloworld P Hello-世界
F declmismatch
F infermismatch
F usedef