[llvm-commits] [LNT] r154717 - /lnt/trunk/lnt/server/db/testsuitedb.py
Daniel Dunbar
daniel at zuster.org
Fri Apr 13 16:36:21 PDT 2012
Author: ddunbar
Date: Fri Apr 13 18:36:21 2012
New Revision: 154717
URL: http://llvm.org/viewvc/llvm-project?rev=154717&view=rev
Log:
lnt.server.db: Change order fields to be compared as numerically, including for version strings.
Modified:
lnt/trunk/lnt/server/db/testsuitedb.py
Modified: lnt/trunk/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitedb.py?rev=154717&r1=154716&r2=154717&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py (original)
+++ lnt/trunk/lnt/server/db/testsuitedb.py Fri Apr 13 18:36:21 2012
@@ -154,9 +154,20 @@
if self.__class__ is not b.__class__:
return -1
- return cmp(tuple(self.get_field(item)
+ # Compare each field numerically integer or integral version,
+ # where possible. We ignore whitespace and convert each dot
+ # separated component to an integer if is is numeric.
+ def convert_field(value):
+ items = value.strip().split('.')
+ for i,item in enumerate(items):
+ if item.isdigit():
+ items[i] = int(item, 10)
+ return tuple(items)
+
+ # Compare every field in lexicographic order.
+ return cmp(tuple(convert_field(self.get_field(item))
for item in self.fields),
- tuple(b.get_field(item)
+ tuple(convert_field(b.get_field(item))
for item in self.fields))
class Run(self.base, ParameterizedMixin):
More information about the llvm-commits
mailing list