summary refs log tree commit diff
path: root/tools/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/test.sh')
-rwxr-xr-xtools/test.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/test.sh b/tools/test.sh
index c5e5b37..1b23469 100755
--- a/tools/test.sh
+++ b/tools/test.sh
@@ -43,6 +43,30 @@ init() {
 		fi
 		bin="$bin -t arm64"
 		;;
+	rv64)
+		for p in riscv64-linux-musl riscv64-linux-gnu
+		do
+			cc="$p-gcc -no-pie"
+			qemu="qemu-riscv64"
+			if
+				$cc -v >/dev/null 2>&1 &&
+				$qemu -version >/dev/null 2>&1
+			then
+				if sysroot=$($cc -print-sysroot) && test -n "$sysroot"
+				then
+					qemu="$qemu -L $sysroot"
+				fi
+				break
+			fi
+			cc=
+		done
+		if test -z "$cc"
+		then
+			echo "Cannot find riscv64 compiler or qemu."
+			exit 1
+		fi
+		bin="$bin -t rv64"
+		;;
 	"")
 		case `uname` in
 		*Darwin*)