Repository navigation
Expand file tree
/
Copy pathtest.ps1
More file actions
108 lines (98 loc) · 4.07 KB
/
Copy pathtest.ps1
File metadata and controls
108 lines (98 loc) · 4.07 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Copyright 2026 MiniLangProject contributors
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.
# Software distributed under the License is provided on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<#
.SYNOPSIS
Runs the single supported MiniSQL cumulative acceptance entry point.
.PARAMETER Compiler
Path to the MiniLang Python compiler forwarded to the internal runner.
.PARAMETER Python
Python executable used to run the acceptance orchestrator.
.PARAMETER Target
Selects the existing complete Windows suite or the portable Linux x64 suite.
.PARAMETER StaticOnly
Runs repository and source-contract checks without compiling native targets.
.PARAMETER StorageV2
Runs the focused storage-v2 binary-layout and compatibility regression gate.
.PARAMETER Routines
Runs the focused stored-procedure and SQL/client regression gate.
.PARAMETER CompileOnly
Compiles focused Routines or StorageV2 tests without running the target images.
.PARAMETER KeepArtifacts
Preserves intermediate acceptance files for diagnosis.
.PARAMETER VerboseOutput
Streams detailed compiler and test process output.
#>
param(
[string]$Compiler = $env:MINILANG_COMPILER,
[string]$Python = "python",
[ValidateSet("windows-x64", "linux-x64")]
[string]$Target = "windows-x64",
[switch]$StaticOnly,
[switch]$StorageV2,
[switch]$Routines,
[switch]$CompileOnly,
[switch]$KeepArtifacts,
[switch]$VerboseOutput
)
$ErrorActionPreference = "Stop"
$Root = Split-Path -Parent $MyInvocation.MyCommand.Path
if ($Routines -and $StorageV2) {
throw "Select either -Routines or -StorageV2."
}
if ($CompileOnly -and ($StaticOnly -or (-not $Routines -and -not $StorageV2))) {
throw "-CompileOnly requires -Routines or -StorageV2 without -StaticOnly."
}
if ($Routines -and -not $StaticOnly) {
$RoutineArguments = @((Join-Path $Root "tests/run_routines.py"), "--target", $Target)
if (-not [string]::IsNullOrWhiteSpace($Compiler)) {
$RoutineArguments += @("--compiler", $Compiler)
}
if ($CompileOnly) { $RoutineArguments += "--compile-only" }
& $Python @RoutineArguments
exit $LASTEXITCODE
}
if ($StorageV2 -and -not $StaticOnly) {
$StorageArguments = @((Join-Path $Root "tests/run_storage_v2.py"), "--target", $Target)
if (-not [string]::IsNullOrWhiteSpace($Compiler)) {
$StorageArguments += @("--compiler", $Compiler)
}
if ($CompileOnly) { $StorageArguments += "--compile-only" }
& $Python @StorageArguments
exit $LASTEXITCODE
}
if ($Target -eq "linux-x64" -and -not $StaticOnly) {
if ([string]::IsNullOrWhiteSpace($Compiler)) {
$Compiler = Join-Path $Root "..\MiniLangCompilerPy\mlc_win64.py"
}
$LinuxRunner = Join-Path $Root "tests\run_linux_tests.ps1"
& $LinuxRunner -Compiler $Compiler -Python $Python -KeepArtifacts:$KeepArtifacts
exit $LASTEXITCODE
}
# test.ps1 is the only user-facing test entry point. Once the user approves this
# launcher, remove the Windows download marker from the remaining project tree so
# no internal runner or generated executable causes another security prompt.
Get-ChildItem -LiteralPath $Root -Recurse -File -ErrorAction SilentlyContinue |
Unblock-File -ErrorAction SilentlyContinue
# Acceptance never depends on hidden placeholder files surviving ZIP extraction.
foreach ($Directory in @("build", "data", "logs", "tmp")) {
New-Item -ItemType Directory -Force -Path (Join-Path $Root $Directory) | Out-Null
}
$Runner = Join-Path $Root "tests\run_all_tests.py"
if (-not (Test-Path -LiteralPath $Runner -PathType Leaf)) {
throw "Internal MiniSQL acceptance runner is missing: $Runner"
}
$PythonArguments = @($Runner)
if (-not [string]::IsNullOrWhiteSpace($Compiler)) {
$PythonArguments += @("--compiler", $Compiler)
}
if ($StaticOnly) { $PythonArguments += "--static-only" }
if ($KeepArtifacts) { $PythonArguments += "--keep-artifacts" }
if ($VerboseOutput) { $PythonArguments += "--verbose" }
& $Python @PythonArguments
exit $LASTEXITCODE