tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

validate.ts (1181B)


      1 import * as process from 'process';
      2 
      3 import { crawl } from './crawl.js';
      4 
      5 function usage(rc: number): never {
      6  console.error(`Usage: tools/validate [options] [SUITE_DIRS...]
      7 
      8 For each suite in SUITE_DIRS, validate some properties about the file:
      9 - It has a .description and .g
     10 - That each test:
     11  - Has a test function (or is marked unimplemented)
     12  - Has no duplicate cases
     13  - Configures batching correctly, if used
     14 - That each case query is not too long
     15 
     16 Example:
     17  tools/validate src/unittests src/webgpu
     18 
     19 Options:
     20  --help                     Print this message and exit.
     21  --print-metadata-warnings  Print non-fatal warnings about listing_meta.json files.
     22 `);
     23  process.exit(rc);
     24 }
     25 
     26 const args = process.argv.slice(2);
     27 if (args.length < 1) {
     28  usage(0);
     29 }
     30 if (args.indexOf('--help') !== -1) {
     31  usage(0);
     32 }
     33 
     34 let printMetadataWarnings = false;
     35 const suiteDirs = [];
     36 for (const arg of args) {
     37  if (arg === '--print-metadata-warnings') {
     38    printMetadataWarnings = true;
     39  } else {
     40    suiteDirs.push(arg);
     41  }
     42 }
     43 
     44 if (suiteDirs.length === 0) {
     45  usage(0);
     46 }
     47 
     48 for (const suiteDir of suiteDirs) {
     49  void crawl(suiteDir, {
     50    validate: true,
     51    printMetadataWarnings,
     52  });
     53 }