tests: make .t tests stop immediately if a cd fails

This prevents tests from escaping from TESTTMP as a consequence of a failing
directory creation.
This commit is contained in:
Mads Kiilerich 2012-06-10 18:50:42 +02:00
parent c425afcd4c
commit cb3472a4d3

View File

@ -659,6 +659,9 @@ def tsttest(test, wd, options, replacements):
prepos = pos
pos = n
addsalt(n, False)
cmd = l[4:].split()
if len(cmd) == 2 and cmd[0] == 'cd':
l = ' $ cd %s || exit 1\n' % cmd[1]
script.append(l[4:])
elif l.startswith(' > '): # continuations
after.setdefault(prepos, []).append(l)