##// END OF EJS Templates
test-commandserver: change way of triggering early crash...
Yuya Nishihara -
r40857:6a75363f default
parent child Browse files
Show More
@@ -846,9 +846,18 b' unix domain socket:'
846 if server crashed before hello, traceback will be sent to 'e' channel as
846 if server crashed before hello, traceback will be sent to 'e' channel as
847 last ditch:
847 last ditch:
848
848
849 $ cat <<'EOF' > ../earlycrasher.py
850 > from mercurial import commandserver, extensions
851 > def _serverequest(orig, ui, repo, conn, createcmdserver):
852 > def createcmdserver(*args, **kwargs):
853 > raise Exception('crash')
854 > return orig(ui, repo, conn, createcmdserver)
855 > def extsetup(ui):
856 > extensions.wrapfunction(commandserver, b'_serverequest', _serverequest)
857 > EOF
849 $ cat <<EOF >> .hg/hgrc
858 $ cat <<EOF >> .hg/hgrc
850 > [cmdserver]
859 > [extensions]
851 > log = inexistent/path.log
860 > earlycrasher = ../earlycrasher.py
852 > EOF
861 > EOF
853 >>> from hgclient import bprint, check, readchannel, unixserver
862 >>> from hgclient import bprint, check, readchannel, unixserver
854 >>> server = unixserver(b'.hg/server.sock', b'.hg/server.log')
863 >>> server = unixserver(b'.hg/server.sock', b'.hg/server.log')
@@ -863,13 +872,13 b' unix domain socket:'
863 ... break
872 ... break
864 >>> check(earlycrash, server.connect)
873 >>> check(earlycrash, server.connect)
865 e, 'Traceback (most recent call last):\n'
874 e, 'Traceback (most recent call last):\n'
866 e, "(IOError|FileNotFoundError): .*" (re)
875 e, 'Exception: crash\n'
867 >>> server.shutdown()
876 >>> server.shutdown()
868
877
869 $ cat .hg/server.log | grep -v '^ '
878 $ cat .hg/server.log | grep -v '^ '
870 listening at .hg/server.sock
879 listening at .hg/server.sock
871 Traceback (most recent call last):
880 Traceback (most recent call last):
872 (IOError|FileNotFoundError): .* (re)
881 Exception: crash
873 killed!
882 killed!
874 #endif
883 #endif
875 #if no-unix-socket
884 #if no-unix-socket
General Comments 0
You need to be logged in to leave comments. Login now