Fix OS::GetFileSizeBytes().
Also improve CHECKs in dex2oat_image_test and
Revert "Disable failing test."
This reverts commit f0e3d9fc0354dfebb06d6930515c315ecc76fe1d.
Test: m test-art-host-gtest-dex2oat_image_test
Bug: 74375666
Change-Id: Iebeceb5a1cdc9d80a76039f52e826711085a7626
Merged-In: a5785a2fda0f01c0a0e3e8632901772c08c41488
(cherry picked from commit a5785a2fda0f01c0a0e3e8632901772c08c41488)
diff --git a/libartbase/base/os_linux.cc b/libartbase/base/os_linux.cc
index 6b5a604..cb228bd 100644
--- a/libartbase/base/os_linux.cc
+++ b/libartbase/base/os_linux.cc
@@ -89,9 +89,11 @@
int64_t OS::GetFileSizeBytes(const char* name) {
struct stat st;
if (stat(name, &st) == 0) {
- return -1; // TODO: Deal with symlinks?
+ return st.st_size; // TODO: Deal with symlinks? According to the documentation,
+ // the st_size for a symlink is "the length of the pathname
+ // it contains, without a terminating null byte."
} else {
- return st.st_size;
+ return -1;
}
}