Consolidate path handling for test data files.

Added CERES_TEST_SRCDIR_POSTFIX macro.
Added TestFileAbsolutePath function.

Change-Id: I223b74af027bfb775447e062edab897395b21514
diff --git a/internal/ceres/test_util.cc b/internal/ceres/test_util.cc
index e98052d..8a1def7 100644
--- a/internal/ceres/test_util.cc
+++ b/internal/ceres/test_util.cc
@@ -31,10 +31,20 @@
 // Utility functions useful for testing.
 
 #include <cmath>
+#include "ceres/file.h"
 #include "ceres/stringprintf.h"
 #include "glog/logging.h"
 #include "gtest/gtest.h"
 
+DECLARE_string(test_srcdir);
+
+// This macro is used to inject additional path information specific
+// to the build system.
+
+#ifndef CERES_TEST_SRCDIR_SUFFIX
+#define CERES_TEST_SRCDIR_SUFFIX ""
+#endif
+
 namespace ceres {
 namespace internal {
 
@@ -106,5 +116,11 @@
   }
 }
 
+string TestFileAbsolutePath(const string& filename) {
+  return JoinPath(FLAGS_test_srcdir + CERES_TEST_SRCDIR_SUFFIX,
+                  filename);
+}
+
+
 }  // namespace internal
 }  // namespace ceres