77 lines
2.4 KiB
GDScript
77 lines
2.4 KiB
GDScript
extends SceneTree
|
|
|
|
const HarnessType = preload("res://tests/performance/perf_mvp_001_harness.gd")
|
|
|
|
|
|
func _initialize() -> void:
|
|
call_deferred("_run")
|
|
|
|
|
|
func _run() -> void:
|
|
var tier := &"full" if _full_tier_requested() else &"smoke"
|
|
print("PERF-MVP-001: %s tier" % String(tier))
|
|
var report: Dictionary = HarnessType.new().run(tier)
|
|
_print_summary(report)
|
|
print("PERF_MVP_001_REPORT=%s" % JSON.stringify(report))
|
|
match String(report.get("status", "INCOMPLETE")):
|
|
"PASS", "SMOKE_PASS":
|
|
quit(0)
|
|
"INCOMPLETE":
|
|
quit(2)
|
|
_:
|
|
quit(1)
|
|
|
|
|
|
func _full_tier_requested() -> bool:
|
|
var environment_value := OS.get_environment("PERF_MVP_FULL").strip_edges().to_lower()
|
|
if environment_value in ["1", "true", "yes", "full"]:
|
|
return true
|
|
for argument: String in OS.get_cmdline_user_args():
|
|
if argument in ["--full", "full"]:
|
|
return true
|
|
return false
|
|
|
|
|
|
func _print_summary(report: Dictionary) -> void:
|
|
var initial: Dictionary = report.get("actual_initial", {})
|
|
var summary: Dictionary = report.get("check_summary", {})
|
|
print(
|
|
" status=%s cells=%d guests=%d staff=%d facilities=%d queue=%d logistics=%d events=%d"
|
|
% [
|
|
report.get("status", "INCOMPLETE"),
|
|
int(initial.get("open_cells", 0)),
|
|
int(initial.get("guests", 0)),
|
|
int(initial.get("staff", 0)),
|
|
int(initial.get("facilities", 0)),
|
|
int(initial.get("queue_entries", 0)),
|
|
int(initial.get("unfinished_logistics", 0)),
|
|
int(initial.get("active_events", 0)),
|
|
]
|
|
)
|
|
if report.has("simulation"):
|
|
var simulation: Dictionary = report["simulation"]
|
|
print(
|
|
" simulated=%d/%d minutes runtime=%.3f ms"
|
|
% [
|
|
int(simulation.get("completed_minutes", 0)),
|
|
int(simulation.get("requested_minutes", 0)),
|
|
float(simulation.get("duration_ms", 0.0)),
|
|
]
|
|
)
|
|
print(
|
|
" checks=%d passed=%d failed=%d skipped=%d"
|
|
% [
|
|
int(summary.get("total", 0)),
|
|
int(summary.get("passed", 0)),
|
|
int(summary.get("failed", 0)),
|
|
int(summary.get("skipped", 0)),
|
|
]
|
|
)
|
|
for validation: Dictionary in report.get("validations", []):
|
|
if validation.get("status", "FAIL") != "PASS":
|
|
print(" %s: %s %s" % [validation["status"], validation["id"], validation["details"]])
|
|
for unmet: Dictionary in report.get("unmet_fixture_fields", []):
|
|
print(" INCOMPLETE fixture: %s target=%s actual=%s" % [unmet["field"], unmet["target"], unmet["actual"]])
|
|
for error: Dictionary in report.get("runtime_errors", []):
|
|
print(" ERROR %s: %s" % [error["code"], error["message"]])
|