Patchwork [1,of,3] run-tests: set a default largefiles usercache in the default hgrc file

login
register
mail settings
Submitter Matt Harbison
Date Nov. 21, 2014, 4:16 a.m.
Message ID <c32796f1605539096eed.1416543394@Envy>
Download mbox | patch
Permalink /patch/6816/
State Accepted
Headers show

Comments

Matt Harbison - Nov. 21, 2014, 4:16 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1416458500 18000
#      Wed Nov 19 23:41:40 2014 -0500
# Node ID c32796f1605539096eed2603e0c2dca44f99fb04
# Parent  704e8ea4f12df5e9d9520efa3b60fe7b94698386
run-tests: set a default largefiles usercache in the default hgrc file

This fixes a test failure introduced in 4be754832829 on Windows and OS X, where
the cached largefile wasn't being deleted because the named .cache directory
didn't exist.  It only existed on Linux because the test suite sets $HOME to the
directory of the test being run, and Linux uses $HOME/.cache by default.

Most of the other largefiles tests explicitly set this value at the top of their
scripts, but test-largefiles-update.t didn't pick that up when it was created.
Those scripts that do set a value will override this.

We could just set the parameter in the test-largefiles-update.t script, but
there are a few other non obvious tests that exercise largefiles too.  These
largefiles end up being cached in the user's real cache, so proper hygiene
dictates that this not be left to each individual test script.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -689,6 +689,10 @@ 
         hgrc.write('commit = -d "0 0"\n')
         hgrc.write('shelve = --date "0 0"\n')
         hgrc.write('tag = -d "0 0"\n')
+        hgrc.write('[largefiles]\n')
+        hgrc.write('usercache = %s\n' %
+                   (os.path.join(self._testtmp, '.cache/largefiles')))
+
         for opt in self._extraconfigopts:
             section, key = opt.split('.', 1)
             assert '=' in key, ('extra config opt %s must '
diff --git a/tests/test-basic.t b/tests/test-basic.t
--- a/tests/test-basic.t
+++ b/tests/test-basic.t
@@ -5,6 +5,7 @@ 
   defaults.commit=-d "0 0"
   defaults.shelve=--date "0 0"
   defaults.tag=-d "0 0"
+  largefiles.usercache=$TESTTMP/.cache/largefiles (glob)
   ui.slash=True
   ui.interactive=False
   ui.mergemarkers=detailed
diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -178,6 +178,7 @@ 
   defaults.commit=-d "0 0"
   defaults.shelve=--date "0 0"
   defaults.tag=-d "0 0"
+  largefiles.usercache=$TESTTMP/.cache/largefiles
   ui.slash=True
   ui.interactive=False
   ui.mergemarkers=detailed