summaryrefslogtreecommitdiff
path: root/cpp/allTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/allTests.py')
-rwxr-xr-xcpp/allTests.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/cpp/allTests.py b/cpp/allTests.py
index 79e2904ab1b..316bc188080 100755
--- a/cpp/allTests.py
+++ b/cpp/allTests.py
@@ -10,16 +10,16 @@
import os, sys, re, getopt
-for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
- toplevel = os.path.abspath(toplevel)
- if os.path.exists(os.path.join(toplevel, "scripts", "TestUtil.py")):
- break
-else:
- print "can't find toplevel directory!"
- raise "can't find toplevel directory!"
+path = [ ".", "..", "../..", "../../..", "../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(toplevel))
-from scripts import *
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
#
# List of all basic tests.