Commit 365c3e7b authored by Erich Gubler's avatar Erich Gubler
Browse files

Bug 1720941, part 2: tests(ci): now do the actual vendoring...

Bug 1720941, part 2: tests(ci): now do the actual vendoring r=webgpu-reviewers,taskgraph-reviewers,jmaher,jimb

After implementing vendoring in part 1, it's time to run it! This patch was broken out from part 1 to isolate very tedious portion of the review. Most of this patch is composed of:

1. Generated CTS test files from part 1.
2. A massive wall of test expectation management acknowledging current passes and failures. Currently, Linux and Windows are expected to pass with these noted failures. Many, but not all, current failures on MacOS are recorded.

Differential Revision: https://phabricator.services.mozilla.com/D169953
parent 59905b61
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
const path = require('path');
const resolve = require('resolve')

// Implements the following resolver spec:
// https://github.com/benmosher/eslint-plugin-import/blob/master/resolvers/README.md
exports.interfaceVersion = 2

exports.resolve = function (source, file, config) {
  if (resolve.isCore(source)) return { found: true, path: null }

  source = source.replace(/\.js$/, '.ts');
  try {
    return {
      found: true, path: resolve.sync(source, {
        extensions: [],
        basedir: path.dirname(path.resolve(file)),
        ...config,
      })
    }
  } catch (err) {
    return { found: false }
  }
}
+1 −0
Original line number Diff line number Diff line
/src/external/*
+127 −0
Original line number Diff line number Diff line
{
  "root": true,
  "parser": "@typescript-eslint/parser",
  "parserOptions": { "project": "./tsconfig.json" },
  "extends": [
    "./node_modules/gts",
    "plugin:import/errors",
    "plugin:import/warnings",
    "plugin:import/typescript"
  ],
  "env": {
    "browser": true,
    "node": true
  },
  "plugins": ["node", "ban", "import", "deprecation"],
  "rules": {
    // Core rules
    "linebreak-style": ["warn", "unix"],
    "no-console": "warn",
    "no-undef": "off",
    "no-useless-rename": "warn",
    "object-shorthand": "warn",
    "quotes": ["warn", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],

    // All test TODOs must be tracked inside file/test descriptions or READMEs.
    // Comments relating to TODOs in descriptions can be marked with references like "[1]".
    // TODOs not relating to test coverage can be marked MAINTENANCE_TODO or similar.
    "no-warning-comments": ["warn", { "terms": ["todo", "fixme", "xxx"], "location": "anywhere" }],

    // Plugin: @typescript-eslint
    "@typescript-eslint/no-inferrable-types": "off",
    "@typescript-eslint/consistent-type-assertions": "warn",
    // Recommended lints
    // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/README.md
    "@typescript-eslint/adjacent-overload-signatures": "warn",
    "@typescript-eslint/await-thenable": "warn",
    "@typescript-eslint/ban-ts-comment": "warn",
    "@typescript-eslint/no-empty-interface": "warn",
    "@typescript-eslint/no-explicit-any": "warn",
    "@typescript-eslint/no-extra-non-null-assertion": "warn",
    "@typescript-eslint/no-floating-promises": "warn",
    "@typescript-eslint/no-for-in-array": "warn",
    "@typescript-eslint/no-misused-new": "warn",
    "@typescript-eslint/no-namespace": "warn",
    "@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
    "@typescript-eslint/no-this-alias": "warn",
    "@typescript-eslint/no-unnecessary-type-assertion": "warn",
    "@typescript-eslint/no-unnecessary-type-constraint": "warn",
    "@typescript-eslint/no-unused-vars": ["warn", { "vars": "all", "args": "none" }],
    "@typescript-eslint/prefer-as-const": "warn",
    "@typescript-eslint/prefer-for-of": "warn",
    "@typescript-eslint/prefer-namespace-keyword": "warn",
    "@typescript-eslint/restrict-plus-operands": "warn",
    "@typescript-eslint/triple-slash-reference": "warn",
    "@typescript-eslint/unbound-method": "warn",
    // MAINTENANCE_TODO: Try to clean up and enable these recommended lints?
    //"@typescript-eslint/no-unsafe-argument": "warn",
    //"@typescript-eslint/no-unsafe-assignment": "warn",
    //"@typescript-eslint/no-unsafe-call": "warn",
    //"@typescript-eslint/no-unsafe-member-access": "warn",
    //"@typescript-eslint/no-unsafe-return": "warn",
    // Note: These recommended lints are probably not practical to enable.
    //"@typescript-eslint/no-misused-promises": "warn",
    //"@typescript-eslint/no-non-null-assertion": "warn",
    //"@typescript-eslint/no-var-requires": "warn",
    //"@typescript-eslint/restrict-template-expressions": "warn",

    // Plugin: ban
    "ban/ban": [
      "warn",
      {
        "name": "setTimeout",
        "message": "WPT disallows setTimeout; use `common/util/timeout.js`."
      }
    ],

    // Plugin: deprecation
    //"deprecation/deprecation": "warn",

    // Plugin: import
    "import/order": [
      "warn",
      {
        "groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
        "newlines-between": "always",
        "alphabetize": { "order": "asc", "caseInsensitive": false }
      }
    ],
    "import/newline-after-import": ["warn", { "count": 1 }],
    "import/no-duplicates": "warn",
    "import/no-restricted-paths": [
      "error",
      {
        "zones": [
          {
            "target": "./src/webgpu",
            "from": "./src/common",
            "except": ["./framework", "./util"],
            "message": "Non-framework common/ code imported from webgpu/ suite"
          },
          {
            "target": "./src/unittests",
            "from": "./src/common",
            "except": ["./framework", "./util", "./internal"],
            "message": "Non-framework common/ code imported from unittests/ suite"
          },
          {
            "target": "./src/webgpu",
            "from": "./src/unittests",
            "message": "unittests/ suite imported from webgpu/ suite"
          },
          {
            "target": "./src/common",
            "from": "./src",
            "except": ["./common", "./external"],
            "message": "Non common/ code imported from common/"
          }
        ]
      }
    ]
  },
  "settings": {
    "import/resolver": {
      "./.eslint-resolver": {}
    }
  }
}
+1 −0
Original line number Diff line number Diff line
* text=auto eol=lf
 No newline at end of file
+21 −0
Original line number Diff line number Diff line



Issue: #<!-- Fill in the issue number here. See docs/intro/life_of.md -->

<hr>

**Requirements for PR author:**

- [ ] All missing test coverage is tracked with "TODO" or `.unimplemented()`.
- [ ] New helpers are `/** documented */` and new helper files are found in `helper_index.txt`.
- [ ] Test behaves as expected in a WebGPU implementation. (If not passing, explain above.)

**Requirements for [reviewer sign-off](https://github.com/gpuweb/cts/blob/main/docs/reviews.md):**

- [ ] Tests are properly located in the test tree.
- [ ] [Test descriptions](https://github.com/gpuweb/cts/blob/main/docs/intro/plans.md) allow a reader to "read only the test plans and evaluate coverage completeness", and accurately reflect the test code.
- [ ] Tests provide complete coverage (including validation control cases). **Missing coverage MUST be covered by TODOs.**
- [ ] Helpers and types promote readability and maintainability.

When landing this PR, be sure to make any necessary issue status updates.
Loading