##// END OF EJS Templates
tests: add coverage to ensure Wix tracks 'help' and 'templates' files...
Matt Harbison -
r27383:b1160299 default
parent child Browse files
Show More
@@ -1,43 +1,111 b''
1 1 hg debuginstall
2 2 $ hg debuginstall
3 3 checking encoding (ascii)...
4 4 checking Python executable (*) (glob)
5 5 checking Python version (2.*) (glob)
6 6 checking Python lib (*lib*)... (glob)
7 7 checking installed modules (*mercurial)... (glob)
8 8 checking templates (*mercurial?templates)... (glob)
9 9 checking commit editor...
10 10 checking username...
11 11 no problems detected
12 12
13 13 hg debuginstall with no username
14 14 $ HGUSER= hg debuginstall
15 15 checking encoding (ascii)...
16 16 checking Python executable (*) (glob)
17 17 checking Python version (2.*) (glob)
18 18 checking Python lib (*lib*)... (glob)
19 19 checking installed modules (*mercurial)... (glob)
20 20 checking templates (*mercurial?templates)... (glob)
21 21 checking commit editor...
22 22 checking username...
23 23 no username supplied
24 24 (specify a username in your configuration file)
25 25 1 problems detected, please check your install!
26 26 [1]
27 27
28 28 path variables are expanded (~ is the same as $TESTTMP)
29 29 $ mkdir tools
30 30 $ touch tools/testeditor.exe
31 31 #if execbit
32 32 $ chmod 755 tools/testeditor.exe
33 33 #endif
34 34 $ hg debuginstall --config ui.editor=~/tools/testeditor.exe
35 35 checking encoding (ascii)...
36 36 checking Python executable (*) (glob)
37 37 checking Python version (*) (glob)
38 38 checking Python lib (*lib*)... (glob)
39 39 checking installed modules (*mercurial)... (glob)
40 40 checking templates (*mercurial?templates)... (glob)
41 41 checking commit editor...
42 42 checking username...
43 43 no problems detected
44
45 $ cat >> wixxml.py << EOF
46 > import os, subprocess, sys
47 > import xml.etree.ElementTree as ET
48 >
49 > # MSYS mangles the path if it expands $TESTDIR
50 > testdir = os.environ['TESTDIR']
51 > ns = {'wix' : 'http://schemas.microsoft.com/wix/2006/wi'}
52 >
53 > def directory(node, relpath):
54 > '''generator of files in the xml node, rooted at relpath'''
55 > dirs = node.findall('./wix:Directory', ns)
56 >
57 > for d in dirs:
58 > for subfile in directory(d, relpath + d.attrib['Name'] + '/'):
59 > yield subfile
60 >
61 > files = node.findall('./wix:Component/wix:File', ns)
62 >
63 > for f in files:
64 > yield relpath + f.attrib['Name']
65 >
66 > def hgdirectory(relpath):
67 > '''generator of tracked files, rooted at relpath'''
68 > hgdir = "%s/../mercurial" % (testdir)
69 > args = ['hg', '--cwd', hgdir, 'files', '--rev', '.', relpath]
70 > proc = subprocess.Popen(args, stdout=subprocess.PIPE,
71 > stderr=subprocess.PIPE)
72 > output = proc.communicate()[0]
73 >
74 > slash = '/'
75 > for line in output.splitlines():
76 > if os.name == 'nt':
77 > yield line.replace(os.sep, slash)
78 > else:
79 > yield line
80 >
81 > tracked = [f for f in hgdirectory(sys.argv[1])]
82 >
83 > xml = ET.parse("%s/../contrib/wix/%s.wxs" % (testdir, sys.argv[1]))
84 > root = xml.getroot()
85 > dir = root.find('.//wix:DirectoryRef', ns)
86 >
87 > installed = [f for f in directory(dir, '')]
88 >
89 > print('Not installed:')
90 > for f in sorted(set(tracked) - set(installed)):
91 > print(' %s' % f)
92 >
93 > print('Not tracked:')
94 > for f in sorted(set(installed) - set(tracked)):
95 > print(' %s' % f)
96 > EOF
97
98 $ python wixxml.py help
99 Not installed:
100 help/common.txt
101 help/hg.1.txt
102 help/hgignore.5.txt
103 help/hgrc.5.txt
104 help/internals/bundles.txt
105 help/internals/changegroups.txt
106 Not tracked:
107
108 $ python wixxml.py templates
109 Not installed:
110 templates/map-cmdline.status
111 Not tracked:
General Comments 0
You need to be logged in to leave comments. Login now