use stamp file for tint_generate_wgsl_corpus
using directory for actions output causes issue like crbug.com/1315457 ninja explain: output obj/third_party/dawn/src/tint/fuzzers/tint_generate_wgsl_corpus.stamp older than most recent input gen/third_party/dawn/src/tint/fuzzers/fuzzer_corpus_wgsl (1649712735 vs 1649712999) Use stamp file instead of directory. Bug: chromium:1315457, chromium:1314527 Change-Id: Ifdf0493e23dbab000513e8f2c0ae4aa8cd76444f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86482 Auto-Submit: Fumitoshi Ukai <ukai@google.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
4c9a6b0951
commit
a5f5f5a1aa
|
@ -22,14 +22,16 @@ if (build_with_chromium) {
|
||||||
import("//testing/libfuzzer/fuzzer_test.gni")
|
import("//testing/libfuzzer/fuzzer_test.gni")
|
||||||
|
|
||||||
fuzzer_corpus_wgsl_dir = "${target_gen_dir}/fuzzer_corpus_wgsl"
|
fuzzer_corpus_wgsl_dir = "${target_gen_dir}/fuzzer_corpus_wgsl"
|
||||||
|
fuzzer_corpus_wgsl_stamp = "${fuzzer_corpus_wgsl_dir}.stamp"
|
||||||
action("tint_generate_wgsl_corpus") {
|
action("tint_generate_wgsl_corpus") {
|
||||||
script = "generate_wgsl_corpus.py"
|
script = "generate_wgsl_corpus.py"
|
||||||
sources = [ "generate_wgsl_corpus.py" ]
|
sources = [ "generate_wgsl_corpus.py" ]
|
||||||
args = [
|
args = [
|
||||||
|
"--stamp=${fuzzer_corpus_wgsl_stamp}",
|
||||||
rebase_path("${tint_root_dir}/test", root_build_dir),
|
rebase_path("${tint_root_dir}/test", root_build_dir),
|
||||||
rebase_path(fuzzer_corpus_wgsl_dir, root_build_dir),
|
rebase_path(fuzzer_corpus_wgsl_dir, root_build_dir),
|
||||||
]
|
]
|
||||||
outputs = [ fuzzer_corpus_wgsl_dir ]
|
outputs = [ fuzzer_corpus_wgsl_stamp ]
|
||||||
}
|
}
|
||||||
|
|
||||||
tint_fuzzer_common_libfuzzer_options = [
|
tint_fuzzer_common_libfuzzer_options = [
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
# Usage:
|
# Usage:
|
||||||
# generate_wgsl_corpus.py <input_dir> <corpus_dir>
|
# generate_wgsl_corpus.py <input_dir> <corpus_dir>
|
||||||
|
|
||||||
|
import optparse
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -40,11 +41,14 @@ def list_wgsl_files(root_search_dir):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) != 3:
|
parser = optparse.OptionParser(
|
||||||
print("Usage: " + sys.argv[0] + " <input dir> <output dir>")
|
usage="usage: %prog [option] input-dir output-dir")
|
||||||
return 1
|
parser.add_option('--stamp', dest='stamp', help='stamp file')
|
||||||
input_dir: str = os.path.abspath(sys.argv[1].rstrip(os.sep))
|
options, args = parser.parse_args(sys.argv[1:])
|
||||||
corpus_dir: str = os.path.abspath(sys.argv[2])
|
if len(args) != 2:
|
||||||
|
parser.error("incorrect number of arguments")
|
||||||
|
input_dir: str = os.path.abspath(args[0].rstrip(os.sep))
|
||||||
|
corpus_dir: str = os.path.abspath(args[1])
|
||||||
if os.path.exists(corpus_dir):
|
if os.path.exists(corpus_dir):
|
||||||
shutil.rmtree(corpus_dir)
|
shutil.rmtree(corpus_dir)
|
||||||
os.makedirs(corpus_dir)
|
os.makedirs(corpus_dir)
|
||||||
|
@ -53,6 +57,8 @@ def main():
|
||||||
continue
|
continue
|
||||||
out_file = in_file[len(input_dir) + 1:].replace(os.sep, '_')
|
out_file = in_file[len(input_dir) + 1:].replace(os.sep, '_')
|
||||||
shutil.copy(in_file, corpus_dir + os.sep + out_file)
|
shutil.copy(in_file, corpus_dir + os.sep + out_file)
|
||||||
|
if options.stamp:
|
||||||
|
pathlib.Path(options.stamp).touch(mode=0o644, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue