Make update_engine_unittests depend on bsdiff.
Added build artifacts path to PATH for unittests.
Test: mma; ./update_engine_unittests
Bug: 26955860
Change-Id: I09401cb883be5210887d7c789fdaec4145626fa0
diff --git a/testrunner.cc b/testrunner.cc
index 635e120..934ea91 100644
--- a/testrunner.cc
+++ b/testrunner.cc
@@ -16,14 +16,18 @@
// based on pam_google_testrunner.cc
+#include <string>
+
#include <xz.h>
#include <base/at_exit.h>
#include <base/command_line.h>
+#include <base/environment.h>
#include <brillo/test_helpers.h>
#include <gtest/gtest.h>
#include "update_engine/common/terminator.h"
+#include "update_engine/common/test_utils.h"
#include "update_engine/payload_generator/xz.h"
int main(int argc, char **argv) {
@@ -40,6 +44,15 @@
// the default exit status of 1. Corresponding reverts are necessary in
// terminator_unittest.cc.
chromeos_update_engine::Terminator::Init(2);
+ // In Android bsdiff is located in update_engine_unittests, add it to PATH.
+#ifdef __ANDROID__
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+ std::string path_env;
+ CHECK(env->GetVar("PATH", &path_env));
+ path_env +=
+ ":" + chromeos_update_engine::test_utils::GetBuildArtifactsPath().value();
+ CHECK(env->SetVar("PATH", path_env));
+#endif
LOG(INFO) << "parsing command line arguments";
base::CommandLine::Init(argc, argv);
LOG(INFO) << "initializing gtest";