-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_lua_tests.ps1
More file actions
61 lines (51 loc) · 1.09 KB
/
Copy pathrun_lua_tests.ps1
File metadata and controls
61 lines (51 loc) · 1.09 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
param(
[ValidateSet("debug", "release")]
[string]$Profile = "debug",
[string]$Script = "all.lua",
[switch]$SkipBuild
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $repoRoot
if (-not $SkipBuild) {
if ($Profile -eq "debug") {
cargo build -p luars_interpreter
}
else {
cargo build -p luars_interpreter --release
}
}
if ($Profile -eq "debug") {
if (-not $env:LUARS_MAIN_STACK_SIZE_MB) {
$env:LUARS_MAIN_STACK_SIZE_MB = "128"
}
if (-not $env:LUARS_MAX_CALL_DEPTH) {
$env:LUARS_MAX_CALL_DEPTH = "1024"
}
if (-not $env:LUARS_MAX_C_STACK_DEPTH) {
$env:LUARS_MAX_C_STACK_DEPTH = "200"
}
}
$exeName = if ($IsWindows) {
"lua.exe"
}
else {
"lua"
}
$exe = if ($Profile -eq "debug") {
Join-Path $repoRoot "target/debug/$exeName"
}
else {
Join-Path $repoRoot "target/release/$exeName"
}
if (-not (Test-Path $exe)) {
throw "Lua interpreter not found at '$exe'. Build may have failed or produced the binary at a different path."
}
Push-Location "lua_tests/testes"
try {
& $exe $Script
exit $LASTEXITCODE
}
finally {
Pop-Location
}