move HQServerTransportFactory to HQServer.h
[hiphop-php.git] / hphp / test / ext / main.cpp
blob0718e459949a016128585b13fa2abc1777c5a7e1
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #include "hphp/test/ext/test.h"
18 #include "hphp/util/logger.h"
19 #include "hphp/runtime/base/program-functions.h"
21 #include "hphp/hhvm/process-init.h"
23 using namespace HPHP;
25 ///////////////////////////////////////////////////////////////////////////////
27 int main(int argc, char **argv) {
28 HPHP::StaticString::CreateAll();
29 HPHP::register_process_init();
31 #ifdef HHVM_FBMAKE
32 // In an fbmake build, override the locations of hphp and hhvm that
33 // dirs.mk will think we're using. (This is used in test.mk when
34 // building/running tests.)
35 setenv("TEST_OVERRIDE_HHVM", "_bin/hphp/hhvm/hhvm", true);
36 setenv("TEST_OVERRIDE_HPHP", "_bin/hphp/hhvm/hphp", true);
37 #endif
39 std::string suite, which, set;
40 if (argc >= 2) suite = argv[1];
41 if (argc >= 3) which = argv[2];
42 if (argc >= 4) set = argv[3];
43 if (argc >= 5) {
44 if (strcmp(argv[4], "quiet") == 0) {
45 Test::s_quiet = true;
46 } else {
47 Logger::LogLevel = (Logger::LogLevelType)atoi(argv[4]);
51 Test::logger.log_url = nullptr;
52 if (argc >= 6) {
53 Test::logger.log_url = argv[5];
56 rds::local::init();
57 SCOPE_EXIT { rds::local::fini(); };
59 // Initialize the runtime options with their default values
61 IniSetting::Map ini = IniSetting::Map::object;
62 Hdf empty;
63 RuntimeOption::Load(ini, empty);
64 // This one's default value changed recently
65 Cfg::Server::AlwaysPopulateRawPostData = true;
68 hphp_process_init();
69 SCOPE_EXIT { hphp_process_exit(); };
70 Test test;
71 return test.RunTests(suite, which, set) ? 0 : -1;