about summary refs log tree commit diff stats
path: root/test_apps
diff options
context:
space:
mode:
Diffstat (limited to 'test_apps')
-rwxr-xr-xtest_apps56
1 files changed, 29 insertions, 27 deletions
diff --git a/test_apps b/test_apps
index b19c837e..b96b57e0 100755
--- a/test_apps
+++ b/test_apps
@@ -21,12 +21,14 @@ test $NATIVE  &&  echo 'testing native runs'
 
 ./build
 
+export OS=${OS:-linux}
+
 echo "== translating and running using C++"
 
 # example programs
 
 echo ex1
-./subx translate 049init.linux examples/ex1.subx  -o examples/ex1
+./subx translate init.$OS examples/ex1.subx  -o examples/ex1
 test "$1" = 'record'  ||  git diff --exit-code examples/ex1
 test $EMULATED  &&  {
   ./subx run examples/ex1  ||  ret=$?
@@ -38,7 +40,7 @@ test $NATIVE  &&  {
 }
 
 echo ex2
-./subx translate 049init.linux examples/ex2.subx  -o examples/ex2
+./subx translate init.$OS examples/ex2.subx  -o examples/ex2
 test "$1" = 'record'  ||  git diff --exit-code examples/ex2
 test $EMULATED  &&  {
   ./subx run examples/ex2  ||  ret=$?
@@ -50,7 +52,7 @@ test $NATIVE  &&  {
 }
 
 echo ex3
-./subx translate 049init.linux examples/ex3.subx  -o examples/ex3
+./subx translate init.$OS examples/ex3.subx  -o examples/ex3
 test "$1" = 'record'  ||  git diff --exit-code examples/ex3
 test $EMULATED  &&  {
   ./subx run examples/ex3  ||  ret=$?
@@ -62,7 +64,7 @@ test $NATIVE  &&  {
 }
 
 echo ex4
-./subx translate 049init.linux examples/ex4.subx  -o examples/ex4
+./subx translate init.$OS examples/ex4.subx  -o examples/ex4
 test "$1" = 'record'  ||  git diff --exit-code examples/ex4
 test $EMULATED  &&  {
   echo a | ./subx run examples/ex4 >ex4.out  ||  true
@@ -74,7 +76,7 @@ test $NATIVE  &&  {
 }
 
 echo ex5
-./subx translate 049init.linux examples/ex5.subx  -o examples/ex5
+./subx translate init.$OS examples/ex5.subx  -o examples/ex5
 test "$1" = 'record'  ||  git diff --exit-code examples/ex5
 test $EMULATED  &&  {
   echo a | ./subx run examples/ex5 >ex5.out  ||  true
@@ -86,7 +88,7 @@ test $NATIVE  &&  {
 }
 
 echo ex6
-./subx translate 049init.linux examples/ex6.subx  -o examples/ex6
+./subx translate init.$OS examples/ex6.subx  -o examples/ex6
 test "$1" = 'record'  ||  git diff --exit-code examples/ex6
 test $EMULATED  &&  {
   ./subx run examples/ex6 >ex6.out  ||  true
@@ -98,7 +100,7 @@ test $NATIVE  &&  {
 }
 
 echo ex7
-./subx translate 049init.linux examples/ex7.subx  -o examples/ex7
+./subx translate init.$OS examples/ex7.subx  -o examples/ex7
 test "$1" = 'record'  ||  git diff --exit-code examples/ex7
 test $EMULATED  &&  {
   ./subx run examples/ex7  ||  ret=$?
@@ -110,7 +112,7 @@ test $NATIVE  &&  {
 }
 
 echo ex8
-./subx translate 049init.linux examples/ex8.subx  -o examples/ex8
+./subx translate init.$OS examples/ex8.subx  -o examples/ex8
 test "$1" = 'record'  || git diff --exit-code examples/ex8
 test $EMULATED  &&  {
   ./subx run examples/ex8 abcd  ||  ret=$?
@@ -122,7 +124,7 @@ test $NATIVE  &&  {
 }
 
 echo ex9
-./subx translate 049init.linux examples/ex9.subx  -o examples/ex9
+./subx translate init.$OS examples/ex9.subx  -o examples/ex9
 test "$1" = 'record'  || git diff --exit-code examples/ex9
 test $EMULATED  &&  {
   ./subx run examples/ex9 z x  ||  ret=$?
@@ -134,7 +136,7 @@ test $NATIVE  &&  {
 }
 
 echo ex10
-./subx translate 049init.linux examples/ex10.subx  -o examples/ex10
+./subx translate init.$OS examples/ex10.subx  -o examples/ex10
 test "$1" = 'record'  || git diff --exit-code examples/ex10
 test $EMULATED  &&  {
   ./subx run examples/ex10 abc abc  ||  ret=$?
@@ -148,7 +150,7 @@ test $NATIVE  &&  {
 }
 
 echo ex11
-./subx translate 049init.linux examples/ex11.subx  -o examples/ex11
+./subx translate init.$OS examples/ex11.subx  -o examples/ex11
 test "$1" = 'record'  || git diff --exit-code examples/ex11
 test $EMULATED  &&  {
   ./subx run examples/ex11
@@ -160,7 +162,7 @@ test $NATIVE  &&  {
 }
 
 echo ex12
-./subx translate 049init.linux examples/ex12.subx  -o examples/ex12
+./subx translate init.$OS examples/ex12.subx  -o examples/ex12
 test "$1" = 'record'  || git diff --exit-code examples/ex12
 test $EMULATED  &&  ./subx run examples/ex12  # final byte of mmap'd address is well-nigh guaranteed to be 0
 test $NATIVE  &&  examples/ex12
@@ -168,7 +170,7 @@ test $NATIVE  &&  examples/ex12
 # Larger apps that use the standard library.
 
 echo factorial
-./subx translate 049init.linux 0*.subx apps/factorial.subx  -o apps/factorial
+./subx translate init.$OS 0*.subx apps/factorial.subx  -o apps/factorial
 test "$1" = 'record'  ||  git diff --exit-code apps/factorial
 test $EMULATED  &&  {
   ./subx run apps/factorial  ||  ret=$?
@@ -184,7 +186,7 @@ test $NATIVE  &&  {
 }
 
 echo crenshaw2-1
-./subx translate 049init.linux 0*.subx apps/crenshaw2-1.subx  -o apps/crenshaw2-1
+./subx translate init.$OS 0*.subx apps/crenshaw2-1.subx  -o apps/crenshaw2-1
 test "$1" = 'record'  ||  git diff --exit-code apps/crenshaw2-1
 test $EMULATED  &&  {
   ./subx run apps/crenshaw2-1 test
@@ -196,7 +198,7 @@ test $NATIVE  &&  {
 }
 
 echo crenshaw2-1b
-./subx translate 049init.linux 0*.subx apps/crenshaw2-1b.subx  -o apps/crenshaw2-1b
+./subx translate init.$OS 0*.subx apps/crenshaw2-1b.subx  -o apps/crenshaw2-1b
 test "$1" = 'record'  ||  git diff --exit-code apps/crenshaw2-1b
 test $EMULATED  &&  {
   ./subx run apps/crenshaw2-1b test
@@ -208,7 +210,7 @@ test $NATIVE  &&  {
 }
 
 echo handle
-./subx translate 049init.linux 0*.subx apps/handle.subx  -o apps/handle
+./subx translate init.$OS 0*.subx apps/handle.subx  -o apps/handle
 test "$1" = 'record'  ||  git diff --exit-code apps/handle
 test $EMULATED  &&  {
   ./subx run apps/handle > handle.out 2>&1  ||  true
@@ -224,7 +226,7 @@ test $NATIVE  &&  {
 # Phases of the self-hosted SubX translator.
 
 echo hex
-./subx translate 049init.linux 0*.subx apps/subx-common.subx apps/hex.subx  -o apps/hex
+./subx translate init.$OS 0*.subx apps/subx-common.subx apps/hex.subx  -o apps/hex
 test "$1" = 'record'  ||  git diff --exit-code apps/hex
 test $EMULATED  &&  {
   ./subx run apps/hex test
@@ -236,7 +238,7 @@ test $NATIVE  &&  {
 }
 
 echo survey
-./subx translate 049init.linux 0*.subx apps/subx-common.subx apps/survey.subx  -o apps/survey
+./subx translate init.$OS 0*.subx apps/subx-common.subx apps/survey.subx  -o apps/survey
 test "$1" = 'record'  ||  git diff --exit-code apps/survey
 test $EMULATED  &&  {
   ./subx run apps/survey test
@@ -248,7 +250,7 @@ test $NATIVE  &&  {
 }
 
 echo pack
-./subx translate 049init.linux 0*.subx apps/subx-common.subx apps/pack.subx  -o apps/pack
+./subx translate init.$OS 0*.subx apps/subx-common.subx apps/pack.subx  -o apps/pack
 test "$1" = 'record'  ||  git diff --exit-code apps/pack
 test $EMULATED  &&  {
   ./subx run apps/pack test
@@ -260,7 +262,7 @@ test $NATIVE  &&  {
 }
 
 echo assort
-./subx translate 049init.linux 0*.subx apps/subx-common.subx apps/assort.subx  -o apps/assort
+./subx translate init.$OS 0*.subx apps/subx-common.subx apps/assort.subx  -o apps/assort
 test "$1" = 'record'  ||  git diff --exit-code apps/assort
 test $EMULATED  &&  {
   ./subx run apps/assort test
@@ -272,7 +274,7 @@ test $NATIVE  &&  {
 }
 
 echo dquotes
-./subx translate 049init.linux 0*.subx apps/subx-common.subx apps/dquotes.subx  -o apps/dquotes
+./subx translate init.$OS 0*.subx apps/subx-common.subx apps/dquotes.subx  -o apps/dquotes
 test "$1" = 'record'  ||  git diff --exit-code apps/dquotes
 test $EMULATED  &&  {
   ./subx run apps/dquotes test
@@ -284,7 +286,7 @@ test $NATIVE  &&  {
 }
 
 echo tests
-./subx translate 049init.linux 0*.subx apps/subx-common.subx apps/tests.subx  -o apps/tests
+./subx translate init.$OS 0*.subx apps/subx-common.subx apps/tests.subx  -o apps/tests
 test "$1" = 'record'  ||  git diff --exit-code apps/tests
 test $EMULATED  &&  {
   ./subx run apps/tests test
@@ -298,7 +300,7 @@ test $NATIVE  &&  {
 # Higher-level syntax.
 
 echo sigils
-./subx translate 049init.linux 0*.subx apps/subx-common.subx apps/sigils.subx  -o apps/sigils
+./subx translate init.$OS 0*.subx apps/subx-common.subx apps/sigils.subx  -o apps/sigils
 [ "$1" != record ]  &&  git diff --exit-code apps/sigils
 ./subx run apps/sigils test
 echo
@@ -313,7 +315,7 @@ test $NATIVE  ||  exit 0
 
 echo calls
 cat 0*.subx apps/subx-common.subx apps/calls.subx  |  apps/sigils  > a.sigils
-./subx translate 049init.linux a.sigils -o apps/calls
+./subx translate init.$OS a.sigils -o apps/calls
 [ "$1" != record ]  &&  git diff --exit-code apps/calls
 ./subx run apps/calls test
 echo
@@ -329,7 +331,7 @@ echo "== translating using SubX"
 for n in `seq 1 12`
 do
   echo ex$n
-  ./ntranslate 049init.linux examples/ex$n.subx
+  ./ntranslate init.$OS examples/ex$n.subx
   diff examples/ex$n a.elf
 done
 
@@ -338,7 +340,7 @@ done
 for app in factorial crenshaw2-1 crenshaw2-1b handle
 do
   echo $app
-  ./ntranslate 049init.linux 0*.subx apps/$app.subx
+  ./ntranslate init.$OS 0*.subx apps/$app.subx
   diff apps/$app a.elf
 done
 
@@ -347,7 +349,7 @@ done
 for app in hex survey pack assort dquotes tests sigils calls
 do
   echo $app
-  ./ntranslate 049init.linux 0*.subx apps/subx-common.subx apps/$app.subx
+  ./ntranslate init.$OS 0*.subx apps/subx-common.subx apps/$app.subx
   diff apps/$app a.elf
 done