Skip to content

Testing: MiniWebApp AOT binary CLI execute smoke (tracked in #747, blocked #764) #485

@PurHur

Description

@PurHur

Problem

#478 covers phpc serve --aot HTTP routes. #454 tracks ExamplesCompileTest for the 003 tree. There is no PHPUnit gate that:

  1. phpc build --project examples/003-MiniWebApp (link green — AOT: MiniWebApp phpc build --project native link fails on master (post-#568/#734) #752 ✅)
  2. Runs .phpc/bin/app without TCP, with CGI env (QUERY_STRING, REQUEST_METHOD, REQUEST_BODY)

CLI execute catches AOT runtime bugs earlier than ServeAotTest and matches production CGI deployment (#50).

Active blocker: #764 — binary exits 0 with empty stdout for home/hello routes (not link failure).

Goal

test/unit/MiniWebAppAotExecuteTest.php (tracked in #747; implement here or split methods):

Step Assert
Build phpc build --project exit 0
GET home QUERY_STRING=route=home stdout contains app_name from config.php
GET hello QUERY_STRING=route=hello&name=Dev greeting
POST contact REQUEST_METHOD=POST + REQUEST_BODY=name=PostDev thank-you (#257 pattern)
GET api JSON ok (#61)
PATH_INFO PATH_INFO=/hello + QUERY_STRING=name=Dev (#489)

Start with markTestSkipped('Blocked by #764 — AOT execute empty stdout') until runtime green.

Implementation hints

Piece File Notes
Test class test/unit/MiniWebAppAotExecuteTest.php @group llvm, @group miniwebapp
Helper runBinaryWithCgiEnv(string $binary, array $env): array proc_open + putenv before exec; share with #773 if landed
Env Mirror ExamplesCompileTest 001 POST pattern (#259) REQUEST_BODY for POST
Deploy PHPC_DEPLOY_ROOT optional case #612 dist layout
Root cause #764, #776 void include templates; #767 typed array $config
# Manual repro (Docker, apply patches):
composer install && ./script/apply-patches.sh
php bin/phpc.php build --project examples/003-MiniWebApp
cd examples/003-MiniWebApp
QUERY_STRING=route=home REQUEST_METHOD=GET ./.phpc/bin/app | wc -c

Acceptance criteria

./script/ci-local.sh --filter MiniWebAppAotExecuteTest
# After #764 + #747:
MINIWEBAPP_AOT_EXECUTE_GATE=1 ./script/ci-local.sh --filter MiniWebAppAotExecuteTest

Harness (empty bind-mount):

./script/docker-ci-local.sh --filter MiniWebAppAotExecuteTest

No GitHub Actions.

Dependencies

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolingTooling / CI / docsarea:webWeb / CGI / superglobalsenhancementNew feature or requestphase-3:aotPhase 3 – AOT deployment

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions