From 1cc11dbf58edca1e049c5f518deeaf6332b7c633 Mon Sep 17 00:00:00 2001
From: Craig Tiller <craig.tiller@gmail.com>
Date: Thu, 15 Jan 2015 22:50:50 -0800
Subject: [PATCH] Fix run_test.py so it runs the first time

---
 tools/run_tests/run_tests.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 8c4c998d7b..e8c121456a 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -5,6 +5,7 @@ import argparse
 import glob
 import itertools
 import multiprocessing
+import os
 import sys
 import time
 
@@ -117,9 +118,10 @@ class TestCache(object):
     with open('.run_tests_cache', 'w') as f:
       f.write(simplejson.dumps(self.dump()))
 
-  def load(self):
-    with open('.run_tests_cache') as f:
-      self.parse(simplejson.loads(f.read()))
+  def maybe_load(self):
+    if os.path.exists('.run_tests_cache'):
+      with open('.run_tests_cache') as f:
+        self.parse(simplejson.loads(f.read()))
 
 
 def _build_and_run(check_cancelled, newline_on_success, cache):
@@ -158,7 +160,7 @@ test_cache = (None if runs_per_test != 1
               or 'valgrind' in build_configs
               else TestCache())
 if test_cache:
-  test_cache.load()
+  test_cache.maybe_load()
 
 if forever:
   success = True
-- 
GitLab