Make generate_cas_paths.py output deterministic

Sorts final resolved paths in generate_cas_paths.py, as the order of
Path.iterdir() is not deterministic.

The //testing/tools:test_runner_py is a "leaf" target, so this doesn't
make any difference right now, but it could reduce rebuilds for future
targets that might depend on this target.

Bug: pdfium:1933
Change-Id: Ifb3029f27e48dd393cb203b7395bd837e269f384
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/109591
Commit-Queue: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
diff --git a/testing/tools/generate_cas_paths.py b/testing/tools/generate_cas_paths.py
index c76b232..bf41c26 100644
--- a/testing/tools/generate_cas_paths.py
+++ b/testing/tools/generate_cas_paths.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python3
 # Copyright 2023 The PDFium Authors
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
@@ -35,11 +36,12 @@
       # Expand specific children if any are excluded.
       child_paths = expand_dir(path)
       if child_paths:
-        unvisited_paths += child_paths
+        unvisited_paths.extendleft(child_paths)
         continue
 
     resolved_paths.append(os.path.relpath(path, start=absolute_root))
 
+  resolved_paths.sort()
   return [[absolute_root, path] for path in resolved_paths]