summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-10-28 12:54:47 -0700
committerOri Bernstein <ori@eigenstate.org>2018-10-28 13:17:17 -0700
commitd92ff16a7e9ba2919746620fac40c798b06955ce (patch)
treeedf6544e4656d9601377eee180e9995c2ddd609c
parent666970ff83272349c1713169bf7cb49964366fb1 (diff)
downloadmc-d92ff16a7e9ba2919746620fac40c798b06955ce.tar.gz
Respect outdir and use it for tests.
This makes our gitignore nicer.
-rw-r--r--.gitignore1
-rw-r--r--mbld/main.myr8
-rwxr-xr-xtest/runtest.rc10
-rwxr-xr-xtest/runtest.sh14
4 files changed, 17 insertions, 16 deletions
diff --git a/.gitignore b/.gitignore
index 91c01f9..f5c4a7f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ rt/_*.s
# outputs
obj/**
+test/obj/**
6/6m
muse/muse
mbld/mbld
diff --git a/mbld/main.myr b/mbld/main.myr
index 4d74f99..4e14761 100644
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -72,11 +72,11 @@ const main = {args : byte[:][:]
b = mkbuild(tags)
if targname.len != 0
- ok = buildimm(b, targname, cmd.args)
+ ok = buildimm(b, targname, cmd.args, bld.opt_objdir)
elif runsrc.len != 0
bld.opt_verbosity = -1
tmp = std.mktemppath("runmyr")
- ok = buildimm(b, tmp, [runsrc][:])
+ ok = buildimm(b, tmp, [runsrc][:], bld.opt_objdir)
if ok
pid = runcmd(tmp, cmd.args)
match std.wait(pid)
@@ -115,7 +115,7 @@ const main = {args : byte[:][:]
;;
}
-const buildimm = {b, targ, inputs
+const buildimm = {b, targ, inputs, objdir
var mt : bld.myrtarg
mt = [
@@ -125,7 +125,7 @@ const buildimm = {b, targ, inputs
.incpath=bld.opt_incpaths,
.libdeps=[][:]
]
- bld.opt_objdir = ""
+ bld.opt_objdir = objdir
std.slpush(&b.all, "__out__")
std.htput(b.targs, "__out__", `bld.Bin &mt)
bld.deps(b)
diff --git a/test/runtest.rc b/test/runtest.rc
index 111c248..0b3e80b 100755
--- a/test/runtest.rc
+++ b/test/runtest.rc
@@ -5,7 +5,7 @@ MYR_MC=../6/6.out
MYR_MUSE=../muse/6.out
fn build {
rm -f $1 $1^.6 $1^.use
- ../obj/mbld/mbld -Bnone -o '' -b $1 -I../obj/lib/std -I../obj/lib/sys -I../obj/lib/regex -r../rt/_myrrt.6 $1^.myr
+ ../obj/mbld/mbld -Bnone -o 'out' -b $1 -I../obj/lib/std -I../obj/lib/sys -I../obj/lib/regex -r../rt/_myrrt.6 $1^.myr
}
fn pass {
@@ -20,7 +20,7 @@ fn expectstatus {
st='*'^$2
if(~ $2 0)
st=''''''
- ./$1 $3
+ ./out/$1 $3
if(eval '~ $status '$st)
pass $1
if not
@@ -30,7 +30,7 @@ fn expectstatus {
fn expectprint {
ifs='
'
- if(~ `{./$1 $3} $2)
+ if(~ `{./out/$1 $3} $2)
pass $1
if not
fail $1
@@ -39,7 +39,7 @@ fn expectprint {
fn expectcmp {
t=/tmp/myrtest-^$1
rm -f $t
- ./$1 $3 > $t
+ ./out/$1 $3 > $t
if (cmp $t data/$1-expected)
pass $1
if not
@@ -49,7 +49,7 @@ fn expectcmp {
fn expectfcmp {
t=/tmp/myrtest-^$1
rm -f $t
- ./$1 $3
+ ./out/$1 $3
if (cmp $2 data/$1-expected)
pass $1
if not
diff --git a/test/runtest.sh b/test/runtest.sh
index 16ca68b..4c649f6 100755
--- a/test/runtest.sh
+++ b/test/runtest.sh
@@ -1,5 +1,4 @@
#!/bin/sh
-#set -x
export PATH=.:$PATH
export MYR_MC=../6/6m
export MYR_MUSE=../muse/muse
@@ -8,8 +7,9 @@ NFAILURES=0
NPASSES=0
build() {
- rm -f $1 $1.o $1.s $1.use
- ../obj/mbld/mbld -Bnone -o '' -b $1 -I../obj/lib/std -I../obj/lib/sys -I../obj/lib/regex -r../rt/_myrrt.o $1.myr
+ rm -f out/$1 out/$1.o out/$1.s out/$1.use
+ mkdir -p out
+ ../obj/mbld/mbld -Bnone -o 'out' -b $1 -I../obj/lib/std -I../obj/lib/sys -I../obj/lib/regex -r../rt/_myrrt.o $1.myr
}
pass() {
@@ -25,7 +25,7 @@ fail() {
}
expectstatus() {
- ./$1 $3
+ ./out/$1 $3
if [ $? -eq $2 ]; then
pass $1
return
@@ -35,7 +35,7 @@ expectstatus() {
}
expectprint() {
- if [ "`./$1 $3`" != "$2" ]; then
+ if [ "`./out/$1 $3`" != "$2" ]; then
fail $1
else
pass $1
@@ -48,7 +48,7 @@ expectcompare() {
else
t=/tmp/myrtest-$1-$RANDOM
fi
- ./$1 $3 > $t
+ ./out/$1 $3 > $t
if cmp $t data/$1-expected; then
pass $1
else
@@ -58,7 +58,7 @@ expectcompare() {
}
expectfcompare() {
- ./$1 $3
+ ./out/$1 $3
if cmp data/$1-expected $2; then
pass $1
else