summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-02 00:45:39 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-02 00:48:32 -0500
commit95e08cc46fb499866f2491b4a8aad9fe29ac6a00 (patch)
treeca131c3280cebc30bbdb6bf96aa230096e0793e2 /test
parent307b63be77f932ce7cf9685be261f1c3786ea719 (diff)
downloadfork-ledger-95e08cc46fb499866f2491b4a8aad9fe29ac6a00.tar.gz
fork-ledger-95e08cc46fb499866f2491b4a8aad9fe29ac6a00.tar.bz2
fork-ledger-95e08cc46fb499866f2491b4a8aad9fe29ac6a00.zip
Make the source directory available to all tests
Diffstat (limited to 'test')
-rwxr-xr-xtest/ConfirmTests.py2
-rwxr-xr-xtest/GenerateTests.py6
-rwxr-xr-xtest/LedgerHarness.py25
-rwxr-xr-xtest/RegressTests.py10
4 files changed, 26 insertions, 17 deletions
diff --git a/test/ConfirmTests.py b/test/ConfirmTests.py
index 0b3d4897..901ae7cd 100755
--- a/test/ConfirmTests.py
+++ b/test/ConfirmTests.py
@@ -10,7 +10,7 @@ import re
from LedgerHarness import LedgerHarness
harness = LedgerHarness(sys.argv)
-tests = sys.argv[2]
+tests = sys.argv[3]
if not os.path.isdir(tests) and not os.path.isfile(tests):
sys.exit(1)
diff --git a/test/GenerateTests.py b/test/GenerateTests.py
index aa36737d..d60e0581 100755
--- a/test/GenerateTests.py
+++ b/test/GenerateTests.py
@@ -104,9 +104,9 @@ def generation_test(seed):
beg_range = 1
end_range = 20
-if len(sys.argv) > 3:
- beg_range = int(sys.argv[2])
- end_range = int(sys.argv[3])
+if len(sys.argv) > 4:
+ beg_range = int(sys.argv[3])
+ end_range = int(sys.argv[4])
for i in range(beg_range, end_range):
if generation_test(i):
diff --git a/test/LedgerHarness.py b/test/LedgerHarness.py
index cf65f590..7e8cfa3d 100755
--- a/test/LedgerHarness.py
+++ b/test/LedgerHarness.py
@@ -7,22 +7,27 @@ import re
from subprocess import Popen, PIPE
class LedgerHarness:
- ledger = None
- succeeded = 0
- failed = 0
- verify = False
- gmalloc = False
+ ledger = None
+ sourcepath = None
+ succeeded = 0
+ failed = 0
+ verify = False
+ gmalloc = False
def __init__(self, argv):
if not os.path.isfile(argv[1]):
print "Cannot find ledger at '%s'" % argv[1]
sys.exit(1)
+ if not os.path.isdir(argv[2]):
+ print "Cannot find source path at '%s'" % argv[2]
+ sys.exit(1)
- self.ledger = argv[1]
- self.succeeded = 0
- self.failed = 0
- self.verify = '--verify' in argv
- self.gmalloc = '--gmalloc' in argv
+ self.ledger = argv[1]
+ self.sourcepath = argv[2]
+ self.succeeded = 0
+ self.failed = 0
+ self.verify = '--verify' in argv
+ self.gmalloc = '--gmalloc' in argv
def run(self, command, verify=None, gmalloc=None, columns=True):
env = os.environ.copy()
diff --git a/test/RegressTests.py b/test/RegressTests.py
index 4d23f6b5..13a0a113 100755
--- a/test/RegressTests.py
+++ b/test/RegressTests.py
@@ -11,7 +11,7 @@ from difflib import unified_diff
from LedgerHarness import LedgerHarness
harness = LedgerHarness(sys.argv)
-tests = sys.argv[2]
+tests = sys.argv[3]
if not os.path.isdir(tests) and not os.path.isfile(tests):
sys.exit(1)
@@ -27,11 +27,15 @@ class RegressFile:
line == ">>>2\n" or \
line.startswith("===")
+ def transform_line(self, line):
+ line = re.sub('\$sourcepath', harness.sourcepath, line)
+ return line
+
def read_section(self):
lines = []
line = self.fd.readline()
while not self.is_directive(line):
- lines.append(line)
+ lines.append(self.transform_line(line))
line = self.fd.readline()
return (lines, line)
@@ -60,7 +64,7 @@ class RegressFile:
test['exitcode'] = int(match.group(1))
return test
else:
- test['command'] = line
+ test['command'] = self.transform_line(line)
line = self.fd.readline()
return None