tests/test-worker.t
author Jun Wu <quark@fb.com>
Wed, 29 Mar 2017 12:37:03 -0700
changeset 31720 dea2a17cbfd0
parent 31696 9d3d56aa1a9f
child 32041 38963a53ab0d
permissions -rw-r--r--
hardlink: check directory's st_dev when copying files Previously, when copying a file, copyfiles will compare src's st_dev with dirname(dst)'s st_dev, to decide whether to enable hardlink or not. That could have issues on Linux's overlayfs, where stating directories could result in different st_dev from st_dev of stating files, even if both the directories and the files exist in the overlay's upperdir. This patch fixes it by checking dirname(src) instead. It's more consistent because we are checking directories for both src and dest. That fixes test-hardlinks.t running on common Docker setups.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31696
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
     1
Test UI worker interaction
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
     2
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
     3
  $ cat > t.py <<EOF
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
     4
  > from __future__ import absolute_import, print_function
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
     5
  > from mercurial import (
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
     6
  >     cmdutil,
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
     7
  >     ui as uimod,
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
     8
  >     worker,
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
     9
  > )
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    10
  > def runme(ui, args):
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    11
  >     for arg in args:
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    12
  >         ui.status('run\n')
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    13
  >         yield 1, arg
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    14
  > cmdtable = {}
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    15
  > command = cmdutil.command(cmdtable)
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    16
  > @command('test', [], 'hg test [COST]')
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    17
  > def t(ui, repo, cost=1.0):
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    18
  >     cost = float(cost)
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    19
  >     ui.status('start\n')
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    20
  >     runs = worker.worker(ui, cost, runme, (ui,), range(8))
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    21
  >     for n, i in runs:
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    22
  >         pass
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    23
  >     ui.status('done\n')
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    24
  > EOF
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    25
  $ abspath=`pwd`/t.py
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    26
  $ hg init
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    27
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    28
Run tests with worker enable by forcing a heigh cost
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    29
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    30
  $ hg --config "extensions.t=$abspath" test 100000.0
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    31
  start
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    32
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    33
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    34
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    35
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    36
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    37
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    38
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    39
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    40
  done
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    41
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    42
Run tests without worker by forcing a low cost
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    43
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    44
  $ hg --config "extensions.t=$abspath" test 0.0000001
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    45
  start
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    46
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    47
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    48
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    49
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    50
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    51
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    52
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    53
  run
9d3d56aa1a9f worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff changeset
    54
  done