blob: afffd07eaf48f35ef2425d8bc947e84c5f88096e [file] [log] [blame]
load("//bazel:skia_rules.bzl", "exports_files_legacy", "skia_cc_library")
load("//bazel:cc_test_with_flags.bzl", "cc_test_with_flags")
load(":android_gm_test.bzl", "android_gm_test")
load(":png_codec.bzl", "png_codec_tests")
licenses(["notice"])
exports_files_legacy()
filegroup(
name = "gm_subset",
srcs = [
"bitmaprect.cpp",
"fontations.cpp",
],
visibility = ["//tools/viewer:__pkg__"],
)
skia_cc_library(
name = "gm",
testonly = True,
srcs = [
"gm.cpp",
"verifiers/gmverifier.cpp",
"verifiers/gmverifier.h",
],
hdrs = ["gm.h"],
visibility = [
"//gm:__subpackages__",
"//tools/viewer:__pkg__",
],
deps = [
"//:skia_internal",
"//tools:registry",
"//tools:tool_utils",
],
)
skia_cc_library(
name = "tests_base",
testonly = True,
srcs = [
"//src/utils:json_hdrs",
"//src/utils:json_srcs",
"//tools/flags",
"//tools/flags:common_flags",
],
deps = [
":gm",
"//gm/surface_manager",
"//gm/vias",
"//tools:hash_and_encode",
"//tools/timer", # Required by animatedimageblurs.cpp.
],
)
CPU_GMS = [
# This is an incomplete list of GMs that only require a CPU.
# TODO(lovisolo): Complete this list.
"3d.cpp",
"aaa.cpp",
"aaclip.cpp",
"aarectmodes.cpp",
"aaxfermodes.cpp",
"addarc.cpp",
"all_bitmap_configs.cpp",
"alphagradients.cpp",
"alpha_image.cpp",
"analytic_gradients.cpp",
"androidblendmodes.cpp",
"animated_gif.cpp",
"animatedimageblurs.cpp",
"animated_image_orientation.cpp",
# "annotated_text.cpp", # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)"
"arcofzorro.cpp",
"arcto.cpp",
"arithmode.cpp",
# TODO(lovisolo): Are these CPU-only, GPU-only or something else? Try them and add them to the
# corresponding list.
# "b_119394958.cpp",
# "backdrop.cpp",
# "backdrop_imagefilter_croprect.cpp",
# "badpaint.cpp",
# "batchedconvexpaths.cpp",
# "bc1_transparency.cpp",
# "beziereffects.cpp",
# "beziers.cpp",
# "bicubic.cpp",
# "bigblurs.cpp",
# "bigmatrix.cpp",
# "bigrect.cpp",
# "bigrrectaaeffect.cpp",
# "bigtext.cpp",
# "bigtileimagefilter.cpp",
# "bitmapcopy.cpp",
# "bitmapfilters.cpp",
# "bitmapimage.cpp",
# "bitmappremul.cpp",
# "bitmaprect.cpp",
# "bitmaprecttest.cpp",
# "bitmapshader.cpp",
# "bitmaptiled.cpp",
# "bleed.cpp",
# "blend.cpp",
# "blurcircles2.cpp",
# "blurcircles.cpp",
# "blurignorexform.cpp",
# "blurimagevmask.cpp",
# "blurpositioning.cpp",
# "blurquickreject.cpp",
# "blurrect.cpp",
# "blurredclippedcircle.cpp",
# "blurroundrect.cpp",
# "blurs.cpp",
# "blurtextsmallradii.cpp",
# "bmpfilterqualityrepeat.cpp",
# "bug12866.cpp",
# "bug5252.cpp",
# "bug530095.cpp",
# "bug615686.cpp",
# "bug6643.cpp",
# "bug6783.cpp",
# "bug9331.cpp",
# "circle_sizes.cpp",
# "circulararcs.cpp",
# "circularclips.cpp",
# "clear_swizzle.cpp",
# "clipdrawdraw.cpp",
# "clip_error.cpp",
# "clippedbitmapshaders.cpp",
# "clipshader.cpp",
# "clip_sierpinski_region.cpp",
# "clip_strokerect.cpp",
# "clockwise.cpp",
# "collapsepaths.cpp",
# "color4f.cpp",
# "coloremoji_blendmodes.cpp",
# "coloremoji.cpp",
# "colorfilteralpha8.cpp",
# "colorfilterimagefilter.cpp",
# "colorfilters.cpp",
# "colormatrix.cpp",
# "colorspace.cpp",
# "colorwheel.cpp",
# "colrv1.cpp",
# "complexclip2.cpp",
# "complexclip3.cpp",
# "complexclip4.cpp",
# "complexclip_blur_tiled.cpp",
# "complexclip.cpp",
# "composecolorfilter.cpp",
# "composeshader.cpp",
# "compositor_quads.cpp",
# "compressed_textures.cpp",
# "concavepaths.cpp",
# "conicpaths.cpp",
# "constcolorprocessor.cpp",
# "convex_all_line_paths.cpp",
# "convexpaths.cpp",
# "convexpolyclip.cpp",
# "convexpolyeffect.cpp",
# "coordclampshader.cpp",
# "copy_to_4444.cpp",
# "crbug_1041204.cpp",
# "crbug_1073670.cpp",
# "crbug_1086705.cpp",
# "crbug_1113794.cpp",
# "crbug_1139750.cpp",
# "crbug_1156804.cpp",
# "crbug_1162942.cpp",
# "crbug_1167277.cpp",
# "crbug_1174186.cpp",
# "crbug_1174354.cpp",
# "crbug_1177833.cpp",
# "crbug_1257515.cpp",
# "crbug_1313579.cpp",
# "crbug_224618.cpp",
# "crbug_691386.cpp",
# "crbug_788500.cpp",
# "crbug_847759.cpp",
# "crbug_884166.cpp",
# "crbug_887103.cpp",
# "crbug_892988.cpp",
# "crbug_899512.cpp",
# "crbug_905548.cpp",
# "crbug_908646.cpp",
# "crbug_913349.cpp",
# "crbug_918512.cpp",
# "crbug_938592.cpp",
# "crbug_946965.cpp",
# "crbug_947055.cpp",
# "crbug_996140.cpp",
# "crop_imagefilter.cpp",
# "croppedrects.cpp",
# "crosscontextimage.cpp",
# "cubicpaths.cpp",
# "daa.cpp",
# "dashcircle.cpp",
# "dashcubics.cpp",
# "dashing.cpp",
# "degeneratesegments.cpp",
# "destcolor.cpp",
# "dftext_blob_persp.cpp",
# "dftext.cpp",
# "discard.cpp",
# "displacement.cpp",
# "distantclip.cpp",
# "drawable.cpp",
# "drawatlascolor.cpp",
# "drawatlas.cpp",
# "drawbitmaprect.cpp",
# "draw_bitmap_rect_skbug4374.cpp",
# "drawglyphs.cpp",
# "drawimageset.cpp",
# "drawlines_with_local_matrix.cpp",
# "drawminibitmaprect.cpp",
# "drawquadset.cpp",
# "drawregion.cpp",
# "drawregionmodes.cpp",
# "dropshadowimagefilter.cpp",
# "drrect.cpp",
# "drrect_small_inner.cpp",
# "dstreadshuffle.cpp",
# "ducky_yuv_blend.cpp",
# "emboss.cpp",
# "emptypath.cpp",
# "encode_alpha_jpeg.cpp",
# "encode_color_types.cpp",
# "encode.cpp",
# "encode_platform.cpp",
# "encode_srgb.cpp",
# "exoticformats.cpp",
# "fadefilter.cpp",
# "fatpathfill.cpp",
# "fiddle.cpp",
# "fillrect_gradient.cpp",
# "filltypes.cpp",
# "filltypespersp.cpp",
# "filterbug.cpp",
# "filterfastbounds.cpp",
# "filterindiabox.cpp",
# "flippity.cpp",
# "fontations.cpp",
# "fontcache.cpp",
# "fontmgr.cpp",
# "fontregen.cpp",
# "fontscaler.cpp",
# "fontscalerdistortable.cpp",
# "fpcoordinateoverride.cpp",
# "fp_sample_chaining.cpp",
# "fwidth_squircle.cpp",
# "gammatext.cpp",
# "getpostextpath.cpp",
# "giantbitmap.cpp",
# "glyph_pos.cpp",
# "gpu_blur_utils.cpp",
# "gradient_dirty_laundry.cpp",
# "gradient_matrix.cpp",
# "gradients_2pt_conical.cpp",
# "gradients.cpp",
# "gradients_degenerate.cpp",
# "gradients_no_texture.cpp",
# "gradtext.cpp",
# "graphite_replay.cpp",
# "graphitestart.cpp",
# "grayscalejpg.cpp",
# "hairlines.cpp",
# "hairmodes.cpp",
# "hardstop_gradients.cpp",
# "hardstop_gradients_many.cpp",
# "highcontrastfilter.cpp",
# "hittestpath.cpp",
# "hsl.cpp",
# "hugepath.cpp",
# "imageblur2.cpp",
# "imageblurclampmode.cpp",
# "imageblur.cpp",
# "imageblurrepeatmode.cpp",
# "imageblurtiled.cpp",
# "image.cpp",
# "imagefiltersbase.cpp",
# "imagefiltersclipped.cpp",
# "imagefilters.cpp",
# "imagefilterscropexpand.cpp",
# "imagefilterscropped.cpp",
# "imagefiltersgraph.cpp",
# "imagefiltersscaled.cpp",
# "imagefiltersstroked.cpp",
# "imagefilterstransformed.cpp",
# "imagefiltersunpremul.cpp",
# "imagefromyuvtextures.cpp",
# "imagemagnifier.cpp",
# "imagemakewithfilter.cpp",
# "imagemasksubset.cpp",
# "image_pict.cpp",
# "imageresizetiled.cpp",
# "image_shader.cpp",
# "imagesource2.cpp",
# "imagesource.cpp",
# "internal_links.cpp",
# "inverseclip.cpp",
# "inversepaths.cpp",
# "jpg_color_cube.cpp",
# "kawase_blur_rt.cpp",
# "labyrinth.cpp",
# "largeclippedpath.cpp",
# "largeglyphblur.cpp",
# "lattice.cpp",
# "lazytiling.cpp",
# "lcdblendmodes.cpp",
# "lcdoverlap.cpp",
# "lcdtext.cpp",
# "lighting.cpp",
# "linepaths.cpp",
# "localmatriximagefilter.cpp",
# "localmatriximageshader.cpp",
# "localmatrixshader.cpp",
# "lumafilter.cpp",
# "mac_aa_explorer.cpp",
# "makecolorspace.cpp",
# "make_raster_image.cpp",
# "mandoline.cpp",
# "manypathatlases.cpp",
# "manypaths.cpp",
# "matrixconvolution.cpp",
# "matriximagefilter.cpp",
# "mesh.cpp",
# "mipmap.cpp",
# "mirrortile.cpp",
# "mixedtextblobs.cpp",
# "mixercolorfilter.cpp",
# "modecolorfilters.cpp",
# "morphology.cpp",
# "nearesthalfpixelimage.cpp",
# "nested.cpp",
# "ninepatchstretch.cpp",
# "nonclosedpaths.cpp",
# "offsetimagefilter.cpp",
# "orientation.cpp",
# "ovals.cpp",
# "overdrawcanvas.cpp",
# "overdrawcolorfilter.cpp",
# "overstroke.cpp",
# "p3.cpp",
# "palette.cpp",
# "patch.cpp",
# "patharcto.cpp",
# "pathcontourstart.cpp",
# "patheffects.cpp",
# "pathfill.cpp",
# "pathinterior.cpp",
# "pathmaskcache.cpp",
# "pathmeasure.cpp",
# "pathopsinverse.cpp",
# "pathreverse.cpp",
# "path_stroke_with_zero_length.cpp",
# "pdf_never_embed.cpp",
# "perlinnoise.cpp",
# "perspimages.cpp",
# "perspshaders.cpp",
# "persptext.cpp",
# "picture.cpp",
# "pictureimagefilter.cpp",
# "pictureimagegenerator.cpp",
# "pictureshadercache.cpp",
# "pictureshader.cpp",
# "pictureshadertile.cpp",
# "plus.cpp",
# "points.cpp",
# "poly2poly.cpp",
# "polygonoffset.cpp",
# "polygons.cpp",
# "postercircle.cpp",
# "preservefillrule.cpp",
# "quadpaths.cpp",
# "radial_gradient_precision.cpp",
# "rasterhandleallocator.cpp",
# "readpixels.cpp",
# "recordopts.cpp",
# "rectangletexture.cpp",
# "repeated_bitmap.cpp",
# "resizeimagefilter.cpp",
# "rippleshadergm.cpp",
# "roundrects.cpp",
# "rrectclipdrawpaint.cpp",
# "rrect.cpp",
# "rrects.cpp",
# "rsxtext.cpp",
# "runtimecolorfilter.cpp",
# "runtimefunctions.cpp",
# "runtimeimagefilter.cpp",
# "runtimeintrinsics.cpp",
# "runtimeshader.cpp",
# "samplerstress.cpp",
# "savelayer.cpp",
# "scaledemoji.cpp",
# "scaledemoji_rendering.cpp",
# "scaledrects.cpp",
# "scaledstrokes.cpp",
# "shadermaskfilter.cpp",
# "shaderpath.cpp",
# "shadertext3.cpp",
# "shadowutils.cpp",
# "shallowgradient.cpp",
# "shapes.cpp",
# "sharedcorners.cpp",
# "showmiplevels.cpp",
# "simpleaaclip.cpp",
# "simplerect.cpp",
# "skbug_12212.cpp",
# "skbug1719.cpp",
# "skbug_257.cpp",
# "skbug_4868.cpp",
# "skbug_5321.cpp",
# "skbug_8664.cpp",
# "skbug_8955.cpp",
# "skbug_9319.cpp",
# "skbug_9819.cpp",
# "slug.cpp",
# "smallarc.cpp",
# "smallpaths.cpp",
# "spritebitmap.cpp",
# "srcmode.cpp",
# "srgb.cpp",
# "stlouisarch.cpp",
# "stringart.cpp",
# "strokedlines.cpp",
# "strokefill.cpp",
# "strokerect_anisotropic.cpp",
# "strokerect.cpp",
# "strokerects.cpp",
# "stroke_rect_shader.cpp",
# "strokes.cpp",
# "stroketext.cpp",
# "subsetshader.cpp",
# "surface.cpp",
# "swizzle.cpp",
# "tablecolorfilter.cpp",
# "tallstretchedbitmaps.cpp",
# "testgradient.cpp",
# "texelsubset.cpp",
# "textblobblockreordering.cpp",
# "textblobcolortrans.cpp",
# "textblob.cpp",
# "textblobgeometrychange.cpp",
# "textblobmixedsizes.cpp",
# "textblobrandomfont.cpp",
# "textblobshader.cpp",
# "textblobtransforms.cpp",
# "textblobuseaftergpufree.cpp",
# "texteffects.cpp",
# "text_scale_skew.cpp",
# "thinconcavepaths.cpp",
# "thinrects.cpp",
# "thinstrokedrects.cpp",
# "tiledscaledbitmap.cpp",
# "tileimagefilter.cpp",
# "tilemodes_alpha.cpp",
# "tilemodes.cpp",
# "tilemodes_scaled.cpp",
# "tinybitmap.cpp",
# "transparency.cpp",
# "trickycubicstrokes.cpp",
# "typeface.cpp",
# "unpremul.cpp",
# "userfont.cpp",
# "variedtext.cpp",
# "verifiers",
# "vertices.cpp",
# "verylargebitmap.cpp",
# "video_decoder.cpp",
# "wacky_yuv_formats.cpp",
# "widebuttcaps.cpp",
# "windowrectangles.cpp",
# "xfermodeimagefilter.cpp",
# "xfermodes2.cpp",
# "xfermodes3.cpp",
# "xfermodes.cpp",
# "ycbcrimage.cpp",
# "yuv420_odd_dim.cpp",
# "yuvtorgbsubset.cpp",
]
GPU_GMS = [
# TODO(lovisolo): Incomplete list. Some commented out files in CPU_GMS probably belong here.
# "aarecteffect.cpp", # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)"
"anisotropic.cpp",
# "asyncrescaleandread.cpp", # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)"
# "attributes.cpp", # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)"
# "beziereffects.cpp", # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)"
# "clockwise.cpp", # ./include/core/SkRefCnt.h:41: fatal error: "assert(this->getRefCnt() == 1)"
]
# Sample invocation:
#
# $ bazel run --config=linux_rbe //gm:cpu_8888_test
#
# Then inspect the PNG and JSON files produced by the GMs:
#
# $ unzip -l bazel-testlogs/gm/cpu_8888_test/test.outputs/outputs.zip
cc_test_with_flags(
name = "cpu_8888_test",
srcs = ["BazelGMRunner.cpp"] + CPU_GMS,
args = [
"--surfaceConfig",
"8888",
],
data = ["//resources"],
set_flags = {
"include_decoder": [
"gif_decode_codec",
"webp_decode_codec",
],
},
deps = [":tests_base"],
)
# Currently fails the "arithmode_blender" GM with "Deserialized and reference bitmap pixels do not
# match". Other GMs fail as well, and some others pass.
#
# TODO(lovisolo): Define flag --skip and skip the "arithmode_blender" GM.
# TODO(lovisolo): Consider adding a gm_test macro that keeps the "--via" command-line argument and
# the "via" flag in sync.
cc_test_with_flags(
name = "cpu_8888_via_picture_serialization_test",
srcs = ["BazelGMRunner.cpp"] + CPU_GMS,
args = [
"--surfaceConfig",
"8888",
"--via",
"picture_serialization",
],
data = ["//resources"],
set_flags = {
"include_decoder": [
"gif_decode_codec",
"webp_decode_codec",
],
"include_encoder": [
"png_encode_codec", # Required by the "picture_serialization" via.
],
"via": ["picture_serialization"],
},
deps = [":tests_base"],
)
cc_test_with_flags(
name = "cpu_8888_via_picture_test",
srcs = ["BazelGMRunner.cpp"] + CPU_GMS,
args = [
"--surfaceConfig",
"8888",
"--via",
"picture",
],
data = ["//resources"],
set_flags = {
"include_decoder": [
"gif_decode_codec",
"webp_decode_codec",
],
"include_encoder": [
"png_encode_codec", # Required by the "picture" via.
],
"via": ["picture"],
},
deps = [":tests_base"],
)
png_codec_tests(name = "png_codec_tests")
test_suite(
name = "cpu_gm_tests",
tests = [
"cpu_8888_test",
# "cpu_8888_via_picture_serialization_test", # Fails due to differences in image.
"cpu_8888_via_picture_test",
":png_codec_tests",
],
)
cc_test_with_flags(
name = "gpu_gles_test",
srcs = ["BazelGMRunner.cpp"] + GPU_GMS,
args = [
"--surfaceConfig",
"gles",
],
data = ["//resources"],
set_flags = {
"include_decoder": [
"gif_decode_codec",
"webp_decode_codec",
],
},
deps = [":tests_base"],
)
cc_test_with_flags(
name = "hello_bazel_world_test",
srcs = [
"BazelGMRunner.cpp",
"hello_bazel_world.cpp",
],
args = [
"--surfaceConfig",
"8888",
],
data = ["//resources"],
deps = [":tests_base"],
)
android_gm_test(
name = "hello_bazel_world_android_test",
srcs = ["hello_bazel_world.cpp"],
config = "8888",
requires_resources_dir = True,
deps = [":tests_base"],
)
[
# Sample invocation (assuming there's a Pixel 5 or similar device available via adb):
#
# $ bazel test --config=linux_rbe //gm:cpu_8888_android_test --config=pixel_5
#
# Then inspect the PNG and JSON files produced by the GMs:
#
# $ unzip -l bazel-testlogs/gm/cpu_8888_android_test/test.outputs/outputs.zip
android_gm_test(
name = "cpu_%s_android_test" % config,
srcs = CPU_GMS,
config = config,
flags = {
"include_decoder": [
"gif_decode_codec",
"webp_decode_codec",
],
},
requires_resources_dir = True,
deps = [":tests_base"],
)
for config in [
"8888",
"565",
]
]
android_gm_test(
name = "gpu_gles_android_test",
srcs = GPU_GMS,
config = "gles",
flags = {
"include_decoder": [
"png_decode_codec",
"webp_decode_codec",
],
},
requires_condition = "//src/gpu:gl_ganesh",
requires_resources_dir = True,
deps = [":tests_base"],
)
# Currently fails the "anisomips" GM with "Deserialized and reference bitmap pixels do not match".
# Other GMs do pass.
# TODO(lovisolo): Define flag --skip and skip the "anisomips" GM.
android_gm_test(
name = "gpu_gles_via_picture_serialization_android_test",
srcs = GPU_GMS,
config = "gles",
flags = {
"include_decoder": [
"png_decode_codec",
"webp_decode_codec",
],
"include_encoder": [
"png_encode_codec", # Required by the "picture_serialization" via.
],
},
requires_condition = "//src/gpu:gl_ganesh",
requires_resources_dir = True,
via = "picture_serialization",
deps = [":tests_base"],
)
# Currently fails the "anisomips" GM with "Deserialized and reference bitmap pixels do not match".
# Other GMs do pass.
# TODO(lovisolo): Define flag --skip and skip the "anisomips" GM.
android_gm_test(
name = "gpu_gles_via_picture_android_test",
srcs = GPU_GMS,
config = "gles",
flags = {
"include_decoder": [
"png_decode_codec",
"webp_decode_codec",
],
"include_encoder": [
"png_encode_codec", # Required by the "picture" via.
],
},
requires_condition = "//src/gpu:gl_ganesh",
requires_resources_dir = True,
via = "picture",
deps = [":tests_base"],
)