And add a reasonable timeout to tests.
Change-Id: I362d44f2a799562d236a80f5c35d50d93e8d094a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56769
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Colors were not being escaped properly for windows (which has special non-ANSI color code handling)
Change-Id: I03c34b1205b26b1192af9c05162bbe03035172bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56500
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
We've decided that these will be omitted for now.
Move the check-spec-examples script into the tools/src directory, and update the go modules.
Add a bash script to build and run this.
Change-Id: I852f8ddb1b9b987410a2a49cf6d14e54c3cf3f0e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56381
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
If a full test row PASSes, then omit this unless the --verbose flag is used.
Add a summary below the table for PASS, SKIP and FAIL for each column.
Change-Id: Ie88003696c59614cf8e5efa3c80dca37a8e4d3f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56380
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Instead of just generating pointers to functions, generate pointers to all permuted storage types and accesses.
Change-Id: I930b20150d823877eaf72dd7cac850078fe22f35
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54656
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
The resolver is the closest thing to a validator in this case.
Enables `--generate-expected` for WGSL files that were previously marked as SKIP.
Change-Id: Id7979ec39571ff52a2beb4255d88e4eb0962b82a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54650
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
Handle cases where the expected and got strings are both substrings of the test source. In this situation its better to use the longer option.
Fixes cases where fix-tests would keep on adding junk to an EXPECT_EQ string
Change-Id: I800d0d08178d01743b3587527830aefce3f3152e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54240
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
And produce a warning if these are used. Hard to test, as we don't want to introduce fake functions in our definition file.
Also add missing cast in EnumMatcher.
Bug: tint:806
Change-Id: I21f189e4befe419f6d5544acfc52387d9a5da782
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54001
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Gives feedback much eariler.
Also move the error messages after the table
Change-Id: If462fd9bbc72ff9428d6ee77c8ec6c9338f7f27e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54000
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
This ensures that we don't fail when comparing against expected output
that contains paths in them.
Bug: tint:872
Change-Id: I93d4b940eae2c22175ef3add94bb28f907156ca0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53600
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Unless the test also passed validation.
Prevents clobbering expected validation failures when you've only checked tint didn't error.
Change-Id: I44be0c8b1f9ef1a0df51bba81f5ad694715204b8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53383
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Handle access control on var declarations instead of via [[access]]
decorations. This change does the minimal work to migrate the WGSL
parser over to the new syntax. Additional changes will be needed
to correctly generate defaulted access qualifiers, as well as
validating access usage.
The [[access]] decorations are still supported by the WGSL parser,
with new deprecated warnings, but not for aliases. Example:
var x : [[access(x)]] alias_to_struct;
Making this work is far more effort than I want to dedicate to backwards
compatibility, and I do not beleive any real-world usage will be doing
this.
Still TODO:
* Adding access control as the optional, third parameter to ptr<>.
* Calculating default accesses for the various storage types.
* Validating usage of variables against the different accesses.
Bug: tint:846
Change-Id: If8ca82e5d16ec319ecd01f9a2cafffd930963bde
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53088
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This is required to generate valid MSL code, and will soon be
validated by Tint too.
Change-Id: I4c5f5c4ecb1c91131c934de1132217d9f6be1f8e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53420
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Use the new [[stage()]] decorations in intrinsics.def to validate that intrinsics are only called from the correct pipeline stages.
Fixed: tint:657
Change-Id: I9efda26369c45c6f816bdaa53408d3909db403a1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53084
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Add test/intrinsics/intrinsics.wgsl.tmpl that generates a vast set of intrinsic overload permutations into test/intrinsics/gen/...
Add expected output for all of these, including 'SKIP' headers for those that currently fail.
Fixed: tint:832
Change-Id: Id6888df52c07f35e7a55199f2ad4d842c6e2595c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53051
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Generates expected cases that fail, using a SKIP header
Change-Id: I2738fa2cf47c715fe6e978edf51aa928c5e3b216
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53049
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Specifies that the overload can only be used in the specific stages.
Actually validating this with the IntrinsicTable is TODO.
Bug: tint:657
Bug: tint:832
Change-Id: I11ffefee22e5f26103f008b23d16066a2a3ba90d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53050
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
* Add new template utilty functions, including the ability to split out multiple files.
* Add basic printing of the semantic overloads.
* Add a pointer from the overload to the function
* Change TemplateArguments from a list of FQN to a list of interface{} (any). This is required as once the overload is permutated, some arguments will need to hold integers.
This will be used by the test generator.
Bug: tint:832
Change-Id: Idbfbe85e52489b31850cbb0ee7430bb4b021530e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53046
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Add `[[internal]]` decoration on `storage_class.handle` - its not an entry that should ever appear in WGSL.
Bug: tint:832
Change-Id: I210f64c495bf37a8f48422919248806e7b096638
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53045
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Performs output validation with spirv-val for SPIR-V (as before), HLSL
validation with DXC, and MSL validation with the Metal Shader Compiler.
Disable HLSL tests that fail to validate
Bug: tint:812
Change-Id: If78c351b4e23c7fb50d333eacf9ee7cc81d18564
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51280
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Add a template file to generate intrinsic_table.inl and
include this from intrinsic_table.cc.
Speeds up execution of the unittests by 20 - 30%, and
reduces the executable size by a couple of percent.
Bug: tint:832
Change-Id: Ifa7f3c42202c92e97b46ed1716ece48660dd29dd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52504
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: David Neto <dneto@google.com>
Used by the intrinsic definition generator.
Bug: tint:832
Change-Id: I000b1ebe067117e533b3edd8a3fac67a3cbc14c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52601
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Parses the intrinsics.def file, then scans the source tree for .tmpl files.
Using both of these, it produces source files for use in tint.
Bug: tint:832
Change-Id: I718114f4c540b9d620899e89d5758f048377ee04
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52642
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Have the resolver emit unique parameter names
Aslo: Update the parser tests to include ':' between parameter name and type.
This functionality landed a few changes up, but I missed this test from the change.
Bug: tint:832
Change-Id: If0d6d3a33bbcd8be4d70ee7182754158ed0da819
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52641
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Will be used by the lookup table package, which is used by the intrinsic definition generator.
Bug: tint:832
Change-Id: I72c2dc5e37678dbaffc1a32e1631caa8ba6c690e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52600
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Part of the new intrinsic definition parser.
Bug: tint:832
Change-Id: I701072def1a4ca723d10d08b44c1e271b9458212
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52540
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Add tests.
This is going to be used by intrinsic-gen, a new tool
Bug: tint:832
Change-Id: Ib22ffa88a699be9c8dfdf3f8f6e32cff4ffc88e3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52602
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
This test was not building, as relative imports are not allowed when using modules
Change-Id: I661870c0d676029a782fe2a05acb98d4544fbb95
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52502
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Ground work for the new intrinsic definition parser.
Bug: tint:832
Change-Id: I0aff7f8cf5db4b6aa3a56939b944a37abc360cc7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52501
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Ground work for the new intrinsic definition parser.
Bug: tint:832
Change-Id: I341ae11e36ef7af96ce7d01609a96e2c02425e87
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52500
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro will use this to fail presubmits on new failures.
Change-Id: I32cf49d0380c7b751ae4410ccd91b20407262e9f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51482
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Makes future development easier.
New features:
* A more compact and cleaner results view
* Concurrent testing, much quicker across multiple cores
* Supports comparing output against an expected file, including a text diff of differences. Also has a flag for updating the expected outputs
* Advanced file-globbing support, including scanning for files in subdirectories
* Skip lists are now no longer hidden away in the tool, but defined as a SKIP header in the *.expected.* file
Change-Id: I4fac80bb084a720ec9a307b4acf9f73792973a1d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50903
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
main packages usually go under a `cmd` directory.
Hoist utility packages to the root `src` directroy so they can be shared.
Change-Id: I0c221f6cd39980f5c202c030cd5134d775533efa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50901
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
These are the module dependencies.
We'll never want different versions of third_party deps, so merging these makes sense.
Change-Id: If2ff93b77ad79d31a5aad04194dcf82c9782e0d3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50900
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
And update tools/lint to use cpplint.py from path.
DEPS was fetchling cpplint from `{chromium_git}/third_party/cpplint/google/styleguide`.
This repo no longer contains cpplint, and now instead is maintained in depot_tools.
The version in depot_tools contains a fix for python3.
Fixed: tint:794
Change-Id: I06c3f8a628ffa3e70887464b1da063b465c05c65
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50743
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Allows bash scripts to share the same name as the directory.
Add fix-tests bash script.
Change-Id: Iaf1943d50ec1fd3f382a2c7823fb7cdd13b1d9a2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47766
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
By comparing the old substring to the new full body, we can do a pretty
good job at creating a new substring.
This is not an exact science. Always carefully examine the newly
generated strings for correctness.
Change-Id: I8bdf591539a32ec42d0444aa054d88a933e4d250
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47765
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
A simple regex based tool for fixing unit tests that fail due to unexpected output
Change-Id: I72c47abaff6d6f4ba8cd497240eadc171af0fec3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47629
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Don't return error code 1 when some invocations return with no errors.
Change-Id: I4eec555bc188bcfaa3424dbb70a3391062ba87f6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44782
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
These errors were captured, but not printed.
Fix the lint error that was not being displayed.
Change-Id: I56da5c3a044b8a8e41695883ce780aca6245ad04
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44780
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
On my machine this reduces the time taken from 23 seconds -> 2 seconds
Change-Id: I676b89251fc183171cc3d955873960b00cb48bc1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44164
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Automatically fetches the spec from the web, runs tint for all compilable examples.
Displays all examples that don't compile or compile when they shouldn't
Change-Id: I4718dd45ddec7f191ceed937ecb1c384d77d0eb5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36722
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Coverage can be useful for debugging unfamiliar code. If the bug causes a non-zero exit, then we still want the coverage to be generated.
Change-Id: I2d218cd4bb1395c71553e1baab78fb6ca9d41cca
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35422
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>