Commit 490a1c43 authored by Takuto Ikuta's avatar Takuto Ikuta Committed by Commit Bot

Specify output files of do_generate_fontconfig_caches explicitly

This does not allow arbitrary files are included in isolated input from fontconfig_caches directory.

Bug: 870622
Change-Id: I69bc8993800f263d7e3d7679ed85f9c79a380a0b
Reviewed-on: https://chromium-review.googlesource.com/1163596Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarErik Chen <erikchen@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581056}
parent 05b3a3f7
...@@ -378,7 +378,7 @@ if (is_linux) { ...@@ -378,7 +378,7 @@ if (is_linux) {
] ]
args = [] args = []
outputs = [ outputs = [
"$root_out_dir/fontconfig_caches/", "$root_out_dir/fontconfig_caches/df1acc8c-39d5-4a8b-8507-b1a7396ac3ac-le64.cache-7",
"$root_out_dir/test_fonts/.uuid", "$root_out_dir/test_fonts/.uuid",
] ]
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/strings/strcat.h"
#include "base/test/fontconfig_util_linux.h" #include "base/test/fontconfig_util_linux.h"
// GIANT WARNING: The point of this file is to front-load construction of the // GIANT WARNING: The point of this file is to front-load construction of the
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
// deterministic. This executable tries to set some external state to ensure // deterministic. This executable tries to set some external state to ensure
// determinism. We have no way of guaranteeing that this produces correct // determinism. We have no way of guaranteeing that this produces correct
// results, or even has the intended effect. // results, or even has the intended effect.
int main(void) { int main() {
// fontconfig generates a random uuid and uses it to match font folders with // fontconfig generates a random uuid and uses it to match font folders with
// the font cache. Rather than letting fontconfig generate a random uuid, // the font cache. Rather than letting fontconfig generate a random uuid,
// which introduces build non-determinism, we place a fixed uuid in the font // which introduces build non-determinism, we place a fixed uuid in the font
...@@ -46,13 +47,17 @@ int main(void) { ...@@ -46,13 +47,17 @@ int main(void) {
new_times.modtime = 123456789; new_times.modtime = 123456789;
utime(test_fonts_file_path.value().c_str(), &new_times); utime(test_fonts_file_path.value().c_str(), &new_times);
base::FilePath fontconfig_caches = dir_module.Append("fontconfig_caches");
// Delete directory before generating fontconfig caches. This will notify
// future fontconfig_caches changes.
CHECK(base::DeleteFile(fontconfig_caches, /*recursive=*/true));
base::SetUpFontconfig(); base::SetUpFontconfig();
base::TearDownFontconfig(); base::TearDownFontconfig();
base::FilePath fontconfig_caches = dir_module.Append("fontconfig_caches"); // Check existence of intended fontconfig cache file.
CHECK(base::DirectoryExists(fontconfig_caches)); CHECK(base::PathExists(
base::FilePath stamp = fontconfig_caches.Append("STAMP"); fontconfig_caches.Append(base::StrCat({uuid, "-le64.cache-7"}))));
CHECK_EQ(0, base::WriteFile(stamp, "", 0));
return 0; return 0;
} }
...@@ -27,7 +27,9 @@ How to update or add fonts: ...@@ -27,7 +27,9 @@ How to update or add fonts:
6. Add all the font_bundle.tar.gz.sha1 file to the chromium src repository, by 6. Add all the font_bundle.tar.gz.sha1 file to the chromium src repository, by
executing the following command: executing the following command:
$ git add ./third_party/test_fonts/test_fonts.tar.gz.sha1 $ git add ./third_party/test_fonts/test_fonts.tar.gz.sha1
7. (optional) Update FONT_FILES in 7. Update filename constant for fontconfig cache in //base/test/BUILD.gn and
//base/test/generate_fontconfig_caches.cc when test fonts change.
8. (optional) Update FONT_FILES in
third_party/blink/tools/blinkpy/web_tests/port/base.py . third_party/blink/tools/blinkpy/web_tests/port/base.py .
If you need access to the chromium-fonts bucket, contact Chrome infra.% For If you need access to the chromium-fonts bucket, contact Chrome infra.% For
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment