Skip to content
Snippets Groups Projects
Commit 420fad6b authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

test: use a more direct form of interruption in fncache "recover" testing

The previous test was relying on implementation details and harder to maintain.

The new version is closer to the initial intend : "What happens if the process
die without cleanup".

This change is motivated by further changes around the transaction and dirstate
logic that would break the fragile equilibrium that existed before this patch.

Making this change early make it easier to review on its own and remove noise
in future larger changes.
parent 3997c64e
No related branches found
No related tags found
12 merge requests!485branching: merge default into stable,!435dirstate-scoping [11] : remove dirstate-guard,!434dirstate-scoping [10] : start warning/breaking on bad usage,!433dirstate-scoping [09] : use `changing_files` context in many places,!432dirstate-scoping [08] : use change_files and transaction in the commit logic (sometimes),!430dirstate-scoping [06] : rework the way some extensions meddle with the dirstate content,!429dirstate-scoping [05] : improve locking of various commands,!427dirstate-scoping [04] : first cleanup wave for dirstate's backup,!426dirstate-scoping [03] : explicitly write the dirstate in a handful of place.,!425dirstate-scoping [02] : fix and improve transaction "quick" rollback,!424dirstate-scoping [01] : preliminary test change,!415dirstate-scoping [07] : introduce a changing_files context
......@@ -304,6 +304,7 @@
$ cat > ../exceptionext.py <<EOF
> import os
> import signal
> from mercurial import (
> commands,
> error,
......@@ -315,8 +316,8 @@
> def trwrapper(orig, self, *args, **kwargs):
> tr = orig(self, *args, **kwargs)
> def fail(tr):
> raise error.Abort(b"forced transaction failure")
> os.kill(os.getpid(), signal.SIGKILL)
> # zzz prefix to ensure it sorted after store.write
> tr.addfinalize(b'zzz-forcefails', fail)
> return tr
>
......@@ -319,10 +320,7 @@
> # zzz prefix to ensure it sorted after store.write
> tr.addfinalize(b'zzz-forcefails', fail)
> return tr
>
> def abortwrapper(orig, self, *args, **kwargs):
> raise error.Abort(b"forced transaction failure")
>
> def uisetup(ui):
> extensions.wrapfunction(localrepo.localrepository, 'transaction',
> trwrapper)
......@@ -326,8 +324,6 @@
> def uisetup(ui):
> extensions.wrapfunction(localrepo.localrepository, 'transaction',
> trwrapper)
> extensions.wrapfunction(transaction.transaction, '_abort',
> abortwrapper)
>
> cmdtable = {}
>
......@@ -339,8 +335,12 @@
$ hg up -q 1
$ touch z
$ hg ci -qAm z 2>/dev/null
[255]
# Cannot rely on the return code value as chg use a different one.
# So we use a `|| echo` trick
# XXX-CHG fixing chg behavior would be nice here.
$ hg ci -qAm z || echo "He's Dead, Jim." 2>/dev/null
Killed (?)
He's Dead, Jim.
$ cat .hg/store/fncache | sort
data/y.i
data/z.i
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment