test: Vendor kcl-samples and add simulation tests for them (#5460)
* Change to unzip * Download kcl-samples as zip to public dir * Fix fetch:samples, e2e electron still not working * Change error message to be clearer * Refactor so that input and output directories of sim tests can be different * Add kcl samples test implementation * Update output since adding kcl_samples tests * Update kcl-samples branch * Fix git-ignore pattern to only apply to the root * Fix yarn install and yarn fetch:samples to work the first time * Remove unneeded exists check * Change to use kcl-samples in public directory * Add kcl-samples * Update output since updating kcl-samples * Update output files * Change to not fetch samples during yarn install * Update output after merge * Ignore kcl-samples in codespell * WIP: Don't run e2e if only kcl-samples changed * Conditionally run cargo tests * Fix to round floating point values in program memory arrays * Update output since merge and rounding numbers in memory * Fix memory redaction for floating point to find more values * Fix float redaction pattern * Update output since rounding floating point numbers * Add center to floating point pattern * Fix trigger to use picomatch syntax * Update output since rounding center * Remove kcl-samples github workflows * Enable Rust backtrace * Update output after re-running * Update output after changing order of post-extrude commands * Fix to have deterministic order of commands * Update output after reverting ordering changes * Update kcl-samples * Update output after updating samples * Fix error messages to show the names of all samples that failed * Change cargo test command to match current one * Update kcl-samples * Update output since updating kcl-samples * Add generate manifest workflow and yarn script * Fix error check to actually work * Change util function to be what we actually need * Move new files after merge * Fix paths since directory move * Add dependabot updates for kcl-samples * Add GitHub workflow to make PR to kcl-samples repo * Add GitHub workflow to check kcl-samples header comments * Fix worfklow to change to the right directory * Add auto-commit simulation test output changes * Add permissions to workflows * Fix to run git commit step * Install just if needed * Fix directory of justfile * Add installation of cargo-insta * Fix to use underscore * Fix to allow just command failure * Change to always install CLI tools and cache them * Trying to fix overwrite failing * Combine commands * Change reviewer * Change to PR targeting the next branch * Change git commands to not do unnecessary fetch * Comment out trigger for creating a PR * Update kcl-samples from next branch * Update outputs after kcl-samples change * Fix to use bash pipefail * Add rust backtrace * Print full env from sim tests * Change command to use long option name * Fix to use ci profile even when calling through just * Add INSTA_UPDATE=always * Fix git push by using an app token on checkout * Add comments * Fix to use bash options * Change to echo when no changes are found * Fix so that kcl-samples updates don't trigger full run * Fix paths to reflect new crate location * Fix path detection * Fix e2e job to ignore kcl_samples simulation test output * Fix the fetch logic for the KCL samples after vendoring (#5661) Fixes the last 2 E2E tests for #5460. --------- Co-authored-by: Pierre Jacquier <pierre@zoo.dev> Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> Co-authored-by: Frank Noirot <frank@zoo.dev>
This commit is contained in:
627
rust/kcl-lib/tests/kcl_samples/i-beam/ast.snap
Normal file
627
rust/kcl-lib/tests/kcl_samples/i-beam/ast.snap
Normal file
@ -0,0 +1,627 @@
|
||||
---
|
||||
source: kcl-lib/src/simulation_tests.rs
|
||||
description: Result of parsing i-beam.kcl
|
||||
---
|
||||
{
|
||||
"Ok": {
|
||||
"body": [
|
||||
{
|
||||
"declaration": {
|
||||
"end": 185,
|
||||
"id": {
|
||||
"end": 180,
|
||||
"name": "beamLength",
|
||||
"start": 170,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"end": 185,
|
||||
"raw": "24",
|
||||
"start": 183,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 24.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 170,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 185,
|
||||
"kind": "const",
|
||||
"start": 170,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 203,
|
||||
"id": {
|
||||
"end": 195,
|
||||
"name": "beamWidth",
|
||||
"start": 186,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"end": 203,
|
||||
"raw": "2.663",
|
||||
"start": 198,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 2.663,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 186,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 203,
|
||||
"kind": "const",
|
||||
"start": 186,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 218,
|
||||
"id": {
|
||||
"end": 214,
|
||||
"name": "beamHeight",
|
||||
"start": 204,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"end": 218,
|
||||
"raw": "4",
|
||||
"start": 217,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 4.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 204,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 218,
|
||||
"kind": "const",
|
||||
"start": 204,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 240,
|
||||
"id": {
|
||||
"end": 232,
|
||||
"name": "wallThickness",
|
||||
"start": 219,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"end": 240,
|
||||
"raw": "0.293",
|
||||
"start": 235,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.293,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 219,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 240,
|
||||
"kind": "const",
|
||||
"start": 219,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 650,
|
||||
"id": {
|
||||
"end": 376,
|
||||
"name": "sketch001",
|
||||
"start": 367,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"body": [
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 398,
|
||||
"raw": "'-XZ'",
|
||||
"start": 393,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "-XZ"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 392,
|
||||
"name": "startSketchOn",
|
||||
"start": 379,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 399,
|
||||
"start": 379,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"end": 422,
|
||||
"raw": "0",
|
||||
"start": 421,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 436,
|
||||
"left": {
|
||||
"end": 434,
|
||||
"name": "beamHeight",
|
||||
"start": 424,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "/",
|
||||
"right": {
|
||||
"end": 436,
|
||||
"raw": "2",
|
||||
"start": 435,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 424,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
],
|
||||
"end": 437,
|
||||
"start": 420,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"end": 440,
|
||||
"start": 439,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 419,
|
||||
"name": "startProfileAt",
|
||||
"start": 405,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 441,
|
||||
"start": 405,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 464,
|
||||
"left": {
|
||||
"end": 462,
|
||||
"name": "beamWidth",
|
||||
"start": 453,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "/",
|
||||
"right": {
|
||||
"end": 464,
|
||||
"raw": "2",
|
||||
"start": 463,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 453,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"end": 467,
|
||||
"start": 466,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 452,
|
||||
"name": "xLine",
|
||||
"start": 447,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 468,
|
||||
"start": 447,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"argument": {
|
||||
"end": 494,
|
||||
"name": "wallThickness",
|
||||
"start": 481,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 494,
|
||||
"operator": "-",
|
||||
"start": 480,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
},
|
||||
{
|
||||
"end": 497,
|
||||
"start": 496,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 479,
|
||||
"name": "yLine",
|
||||
"start": 474,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 498,
|
||||
"start": 474,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 527,
|
||||
"left": {
|
||||
"end": 525,
|
||||
"name": "wallThickness",
|
||||
"start": 512,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "/",
|
||||
"right": {
|
||||
"end": 527,
|
||||
"raw": "2",
|
||||
"start": 526,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 512,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"end": 530,
|
||||
"start": 529,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 511,
|
||||
"name": "xLineTo",
|
||||
"start": 504,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 531,
|
||||
"start": 504,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 546,
|
||||
"raw": "0",
|
||||
"start": 545,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 549,
|
||||
"start": 548,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 544,
|
||||
"name": "yLineTo",
|
||||
"start": 537,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 550,
|
||||
"start": 537,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 579,
|
||||
"properties": [
|
||||
{
|
||||
"end": 577,
|
||||
"key": {
|
||||
"end": 571,
|
||||
"name": "axis",
|
||||
"start": 567,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 567,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"end": 577,
|
||||
"raw": "'X'",
|
||||
"start": 574,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "X"
|
||||
}
|
||||
}
|
||||
],
|
||||
"start": 565,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
},
|
||||
{
|
||||
"end": 582,
|
||||
"start": 581,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 564,
|
||||
"name": "mirror2d",
|
||||
"start": 556,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 583,
|
||||
"start": 556,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 612,
|
||||
"properties": [
|
||||
{
|
||||
"end": 610,
|
||||
"key": {
|
||||
"end": 604,
|
||||
"name": "axis",
|
||||
"start": 600,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 600,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"end": 610,
|
||||
"raw": "'Y'",
|
||||
"start": 607,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "Y"
|
||||
}
|
||||
}
|
||||
],
|
||||
"start": 598,
|
||||
"type": "ObjectExpression",
|
||||
"type": "ObjectExpression"
|
||||
},
|
||||
{
|
||||
"end": 615,
|
||||
"start": 614,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 597,
|
||||
"name": "mirror2d",
|
||||
"start": 589,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 616,
|
||||
"start": 589,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"end": 636,
|
||||
"name": "length",
|
||||
"start": 630,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"arg": {
|
||||
"end": 649,
|
||||
"name": "beamLength",
|
||||
"start": 639,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 629,
|
||||
"name": "extrude",
|
||||
"start": 622,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 650,
|
||||
"start": 622,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": null
|
||||
}
|
||||
],
|
||||
"end": 650,
|
||||
"start": 379,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"start": 367,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 650,
|
||||
"kind": "const",
|
||||
"start": 367,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
}
|
||||
],
|
||||
"end": 651,
|
||||
"innerAttrs": [
|
||||
{
|
||||
"end": 143,
|
||||
"name": {
|
||||
"end": 119,
|
||||
"name": "settings",
|
||||
"start": 111,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"end": 142,
|
||||
"key": {
|
||||
"end": 137,
|
||||
"name": "defaultLengthUnit",
|
||||
"start": 120,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 120,
|
||||
"type": "ObjectProperty",
|
||||
"value": {
|
||||
"end": 142,
|
||||
"name": "in",
|
||||
"start": 140,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"start": 110,
|
||||
"type": "Annotation"
|
||||
}
|
||||
],
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"3": [
|
||||
{
|
||||
"end": 366,
|
||||
"start": 240,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLineBlockComment",
|
||||
"value": "Sketch a quadrant of the beam cross section, then mirror for symmetry across each axis. Extrude to the appropriate length",
|
||||
"style": "line"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"startNodes": [
|
||||
{
|
||||
"end": 9,
|
||||
"start": 0,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "I-beam",
|
||||
"style": "line"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 95,
|
||||
"start": 10,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "A structural metal beam with an I shaped cross section. Often used in construction",
|
||||
"style": "line"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 97,
|
||||
"start": 95,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLine"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 109,
|
||||
"start": 97,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "Set Units",
|
||||
"style": "line"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 145,
|
||||
"start": 143,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLine"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 169,
|
||||
"start": 145,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "blockComment",
|
||||
"value": "Define Beam Dimensions",
|
||||
"style": "line"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"start": 0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user