Arquivos
hhvm/hphp/test/README.md
T
Herman Venter 3d0330fd9d Provide a command line switch to specify the path to the debugger config file
Currently the debugger config file is always expected to be at ~/.hphpd.hdf, except when the debugger is controlled via the API, in which case the API client can specify the path. With these changes the path can now also be specified via the command line. Also, the test runner has been modified to look for an hphpd.hdf file and specify the path to it as a command line option. If present, this file also indicates that tests in the directory must be run in debugger mode, making the .opt files redundant. Note that it is important for tests to be able to control the contents of the config file since debugger output is controlled by it and tests will be brittle unless the config is part of the suite and not controlled by the user running the tests
2013-06-10 10:14:12 -07:00

3.2 KiB

Suites

Tests are grouped into "suites". They are just directories. Suites can have subdirectories if you want to group them even more. Running a suite will run all sub-suites.

  • quick - The most common. Put your test here by default.
  • slow - Slower full featured tests. Grouped into sub-suites.
  • zend/good - Passing tests from Zend's suite.
  • zend/bad - Failing tests from Zend. Fix these and move them to zend/good.
  • vm-perf - Some performance tests that aren't commonly run.

Examples how to run them

  • Quick suite with the JIT on - test/run test/quick

  • Zend tests just with the interpreter in RepoAuthoritative mode - test/run test/zend/good -m interp -r

  • Slow tests with the JIT in IR mode - test/run test/slow -m hhir

  • Run evertyhing that is supposed to pass - fbmake runtests

File Layout

The format is the same as Zend's .phpt but instead of sections it is separate files with the section name converted to an extension. This allows you to easily run the .php file without first running the test suite.

These are the allowed extensions:

  • .php - The source of the test.
  • .php.expect - The exact string expected output.
  • .php.expectf - The exact string expected output with formating characters.
  • .php.expectregex - A regex that matches the output.
  • .php.in - When you run the test, the input will be obtained from here.
  • .php.out - When you run the test, the output will be stored here.
  • .php.opts - Runtime options to pass to hhvm.
  • .php.hphp_opts - Options passed to hphp when generating a bytecode repo.
  • .php.diff or hhas.diff - The diff for .expect tests.
  • .hhas - HipHop Assembly.
  • .php.norepo - don't run the test in repo mode

You must have one .php; one and only one of .php.expect, .php.expectf, and .php.expectregex; and the rest are optional.

Any suite can have a config.hdf file in it that will be used. If one isn't present, then the parent suite it checked recusrivly until we use test/config.hdf.

If a suite contains an hphpd.hdf file, all of the files in the suite will be run with the -m debug and --debug-config dir/hphpd.hdf switches added to the command line. (dir will be replaced by path of the suite directory.)

Name your test in a descriptive manner and when in doubt break your test into many files. You can use comments too so future engineers know if it is a real breakage or they need to change the expected output.

Format Characters

These can appear in .expectf files.

Char Description Regex
%e Path separator /
%s Any characters except newlines [^\r\n]+
%S Optionally any characters except newlines [^\r\n]*
%a Any characters .+
%A Optionally any characters .*
%w Optional whitespace \s*
%i Integer with optional sign [+-]?\d+
%d Digits \d+
%x Hex [0-9a-fA-F]+
%f Float [+-]?.?\d+.?\d
%c Character .