diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-07-20 08:41:57 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-07-20 08:43:25 -0700 |
commit | d0f39e75ca761bb9c5fa6889ea0703e3700990a2 (patch) | |
tree | 8c4bf813419efeafc1f25165311b764df9b57b47 | |
parent | 13ef425825cef5fa30f7eb68688b6d114ecbe554 (diff) | |
download | mu-d0f39e75ca761bb9c5fa6889ea0703e3700990a2.tar.gz |
.
-rw-r--r-- | linux/apps/random.subx (renamed from linux/random.subx) | 4 | ||||
-rwxr-xr-x | linux/test_apps | 44 | ||||
-rwxr-xr-x | linux/test_apps_emulated | 44 |
3 files changed, 46 insertions, 46 deletions
diff --git a/linux/random.subx b/linux/apps/random.subx index d7bc03ac..4b770d8f 100644 --- a/linux/random.subx +++ b/linux/apps/random.subx @@ -1,8 +1,8 @@ # Repeatedly read 32-bit numbers from /dev/random, print them to stdout. # # To run: -# $ bootstrap/bootstrap translate [01]*.subx random.subx -o random -# $ bootstrap/bootstrap run random +# $ ./translate_subx [01]*.subx apps/random.subx +# $ ./a.elf == code 0x09000000 # instruction effective address register displacement immediate diff --git a/linux/test_apps b/linux/test_apps index 057e10df..9dab3e41 100755 --- a/linux/test_apps +++ b/linux/test_apps @@ -17,7 +17,7 @@ echo "== translating using the bootstrap C++ translator" # example programs echo ex1 -bootstrap/bootstrap translate 000init.subx ex1.subx -o ex1 +bootstrap/bootstrap translate 000init.subx apps/ex1.subx -o ex1 { bootstrap/bootstrap run ex1 || ret=$? test $ret -eq 42 # life, the universe and everything @@ -29,7 +29,7 @@ bootstrap/bootstrap translate 000init.subx ex1.subx -o ex1 } echo ex2 -bootstrap/bootstrap translate 000init.subx ex2.subx -o ex2 +bootstrap/bootstrap translate 000init.subx apps/ex2.subx -o ex2 { bootstrap/bootstrap run ex2 || ret=$? test $ret -eq 7 # 3 + 4 @@ -41,7 +41,7 @@ bootstrap/bootstrap translate 000init.subx ex2.subx -o ex2 } echo ex3 -bootstrap/bootstrap translate 000init.subx ex3.subx -o ex3 +bootstrap/bootstrap translate 000init.subx apps/ex3.subx -o ex3 { bootstrap/bootstrap run ex3 || ret=$? test $ret -eq 55 # 1 + 2 + ... + 10 @@ -53,7 +53,7 @@ bootstrap/bootstrap translate 000init.subx ex3.subx -o ex3 } echo ex4 -bootstrap/bootstrap translate 000init.subx ex4.subx -o ex4 +bootstrap/bootstrap translate 000init.subx apps/ex4.subx -o ex4 { echo a | bootstrap/bootstrap run ex4 >ex4.out || true test `cat ex4.out` = 'a' @@ -65,7 +65,7 @@ bootstrap/bootstrap translate 000init.subx ex4.subx -o ex4 } echo ex5 -bootstrap/bootstrap translate 000init.subx ex5.subx -o ex5 +bootstrap/bootstrap translate 000init.subx apps/ex5.subx -o ex5 { echo a | bootstrap/bootstrap run ex5 >ex5.out || true test `cat ex5.out` = 'a' @@ -77,7 +77,7 @@ bootstrap/bootstrap translate 000init.subx ex5.subx -o ex5 } echo ex6 -bootstrap/bootstrap translate 000init.subx ex6.subx -o ex6 +bootstrap/bootstrap translate 000init.subx apps/ex6.subx -o ex6 { bootstrap/bootstrap run ex6 >ex6.out || true test "`cat ex6.out`" = 'Hello world!' @@ -89,7 +89,7 @@ bootstrap/bootstrap translate 000init.subx ex6.subx -o ex6 } echo ex7 -bootstrap/bootstrap translate 000init.subx ex7.subx -o ex7 +bootstrap/bootstrap translate 000init.subx apps/ex7.subx -o ex7 { bootstrap/bootstrap run ex7 || ret=$? test $ret -eq 97 # 'a' @@ -101,7 +101,7 @@ bootstrap/bootstrap translate 000init.subx ex7.subx -o ex7 } echo ex8 -bootstrap/bootstrap translate 000init.subx ex8.subx -o ex8 +bootstrap/bootstrap translate 000init.subx apps/ex8.subx -o ex8 { bootstrap/bootstrap run ex8 abcd || ret=$? test $ret -eq 4 # length('abcd') @@ -113,7 +113,7 @@ bootstrap/bootstrap translate 000init.subx ex8.subx -o ex8 } echo ex9 -bootstrap/bootstrap translate 000init.subx ex9.subx -o ex9 +bootstrap/bootstrap translate 000init.subx apps/ex9.subx -o ex9 { bootstrap/bootstrap run ex9 z x || ret=$? test $ret -eq 2 # 'z' - 'x' @@ -125,7 +125,7 @@ bootstrap/bootstrap translate 000init.subx ex9.subx -o ex9 } echo ex10 -bootstrap/bootstrap translate 000init.subx ex10.subx -o ex10 +bootstrap/bootstrap translate 000init.subx apps/ex10.subx -o ex10 { bootstrap/bootstrap run ex10 abc abc || ret=$? test $ret -eq 1 # equal @@ -139,7 +139,7 @@ bootstrap/bootstrap translate 000init.subx ex10.subx -o ex10 } echo ex11 -bootstrap/bootstrap translate 000init.subx ex11.subx -o ex11 +bootstrap/bootstrap translate 000init.subx apps/ex11.subx -o ex11 { bootstrap/bootstrap run ex11 echo @@ -151,13 +151,13 @@ bootstrap/bootstrap translate 000init.subx ex11.subx -o ex11 } echo ex12 -bootstrap/bootstrap translate 000init.subx ex12.subx -o ex12 +bootstrap/bootstrap translate 000init.subx apps/ex12.subx -o ex12 bootstrap/bootstrap run ex12 # final byte of mmap'd address is well-nigh guaranteed to be 0 chmod +x ex12 ./ex12 echo ex13 -bootstrap/bootstrap translate 000init.subx ex13.subx -o ex13 +bootstrap/bootstrap translate 000init.subx apps/ex13.subx -o ex13 { bootstrap/bootstrap run ex13 || ret=$? test $ret -eq 1 # 3 == 3 @@ -171,7 +171,7 @@ bootstrap/bootstrap translate 000init.subx ex13.subx -o ex13 # Larger apps that use the standard library. echo factorial -bootstrap/bootstrap translate [01]*.subx factorial.subx -o factorial +bootstrap/bootstrap translate [01]*.subx apps/factorial.subx -o factorial { bootstrap/bootstrap run factorial || ret=$? test $ret -eq 120 # factorial(5) @@ -187,7 +187,7 @@ bootstrap/bootstrap translate [01]*.subx factorial.subx -o factorial } echo random -bootstrap/bootstrap translate [01]*.subx random.subx -o random +bootstrap/bootstrap translate [01]*.subx apps/random.subx -o random # don't run # Phases of the self-hosted SubX translator. @@ -275,7 +275,7 @@ echo "== translating using the self-hosted translator" for n in `seq 1 12` do echo ex$n - ./translate_subx 000init.subx ex$n.subx + ./translate_subx 000init.subx apps/ex$n.subx diff ex$n a.elf done @@ -284,7 +284,7 @@ done for app in factorial do echo $app - ./translate_subx [01]*.subx $app.subx + ./translate_subx [01]*.subx apps/$app.subx diff $app a.elf done @@ -312,7 +312,7 @@ diff mu a.elf # Mu programs echo ex1.mu -./translate ex1.mu +./translate apps/ex1.mu { bootstrap/bootstrap run a.elf || ret=$? test $ret -eq 42 # life, the universe and everything @@ -323,7 +323,7 @@ echo ex1.mu } echo ex2.mu -./translate ex2.mu +./translate apps/ex2.mu { bootstrap/bootstrap run a.elf || ret=$? test $ret -eq 7 @@ -334,7 +334,7 @@ echo ex2.mu } echo ex3.mu -./translate ex3.mu +./translate apps/ex3.mu { bootstrap/bootstrap run a.elf || ret=$? test $ret -eq 55 @@ -345,7 +345,7 @@ echo ex3.mu } echo ex3.2.mu -./translate ex3.2.mu +./translate apps/ex3.2.mu { bootstrap/bootstrap run a.elf || ret=$? test $ret -eq 55 @@ -356,7 +356,7 @@ echo ex3.2.mu } echo factorial.mu -./translate factorial.mu +./translate apps/factorial.mu { bootstrap/bootstrap run a.elf || ret=$? test $ret -eq 120 diff --git a/linux/test_apps_emulated b/linux/test_apps_emulated index 844dee82..b46a9b0f 100755 --- a/linux/test_apps_emulated +++ b/linux/test_apps_emulated @@ -18,70 +18,70 @@ echo "== translating using the bootstrap C++ translator" # example programs echo ex1 -bootstrap/bootstrap translate 000init.subx ex1.subx -o ex1 +bootstrap/bootstrap translate 000init.subx apps/ex1.subx -o ex1 { bootstrap/bootstrap run ex1 || ret=$? test $ret -eq 42 # life, the universe and everything } echo ex2 -bootstrap/bootstrap translate 000init.subx ex2.subx -o ex2 +bootstrap/bootstrap translate 000init.subx apps/ex2.subx -o ex2 { bootstrap/bootstrap run ex2 || ret=$? test $ret -eq 7 # 3 + 4 } echo ex3 -bootstrap/bootstrap translate 000init.subx ex3.subx -o ex3 +bootstrap/bootstrap translate 000init.subx apps/ex3.subx -o ex3 { bootstrap/bootstrap run ex3 || ret=$? test $ret -eq 55 # 1 + 2 + ... + 10 } echo ex4 -bootstrap/bootstrap translate 000init.subx ex4.subx -o ex4 +bootstrap/bootstrap translate 000init.subx apps/ex4.subx -o ex4 { echo a | bootstrap/bootstrap run ex4 >ex4.out || true test `cat ex4.out` = 'a' } echo ex5 -bootstrap/bootstrap translate 000init.subx ex5.subx -o ex5 +bootstrap/bootstrap translate 000init.subx apps/ex5.subx -o ex5 { echo a | bootstrap/bootstrap run ex5 >ex5.out || true test `cat ex5.out` = 'a' } echo ex6 -bootstrap/bootstrap translate 000init.subx ex6.subx -o ex6 +bootstrap/bootstrap translate 000init.subx apps/ex6.subx -o ex6 { bootstrap/bootstrap run ex6 >ex6.out || true test "`cat ex6.out`" = 'Hello world!' } echo ex7 -bootstrap/bootstrap translate 000init.subx ex7.subx -o ex7 +bootstrap/bootstrap translate 000init.subx apps/ex7.subx -o ex7 { bootstrap/bootstrap run ex7 || ret=$? test $ret -eq 97 # 'a' } echo ex8 -bootstrap/bootstrap translate 000init.subx ex8.subx -o ex8 +bootstrap/bootstrap translate 000init.subx apps/ex8.subx -o ex8 { bootstrap/bootstrap run ex8 abcd || ret=$? test $ret -eq 4 # length('abcd') } echo ex9 -bootstrap/bootstrap translate 000init.subx ex9.subx -o ex9 +bootstrap/bootstrap translate 000init.subx apps/ex9.subx -o ex9 { bootstrap/bootstrap run ex9 z x || ret=$? test $ret -eq 2 # 'z' - 'x' } echo ex10 -bootstrap/bootstrap translate 000init.subx ex10.subx -o ex10 +bootstrap/bootstrap translate 000init.subx apps/ex10.subx -o ex10 { bootstrap/bootstrap run ex10 abc abc || ret=$? test $ret -eq 1 # equal @@ -89,18 +89,18 @@ bootstrap/bootstrap translate 000init.subx ex10.subx -o ex10 } echo ex11 -bootstrap/bootstrap translate 000init.subx ex11.subx -o ex11 +bootstrap/bootstrap translate 000init.subx apps/ex11.subx -o ex11 { bootstrap/bootstrap run ex11 echo } echo ex12 -bootstrap/bootstrap translate 000init.subx ex12.subx -o ex12 +bootstrap/bootstrap translate 000init.subx apps/ex12.subx -o ex12 bootstrap/bootstrap run ex12 # final byte of mmap'd address is well-nigh guaranteed to be 0 echo ex13 -bootstrap/bootstrap translate 000init.subx ex13.subx -o ex13 +bootstrap/bootstrap translate 000init.subx apps/ex13.subx -o ex13 { bootstrap/bootstrap run ex13 || ret=$? test $ret -eq 1 # 3 == 3 @@ -109,7 +109,7 @@ bootstrap/bootstrap translate 000init.subx ex13.subx -o ex13 # Larger apps that use the standard library. echo factorial -bootstrap/bootstrap translate [01]*.subx factorial.subx -o factorial +bootstrap/bootstrap translate [01]*.subx apps/factorial.subx -o factorial { bootstrap/bootstrap run factorial || ret=$? test $ret -eq 120 # factorial(5) @@ -118,7 +118,7 @@ bootstrap/bootstrap translate [01]*.subx factorial.subx -o factorial } echo random -bootstrap/bootstrap translate [01]*.subx random.subx -o random +bootstrap/bootstrap translate [01]*.subx apps/random.subx -o random # don't run # Phases of the self-hosted SubX translator. @@ -182,7 +182,7 @@ echo "== translating using the self-hosted translator" for n in `seq 1 12` do echo ex$n - ./translate_subx_emulated 000init.subx ex$n.subx + ./translate_subx_emulated 000init.subx apps/ex$n.subx diff ex$n a.elf done @@ -191,7 +191,7 @@ done for app in factorial do echo $app - ./translate_subx_emulated [01]*.subx $app.subx + ./translate_subx_emulated [01]*.subx apps/$app.subx diff $app a.elf done @@ -219,35 +219,35 @@ diff mu a.elf # Mu programs echo ex1.mu -./translate_emulated ex1.mu +./translate_emulated apps/ex1.mu { bootstrap/bootstrap run a.elf || ret=$? test $ret -eq 42 # life, the universe and everything } echo ex2.mu -./translate_emulated ex2.mu +./translate_emulated apps/ex2.mu { bootstrap/bootstrap run a.elf || ret=$? test $ret -eq 7 } echo ex3.mu -./translate_emulated ex3.mu +./translate_emulated apps/ex3.mu { bootstrap/bootstrap run a.elf || ret=$? test $ret -eq 55 } echo ex3.2.mu -./translate_emulated ex3.2.mu +./translate_emulated apps/ex3.2.mu { bootstrap/bootstrap run a.elf || ret=$? test $ret -eq 55 } echo factorial.mu -./translate_emulated factorial.mu +./translate_emulated apps/factorial.mu { bootstrap/bootstrap run a.elf || ret=$? test $ret -eq 120 |