-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
64 lines (51 loc) · 1.24 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
// More info about CppComet http://comet-server.org/doku.php/en
// More info about CometQL http://comet-server.org/doku.php/en:comet:cometql
// More info about auth in CppComet http://comet-server.org/doku.php/en:comet:authentication
header('Content-Type: text/html; charset=utf-8');
header("Access-Control-Allow-Origin: *");
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
{
exit();
}
ini_set('display_errors','on');
error_reporting (E_ALL);
session_start();
include './utils/timetest.php';
include './utils/testClass.php';
$count = 100;
if(isset($_GET['count']))
{
$count = $_GET['count'];
if($count > 100)
{
return "-1";
}
}
$test = preg_replace("#[^A-z0-9\_\-]#usi", "", $_GET['test']);
if(!file_exists("./tests/".$test.".php"))
{
die("Error 404");
}
include "./tests/".$test.".php";
if(file_exists("./conf.php"))
{
include "./conf.php";
}
$className = "test_".$test;
$cppTest = new $className();
echo "RUN:".$test."\n";
$cppTest->init($serverConf);
$cppTest->start();
timeTest::test('cpp', 'test');
for($i =0; $i<$count; $i++)
{
$cppTest->test();
}
$t = timeTest::test('cpp','test');
$t = $t[count($t) - 1];
$cppTest->stop();
echo json_encode([
'count' => $count,
'time' => $t['time']
]);