##// END OF EJS Templates
test: use a more direct form of interruption in fncache "recover" testing...
marmoute -
r50887:420fad6b default
parent child Browse files
Show More
@@ -304,6 +304,7 b' Aborted transactions can be recovered la'
304
304
305 $ cat > ../exceptionext.py <<EOF
305 $ cat > ../exceptionext.py <<EOF
306 > import os
306 > import os
307 > import signal
307 > from mercurial import (
308 > from mercurial import (
308 > commands,
309 > commands,
309 > error,
310 > error,
@@ -315,19 +316,14 b' Aborted transactions can be recovered la'
315 > def trwrapper(orig, self, *args, **kwargs):
316 > def trwrapper(orig, self, *args, **kwargs):
316 > tr = orig(self, *args, **kwargs)
317 > tr = orig(self, *args, **kwargs)
317 > def fail(tr):
318 > def fail(tr):
318 > raise error.Abort(b"forced transaction failure")
319 > os.kill(os.getpid(), signal.SIGKILL)
319 > # zzz prefix to ensure it sorted after store.write
320 > # zzz prefix to ensure it sorted after store.write
320 > tr.addfinalize(b'zzz-forcefails', fail)
321 > tr.addfinalize(b'zzz-forcefails', fail)
321 > return tr
322 > return tr
322 >
323 >
323 > def abortwrapper(orig, self, *args, **kwargs):
324 > raise error.Abort(b"forced transaction failure")
325 >
326 > def uisetup(ui):
324 > def uisetup(ui):
327 > extensions.wrapfunction(localrepo.localrepository, 'transaction',
325 > extensions.wrapfunction(localrepo.localrepository, 'transaction',
328 > trwrapper)
326 > trwrapper)
329 > extensions.wrapfunction(transaction.transaction, '_abort',
330 > abortwrapper)
331 >
327 >
332 > cmdtable = {}
328 > cmdtable = {}
333 >
329 >
@@ -339,8 +335,12 b' Clean cached versions'
339
335
340 $ hg up -q 1
336 $ hg up -q 1
341 $ touch z
337 $ touch z
342 $ hg ci -qAm z 2>/dev/null
338 # Cannot rely on the return code value as chg use a different one.
343 [255]
339 # So we use a `|| echo` trick
340 # XXX-CHG fixing chg behavior would be nice here.
341 $ hg ci -qAm z || echo "He's Dead, Jim." 2>/dev/null
342 Killed (?)
343 He's Dead, Jim.
344 $ cat .hg/store/fncache | sort
344 $ cat .hg/store/fncache | sort
345 data/y.i
345 data/y.i
346 data/z.i
346 data/z.i
General Comments 0
You need to be logged in to leave comments. Login now