Browse code

Run asma tests in repo root directory

Andrew Alderwick authored on 06/10/2021 05:12:27
Showing 1 changed files
... ...
@@ -13,8 +13,8 @@ build_asma() {
13 13
 	#01 .System/halt DEO
14 14
 	BRK
15 15
 
16
-	&source-file "in.tal 00
17
-	&dest-file "out.rom 00
16
+	&source-file "asma-test/in.tal 00
17
+	&dest-file "asma-test/out.rom 00
18 18
 
19 19
 EOD
20 20
 	sed -ne '/%asma-IF-ERROR/,$p' ../projects/software/asma.tal
... ...
@@ -22,22 +22,21 @@ EOD
22 22
 
23 23
 expect_failure() {
24 24
 	cat > 'in.tal'
25
-	../bin/uxncli asma.rom > asma.log 2>/dev/null
25
+	( cd .. && bin/uxncli asma-test/asma.rom ) > asma.log 2>/dev/null
26 26
 	if ! grep -qF "${1}" asma.log; then
27 27
 		echo "error: asma didn't report error ${1} in faulty code"
28
-		tail asma.log
29
-		exit 1
28
+		xxd asma.log
30 29
 	fi
31 30
 }
32 31
 
33 32
 echo 'Assembling asma with uxnasm'
34 33
 build_asma > asma.tal
35
-../bin/uxnasm asma.tal asma.rom > uxnasm.log
36
-for F in $(find ../projects -path ../projects/library -prune -false -or -type f -name '*.tal' -not -name 'blank.tal'); do
34
+( cd .. && bin/uxnasm asma-test/asma.tal asma-test/asma.rom ) > uxnasm.log
35
+for F in $(find ../projects -path ../projects/library -prune -false -or -type f -name '*.tal' -not -name 'blank.tal' | sort); do
37 36
 	echo "Comparing assembly of ${F}"
38 37
 	BN="$(basename "${F%.tal}")"
39 38
 
40
-	if ! ../bin/uxnasm "${F}" "uxnasm-${BN}.rom" > uxnasm.log; then
39
+	if ! ( cd .. && bin/uxnasm "asma-test/${F}" "asma-test/uxnasm-${BN}.rom" ) > uxnasm.log; then
41 40
 		echo "error: uxnasm failed to assemble ${F}"
42 41
 		tail uxnasm.log
43 42
 		exit 1
... ...
@@ -46,7 +45,7 @@ for F in $(find ../projects -path ../projects/library -prune -false -or -type f
46 45
 
47 46
 	cp "${F}" 'in.tal'
48 47
 	rm -f 'out.rom'
49
-	../bin/uxncli asma.rom > asma.log
48
+	( cd .. && bin/uxncli asma-test/asma.rom ) > asma.log
50 49
 	if [ ! -f 'out.rom' ]; then
51 50
 		echo "error: asma failed to assemble ${F}, while uxnasm succeeded"
52 51
 		tail asma.log