summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-conf/checkout/deqp/data/gles3/shaders/split-conversions.js
blob: c3eeb7928fd9c2b428e18c993b9b33a972412bf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*

run with
   node split-conversions.js

notes:

conversions.test is generated from the C++ based dEQP tests
https://github.com/KhronosGroup/VK-GL-CTS/blob/main/modules/gles3/scripts/gen-conversions.py

You need to manually add these tests to the 00_test_list.txt

*/

const fs = require('fs');

process.chdir(__dirname);

const testWarning = `\
# WARNING: This file is auto-generated. Do NOT modify it manually, but rather
# modify the generating script file. Otherwise changes will be lost!
# See split-conversions.js

`;

const conversionsHTML = fs.readFileSync('conversions.template', {encoding: 'utf8'});
const conversions = fs.readFileSync('conversions.test', {encoding: 'utf8'});
const groupMatches = conversions.matchAll(/group ([a-zA-Z0-9_]+) [\s\S]+?end #.*?\n/g);
for (const [str, groupName] of groupMatches) {
  const baseName = `conversions_${groupName}`;
  fs.writeFileSync(`${baseName}.test`, `${testWarning}${str}`);
  fs.writeFileSync(`${baseName}.html`, `<!--\n${testWarning}-->\n${conversionsHTML.replace("'conversions'", `'${baseName}'`)}`);
}