skia2/include/core
Kevin Lubick acab911351 [bazel] Make use of test_on_env to spin up server for gms
In order to extract the PNG files produced by our CanvasKit gms,
we need our JS tests to POST them to a server which can write to
disk. The easiest way to do this is to use the test_on_env
rule defined in the Skia Infra repo for exactly this purpose.

This required https://skia-review.googlesource.com/c/buildbot/+/510717
to be able to configure the binary correctly and
https://skia-review.googlesource.com/c/buildbot/+/511862, for nicer
debugging so the skia-infra dep was updated via the following commands:
$ go get go.skia.org/infra@d8a552a29e
$ go mod download
$ make -C infra/bots train
$ make -C bazel gazelle_update_repo
This caused many automated changes to infra/bots/tasks.json

The flow is:
1. User types bazelisk test :hello_world_test_with_env
2. The test_on_env rule starts gold_test_env and waits
   for the file defined in $ENV_READY_FILE to be created.
3. gold_test_env starts a web server on a random port. It
   writes this port number to $ENV_DIR/port. Then, it
   creates $ENV_READY_FILE to signal ready.
4. test_on_env sees the ready file and then starts the
   karma_test rule. (Reminder: this is a bash script
   which starts karma using the Bazel-bundled chromium).
5. The karma_test rule runs the karma.bazel.js file (which
   has been injected with some JS code to fill in Bazel
   paths and settings) using Bazel-bundled node. This reads
   in the port file and sets up a Karma proxy to redirect
   /gold_rpc/report to http://localhost:PORT/report
6. The JS tests run via Karma (and do assertions via Jasmine).
   Some tests, the gms, make POST requests to the proxy.
7. gold_test_env gets these POST requests writes the images
   to a special Bazel folder on disk as defined by
   $TEST_UNDECLARED_OUTPUTS_DIR.
8. test_on_env identifies that the tests finish (because the
   karma_test script returns 0). It sends SIGINT to gold_test_env.
9. gold_test_env stops the webserver. The special Bazel folder
   will zip up anything inside it and make it available for
   future rules (e.g. a rule that will upload to Gold via goldctl).

Suggested Review Order:
 - bazel/karma_test.bzl to see the test_on_env rule bundled into
   the karma_test macro. I chose to put it there because it might
   be confusing to have to define both a karma_test and test_on_env
   rule in the same package but not be able to call one because it
   will fail to talk to the server.
 - gold_test_env.go to see how the appropriate files are written
   to signal the environment is ready and the handlers are set up.
 - karma.bazel.js to see how we make our own proxy given the
   port from the env binary. The fact that we could not create
   our own proxy with the existing karma_test rule was why the
   chain ending in https://skia-review.googlesource.com/c/skia/+/508797
   had to be abandoned.
 - tests/*.js to see how the environment is probed via /healthz
   and then used to make POST requests with data.
 - Everything else.

Change-Id: I32a90def41796ca94cf187d640cfff8e262f85f6
BUG: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/510737
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2022-02-28 14:05:54 +00:00
..
BUILD.bazel [bazel] Make use of test_on_env to spin up server for gms 2022-02-28 14:05:54 +00:00
SkAnnotation.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkBBHFactory.h Reenable Wdeprecated-copy-dtor 2021-02-16 17:53:28 +00:00
SkBitmap.h Remove supported for (removed) inheriting paint filter-quality 2021-03-09 00:58:09 +00:00
SkBlender.h Move Mode() factory into SkBlender 2021-07-06 13:39:05 +00:00
SkBlendMode.h [androidkit] bind SkImageFilters to java shared library 2021-07-16 16:18:55 +00:00
SkBlurTypes.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkCanvas.h Reland "Remove skstd::optional entirely." 2022-02-24 15:12:43 +00:00
SkCanvasVirtualEnforcer.h Pass sampling to drawImageSet 2021-01-05 19:40:31 +00:00
SkClipOp.h Remove SK_SUPPORT_DEPRECATED_CLIPOPS and expanding clip op defs 2021-08-06 19:15:13 +00:00
SkColor.h Support luminance-alpha GL format for YUVA planes 2020-12-17 14:54:25 +00:00
SkColorFilter.h Move WithWorkingFormat to SkColorFilterPriv 2021-11-03 20:30:50 +00:00
SkColorPriv.h move SkTPin to include/private 2020-10-16 19:45:11 +00:00
SkColorSpace.h Enable ClangTidy check llvm-namespace-comment. 2020-08-06 19:07:52 +00:00
SkContourMeasure.h [canvaskit] Flesh out remaining docs for core CanvasKit. 2020-10-05 11:47:40 +00:00
SkCoverageMode.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkCubicMap.h [skottie] De-dupe sequential cubic mappers 2019-07-17 17:14:46 +00:00
SkCustomMesh.h Add SKSL guard to SkCustomMesh APIs 2022-01-06 18:10:57 +00:00
SkData.h Zero-initialize uniform data in SkRuntimeEffectBuilder 2021-11-18 17:15:07 +00:00
SkDataTable.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkDeferredDisplayList.h Reland "Purge ccpr" 2021-06-19 18:42:38 +00:00
SkDeferredDisplayListRecorder.h Move more GPU-specific code behind SK_SUPPORT_GPU flag 2021-11-03 14:12:52 +00:00
SkDocument.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkDrawable.h Plumbing for glyph drawable 2022-02-08 18:14:27 +00:00
SkDrawLooper.h Hide (unused) SkDrawLooper 2021-02-07 12:49:53 +00:00
SkEncodedImageFormat.h Add MVP implementation of JPEGXL decoder. 2022-02-02 15:17:14 +00:00
SkExecutor.h Reenable Wdeprecated-copy-dtor 2021-02-16 17:53:28 +00:00
SkFlattenable.h Fixup enum name in SkFlattenable. 2021-07-30 18:19:11 +00:00
SkFont.h Improve remote glyph caching. 2022-02-03 16:49:43 +00:00
SkFontArguments.h Support font palette overrides through SkFontArguments 2022-02-17 13:19:53 +00:00
SkFontMetrics.h SkCustomTypefaceBuilder to set SkFontStyle 2020-08-19 00:09:55 +00:00
SkFontMgr.h Purge 2020 picture versions 2021-07-19 19:35:49 +00:00
SkFontParameters.h Fix DWrite axis design parameters. 2020-12-01 15:00:33 +00:00
SkFontStyle.h move SkTPin to include/private 2020-10-16 19:45:11 +00:00
SkFontTypes.h Remove SkTextEncoding and SkFontHinting macros. 2019-05-22 20:44:28 +00:00
SkGraphics.h Remove SkGraphics::Term 2022-01-13 17:40:35 +00:00
SkICC.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkImage.h Reland "Remove skstd::optional entirely." 2022-02-24 15:12:43 +00:00
SkImageEncoder.h Bitmap.asImage() 2020-12-23 15:54:57 +00:00
SkImageFilter.h Move more virtuals into ...Base to hide them from public api 2021-06-18 20:20:06 +00:00
SkImageGenerator.h Reland "Remove skstd::optional entirely." 2022-02-24 15:12:43 +00:00
SkImageInfo.h Reland "Add kR8_unorm_SkColorType" 2022-02-10 18:00:19 +00:00
SkM44.h [androidkit] optimize JNI calls in AndroidKit.Matrix transformations 2021-05-07 16:17:09 +00:00
SkMallocPixelRef.h Enable ClangTidy check llvm-namespace-comment. 2020-08-06 19:07:52 +00:00
SkMaskFilter.h Move more virtuals into ...Base to hide them from public api 2021-06-18 20:20:06 +00:00
SkMath.h impl SkMulDiv255Round with SkMul16ShiftRound 2020-09-09 17:01:17 +00:00
SkMatrix.h Document SkMatrix default constructs to identity 2021-07-24 16:04:39 +00:00
SkMilestone.h Update Skia milestone to 101 2022-02-18 12:46:42 +00:00
SkOverdrawCanvas.h introduce SkCanvas::onDrawGlyphRunList 2021-04-15 19:44:24 +00:00
SkPaint.h Reland "Remove skstd::optional entirely." 2022-02-24 15:12:43 +00:00
SkPath.h Add query to test our cached convexity 2021-01-19 14:54:44 +00:00
SkPathBuilder.h Set SkPath.fLastMoveToIndex field from SkPathBuilder 2021-08-06 14:12:11 +00:00
SkPathEffect.h Pass CTM to path effects (experimental) 2021-07-13 18:42:55 +00:00
SkPathMeasure.h [canvaskit] Flesh out remaining docs for core CanvasKit. 2020-10-05 11:47:40 +00:00
SkPathTypes.h Move convexity enum out of public 2020-08-30 13:04:22 +00:00
SkPicture.h Remove legacy support for inheriting sampling from the paint. 2021-03-19 16:17:42 +00:00
SkPictureRecorder.h Almost remove GrContext 2020-10-20 15:52:01 +00:00
SkPixelRef.h Remove dead references to filter-quality 2021-03-21 00:26:07 +00:00
SkPixmap.h Remove dead references to filter-quality 2021-03-21 00:26:07 +00:00
SkPngChunkReader.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkPoint3.h Add clipping for perspective triangles 2019-12-17 23:24:18 +00:00
SkPoint.h Test texture domain effect with local matrix. 2019-11-22 22:37:33 +00:00
SkPromiseImageTexture.h Remove all unused uniqueKey support from SkPromiseImageTexture. 2021-12-21 21:32:43 +00:00
SkRasterHandleAllocator.h Reenable Wdeprecated-copy-dtor 2021-02-16 17:53:28 +00:00
SkRect.h Make simple coord/size getters on Sk[I]Rect constexpr 2021-12-09 22:17:30 +00:00
SkRefCnt.h Make GrSurfaceProxy ref counts thread safe. 2019-10-24 19:55:23 +00:00
SkRegion.h remove enum docs 2020-02-11 21:43:07 +00:00
SkRRect.h Add halfWidth/halfHeight functions to SkRectPriv 2020-12-22 20:42:43 +00:00
SkRSXform.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkSamplingOptions.h SkFilterQuality is gone. 2021-07-22 12:41:49 +00:00
SkScalar.h Format and comment SkScalarInterpFunc 2020-08-26 20:50:34 +00:00
SkSerialProcs.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkShader.h Generalize composing imagefilters and shaders to blenders 2021-07-26 21:07:51 +00:00
SkSize.h Remove GrSurfaceDesc 2020-02-07 19:48:13 +00:00
SkSpan.h reject sizes that will overflow in SkSpan 2021-05-13 19:42:43 +00:00
SkStream.h Add SkFILEStream constructor which takes a size. 2020-09-11 19:50:24 +00:00
SkString.h Add SK_PRINTF_LIKE to existing variadic print functions. 2022-02-07 14:55:39 +00:00
SkStrokeRec.h Relax SkStrokeRec::hasEqualEffect 2020-09-15 20:05:40 +00:00
SkSurface.h Reland "Add SkSurface resolve function." 2022-02-03 20:13:16 +00:00
SkSurfaceCharacterization.h Move more GPU-specific code behind SK_SUPPORT_GPU flag 2021-11-03 14:12:52 +00:00
SkSurfaceProps.h Move the DMSAA surface flag into the public API 2021-07-13 19:21:00 +00:00
SkSwizzle.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkTextBlob.h Expose experimental iterator on SkParagraph 2021-04-16 16:50:33 +00:00
SkTileMode.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkTime.h Reland "Add format-specifier warnings to SkDebugf." 2021-06-25 17:57:43 +00:00
SkTraceMemoryDump.h Add ability to trace wrapped objects and be able to differentiate 2021-04-08 18:38:14 +00:00
SkTypeface.h rename fontID to typefaceID 2022-02-07 20:12:39 +00:00
SkTypes.h Adjust Google3 stack-trace dumping to match recent refactor 2022-02-24 20:32:27 +00:00
SkUnPreMultiply.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkVertices.h Remove custom SkVertices data and runtime effect varying support 2021-04-19 17:49:25 +00:00
SkYUVAInfo.h Reland "Push SkYUVAInfo into GrYUVToRGBEffect." 2021-01-13 22:08:44 +00:00
SkYUVAPixmaps.h Remove SkYUVASizeInfo, make SkYUVAIndex a private part of SkYUVAInfo 2021-01-12 15:06:26 +00:00