llvm_tools: save intermediate state even if a step fails

When uploading multiple crashes, a network error may happen (or anything
else, really).

This isn't going to save us from SIGKILLs or power-offs (it's impossible
to save us 100% from either of those, since there's always going to be a
race between writing the JSON file and submitting the test-case), but it
should keep us from submitting duplicate crash reports in most cases.

This also has us sort results from `gsutil ls`, since that may not
always print things in a deterministic order.

TEST=Ran the script; ^C'ed it in the middle.

Change-Id: I9695d83db6fb8161dc6fce16b13980c8eacf219d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2412482
Reviewed-by: Jian Cai <jiancai@google.com>
Tested-by: George Burgess <gbiv@chromium.org>
1 file changed