# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1533214375 -7200
#      Thu Aug 02 14:52:55 2018 +0200
# Node ID 672dbf5584558c30b00de7836eaf099f117678d6
# Parent  ae97d60ca826d2506ce1ab415abc770cf42f6159
test: make the smoke-test uses "persistent" cache

This should avoid doing network exchange for each run. We now use a cache
directory in `/tmp/.scm-perf-test/` to cache repository we need to pull. The use
of this cache is automatically managed by the `share` extension.

The directory is also used to cache wheels used by pip.

diff --git a/tests/test-smoke-test.t b/tests/test-smoke-test.t
--- a/tests/test-smoke-test.t
+++ b/tests/test-smoke-test.t
@@ -40,13 +40,13 @@
   > all: repos/smoke-test-A.benchrepo repos/smoke-test-B.benchrepo
   > 
   > repos/smoke-test-A.benchrepo:
-  > 	(cd repos; tar xf \$(SOURCE)/smoke-test-A-reference.tar --warning=no-timestamp; hg -R smoke-test-A-reference update tip)
+  > 	(cd repos; tar xf \$(SOURCE)/smoke-test-A-reference.tar --warning=no-timestamp; hg -R smoke-test-A-reference update --quiet tip)
   > 	(cd repos/.cache/; tar xf \$(SOURCE)/smoke-test-A-partial-last-hundred.tar --warning=no-timestamp )
   > 	(cd repos/.cache/; tar xf \$(SOURCE)/smoke-test-A-partial-last-ten.tar --warning=no-timestamp )
   > 	(cd repos/.cache/; tar xf \$(SOURCE)/smoke-test-A-partial-last-thousand.tar --warning=no-timestamp )
   > 	(cd repos/.cache/; tar xf \$(SOURCE)/smoke-test-A-partial-same.tar --warning=no-timestamp )
   > repos/smoke-test-B.benchrepo:
-  > 	(cd repos; tar xf \$(SOURCE)/smoke-test-B-reference.tar --warning=no-timestamp; hg -R smoke-test-B-reference update tip)
+  > 	(cd repos; tar xf \$(SOURCE)/smoke-test-B-reference.tar --warning=no-timestamp; hg -R smoke-test-B-reference update --quiet tip)
   > 	(cd repos/.cache/; tar xf \$(SOURCE)/smoke-test-B-partial-last-hundred.tar --warning=no-timestamp )
   > 	(cd repos/.cache/; tar xf \$(SOURCE)/smoke-test-B-partial-last-ten.tar --warning=no-timestamp )
   > 	(cd repos/.cache/; tar xf \$(SOURCE)/smoke-test-B-partial-last-thousand.tar --warning=no-timestamp )
@@ -55,12 +55,27 @@
 
 setup appropriate virtual env
 
+  $ mkdir -p /tmp/.scm-perf-test/pip-cache
+  $ export XDG_CACHE_HOME=/tmp/.scm-perf-test/pip-cache
   $ virtualenv $TESTTMP/venv 1>/dev/null 2>&1
   $ export PATH=$TESTTMP/venv/bin:${PATH}
   $ pip install --requirement requirements.txt --quiet
 
 run
 
+  $ mkdir -p /tmp/.scm-perf-test/repo-pool
+  $ cat << EOF >> test.hgrc
+  > [ui]
+  > quiet = yes
+  > 
+  > [extensions]
+  > share=
+  > 
+  > [share]
+  > pool = /tmp/.scm-perf-test/repo-pool
+  > poolnaming = remote
+  > EOF
+  $ export HGRCPATH="${TESTTMP}"/test-asv/test.hgrc
   $ ASV_SKIP_SYSTEM_CHECK=1 ./launch.sh fe3ca1e6 -b track_commit
   + asv machine --yes
   * (glob)
@@ -88,26 +103,24 @@
   (use ASV_SKIP_SYSTEM_CHECK=1 to skip it)
   + '[' -z 1 ']'
   + '[' '!' -d mercurial ']'
-  + hg clone https://www.mercurial-scm.org/repo/hg mercurial
-  requesting all changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added * (glob)
-  new changesets * (glob)
-  updating to bookmark @* (glob)
-  * files updated, 0 files merged, 0 files removed, 0 files unresolved (glob)
+  + hg clone https://www.mercurial-scm.org/repo/hg mercurial (?)
+  requesting all changes (?)
+  adding changesets (?)
+  adding manifests (?)
+  adding file changes (?)
+  added * (glob) (?)
+  updating to bookmark @* (glob) (?)
+  new changesets * (glob) (?)
+  * files updated, 0 files merged, 0 files removed, 0 files unresolved (glob) (?)
   + mkdir -p repos/
   + mkdir -p repos/.cache
   + make MAKE_VERBOSE=1 -f repos.make
-  (cd repos; tar xf "$TESTTMP/references"/smoke-test-A-reference.tar --warning=no-timestamp; hg -R smoke-test-A-reference update tip)
-  2001 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (cd repos; tar xf "$TESTTMP/references"/smoke-test-A-reference.tar --warning=no-timestamp; hg -R smoke-test-A-reference update --quiet tip)
   (cd repos/.cache/; tar xf "$TESTTMP/references"/smoke-test-A-partial-last-hundred.tar --warning=no-timestamp )
   (cd repos/.cache/; tar xf "$TESTTMP/references"/smoke-test-A-partial-last-ten.tar --warning=no-timestamp )
   (cd repos/.cache/; tar xf "$TESTTMP/references"/smoke-test-A-partial-last-thousand.tar --warning=no-timestamp )
   (cd repos/.cache/; tar xf "$TESTTMP/references"/smoke-test-A-partial-same.tar --warning=no-timestamp )
-  (cd repos; tar xf "$TESTTMP/references"/smoke-test-B-reference.tar --warning=no-timestamp; hg -R smoke-test-B-reference update tip)
-  2001 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (cd repos; tar xf "$TESTTMP/references"/smoke-test-B-reference.tar --warning=no-timestamp; hg -R smoke-test-B-reference update --quiet tip)
   (cd repos/.cache/; tar xf "$TESTTMP/references"/smoke-test-B-partial-last-hundred.tar --warning=no-timestamp )
   (cd repos/.cache/; tar xf "$TESTTMP/references"/smoke-test-B-partial-last-ten.tar --warning=no-timestamp )
   (cd repos/.cache/; tar xf "$TESTTMP/references"/smoke-test-B-partial-last-thousand.tar --warning=no-timestamp )