ref: 702a8a1b749e84d1a417b437007f327a97a782e9
parent: 383a92cb9963a04aea7b0c31048a7bb1eabb9476
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jul 23 23:17:10 EDT 2022
tests: first couple
--- /dev/null
+++ b/test/basic.rc
@@ -1,0 +1,7 @@
+#!/bin/rc -e
+
+. common.rc
+
+setup
+echo hi > $fs/test
+assert ~ `{cat $fs/test} hi
--- /dev/null
+++ b/test/build.rc
@@ -1,0 +1,21 @@
+#!/bin/rc -e
+
+. common.rc
+
+setup
+
+cd $fs
+
+# we don't want to clobber the installed
+# libs with something corrupt, so copy
+# them in and bind them over.
+mkdir -p $cputype/lib
+dircp /$cputype/lib $cputype/lib
+bind $cputype/lib /$cputype/lib
+
+# clone our repo
+git/clone /dist/plan9front
+bind plan9front/sys/include /sys/include
+
+cd plan9front/sys/src
+mk all
--- /dev/null
+++ b/test/common.rc
@@ -1,0 +1,28 @@
+#!/bin/rc
+
+rfork ne
+
+srv=gefstest.$pid
+fs=/n/$srv
+
+fn setup{
+ if(! test -f test.fs){
+ dd -if /dev/zero -of test.fs -bs 1kk -count 2k
+ chmod +t test.fs
+ }
+ ../6.out -r -f test.fs
+ ../6.out -m 32 -Au glenda -f test.fs -n $srv
+ mount -c /srv/$srv $fs
+}
+
+fn assert {
+ st=$status
+ if(! ~ $#st 0){
+ echo $st >[1=2]
+ exit $st
+ }
+}
+
+fn sigexit{
+ unmount $fs
+}
--- /dev/null
+++ b/test/mkfile
@@ -1,0 +1,10 @@
+TESTS=\
+ basic\
+ build\
+
+test:VQ:
+ @{cd .. && mk 6.out}
+ for(t in $TESTS){
+ echo $t...
+ ./$t.rc >[2=1] >$t.log
+ }