Make tests/*.sh runnable from anywhere
diff --git a/tests/compat.sh b/tests/compat.sh
index 49e7ee56..6186662 100755
--- a/tests/compat.sh
+++ b/tests/compat.sh
@@ -1049,6 +1049,11 @@
 # MAIN
 #
 
+if cd $( dirname $0 ); then :; else
+    echo "cd $( dirname $0 ) failed" >&2
+    exit 1
+fi
+
 get_options "$@"
 
 # sanity checks, avoid an avalanche of errors
diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh
index b54b777..2c0c9ff 100755
--- a/tests/ssl-opt.sh
+++ b/tests/ssl-opt.sh
@@ -460,6 +460,11 @@
 # MAIN
 #
 
+if cd $( dirname $0 ); then :; else
+    echo "cd $( dirname $0 ) failed" >&2
+    exit 1
+fi
+
 get_options "$@"
 
 # sanity checks, avoid an avalanche of errors