Skip to content

Commit a03b174

Browse files
Hugo GrusonHainish
authored andcommitted
Extend duplicates check to rulesets with different platforms
1 parent 770bdfa commit a03b174

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

test/validations/special/duplicate-whitelist-cleanup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ TMPFILE=`mktemp /tmp/buffer.XXXXXXXX`
44
trap 'rm "$TMPFILE"' EXIT
55

66
for host in `cat test/validations/special/duplicate-whitelist.txt`; do
7-
REPEATS=`grep -F "target host=\"$host\"" src/chrome/content/rules/*.xml | wc -l`
7+
REPEATS=`egrep -l "<target\s+host=\s*\"$host\"\s*/>" src/chrome/content/rules/*.xml | wc -l`
88
if [ $REPEATS -gt 1 ]; then
99
echo $host
1010
fi

test/validations/special/duplicate-whitelist.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ www1.arun.gov.uk
99
mailing.channel4.com
1010
training.citrix.com
1111
consumerreports.org
12-
c-spanvideo.org
1312
dell.com
1413
www.dell.com
1514
investors.demandware.com
@@ -74,7 +73,6 @@ www2.scribblelive.com
7473
sparxtrading.com
7574
suppliesfordreams.org
7675
www.techrepublic.com
77-
tesco.com
7876
thefederalistpapers.org
7977
thompsonhotels.com
8078
ti.com

test/validations/special/run.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,24 +180,18 @@ def nomes_all(where=sys.argv[1:]):
180180
failure = 1
181181
fail("%s failed test: %s" % (filename, test.__doc__))
182182

183-
platform_list = xpath_ruleset_platform(tree)
184-
if len(platform_list) == 0:
185-
platform = ''
186-
else:
187-
platform = platform_list[0]
188-
189183
targets = xpath_host(tree)
190184
for target in targets:
191-
host_counter.update([(target, platform)])
185+
host_counter.update([target])
192186

193187

194-
for (host, platform), count in host_counter.most_common():
188+
for host, count in host_counter.most_common():
195189
if count > 1:
196190
if host in duplicate_allowed_list:
197-
warn("Whitelisted hostname %s with platform '%s' shows up in %d different rulesets." % (host, platform, count))
191+
warn("Whitelisted hostname %s shows up in %d different rulesets." % (host, count))
198192
else:
199193
failure = 1
200-
fail("Hostname %s with platform '%s' shows up in %d different rulesets." % (host, platform, count))
194+
fail("Hostname %s shows up in %d different rulesets." % (host, count))
201195
if not is_valid_target_host(host):
202196
failure = 1
203197
fail("%s failed: %s" % (host, is_valid_target_host.__doc__))

0 commit comments

Comments
 (0)