[PATCH] tests: add coverage to ensure Wix tracks 'help' and 'templates' files
Matt Harbison
mharbison72 at gmail.com
Mon Sep 14 03:08:08 UTC 2015
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1442199291 14400
# Sun Sep 13 22:54:51 2015 -0400
# Node ID 1894c23c325b0241ca3b01450bb38fc3ce544dd4
# Parent 433e55099cfd7c391b4428d62f1c74e76a2133b3
tests: add coverage to ensure Wix tracks 'help' and 'templates' files
This would have caught the problem fixed by 65d2538ac993. There are other *.wxs
files that can be checked, but they appear to be more complicated. For example,
locale.wxs has what appears to be foreach loop support, as well as variable
substitution.
I can't tell if the map-cmdline.status file is not included on purpose, but I
don't see the purpose of excluding it. The missing help files seem reasonable
for Windows.
diff --git a/tests/test-install.t b/tests/test-install.t
--- a/tests/test-install.t
+++ b/tests/test-install.t
@@ -41,3 +41,64 @@
checking commit editor...
checking username...
no problems detected
+
+ $ cat >> wixxml.py << EOF
+ > import sys, os
+ > import xml.etree.ElementTree as ET
+ >
+ > # MSYS mangles the path if it expands $TESTDIR
+ > testdir = os.environ['TESTDIR']
+ > ns = {'wix' : 'http://schemas.microsoft.com/wix/2006/wi'}
+ >
+ > def directory(node, relpath):
+ > '''generator of files in the xml node, rooted at relpath'''
+ > dirs = node.findall('./wix:Directory', ns)
+ >
+ > for d in dirs:
+ > for subfile in directory(d, relpath + d.attrib['Name'] + '/'):
+ > yield subfile
+ >
+ > files = node.findall('./wix:Component/wix:File', ns)
+ >
+ > for f in files:
+ > yield relpath + f.attrib['Name']
+ >
+ > def hgdirectory(abspath, relpath):
+ > '''generator of filenames in the filesystem, rooted at relpath'''
+ > for f in os.listdir(abspath):
+ > if os.path.isfile(os.path.join(abspath, f)):
+ > yield relpath + f
+ > if os.path.isdir(os.path.join(abspath, f)):
+ > for f in hgdirectory(abspath + '/' + f, relpath + f + '/'):
+ > yield f
+ >
+ > hgdir = "%s/../mercurial/%s" % (testdir, sys.argv[1])
+ > tracked = [f for f in hgdirectory(hgdir, sys.argv[1] + '/')]
+ >
+ > xml = ET.parse("%s/../contrib/wix/%s.wxs" % (testdir, sys.argv[1]))
+ > root = xml.getroot()
+ > dir = root.find('.//wix:DirectoryRef', ns)
+ >
+ > installed = [f for f in directory(dir, '')]
+ >
+ > print('Not installed:')
+ > for f in sorted(set(tracked) - set(installed)):
+ > print(' %s' % f)
+ >
+ > print('Not tracked:')
+ > for f in sorted(set(installed) - set(tracked)):
+ > print(' %s' % f)
+ > EOF
+
+ $ python wixxml.py help
+ Not installed:
+ help/common.txt
+ help/hg.1.txt
+ help/hgignore.5.txt
+ help/hgrc.5.txt
+ Not tracked:
+
+ $ python wixxml.py templates
+ Not installed:
+ templates/map-cmdline.status
+ Not tracked:
More information about the Mercurial-devel
mailing list