[PATCH] D67884: [LNT] Sort machines by ID as expected by test case

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 21 13:04:54 PDT 2019


hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: cmatthews, thopre, kristof.beyls.

`tests/lnttool/admin.shtest` fails in some environments because it expects the `list-machines` output in a certain order.

Assuming ascending order, the matching sort would be the one based on the id. In particular, "localhost" follows "LNT" in both ASCII `strcmp` and also with case-insensitive sorting, and the test expects "localhost" first.

I'm open to doing the sorting on the client side, but this patch sorts on the server side mainly to demonstrate that the expectation of the test was unwarranted given the state of the code. Sorting on the server side also benefits all clients, as opposed to just the ones that are part of this package.


https://reviews.llvm.org/D67884

Files:
  lnt/server/ui/api.py


Index: lnt/server/ui/api.py
===================================================================
--- lnt/server/ui/api.py
+++ lnt/server/ui/api.py
@@ -100,7 +100,7 @@
     def get():
         ts = request.get_testsuite()
         session = request.session
-        machines = session.query(ts.Machine).all()
+        machines = session.query(ts.Machine).order_by(ts.Machine.id).all()
 
         result = common_fields_factory()
         result['machines'] = machines


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67884.221198.patch
Type: text/x-patch
Size: 466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190921/63b395ac/attachment.bin>


More information about the llvm-commits mailing list