[LNT] r373129 - [LNT] Sort machines by ID as expected by test case

Hubert Tong via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 14:57:00 PDT 2019


Author: hubert.reinterpretcast
Date: Fri Sep 27 14:57:00 2019
New Revision: 373129

URL: http://llvm.org/viewvc/llvm-project?rev=373129&view=rev
Log:
[LNT] Sort machines by ID as expected by test case

Summary:
`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.

Reviewers: cmatthews, thopre, kristof.beyls

Reviewed By: cmatthews

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D67884

Modified:
    lnt/trunk/lnt/server/ui/api.py

Modified: lnt/trunk/lnt/server/ui/api.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/api.py?rev=373129&r1=373128&r2=373129&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/api.py (original)
+++ lnt/trunk/lnt/server/ui/api.py Fri Sep 27 14:57:00 2019
@@ -100,7 +100,7 @@ class Machines(Resource):
     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




More information about the llvm-commits mailing list