hhvm / hacktest

A unit testing framework for Hack
MIT License
29 stars 12 forks source link

Support running hack-test in repo-auth mode. #84

Closed fredemmott closed 5 years ago

fredemmott commented 5 years ago

Various forms of file access (glob, realpath) and other functions (facts_parse) are unavailable in repo-authoritative mode.

Additionally, the static content cache is unavailable in repo-authoritative CLI mode.

For that reason, add hacktest --prepare-repo-auth that does some fairly disgusting codegen.

Tested with the HSL repository:

$ REPO_DIR="$(mktemp -d)"
$ vendor/bin/hacktest --prepare-repo-auth tests/
$ hhvm --hphp --target hhbc \
    -l 3 \
    --ffile vendor/bin/hacktest \
    --module src \
    --module vendor \
    --module tests \
    --ffile vendor/bin/hacktest \
    --output-dir "$REPO_DIR"
$ cd $REPO_DIR
$ hhvm   --no-config   -d hhvm.repo.authoritative=true   -d "hhvm.repo.central.path=${REPO_DIR}/hhvm.hhbc"     vendor/bin/hacktest tests/
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Summary: 1227 test(s), 1227 passed, 0 failed, 0 skipped, 0 error(s).
fredemmott commented 5 years ago

Killing in favor of #86