tests/test-inotify
author Alexander Solovyov <piranha@piranha.org.ua>
Tue, 24 Nov 2009 17:48:23 +0200
branchstable
changeset 9966 1fa9f6850dee
parent 9900 8939900073a8
child 10944 6f1894d6a6b0
permissions -rwxr-xr-x
schemes extension
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7145
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     1
#!/bin/sh
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     2
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     3
"$TESTDIR/hghave" inotify || exit 80
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     4
9896
2c2f7593ffc4 cmdutil.service: do not _exit(0) in the parent process
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9854
diff changeset
     5
hg init repo1
2c2f7593ffc4 cmdutil.service: do not _exit(0) in the parent process
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9854
diff changeset
     6
cd repo1
7145
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     7
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     8
touch a b c d e
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     9
mkdir dir
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    10
mkdir dir/bar
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    11
touch dir/x dir/y dir/bar/foo
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    12
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    13
hg ci -Am m
9896
2c2f7593ffc4 cmdutil.service: do not _exit(0) in the parent process
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9854
diff changeset
    14
cd ..
2c2f7593ffc4 cmdutil.service: do not _exit(0) in the parent process
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9854
diff changeset
    15
hg clone repo1 repo2
7145
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    16
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    17
echo "[extensions]" >> $HGRCPATH
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    18
echo "inotify=" >> $HGRCPATH
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    19
9896
2c2f7593ffc4 cmdutil.service: do not _exit(0) in the parent process
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9854
diff changeset
    20
cd repo2
2c2f7593ffc4 cmdutil.service: do not _exit(0) in the parent process
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9854
diff changeset
    21
echo b >> a
2c2f7593ffc4 cmdutil.service: do not _exit(0) in the parent process
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9854
diff changeset
    22
# check that daemon started automatically works correctly
9897
97eda2133a9b inotify: add a inotify.pidfile configuration possibility
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9896
diff changeset
    23
# and make sure that inotify.pidfile works
97eda2133a9b inotify: add a inotify.pidfile configuration possibility
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9896
diff changeset
    24
hg --config "inotify.pidfile=../hg2.pid" status
97eda2133a9b inotify: add a inotify.pidfile configuration possibility
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9896
diff changeset
    25
97eda2133a9b inotify: add a inotify.pidfile configuration possibility
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9896
diff changeset
    26
# make sure that pidfile worked. Output should be silent.
97eda2133a9b inotify: add a inotify.pidfile configuration possibility
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9896
diff changeset
    27
kill `cat ../hg2.pid`
9896
2c2f7593ffc4 cmdutil.service: do not _exit(0) in the parent process
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9854
diff changeset
    28
2c2f7593ffc4 cmdutil.service: do not _exit(0) in the parent process
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9854
diff changeset
    29
cd ../repo1
7145
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    30
echo % inserve
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    31
hg inserve -d --pid-file=hg.pid
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    32
cat hg.pid >> "$DAEMON_PIDS"
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    33
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    34
# let the daemon finish its stuff
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    35
sleep 1
9900
8939900073a8 inotify: improve error messages
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9897
diff changeset
    36
8939900073a8 inotify: improve error messages
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9897
diff changeset
    37
echo % cannot start, already bound
8939900073a8 inotify: improve error messages
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9897
diff changeset
    38
hg inserve
8939900073a8 inotify: improve error messages
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9897
diff changeset
    39
7145
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    40
# issue907
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    41
hg status
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    42
echo % clean
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    43
hg status -c
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    44
echo % all
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    45
hg status -A
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    46
7393
92c952c4470c inotify: fix status . in repo.root
Brendan Cully <brendan@kublai.com>
parents: 7351
diff changeset
    47
echo '% path patterns'
92c952c4470c inotify: fix status . in repo.root
Brendan Cully <brendan@kublai.com>
parents: 7351
diff changeset
    48
echo x > dir/x
92c952c4470c inotify: fix status . in repo.root
Brendan Cully <brendan@kublai.com>
parents: 7351
diff changeset
    49
hg status .
92c952c4470c inotify: fix status . in repo.root
Brendan Cully <brendan@kublai.com>
parents: 7351
diff changeset
    50
hg status dir
92c952c4470c inotify: fix status . in repo.root
Brendan Cully <brendan@kublai.com>
parents: 7351
diff changeset
    51
cd dir
92c952c4470c inotify: fix status . in repo.root
Brendan Cully <brendan@kublai.com>
parents: 7351
diff changeset
    52
hg status .
92c952c4470c inotify: fix status . in repo.root
Brendan Cully <brendan@kublai.com>
parents: 7351
diff changeset
    53
cd ..
92c952c4470c inotify: fix status . in repo.root
Brendan Cully <brendan@kublai.com>
parents: 7351
diff changeset
    54
9116
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    55
#issue 1375
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    56
#Testing that we can remove a folder and then add a file with the same name
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    57
echo % issue 1375
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    58
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    59
mkdir h
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    60
echo h > h/h
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    61
hg ci -Am t
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    62
hg rm h
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    63
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    64
echo h >h
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    65
hg add h
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    66
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    67
hg status
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    68
hg ci -m0
f90bbf1ea09f inotify: fix issue1375, add a test.
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7393
diff changeset
    69
9117
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    70
# Test for issue1735: inotify watches files in .hg/merge
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    71
hg st
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    72
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    73
echo a > a
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    74
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    75
hg ci -Am a
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    76
hg st
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    77
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    78
echo b >> a
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    79
hg ci -m ab
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    80
hg st
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    81
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    82
echo c >> a
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    83
hg st
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    84
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    85
hg up 0
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    86
hg st
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    87
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    88
HGMERGE=internal:local hg up
a87bc6e2a907 inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9116
diff changeset
    89
hg st
9854
95e1867f765b inotify: mark directories visited during lookup (issue1844)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9117
diff changeset
    90
95e1867f765b inotify: mark directories visited during lookup (issue1844)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9117
diff changeset
    91
# Test for 1844: "hg ci folder" will not commit all changes beneath "folder"
95e1867f765b inotify: mark directories visited during lookup (issue1844)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9117
diff changeset
    92
mkdir 1844
95e1867f765b inotify: mark directories visited during lookup (issue1844)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9117
diff changeset
    93
echo a > 1844/foo
95e1867f765b inotify: mark directories visited during lookup (issue1844)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9117
diff changeset
    94
hg add 1844
95e1867f765b inotify: mark directories visited during lookup (issue1844)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9117
diff changeset
    95
hg ci -m 'working'
95e1867f765b inotify: mark directories visited during lookup (issue1844)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9117
diff changeset
    96
95e1867f765b inotify: mark directories visited during lookup (issue1844)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9117
diff changeset
    97
echo b >> 1844/foo
95e1867f765b inotify: mark directories visited during lookup (issue1844)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9117
diff changeset
    98
hg ci 1844 -m 'broken'
95e1867f765b inotify: mark directories visited during lookup (issue1844)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9117
diff changeset
    99
7145
6f4a253f2a64 inotify: fix status not showing "clean" files (issue907)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
   100
kill `cat hg.pid`