Sort the gestures by finger requirements

Currently the gestures are run in what amounts to a random ordering.
This was fine before, but since the robot is running the tests now, we
can speed things up and decrease the odds of failures/damage by ordering
them intelligently.  Fingertip swapping is slow and the most dangerous
part of the test in terms of likelihood for failure as well as actual
damage to the robot.  Therefore, we would like to minimize the number of
fingertip swaps if possible.

This patch alters the touch FW test so that it will always run the
gestures in an order that is sorted based on fingertip usage.  The order
is arbitrary (whatever the default python sorting algorithm is when the
keys are lists of ints) but the important thing is that all the tests
with the *same* fingertips are run in succession.  This will minimize
the number of fingertips swaps, saving time and making the test more
stable.

BUG=chromium:378956
TEST=manually tested.  The ordering was efficient and the test still
rand as normal (just in a different order than before)

Change-Id: I8b99a8033e2cfb43514ed65c1ca5d1fe5763a33a
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/202128
Reviewed-by: Shyh-In Hwang <josephsih@chromium.org>
2 files changed