Compare commits

...

10 Commits

Author SHA1 Message Date
Anatol Belski
70c3290c08 Prepare 2.1.6 2018-06-28 11:12:52 +02:00
Anatol Belski
d84784d37a Upgrade vswhere 2018-06-26 22:51:51 +02:00
Anatol Belski
8ad74abf3f Improve error handling for unknown cases 2018-05-11 17:05:39 +02:00
Anatol Belski
9ad145c154 Increase training runs number for symfony_demo_pdo_mysql 2018-05-11 14:11:37 +02:00
Anatol Belski
f3001d950e Fix option description 2018-05-11 13:45:33 +02:00
Anatol Belski
01ab6a1bad Add comment 2018-05-11 13:44:08 +02:00
Anatol Belski
659fb3a71d Produce a warning when unknown training case was requested 2018-05-11 13:31:02 +02:00
Anatol Belski
d7dcab4c2f Add comment 2018-05-11 12:35:42 +02:00
Anatol Belski
15ec0845c4 Allow selective training only with certain cases 2018-05-11 12:22:18 +02:00
Anatol Belski
a1bab3dc92 Back to dev 2018-05-09 11:23:46 +02:00
5 changed files with 30 additions and 6 deletions

View File

@@ -1 +1 @@
2.1.5
2.1.6

View File

@@ -6,8 +6,8 @@ use SDK\Config;
use SDK\Exception;
use SDK\Build\PGO\Controller;
$sopt = "itudhs:fr";
$lopt = array("init", "train", "up", "down", "help", "scenario:", "force", "ready");
$sopt = "itudhs:frc:";
$lopt = array("init", "train", "up", "down", "help", "scenario:", "force", "ready", "cases:");
$cmd = NULL;
/* TODO For now we simply check the current php build, this could be extended to take arbitrary binaries. */
@@ -15,6 +15,7 @@ $deps_root = NULL;
$php_root = NULL;
$scenario = NULL;
$force = false;
$cases = NULL;
try {
$opt = getopt($sopt, $lopt);
@@ -47,6 +48,12 @@ try {
case "force":
$force = true;
break;
/* XXX This option is for now only integrated for training. It
would make sense to integrate it also with init. */
case "c":
case "cases":
$cases = explode(",", $val);
break;
case "h": case "help":
usage(0);
break;
@@ -73,7 +80,7 @@ try {
}
}
$controller = new Controller($cmd, $scenario);
$controller = new Controller($cmd, $scenario, $cases);
$controller->handle($force);
if ("check_init" == $cmd) {
@@ -105,6 +112,7 @@ function usage(int $code = -1)
echo " -d --down Shutdown training environment.", PHP_EOL;
echo " -f --force Force requested operation. Not every option can be forced.", PHP_EOL;
echo " -s --scenario Run training with a specified scenario.", PHP_EOL;
echo " -c --cases Run training with specified cases only. If omited, all the active cases will be used.", PHP_EOL;
/*echo " -p --php-root PHP binary to train.", PHP_EOL;*/

Binary file not shown.

View File

@@ -17,8 +17,9 @@ class Controller
protected $cmd;
protected $scenario;
protected $conf;
protected $cases;
public function __construct(string $cmd, ?string $scenario)
public function __construct(string $cmd, ?string $scenario, ?array $cases)
{
$this->cmd = $cmd;
@@ -26,6 +27,7 @@ class Controller
$scenario = "default";
}
$this->scenario = $scenario;
$this->cases = $cases;
}
protected function vitalizeSrv()
@@ -204,10 +206,24 @@ class Controller
$pgo->clean();
unset($pgo);
$cases = $this->cases;
foreach (new TrainingCaseIterator($this->conf) as $handler) {
$name = $handler->getName();
/* Just a white list handling for now. */
if (is_array($cases)) {
if (!in_array($name, $cases)) {
continue;
}
$key = array_search($name, $cases);
unset($cases[$key]);
}
echo "\n";
$handler->run();
}
if (is_array($cases) && !empty($cases)) {
echo "\n\033[31m WARNING: The cases " . implode(",", $cases) . " don't exist and was ignored!\033[0m\n\n";
}
/* All the PGC files are merged, simply clean them out. */
$pgo = new PGO($this->conf, $php);

View File

@@ -16,7 +16,7 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
protected $nginx;
protected $maria;
protected $php;
protected $max_runs = 1;
protected $max_runs = 4;
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $srv_db)
{