sapling/tests/test-fb-hgext-sigtrace.t
Kostia Balytskyi b27a46c987 fb-hgext: fix copied fb-hgext tests
Summary:
This is a big bulk of generally almost-obvious fixes to the moved tests. Mostly
these fixes have to do with correct importing of the actual extensions.

Depends on D6675329

Test Plan:
- ./run-tests.py fails less after this commit
- see further commits for more test fixes

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D6675344
2018-01-09 03:06:09 -08:00

48 lines
1.1 KiB
Perl

$ PYTHONPATH=$TESTDIR/../:$PYTHONPATH
$ export PYTHONPATH
$ cat >> $TESTTMP/signal.py << EOF
> from mercurial import registrar
> import os, signal
> cmdtable = {}
> command = registrar.command(cmdtable)
> @command('signal', norepo=True)
> def signalcommand(ui, *pats, **kwds):
> os.kill(os.getpid(), getattr(signal, 'SIG' + pats[0]))
> EOF
$ cat >> $HGRCPATH << EOF
> [extensions]
> sigtrace=
> signal=$TESTTMP/signal.py
> [sigtrace]
> pathformat=$TESTTMP/dump-%(pid)s-%(time)s.log
> EOF
Test the default SIGUSR1 signal
$ hg signal USR1
$ ls $TESTTMP/dump-*.log
$TESTTMP/dump-*-*.log (glob)
$ grep Thread $TESTTMP/dump-*.log | head -n 1
Thread *: (glob)
$ rm $TESTTMP/dump-*.log
Test the signal config option
$ echo 'signal=USR2' >> $HGRCPATH
$ hg signal USR2
$ ls $TESTTMP/dump-*.log
$TESTTMP/dump-*-*.log (glob)
$ grep Thread $TESTTMP/dump-*.log | head -n 1
Thread *: (glob)
$ rm $TESTTMP/dump-*.log
$ echo 'signal=INVALIDSIGNAL' >> $HGRCPATH
$ hg signal USR1 || false
* (glob)
[1]
$ ls $TESTTMP/dump-*.log || false
ls: * (glob)
[1]