Patchwork D199: tests: make test-profile.t pass if statprof didn't collect samples

login
register
mail settings
Submitter phabricator
Date July 31, 2017, 10:12 p.m.
Message ID <caa02600919e359f8715943604890a09@localhost.localdomain>
Download mbox | patch
Permalink /patch/22593/
State Not Applicable
Headers show

Comments

phabricator - July 31, 2017, 10:12 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa72b2db1a6a9: tests: make test-profile.t pass if statprof didn't collect samples (authored by martinvonz).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D199?vs=460&id=466

REVISION DETAIL
  https://phab.mercurial-scm.org/D199

AFFECTED FILES
  tests/test-profile.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers, durin42
Cc: durin42, mercurial-devel

Patch

diff --git a/tests/test-profile.t b/tests/test-profile.t
--- a/tests/test-profile.t
+++ b/tests/test-profile.t
@@ -4,21 +4,22 @@ 
   $ hg init a
   $ cd a
 
+Function to check that statprof ran
+  $ statprofran () {
+  >   egrep 'Sample count:|No samples recorded' > /dev/null
+  > }
 
 test --profile
 
-  $ hg st --profile 2>&1 | grep Sample
-  Sample count: \d+ (re)
+  $ hg st --profile 2>&1 | statprofran
 
 Abreviated version
 
-  $ hg st --prof 2>&1 | grep Sample
-  Sample count: \d+ (re)
+  $ hg st --prof 2>&1 | statprofran
 
 In alias
 
-  $ hg --config "alias.profst=status --profile" profst 2>&1 | grep Sample
-  Sample count: \d+ (re)
+  $ hg --config "alias.profst=status --profile" profst 2>&1 | statprofran
 
 #if lsprof
 
@@ -81,26 +82,22 @@ 
 statistical profiler works
 
   $ hg --profile sleep 2>../out
-  $ grep Sample ../out
-  Sample count: \d+ (re)
+  $ cat ../out | statprofran
 
 Various statprof formatters work
 
   $ hg --profile --config profiling.statformat=byline sleep 2>../out
   $ head -n 1 ../out
     %   cumulative      self          
-  $ grep Sample ../out
-  Sample count: \d+ (re)
+  $ cat ../out | statprofran
 
   $ hg --profile --config profiling.statformat=bymethod sleep 2>../out
   $ head -n 1 ../out
     %   cumulative      self          
-  $ grep Sample ../out
-  Sample count: \d+ (re)
+  $ cat ../out | statprofran
 
   $ hg --profile --config profiling.statformat=hotpath sleep 2>../out
-  $ grep Sample ../out
-  Sample count: \d+ (re)
+  $ cat ../out | statprofran
 
   $ hg --profile --config profiling.statformat=json sleep 2>../out
   $ cat ../out