summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xtools/test.sh13
1 files changed, 4 insertions, 9 deletions
diff --git a/tools/test.sh b/tools/test.sh
index 4412f61..fa782c3 100755
--- a/tools/test.sh
+++ b/tools/test.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-dir=`cd $(dirname "$0"); pwd`
+dir=`dirname "$0"`
 bin=$dir/../qbe
 binref=$dir/../qbe.ref
 
@@ -12,11 +12,6 @@ asmref=$tmp.ref.s
 exe=$tmp.exe
 out=$tmp.out
 
-testcc() {
-	echo "int main() { }" | $1 -x c -o /dev/null - >/dev/null 2>&1
-	return $?
-}
-
 init() {
 	case "$TARGET" in
 	arm64)
@@ -79,8 +74,8 @@ init() {
 			cc="cc -lpthread"
 			;;
 		*)
-			cc="${CC:-cc} -lpthread"
-			testcc "$cc" || cc="${CC:-cc}"
+			cc="${CC:-cc}"
+			ccpost="-lpthread"
 			;;
 		esac
 		TARGET=`$bin -t?`
@@ -154,7 +149,7 @@ once() {
 		src="$asm"
 	fi
 
-	if ! $cc -g -o $exe $src
+	if ! $cc -g -o $exe $src $ccpost
 	then
 		echo "[cc fail]"
 		return 1