[merge] make selftest pass on a slow cpu

Kent Gibson warthog618 at gmail.com
Fri May 11 09:00:43 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Marien,

Both the old and new patterns seem more complicated to me than necessary.
What is wrong with using "[0-9]+" for a decimal integer?
So the patterns I would suggest in the 1st and 3rd instances would be
"^ +[0-9]+ms$", and "^ +[0-9]+ms/ +[0-9]+ms$" in the second.

Cheers,
Kent.

Marien Zwart wrote:
> Hi,
>
> When running selftest in parallel with a few other cpu-intensive
> things on my slowish box it failed because it requires a benchmark
> selftest to finish in under 100 ms. The attached patch should fix this
> by accepting any integer instead of just ones in the 0-99 range.
>
>
> ----------------------------------------------------------------------
>
> # Bazaar merge directive format 1
> # revision_id: marienz at gentoo.org-20070511003934-5v54sk8ejgxgghst
> # target_branch: http://bazaar-vcs.org/bzr/bzr.dev
> # testament_sha1: 536cbc7e1635ed1fc8b8fd527db776ee54ac69af
> # timestamp: 2007-05-11 02:46:23 +0200
> #
> # Bazaar revision bundle v0.9
> #
> # message:
> #   Make test_elapsed_time_with_benchmarking pass on a slow cpu.
> # committer: Marien Zwart <marienz at gentoo.org>
> # date: Fri 2007-05-11 02:39:34.299999952 +0200
>
> === modified file bzrlib/tests/test_selftest.py
> --- bzrlib/tests/test_selftest.py
> +++ bzrlib/tests/test_selftest.py
> @@ -620,18 +620,19 @@
>          result.extractBenchmarkTime(self)
>          timed_string = result._testTimeString()
>          # without explicit benchmarking, we should get a simple time.
> -        self.assertContainsRe(timed_string, "^ *[ 1-9][0-9]ms$")
> +        self.assertContainsRe(timed_string, "^ +(0|[1-9][0-9]*)ms$")
>          # if a benchmark time is given, we want a x of y style result.
>          self.time(time.sleep, 0.001)
>          result.extractBenchmarkTime(self)
>          timed_string = result._testTimeString()
> -        self.assertContainsRe(timed_string, "^ *[ 1-9][0-9]ms/ *[
1-9][0-9]ms$")
> +        self.assertContainsRe(
> +            timed_string, "^ +(0|[1-9][0-9]*)ms/ +(0|[1-9][0-9]*)ms$")
>          # extracting the time from a non-bzrlib testcase sets to None
>          result._recordTestStartTime()
>          result.extractBenchmarkTime(
>             
unittest.FunctionTestCase(self.test_elapsed_time_with_benchmarking))
>          timed_string = result._testTimeString()
> -        self.assertContainsRe(timed_string, "^ *[ 1-9][0-9]ms$")
> +        self.assertContainsRe(timed_string, "^ +(0|[1-9][0-9]*)ms$")
>          # cheat. Yes, wash thy mouth out with soap.
>          self._benchtime = None
> 
>
> === modified directory  //
last-changed:marienz at gentoo.org-20070511003934-5v54s
> ... k8ejgxgghst
> # revision id: marienz at gentoo.org-20070511003934-5v54sk8ejgxgghst
> # sha1: 536cbc7e1635ed1fc8b8fd527db776ee54ac69af
> # inventory sha1: 364bf6513b0078f52e95421cbb0a6c3b1adfde97
> # parent ids:
> #   pqm at pqm.ubuntu.com-20070510055501-w262sk5hl33vmd19
> # base id: pqm at pqm.ubuntu.com-20070510055501-w262sk5hl33vmd19
> # properties:
> #   branch-nick: fix-timed-tests
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGRCKqgoxTFTi1P8QRAsBJAJ9/9l7os57PY0JV4CH0JJtgjUgkYgCg4JI0
GYSnApFbtAvYMs9s6n/s5cg=
=nbyO
-----END PGP SIGNATURE-----



More information about the bazaar mailing list