update_engine: drop SYSROOT checks
Since unittests are run inside of the sysroot now, the specific checks
for them in the tests are pointless. Delete all the related logic.
BUG=chromium:401872
TEST=precq passes (runs unittests)
Change-Id: I12cb5e6717718a35c0dda2510e63c7bbcfa1f470
Reviewed-on: https://chromium-review.googlesource.com/269643
Trybot-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/delta_performer_unittest.cc b/delta_performer_unittest.cc
index 4739cb2..381f777 100644
--- a/delta_performer_unittest.cc
+++ b/delta_performer_unittest.cc
@@ -231,8 +231,7 @@
if (signature_test == kSignatureGeneratedShellBadKey) {
LOG(INFO) << "Generating a mismatched private key.";
ASSERT_EQ(0, System(base::StringPrintf(
- "%s genrsa -out %s 2048",
- utils::GetPathOnBoard("openssl").c_str(), private_key_path.c_str())));
+ "openssl genrsa -out %s 2048", private_key_path.c_str())));
}
int signature_size = GetSignatureSize(private_key_path);
string hash_file;
@@ -264,8 +263,7 @@
ScopedPathUnlinker sig_unlinker(sig_file);
ASSERT_EQ(0,
System(base::StringPrintf(
- "%s rsautl -raw -sign -inkey %s -in %s -out %s",
- utils::GetPathOnBoard("openssl").c_str(),
+ "openssl rsautl -raw -sign -inkey %s -in %s -out %s",
private_key_path.c_str(),
hash_file.c_str(),
sig_file.c_str())));
@@ -276,8 +274,7 @@
signature_test == kSignatureGeneratedShellRotateCl2) {
ASSERT_EQ(0,
System(base::StringPrintf(
- "%s rsautl -raw -sign -inkey %s -in %s -out %s",
- utils::GetPathOnBoard("openssl").c_str(),
+ "openssl rsautl -raw -sign -inkey %s -in %s -out %s",
kUnittestPrivateKey2Path,
hash_file.c_str(),
sig_file2.c_str())));
diff --git a/payload_generator/payload_signer.cc b/payload_generator/payload_signer.cc
index 6e0b4ee..eec8d7a 100644
--- a/payload_generator/payload_signer.cc
+++ b/payload_generator/payload_signer.cc
@@ -152,10 +152,6 @@
cmd[cmd.size() - 3] = hash_path;
cmd[cmd.size() - 1] = sig_path;
- // When running unittests, we need to use the openssl version from the
- // SYSROOT instead of the one on the $PATH (host).
- cmd[0] = utils::GetPathOnBoard("openssl");
-
int return_code = 0;
TEST_AND_RETURN_FALSE(Subprocess::SynchronousExec(cmd, &return_code,
nullptr));
diff --git a/update_engine.gyp b/update_engine.gyp
index 0a1a445..3df48f1 100644
--- a/update_engine.gyp
+++ b/update_engine.gyp
@@ -346,9 +346,6 @@
'libpayload_generator',
],
'includes': ['../common-mk/common_test.gypi'],
- 'defines': [
- 'SYSROOT="<(sysroot)"',
- ],
'sources': [
'action_pipe_unittest.cc',
'action_processor_unittest.cc',
diff --git a/utils.cc b/utils.cc
index 99a23cf..1e94ffa 100644
--- a/utils.cc
+++ b/utils.cc
@@ -831,27 +831,6 @@
return GetSquashfs4Size(header.data(), header.size(), nullptr, nullptr);
}
-string GetPathOnBoard(const string& command) {
- int return_code = 0;
- string command_path;
- // TODO(deymo): prepend SYSROOT to each PATH instead of the result.
- if (!Subprocess::SynchronousExec(
- {"which", command}, &return_code, &command_path)) {
- return command;
- }
- if (return_code != 0)
- return command;
-
- base::TrimWhitespaceASCII(command_path, base::TRIM_ALL, &command_path);
- const char* env_sysroot = getenv("SYSROOT");
- if (env_sysroot) {
- string sysroot_command_path = env_sysroot + command_path;
- if (utils::FileExists(sysroot_command_path.c_str()))
- return sysroot_command_path;
- }
- return command_path;
-}
-
// Tries to parse the header of an ELF file to obtain a human-readable
// description of it on the |output| string.
static bool GetFileFormatELF(const uint8_t* buffer, size_t size,
diff --git a/utils.h b/utils.h
index e374b5b..8f30ebd 100644
--- a/utils.h
+++ b/utils.h
@@ -248,11 +248,6 @@
// false.
bool IsSquashfsFilesystem(const std::string& device);
-// Returns the path of the passed |command| on the board. This uses the
-// environment variable SYSROOT to determine the path to the command on the
-// board instead of the path on the running environment.
-std::string GetPathOnBoard(const std::string& command);
-
// Returns a human-readable string with the file format based on magic constants
// on the header of the file.
std::string GetFileFormat(const std::string& path);